Example #1
0
        public void Reset()
        {
            if (_connectThread != null)
            {
                _connectThread.Cancel();
                _connectThread = null;
            }

            for (int i = 0; i < _writeThread.Count; i++)
            {
                _writeThread [i].Cancel();
                _writeThread.RemoveAt(i);
            }

            for (int i = 0; i < _readThread.Count; i++)
            {
                _readThread [i].Cancel();
                _readThread.RemoveAt(i);
            }

            if (_listenThread != null)
            {
                _listenThread.Cancel();
                _listenThread = null;
            }

            _state = EnConnectionState.STATE_NONE;
        }
Example #2
0
 public void StopListen()
 {
     if (_listenThread != null)
     {
         _listenThread.Cancel();
         _listenThread = null;
         _listenThread = null;
     }
 }
Example #3
0
        public void ConnectAsMaster()
        {
            //stops listening thread
            StopListen();

            // Start the thread to listen on a BluetoothServerSocket
            _listenThread = new BTListenThread(NAME, MY_UUID);

            //sets the state on STATE_LISTEN and send message to indicate this change
            _state = EnConnectionState.STATE_LISTEN;
            this.ObtainMessage((int)EnLocalMessageType.MESSAGE_STATE_CHANGE, (int)EnConnectionState.STATE_LISTEN, -1).SendToTarget();
        }