private void GattServerCharacteristic_OnWrite(object sender, ICharacteristicWriteRequest e)
            {
                ulong address;

                try
                {
                    address = BitConverter.ToUInt64(e.Value, 0);
                }
                catch (Exception)
                {
                    e.RespondWithProtocolError(GattErrorCode.Failure);
                    return;
                }
                if (!RfcommAddressDict.ContainsKey(e.SourceDevice))
                {
                    RfcommAddressDict.Add(e.SourceDevice, address);
                }
                else
                {
                    RfcommAddressDict[e.SourceDevice] = address;
                }
                e.RespondSuccess();
                ClientRfcommServiceWrapper.OnRfcommAddressWrite?.Invoke(ClientRfcommServiceWrapper, new KeyValuePair <IBluetoothDevice, ulong>(e.SourceDevice, address));
            }
Esempio n. 2
0
 private void OnManufacturerNameStringCharacteristicWrite(object sender, ICharacteristicWriteRequest e)
 {
     e.RespondSuccess();
 }
Esempio n. 3
0
        private async void GattServerCharacteristic_OnWrite(object sender, ICharacteristicWriteRequest e)
        {
            await SendAsync(e.Value);

            e.RespondSuccess();
        }