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); } }
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); } }