コード例 #1
0
        public void Start()
        {
            if (Debug)
            {
                Log.Debug(Tag, "Start");
            }

            // Stopper alle tråde for at prøve at connecte
            if (connectThread != null)
            {
                connectThread.Cancel();
                connectThread = null;
            }

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

            // starter tråden ved at lytte på BT server socket
            if (acceptThread == null)
            {
                acceptThread = new AcceptThread(this);
                acceptThread.Start();
            }

            SetState(State_Listen);
        }
コード例 #2
0
        public void Start()
        {
            if (Debug)
            {
                Log.Debug(TAG, "start");
            }

            // Cancel any thread attempting to make a connection
            if (connectThread != null)
            {
                connectThread.Cancel();
                connectThread = null;
            }

            // Cancel any thread currently running a connection
            if (connectedThread != null)
            {
                connectedThread.Cancel();
                connectedThread = null;
            }

            // Start the thread to listen on a BluetoothServerSocket
            if (acceptThread == null)
            {
                acceptThread = new AcceptThread(this);
                acceptThread.Start();
            }

            SetState(STATE_LISTEN);
        }
コード例 #3
0
        /**
         * Start the chat service. Specifically start AcceptThread to begin a
         * session in listening (server) mode. Called by the Activity onResume()
         * 开始聊天服务。 具体启动AcceptThread开始一个
         * 会话在监听(服务器)模式。 由Activity onResume()调用
         */
        public static void Start()
        {
            lock (Lock)
            {
                // Log.d(TAG, "start");

                // Cancel any thread attempting to make a connection
                if (mConnectThread != null)
                {
                    mConnectThread.Cancel();
                    mConnectThread = null;
                }

                // Cancel any thread currently running a connection
                if (mConnectedThread != null)
                {
                    mConnectedThread.Cancel();
                    mConnectedThread = null;
                }

                SetState(STATE_LISTEN);

                // Start the thread to listen on a BluetoothServerSocket
                if (mAcceptThread == null)
                {
                    mAcceptThread = new AcceptThread();
                    mAcceptThread.Start();
                }
            }
        }
コード例 #4
0
        public void Start()
        {
            if (connectThread != null)
            {
                connectThread.Cancel();
                connectThread = null;
            }

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

            if (secureAcceptThread == null)
            {
                secureAcceptThread = new AcceptThread(this, true);
                secureAcceptThread.Start();
            }
            if (insecureAcceptThread == null)
            {
                insecureAcceptThread = new AcceptThread(this, false);
                insecureAcceptThread.Start();
            }

            UpdateUserInterfaceTitle();
        }
コード例 #5
0
 public void Start()
 {
     Global.Logger.Log(ConsoleColor.Magenta, LogType.Remote, null, "Starting Listener...");
     Server.Start();
     Global.Logger.Log(ConsoleColor.Magenta, LogType.Remote, null, "Listener started! Accepting clients...");
     AcceptThread.Start();
 }
コード例 #6
0
        public void Start()
        {
            if (_connectThread != null)
            {
                _connectThread.Cancel();
                _connectThread = null;
            }

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

            if (_secureAcceptThread == null)
            {
                _secureAcceptThread = new AcceptThread(this, true);
                _secureAcceptThread.Start();
            }
            if (_insecureAcceptThread == null)
            {
                _insecureAcceptThread = new AcceptThread(this, false);
                _insecureAcceptThread.Start();
            }

            UpdateUserInterfaceTitle();
        }
コード例 #7
0
 public void Start()
 {
     if (connectThread != null)
     {
         connectThread.Cancel();
         connectThread = null;
     }
     if (insecureAcceptThread == null)
     {
         insecureAcceptThread = new AcceptThread(this);
         insecureAcceptThread.Start();
     }
 }
