void WroteCharacteristicValue(object sender, CBCharacteristicEventArgs e) { if (e.Error != null) { FailureEventHandler?.Invoke(this, new BluetoothFailureEventArgs(e.Error.Description)); return; } var characteristic = new Characteristic(e.Characteristic.UUID.Uuid); WroteCharacteristicValueEventHandler?.Invoke(this, new WroteCharacteristicValueEventArgs(characteristic)); }
void UpdatedCharacterteristicValue(object sender, CBCharacteristicEventArgs e) { if (e.Error != null) { FailureEventHandler?.Invoke(this, new BluetoothFailureEventArgs(e.Error.Description)); return; } Console.Error.WriteLine($"Got characteristic value for {e.Characteristic.UUID.Uuid}"); var uuid = e.Characteristic.UUID.Uuid; var nsDataValue = e.Characteristic.Value; var characteristic = new Characteristic(uuid); var value = nsDataValue.ToArray(); ReadCharacteristicValueEventHandler?.Invoke(this, new ReadCharacteristicValueEventArgs(characteristic, value)); }
void FailedToConnectPeripheral(object sender, CBPeripheralErrorEventArgs e) { FailureEventHandler?.Invoke(this, new BluetoothFailureEventArgs(e.Error.Description)); }