Exemple #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);
     }
 }
Exemple #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");
 }
 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");
 }
Exemple #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");
            }
        }
 internal Host(Bluetooth bluetooth)
 {
     Debug.Print("Host mode");
     this.bluetooth = bluetooth;
     bluetooth.serialPort.Write("\r\n+STWMOD=1\r\n");
 }
 internal Client(Bluetooth bluetooth)
 {
     Debug.Print("Client Mode");
     this.bluetooth = bluetooth;
     bluetooth.serialPort.Write("\r\n+STWMOD=0\r\n");
 }
 /// <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);
     }
 }
 /// <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);
     }
 }
 /// <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);
     }
 }
 /// <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);
     }
 }
Exemple #11
0
 private void blueT_BluetoothStateChanged(GT.Bluetooth sender, GT.Bluetooth.BluetoothState btState)
 {
     Debug.Print(btState.ToString());
 }
Exemple #12
0
 internal Host(Bluetooth bluetooth)
 {
     Debug.Print("Host mode");
     this.bluetooth = bluetooth;
     bluetooth.serialPort.Write("\r\n+STWMOD=1\r\n");
 }
Exemple #13
0
 internal Client(Bluetooth bluetooth)
 {
     Debug.Print("Client Mode");
     this.bluetooth = bluetooth;
     bluetooth.serialPort.Write("\r\n+STWMOD=0\r\n");
 }
Exemple #14
0
 void bluetooth_DataReceived(Bluetooth sender, string data)
 {
     Debug.Print(data);
     sender.ClientMode.SendLine(data); //echoes the data back to the device.
 }
Exemple #15
0
 void bluetooth_BluetoothStateChanged(Bluetooth sender, Bluetooth.BluetoothState btState)
 {
     Debug.Print(btState.ToString());
 }