コード例 #8
0
        private void setMailBoxes()
        {
            MessagingCenter.Subscribe <Object, String>(this, "Request",
                                                       (sender, arg) =>
            {
                String request = arg;

                if (request.Equals("Server"))
                {
                    ruolo = false;
                    System.Console.WriteLine("Richiesta di Server");
                    server = new AcceptThread();
                    server.Start();
                }
                else if (request.Equals("Client"))
                {
                    ruolo = true;
                    System.Console.WriteLine("Richiesta di Client");
                    client = new ConnectThread(Bth.serverDevice, MY_UUID);
                    client.Start();
                }
                else if (request.Equals("Discovery"))
                {
                    System.Console.WriteLine("Richiesta di Discoverability");
                    AbilitaDiscoverabilty();
                }
                else if (request.Equals("Reset"))
                {
                    System.Console.WriteLine("Richiesta di Reset");
                    reset();
                }
            });

            MessagingCenter.Subscribe <Object, string>(this, "IncomingMessage",
                                                       (sender, arg) =>
            {
                System.Console.WriteLine("posizione cliccata: " + arg[0]);
                System.Console.WriteLine("esito: " + arg[1]);
                byte[] bytes = Encoding.Unicode.GetBytes(arg);
                mConnectedThread.Write(bytes);
            });
        }
コード例 #9
0
        public void Start()
        {
            if (connectThread != null)
            {
                connectThread.Cancel();
                connectThread = null;
            }

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

            if (acceptThread == null)
            {
                acceptThread = new AcceptThread(this);
                acceptThread.Start();
            }

            UpdateUserInterfaceTitle();
        }
コード例 #10
0
        /// <summary>
        /// Start the chat service. Specifically start AcceptThread to begin a
        /// </summary>
        public void Start()
        {
            lock (this)
            {
                if (D)
                {
                    Log.D(TAG, "start");
                }

                // Cancel any thread attempting to make a connection
                if (mConnectThread != null)
                {
                    mConnectThread.Cancel();
                    mConnectThread = null;
                }

                // Cancel any thread currently running a connection
                if (mConnectedThread != null)
                {
                    mConnectedThread.Cancel();
                    mConnectedThread = null;
                }

                State = STATE_LISTEN;

                // Start the thread to listen on a BluetoothServerSocket
                if (mSecureAcceptThread == null)
                {
                    mSecureAcceptThread = new AcceptThread(this, true);
                    mSecureAcceptThread.Start();
                }
                if (mInsecureAcceptThread == null)
                {
                    mInsecureAcceptThread = new AcceptThread(this, false);
                    mInsecureAcceptThread.Start();
                }
            }
        }
コード例 #11
0
		/// <summary>
		/// Start the chat service. Specifically start AcceptThread to begin a
		/// </summary>
		public void Start()
		{
		    lock (this)
		    {
		        if (D)
		        {
		            Log.D(TAG, "start");
		        }

		        // Cancel any thread attempting to make a connection
		        if (mConnectThread != null)
		        {
		            mConnectThread.Cancel();
		            mConnectThread = null;
		        }

		        // Cancel any thread currently running a connection
		        if (mConnectedThread != null)
		        {
		            mConnectedThread.Cancel();
		            mConnectedThread = null;
		        }

		        State = STATE_LISTEN;

		        // Start the thread to listen on a BluetoothServerSocket
		        if (mSecureAcceptThread == null)
		        {
		            mSecureAcceptThread = new AcceptThread(this, true);
		            mSecureAcceptThread.Start();
		        }
		        if (mInsecureAcceptThread == null)
		        {
		            mInsecureAcceptThread = new AcceptThread(this, false);
		            mInsecureAcceptThread.Start();
		        }
		    }
		}
コード例 #12
0
		public void Start ()
		{	
			if (Debug)
				Log.Debug (TAG, "start");
	
			// Cancel any thread attempting to make a connection
			if (connectThread != null) {
				connectThread.Cancel ();
				connectThread = null;
			}
	
			// Cancel any thread currently running a connection
			if (connectedThread != null) {
				connectedThread.Cancel ();
				connectedThread = null;
			}
	
			// Start the thread to listen on a BluetoothServerSocket
			if (acceptThread == null) {
				acceptThread = new AcceptThread (this);
				acceptThread.Start ();
			}
			
			SetState (STATE_LISTEN);
		}
コード例 #13
0
 public static void StartAcceptThread(BluetoothAdapter btAdpt)
 {
     at = new AcceptThread(btAdpt);
     at.Start();
 }