internal async void Start() { bleDevice = await Windows.Devices.Bluetooth.BluetoothLEDevice.FromIdAsync(deviceId); services = bleDevice.GattServices; int ccc = services.Count; for (int i = 0; i < ccc; i++) { Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService service = services[i]; string s = service.Uuid.ToString(); if (s == "4f63756c-7573-2054-6872-65656d6f7465") { myService = service; //var CharResult = myService.GetAllCharacteristics(); //Console.WriteLine("elo"); break; } } if (myService != null) { Get_Characteriisics(); } }
internal async Task <bool> Init() { bool success = false; bleDevice = await Windows.Devices.Bluetooth.BluetoothLEDevice.FromIdAsync(deviceId); services = bleDevice.GattServices; int ccc = services.Count; for (int i = 0; i < ccc; i++) { Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService service = services[i]; string s = service.Uuid.ToString(); if (s == "4f63756c-7573-2054-6872-65656d6f7465") { myService = service; //var CharResult = myService.GetAllCharacteristics(); //Console.WriteLine("elo"); break; } } if (myService != null) { try { allCharacteristics = myService.GetAllCharacteristics(); Guid notifyGuid = new Guid("{c8c51726-81bc-483b-a052-f7a14ea3d281}"); Guid writeGuid = new Guid("{c8c51726-81bc-483b-a052-f7a14ea3d282}"); foreach (Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic c in allCharacteristics) { if ( c.CharacteristicProperties.HasFlag(Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristicProperties.Notify) && c.Uuid == notifyGuid) { notifyCharacteristic = c; } else if ( c.CharacteristicProperties.HasFlag(Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristicProperties.Write) && c.Uuid == writeGuid) { writeCharacteristic = c; } if (notifyCharacteristic != null && writeCharacteristic != null) { break; } } success = notifyCharacteristic != null && writeCharacteristic != null; } catch { } } return(success); }
public GattService(PeripheralContext context, Native native) : base(context.Peripheral, native.Uuid.ToString(), false) { this.context = context; this.native = native; }
internal GattService(BluetoothDevice device, WBluetooth.GattDeviceService service, bool isPrimary) : this(device) { _service = service; _isPrimary = isPrimary; }
public GattService(DeviceContext context, Native native) : base(context.Peripheral, native.Uuid, false) { this.context = context; this.native = native; }
internal GattService(BluetoothDevice device, WBluetooth.GattDeviceService service, bool isPrimary) : this(device) { _service = service; _isPrimary = isPrimary; device.AddDisposableObject(this, service); }
internal GattService(BluetoothDevice device, WBluetooth.GattDeviceService service) : this(device) { _service = service; }
internal GattService(Device device, Win.GattDeviceService service) { this.device = device ?? throw new ArgumentNullException(nameof(device)); this.service = service ?? throw new ArgumentNullException(nameof(service)); }