I am working with Raspberry Pi2 and Windows 10 IoT Core.
After runing aplication, I recieve some lux updates(cca. 3-4) , but after that, sensor tag gets disconnected (green LED blinking). However it doesn't get unpaired from Raspberry. If I start the app again, it works again 3-4 times and get disconnected again.
Here is my code:
async void initialize() { Debug.WriteLine("Running..."); var luxDevices = await DeviceInformation.FindAllAsync(GattDeviceService.GetDeviceSelectorFromUuid(new Guid("F000AA70-0451-4000-B000-000000000000"))); if(luxDevices.Count == 0) { Debug.WriteLine("No devices found..."); return; } var luxService = await GattDeviceService.FromIdAsync(luxDevices[0].Id); if(luxService == null) { Debug.WriteLine("No lux service..."); } var luxData = luxService.GetCharacteristics(new Guid("F000AA71-0451-4000-B000-000000000000"))[0]; luxData.ValueChanged += lux_ValueChanged; await luxData.WriteClientCharacteristicConfigurationDescriptorAsync(GattClientCharacteristicConfigurationDescriptorValue.Notify); var luxConfig = luxService.GetCharacteristics(new Guid("F000AA72-0451-4000-B000-000000000000"))[0]; writer.WriteByte((Byte)0x01); await luxConfig.WriteValueAsync(writer.DetachBuffer()); Debug.WriteLine("Config done, awaiting data..."); } async void lux_ValueChanged(GattCharacteristic sender, GattValueChangedEventArgs args) { Debug.WriteLine("Lux value update..."); }
Can you give me some tips or guidance to work this problem out?
Thanks in advance!