c# - Enable multiple BLE Characteristic notifications in UWP -
i have tried enable 2 notification in uwp application, every time first characteristic notify user.
accessconfigurationcharacteristic(); configurationselectedcharacteristic = selectedcharacteristic; characteristicnotifyenableforconfig(); await task.delay(5000); accessdiagnosticcharacteristic(); diagnosticselectedcharacteristic = selectedcharacteristic; characteristicnotifyenable(); private async void characteristicnotifyenable() { try { // bt_code: must write cccd in order server send notifications. // receive them in valuechanged event handler. // note sample configures either indicate or notify, not both. var result = await diagnosticselectedcharacteristic.writeclientcharacteristicconfigurationdescriptorasync( gattclientcharacteristicconfigurationdescriptorvalue.notify); if (result == gattcommunicationstatus.success) { addvaluechangedhandler(); // rootpage.notifyuser("successfully registered notifications", notifytype.statusmessage); } else { // rootpage.notifyuser($"error registering notifications: {result}", notifytype.errormessage); } } catch (unauthorizedaccessexception ex) { // happens when device reports support notify, doesn't. // rootpage.notifyuser(ex.message, notifytype.errormessage); } }
'characteristicnotifyenableforconfig()' method similar characteristicnotifyenable() different characterstic.can me solve.
Comments
Post a Comment