Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
 void FailedToConnectPeripheral(object sender, CBPeripheralErrorEventArgs e)
 {
     FailureEventHandler?.Invoke(this, new BluetoothFailureEventArgs(e.Error.Description));
 }