コード例 #1
0
 void blueT_DeviceInquired(GT.Bluetooth sender, string macAddress, string name)
 {
     Debug.Print("inquired");
     if (name.IndexOf("HomeSecurity") > -1)
     {
         blueT.HostMode.InputPinCode("1234");
         Debug.Print("Conectado a un dispositivo!!!");
         blueT.HostMode.Connect(macAddress);
     }
 }
コード例 #2
0
 public Devices(Button button, Wifi wifi)
 {
     this.wifi   = wifi;
     blueT       = new Gadgeteer.Bluetooth(8);
     this.button = button;
     t           = new GT.Timer(100);
     t.Tick     += new GT.Timer.TickEventHandler(start);
     t.Start();
     Debug.Print("devices");
 }
コード例 #3
0
 public Devices(Button button, Wifi wifi)
 {
     this.wifi = wifi;
     blueT = new Gadgeteer.Bluetooth(8);
     this.button = button;
     t = new GT.Timer(100);
     t.Tick += new GT.Timer.TickEventHandler(start);
     t.Start();
     Debug.Print("devices");
 }
コード例 #4
0
        void blueT_DataReceived(GT.Bluetooth sender, string data)
        {
            if (!Scheduler.Instance().canContinue())
            {
                return;
            }
            int index = data.IndexOf(bluetoothMessage);

            if (index > -1)
            {
                wifi.SendData("device", data.Substring(index + bluetoothMessage.Length, data.Length - (index + bluetoothMessage.Length + 1)), "sendMovement");
            }
        }
コード例 #5
0
 internal Host(Bluetooth bluetooth)
 {
     Debug.Print("Host mode");
     this.bluetooth = bluetooth;
     bluetooth.serialPort.Write("\r\n+STWMOD=1\r\n");
 }
コード例 #6
0
 internal Client(Bluetooth bluetooth)
 {
     Debug.Print("Client Mode");
     this.bluetooth = bluetooth;
     bluetooth.serialPort.Write("\r\n+STWMOD=0\r\n");
 }
コード例 #7
0
 /// <summary>
 /// Raises the <see cref="PinRequested"/> event.
 /// </summary>
 /// <param name="sender">The object that raised the event.</param>  
 protected virtual void OnPinRequested(Bluetooth sender)
 {
     if (onPinRequested == null) onPinRequested = new PinRequestedHandler(OnPinRequested);
     if (Program.CheckAndInvoke(PinRequested, onPinRequested, sender))
     {
         PinRequested(sender);
     }
 }
コード例 #8
0
 /// <summary>
 /// Raises the <see cref="PinRequested"/> event.
 /// </summary>
 /// <param name="sender">The object that raised the event.</param>  
 /// <param name="macAddress">MAC Address of the inquired device</param>
 /// <param name="name">Name of the inquired device</param>
 protected virtual void OnDeviceInquired(Bluetooth sender, string macAddress, string name)
 {
     if (onDeviceInquired == null) onDeviceInquired = new DeviceInquiredHandler(OnDeviceInquired);
     if (Program.CheckAndInvoke(DeviceInquired, onDeviceInquired, sender, macAddress, name))
     {
         DeviceInquired(sender, macAddress, name);
     }
 }
コード例 #9
0
 /// <summary>
 /// Raises the <see cref="DataReceived"/> event.
 /// </summary>
 /// <param name="sender">The object that raised the event.</param>  
 /// <param name="data">Data string received by the Bluetooth module</param>
 protected virtual void OnDataReceived(Bluetooth sender, string data)
 {
     if (onDataReceived == null) onDataReceived = new DataReceivedHandler(OnDataReceived);
     if (Program.CheckAndInvoke(DataReceived, onDataReceived, sender, data))
     {
         DataReceived(sender, data);
     }
 }
コード例 #10
0
 /// <summary>
 /// Raises the <see cref="BluetoothStateChanged"/> event.
 /// </summary>
 /// <param name="sender">The object that raised the event.</param>  
 /// <param name="btState">Current state of the Bluetooth module</param>
 protected virtual void OnBluetoothStateChanged(Bluetooth sender, BluetoothState btState)
 {
     if (onBluetoothStateChanged == null) onBluetoothStateChanged = new BluetoothStateChangedHandler(OnBluetoothStateChanged);
     if (Program.CheckAndInvoke(BluetoothStateChanged, onBluetoothStateChanged, sender, btState))
     {
         BluetoothStateChanged(sender, btState);
     }
 }
コード例 #11
0
 private void blueT_BluetoothStateChanged(GT.Bluetooth sender, GT.Bluetooth.BluetoothState btState)
 {
     Debug.Print(btState.ToString());
 }
コード例 #12
0
 internal Host(Bluetooth bluetooth)
 {
     Debug.Print("Host mode");
     this.bluetooth = bluetooth;
     bluetooth.serialPort.Write("\r\n+STWMOD=1\r\n");
 }
コード例 #13
0
 internal Client(Bluetooth bluetooth)
 {
     Debug.Print("Client Mode");
     this.bluetooth = bluetooth;
     bluetooth.serialPort.Write("\r\n+STWMOD=0\r\n");
 }
コード例 #14
0
ファイル: Program.cs プロジェクト: user-mfp/IMI
 void bluetooth_DataReceived(Bluetooth sender, string data)
 {
     Debug.Print(data);
     sender.ClientMode.SendLine(data); //echoes the data back to the device.
 }
コード例 #15
0
ファイル: Program.cs プロジェクト: user-mfp/IMI
 void bluetooth_BluetoothStateChanged(Bluetooth sender, Bluetooth.BluetoothState btState)
 {
     Debug.Print(btState.ToString());
 }