{"action":"created","issue":{"url":"https://api.github.com/repos/NordicSemiconductor/Android-BLE-Library/issues/48","repository_url":"https://api.github.com/repos/NordicSemiconductor/Android-BLE-Library","labels_url":"https://api.github.com/repos/NordicSemiconductor/Android-BLE-Library/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/NordicSemiconductor/Android-BLE-Library/issues/48/comments","events_url":"https://api.github.com/repos/NordicSemiconductor/Android-BLE-Library/issues/48/events","html_url":"https://github.com/NordicSemiconductor/Android-BLE-Library/issues/48","id":382199667,"node_id":"MDU6SXNzdWUzODIxOTk2Njc=","number":48,"title":"Disable notifications ACK not received, trying to enable notifications throws Status -3 ","user":{"login":"maragues-kolibree","id":30043122,"node_id":"MDQ6VXNlcjMwMDQzMTIy","avatar_url":"https://avatars0.githubusercontent.com/u/30043122?v=4","gravatar_id":"","url":"https://api.github.com/users/maragues-kolibree","html_url":"https://github.com/maragues-kolibree","followers_url":"https://api.github.com/users/maragues-kolibree/followers","following_url":"https://api.github.com/users/maragues-kolibree/following{/other_user}","gists_url":"https://api.github.com/users/maragues-kolibree/gists{/gist_id}","starred_url":"https://api.github.com/users/maragues-kolibree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maragues-kolibree/subscriptions","organizations_url":"https://api.github.com/users/maragues-kolibree/orgs","repos_url":"https://api.github.com/users/maragues-kolibree/repos","events_url":"https://api.github.com/users/maragues-kolibree/events{/privacy}","received_events_url":"https://api.github.com/users/maragues-kolibree/received_events","type":"User","site_admin":false},"labels":[{"id":781956930,"node_id":"MDU6TGFiZWw3ODE5NTY5MzA=","url":"https://api.github.com/repos/NordicSemiconductor/Android-BLE-Library/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/NordicSemiconductor/Android-BLE-Library/milestones/1","html_url":"https://github.com/NordicSemiconductor/Android-BLE-Library/milestone/1","labels_url":"https://api.github.com/repos/NordicSemiconductor/Android-BLE-Library/milestones/1/labels","id":3705793,"node_id":"MDk6TWlsZXN0b25lMzcwNTc5Mw==","number":1,"title":"Version 2.0","description":"Second version of the library","creator":{"login":"philips77","id":6576580,"node_id":"MDQ6VXNlcjY1NzY1ODA=","avatar_url":"https://avatars0.githubusercontent.com/u/6576580?v=4","gravatar_id":"","url":"https://api.github.com/users/philips77","html_url":"https://github.com/philips77","followers_url":"https://api.github.com/users/philips77/followers","following_url":"https://api.github.com/users/philips77/following{/other_user}","gists_url":"https://api.github.com/users/philips77/gists{/gist_id}","starred_url":"https://api.github.com/users/philips77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philips77/subscriptions","organizations_url":"https://api.github.com/users/philips77/orgs","repos_url":"https://api.github.com/users/philips77/repos","events_url":"https://api.github.com/users/philips77/events{/privacy}","received_events_url":"https://api.github.com/users/philips77/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":17,"state":"closed","created_at":"2018-10-02T13:30:36Z","updated_at":"2018-11-30T14:47:10Z","due_on":null,"closed_at":"2018-11-30T14:47:10Z"},"comments":36,"created_at":"2018-11-19T12:48:14Z","updated_at":"2018-12-11T17:04:40Z","closed_at":"2018-11-30T14:45:55Z","author_association":"CONTRIBUTOR","body":"One of the operations I perform often is an atomic enable/disable notifications and write characteristic\r\n\r\n```kotlin \r\n        Timber.d(\"$rawDataOn pre\")\r\nbeginAtomicRequestQueue()\r\n            .add(klEnableNotificationsRequest(sensorsRawDataCharacteristic, rawDataOn)) //enables/disables notifications\r\n            .add(writeCharacteristic(sensorsStreamingControlCharacteristic, payload))\r\n            .before {\r\n                Timber.d(\"$rawDataOn before\")\r\n            }\r\n            .done {\r\n                Timber.d(\"$rawDataOn Completed\")\r\n            }\r\n            .enqueue()\r\n```\r\n\r\nA standard execution when passing \"false\" logs something like this\r\n\r\n```\r\n12:13:20.565 false pre\r\n12:13:20.565 false before\r\n12:13:20.566 gatt.setCharacteristicNotification(01000001-55d0-4989-b640-cfb64e5c34e0, false)\r\n12:13:20.566 setCharacteristicNotification() - uuid: 01000001-55d0-4989-b640-cfb64e5c34e0 enable: false\r\n12:13:20.567 Disabling notifications and indications for 01000001-55d0-4989-b640-cfb64e5c34e0\r\n12:13:20.568 gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x00-00)\r\n12:13:20.575 Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 00-00\r\n12:13:20.575 Notifications and indications disabled\r\n12:13:20.576 Writing characteristic 04000001-55d0-4989-b640-cfb64e5c34e0 (WRITE REQUEST)\r\n12:13:20.576 gatt.writeCharacteristic(04000001-55d0-4989-b640-cfb64e5c34e0)\r\n12:13:20.577 false Completed\r\n```\r\n\r\nSome times, if there are consecutive calls with enable set to false and then true, it tries to enable notifications before the disable is complete. Apparently, the \"disable notifications\" request never confirms that the notifications are disabled but still completes\r\n\r\n```\r\n12:13:19.467 false pre\r\n12:13:19.495 true pre\r\n12:13:20.485 false before\r\n12:13:20.486 gatt.setCharacteristicNotification(01000001-55d0-4989-b640-cfb64e5c34e0, false)\r\n12:13:20.486 setCharacteristicNotification() - uuid: 01000001-55d0-4989-b640-cfb64e5c34e0 enable: false\r\n12:13:20.489 Disabling notifications and indications for 01000001-55d0-4989-b640-cfb64e5c34e0\r\n12:13:20.490 gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x00-00)\r\n12:13:20.504 Writing characteristic 04000001-55d0-4989-b640-cfb64e5c34e0 (WRITE REQUEST)\r\n12:13:20.505 gatt.writeCharacteristic(04000001-55d0-4989-b640-cfb64e5c34e0)\r\n12:13:20.507 false Completed\r\n12:13:20.508 true before\r\n12:13:20.510 klEnableNotificationsRequest setNotificationCallback\r\n12:13:20.511 gatt.setCharacteristicNotification(01000001-55d0-4989-b640-cfb64e5c34e0, true)\r\n12:13:20.511 setCharacteristicNotification() - uuid: 01000001-55d0-4989-b640-cfb64e5c34e0 enable: true\r\n12:13:20.514 Enabling notifications for 01000001-55d0-4989-b640-cfb64e5c34e0\r\n12:13:20.514 gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00)\r\n-> error -3 12:13:20.516 Failed to enabled notifications for 01000001-55d0-4989-b640-cfb64e5c34e0 (status = -3)\r\n12:13:20.517 Writing characteristic 04000001-55d0-4989-b640-cfb64e5c34e0 (WRITE REQUEST)\r\n12:13:20.518 gatt.writeCharacteristic(04000001-55d0-4989-b640-cfb64e5c34e0)\r\n12:13:20.519 true Completed\r\n```\r\n\r\nIf you compare it with the previous log, it's missing the \"disable notifications\" ACK\r\n\r\n```\r\n12:13:20.575 Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 00-00\r\n12:13:20.575 Notifications and indications disabled\r\n```\r\n\r\nDoes it sound like a bug in the library?\r\n\r\nWe develop our own firmware so there might as well be a bug there, but I don't have a sniffer to check the packets."},"comment":{"url":"https://api.github.com/repos/NordicSemiconductor/Android-BLE-Library/issues/comments/446280425","html_url":"https://github.com/NordicSemiconductor/Android-BLE-Library/issues/48#issuecomment-446280425","issue_url":"https://api.github.com/repos/NordicSemiconductor/Android-BLE-Library/issues/48","id":446280425,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NjI4MDQyNQ==","user":{"login":"vicobz","id":11990981,"node_id":"MDQ6VXNlcjExOTkwOTgx","avatar_url":"https://avatars0.githubusercontent.com/u/11990981?v=4","gravatar_id":"","url":"https://api.github.com/users/vicobz","html_url":"https://github.com/vicobz","followers_url":"https://api.github.com/users/vicobz/followers","following_url":"https://api.github.com/users/vicobz/following{/other_user}","gists_url":"https://api.github.com/users/vicobz/gists{/gist_id}","starred_url":"https://api.github.com/users/vicobz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vicobz/subscriptions","organizations_url":"https://api.github.com/users/vicobz/orgs","repos_url":"https://api.github.com/users/vicobz/repos","events_url":"https://api.github.com/users/vicobz/events{/privacy}","received_events_url":"https://api.github.com/users/vicobz/received_events","type":"User","site_admin":false},"created_at":"2018-12-11T17:04:40Z","updated_at":"2018-12-11T17:04:40Z","author_association":"NONE","body":"Hi,\r\n\r\nThanks for this great library!\r\n \r\nI'm wondering if I'm facing an issue similar to what is described above. I use the library to connect to a (Nordic) device and subscribe to notifications from one specific characteristic. \r\n\r\nTo communicate in both ways, I (the Android app) receive notifications from the characteristic and when I need to send a message, I write to that characteristic and the device replies with the same exact data. \r\n\r\nMultiple issues were fixed from 2.0.1 & 2.0.3 releases. \r\n\r\nHowever, I'm still facing something weird. I sometimes receive a notification from the Nordic device and then, I can see in logs that the exact same data is automatically written to the device, without no link with my own code, meaning I'm not sending any write request for that specific message.\r\n\r\nUnfortunately, this issue breaks the communication protocol between our Nordic device and the Android app as we rely on a specific sequence order.\r\n\r\nDo you have any idea why this could happen?\r\n\r\nI will try to add logs asap when facing the issue again as it is not systematically reproducible.\r\n\r\nThanks\r\n"}}
{"actor":{"display_login":"vicobz"}}