Esempio n. 1
0
 private void ClientFindInformationEvent(object sender, FindInformationFoundEventArgs e)
 {
     Console.WriteLine(String.Format("UUID = {0} and Charactaristic Handle = {1}", ByteArrayToHexString(e.uuid), e.chrhandle));
     //TODO if we do things right we will get the tool charactaristiic handle here
     ToolCharactaristic = e.chrhandle;
     connState          = BluetoothState.STATE_FINDING_ATTRIBUTES;
 }
        private void OnCharacteristicFound(object sender, FindInformationFoundEventArgs e)
        {
            if (_deviceService == null)
            {
                return;
            }
            var characteristic = BleMappings.MapBleDeviceCharacteristic(e);

            if (characteristic == null)
            {
                return;
            }
            if (characteristic.CharacteristicId != Guid.Empty)
            {
                _lastCharacteristic = characteristic;
                if (!_deviceService.Characteristics.ContainsKey(characteristic.CharacteristicId))
                {
                    _deviceService.Characteristics.Add(characteristic.CharacteristicId, characteristic);
                }
            }
            else if (_lastCharacteristic?.Handle > 0 && _lastCharacteristic?.ClientCharacteristicConfiguratorDescriptorHandle == 0)
            {
                _lastCharacteristic.ClientCharacteristicConfiguratorDescriptorHandle = characteristic.Handle;
            }
        }
Esempio n. 3
0
 public static BgBleDeviceCharacteristic MapBleDeviceCharacteristic(FindInformationFoundEventArgs e)
 {
     return(new BgBleDeviceCharacteristic
     {
         uuid = e.uuid,
         CharacteristicId = e.uuid.Length < 15
             ? Guid.Empty
             : new Guid(
             ByteArrayToHexString(e.uuid.Reverse().ToArray())),
         ConnectionHandle = e.connection,
         Handle = e.chrhandle
     });
 }
 private void AttributeFound(BlePeripheralService service, FindInformationFoundEventArgs e)
 {
     service.Attributes.Add(new BlePeripheralAttribute(e.uuid, e.chrhandle));
 }
Esempio n. 5
0
 private void Bglib_BLEEventATTClientFindInformationFound(object sender, FindInformationFoundEventArgs e) => ATTClientFindInformationFound?.Invoke(this, e);