コード例 #1
0
        private static NetworkStream CreateBluetoothStreams(Hashtable parms)
        {
            string hostaddr = (string)parms[PARAM_HOST];

            MqttLib.Logger.Log.Write(MqttLib.Logger.LogLevel.INFO, "StreamFactory: Creating Bluetooth Stream to " + hostaddr);

            //BluetoothClient bc = new BluetoothClient();
            FixedBluetoothClient bc  = new FixedBluetoothClient();
            BluetoothAddress     bta = BluetoothAddress.Parse(hostaddr);

            MqttLib.Logger.Log.Write(MqttLib.Logger.LogLevel.INFO, "StreamFactory: Parsed BT address as " + bta.ToString());
            MqttLib.Logger.Log.Write(MqttLib.Logger.LogLevel.INFO, "StreamFactory: BT connecting ");
            bc.Connect(new BluetoothEndPoint(bta, BROKER_SERVICE));
            MqttLib.Logger.Log.Write(MqttLib.Logger.LogLevel.INFO, "StreamFactory: BT connected ");
            NetworkStream ns = bc.GetStream();

            bc.Close();
            return(ns);
        }
コード例 #2
0
        private static NetworkStream CreateBluetoothStreams(Hashtable parms)
        {
            string hostaddr = (string)parms[PARAM_HOST];
              MqttLib.Logger.Log.Write(MqttLib.Logger.LogLevel.INFO, "StreamFactory: Creating Bluetooth Stream to " + hostaddr );

              //BluetoothClient bc = new BluetoothClient();
              FixedBluetoothClient bc = new FixedBluetoothClient();
              BluetoothAddress bta = BluetoothAddress.Parse( hostaddr );
              MqttLib.Logger.Log.Write(MqttLib.Logger.LogLevel.INFO, "StreamFactory: Parsed BT address as " + bta.ToString());
              MqttLib.Logger.Log.Write(MqttLib.Logger.LogLevel.INFO, "StreamFactory: BT connecting " );
              bc.Connect(new BluetoothEndPoint(bta, BROKER_SERVICE));
              MqttLib.Logger.Log.Write(MqttLib.Logger.LogLevel.INFO, "StreamFactory: BT connected ");
              NetworkStream ns = bc.GetStream();
              bc.Close();
              return ns;
        }