Esempio n. 1
0
        public void Open()
        {
            this.Close();

            if (_bda == null)
                return;
            try
            {
                //_socket = new System.Net.Sockets.Socket();
                _bluetoothClient = new BluetoothClient();
                _bta = new BluetoothAddress(_bda);
                _bluetoothClient.Connect(new BluetoothEndPoint(_bta, BluetoothService.SerialPort));

                _networkStream = _bluetoothClient.GetStream();
                if(_networkStream!=null)
                    _thread = new myThread(ref _networkStream);
            }
            catch (SocketException sx)
            {
                System.Diagnostics.Debug.WriteLine("SocketException in Open(): " + sx.Message);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception in Open(): " +ex.Message);
            }

        }
Esempio n. 2
0
 static BluetoothAddress()
 {
     None = new BluetoothAddress();
 }
Esempio n. 3
0
 public BluetoothEndPoint(BluetoothAddress address, Guid service, int port)
 {
     this.m_id = address;
     this.m_service = service;
     this.m_port = port;
 }
Esempio n. 4
0
 public BluetoothEndPoint(BluetoothAddress address, Guid service)
     : this(address, service, m_defaultport)
 {
 }
Esempio n. 5
0
 static BluetoothAddress()
 {
     None = new BluetoothAddress();
 }