Ejemplo n.º 1
0
        void OnPeripheralConnected(object sender, EventArgs e)
        {
            EventHandler <BLEPeripheralEventArgs> handler = ConnectedToPeripheral;

            if (handler != null)
            {
                BLEPeripheralEventArgs args = new BLEPeripheralEventArgs();
                args.Peripheral = sender as BLEPeripheral;

                handler(this, args);
            }
        }
Ejemplo n.º 2
0
        void OnConnectedPeripheral(object sender, CBPeripheralEventArgs e)
        {
            BLEPeripheral peripheral = null;

            foreach (BLEPeripheral blep in discoveredPeripherals)
            {
                if (blep.UUID.StringValue == e.Peripheral.ToString())
                {
                    peripheral = blep;

                    break;
                }
            }

            EventHandler <BLEPeripheralEventArgs> handler = ConnectedToPeripheral;

            if (handler != null)
            {
                BLEPeripheralEventArgs args = new BLEPeripheralEventArgs();
                args.Peripheral = peripheral;

                handler(this, args);
            }
        }