diff options
Diffstat (limited to 'src/com/android/nfc/snep/SnepServer.java')
-rw-r--r-- | src/com/android/nfc/snep/SnepServer.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/com/android/nfc/snep/SnepServer.java b/src/com/android/nfc/snep/SnepServer.java index 84bb673..aa7da48 100644 --- a/src/com/android/nfc/snep/SnepServer.java +++ b/src/com/android/nfc/snep/SnepServer.java @@ -34,9 +34,10 @@ import java.io.IOException; public final class SnepServer { private static final String TAG = "SnepServer"; private static final boolean DBG = false; + private static final int DEFAULT_MIU = 248; + private static final int DEFAULT_RW_SIZE = 1; public static final int DEFAULT_PORT = 4; - private static final int MIU = 248; public static final String DEFAULT_SERVICE_NAME = "urn:nfc:sn:snep"; @@ -44,6 +45,8 @@ public final class SnepServer { final String mServiceName; final int mServiceSap; final int mFragmentLength; + final int mMiu; + final int mRwSize; /** Protected by 'this', null when stopped, non-null when running */ ServerThread mServerThread = null; @@ -59,6 +62,8 @@ public final class SnepServer { mServiceName = DEFAULT_SERVICE_NAME; mServiceSap = DEFAULT_PORT; mFragmentLength = -1; + mMiu = DEFAULT_MIU; + mRwSize = DEFAULT_RW_SIZE; } public SnepServer(String serviceName, int serviceSap, Callback callback) { @@ -66,6 +71,17 @@ public final class SnepServer { mServiceName = serviceName; mServiceSap = serviceSap; mFragmentLength = -1; + mMiu = DEFAULT_MIU; + mRwSize = DEFAULT_RW_SIZE; + } + + public SnepServer(Callback callback, int miu, int rwSize) { + mCallback = callback; + mServiceName = DEFAULT_SERVICE_NAME; + mServiceSap = DEFAULT_PORT; + mFragmentLength = -1; + mMiu = miu; + mRwSize = rwSize; } SnepServer(String serviceName, int serviceSap, int fragmentLength, Callback callback) { @@ -73,6 +89,8 @@ public final class SnepServer { mServiceName = serviceName; mServiceSap = serviceSap; mFragmentLength = fragmentLength; + mMiu = DEFAULT_MIU; + mRwSize = DEFAULT_RW_SIZE; } /** Connection class, used to handle incoming connections */ @@ -168,7 +186,7 @@ public final class SnepServer { try { synchronized (SnepServer.this) { mServerSocket = NfcService.getInstance().createLlcpServerSocket(mServiceSap, - mServiceName, MIU, 1, 1024); + mServiceName, mMiu, mRwSize, 1024); } if (mServerSocket == null) { if (DBG) Log.d(TAG, "failed to create LLCP service socket"); |