private void BglibOnBleEventAttClientGroupFound(object sender, GroupFoundEventArgs e) { String log = String.Format("ble_evt_attclient_group_found: connection={0}, start={1}, end={2}, uuid=[ {3}]" + Environment.NewLine, e.connection, e.start, e.end, ByteArrayToHexString(e.uuid) ); Console.WriteLine(log); //TODO capture start and end for finding the attribute Console.WriteLine(String.Format("Services start {0} and end {1}", e.start, e.end)); connState = BluetoothState.STATE_FINDING_SERVICES; }
private void OnServiceFound(object sender, GroupFoundEventArgs e) { if (_device == null || e.end == 0 || e.uuid.Length < 15) { return; } var service = BleMappings.MapBleDeviceService(e); if (service == null) { return; } if (!_device.Services.ContainsKey(service.ServiceId)) { _device.Services.Add(service.ServiceId, service); } }
public static BgBleDeviceService MapBleDeviceService(GroupFoundEventArgs e) { if (e.uuid.Length < 15) { return(null); } var serviceId = new Guid( ByteArrayToHexString(e.uuid.Reverse().ToArray())); return(new BgBleDeviceService { ServiceId = serviceId, ConnectionHandle = e.connection, Start = e.start, End = e.end }); }
private void BGApi_ATTClientGroupFound(object sender, GroupFoundEventArgs e) { try { if (State == PeripheralState.Disposed) { return; } var serviceUUID = e.uuid.Reverse().ToArray(); Debug.WriteLine($"Found service: {serviceUUID.ToHexString()}"); if (_targetServiceUUIDs != null && _targetServiceUUIDs.Any(bytes => bytes.SequenceEqual(e.uuid))) { AddService(new BGService(this, e.uuid, e.start, e.end, _bgApi)); Debug.WriteLine($"Created and added service: {serviceUUID.ToHexString()}"); } } catch (Exception ex) { if (_exceptionToRethrow == null) { _exceptionToRethrow = ExceptionDispatchInfo.Capture(ex); } } }
private void GroupFound(object sender, GroupFoundEventArgs e) { this.PeripheralMap.Services.Add(new BlePeripheralService(e.uuid, e.start, e.end)); }
private void Bglib_BLEEventATTClientGroupFound(object sender, GroupFoundEventArgs e) => ATTClientGroupFound?.Invoke(this, e);