Пример #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);
            }

        }
Пример #2
0
 static BluetoothAddress()
 {
     None = new BluetoothAddress();
 }
Пример #3
0
 public BluetoothEndPoint(BluetoothAddress address, Guid service, int port)
 {
     this.m_id = address;
     this.m_service = service;
     this.m_port = port;
 }
Пример #4
0
 public BluetoothEndPoint(BluetoothAddress address, Guid service)
     : this(address, service, m_defaultport)
 {
 }
Пример #5
0
 static BluetoothAddress()
 {
     None = new BluetoothAddress();
 }