//-------------------------------------------------------------- // CONSTRUCTORS //-------------------------------------------------------------- public AcceptThread(BluetoothManager service) { _service = service; BluetoothServerSocket temp = null; // Create a new listening server socket try { temp = _service.BluetoothAdapter.ListenUsingRfcommWithServiceRecord(Name, BluetoothManager.MyUUID); } catch(Java.IO.IOException e) { Log.Error(BluetoothManager.Tag, "Listen() failed", e); } _serverSocket = temp; }
public void Cancel() { #if DEBUG Log.Debug(BluetoothManager.Tag, "Cancel " + this.ToString()); #endif _continue = false; if(_serverSocket != null) { try { _serverSocket.Close(); if(!_success) // if it is a success we are trying to abort this thread so no need to wait { // Wait for the end of the thread while(!_end) { Thread.Sleep(100); } } } catch(Java.IO.IOException e) { Log.Error(BluetoothManager.Tag, "Close() of server failed", e); } } _serverSocket = null; }
public AcceptThread(BluetoothChatService chatService, bool secure) { this.chatService = chatService; BluetoothServerSocket tmp = null; mSocketType = secure ? "Secure":"Insecure"; // Create a new listening server socket try { if (secure) { tmp = chatService.mAdapter.ListenUsingRfcommWithServiceRecord(NAME_SECURE, MY_UUID_SECURE); } else { tmp = chatService.mAdapter.ListenUsingInsecureRfcommWithServiceRecord(NAME_INSECURE, MY_UUID_INSECURE); } } catch (IOException e) { Log.E(TAG, "Socket Type: " + mSocketType + "listen() failed", e); } mmServerSocket = tmp; }
public AcceptThread (BluetoothChatService service) { _service = service; BluetoothServerSocket tmp = null; // Create a new listening server socket try { tmp = _service._adapter.ListenUsingRfcommWithServiceRecord (NAME, MY_UUID); } catch (Java.IO.IOException e) { Log.Error (TAG, "listen() failed", e); } mmServerSocket = tmp; }
public AcceptThread (BluetoothChatService service, int index) { _service = service; BluetoothServerSocket tmp = null; mmIndex = index; // Create a new listening server socket TODO potential problem with names? try { tmp = _service._adapter.ListenUsingRfcommWithServiceRecord (NAME, MY_UUID); } catch (Java.IO.IOException e) { Log.Error (TAG, "listen() failed", e); } mmServerSocket = tmp; }
public AcceptThread(bool secure, MessageController controller) { BluetoothServerSocket temp = null; _socketType = secure ? "Secure" : "Insecure"; try{ if(secure){ temp = _adapter.ListenUsingRfcommWithServiceRecord(NAME_SECURE, MY_UUID_SECURE); }else{ temp = _adapter.ListenUsingInsecureRfcommWithServiceRecord(NAME_INSECURE, MY_UUID_INSECURE); } } catch(Java.IO.IOException e){ Console.WriteLine(TAG + "Socket type: "+ _socketType + " listen() failed."); } _serverSocket = temp; }