If you are asking a question, please follow this template:
- My goal is: [describe your goal] I am trying to get notifications from a device. I am certain that the device is sending notifications upon subscription. Here is a link to video of it working with nRF.
http://pinatabot5000.xyz/Notifications.mov - My actions are: [describe your actions - code, commands, etc] Using the helpful example in mongoose-os-apps I have copied and pasted till I get the charectaristic and try to set the notifications.
Event.on(GATTC.EV_DISCOVERY_RESULT, function(ev, evdata) {
print('discovered!')
let dr = GATTC.getDiscoveryResultArg(evdata);
print('Found', JSON.stringify(dr));
if (dr.chr === 'a6ed0202-d344-460a-8075-b9e8ec90d71b') {
GATTC.read(dr.conn.connId, dr.handle);
// GATTC.setNotifyModeCCCD(conn.connId, dr.handle + 1, GATTC.NOTIFY_MODE_NOTIFY);
let set = GATTC.setNotifyModeCCCD(dr.conn.connId, dr.handle+1, GATTC.NOTIFY_MODE_NOTIFY);
print('setting notifier', dr.conn.connId, dr.handle+1, GATTC.NOTIFY_MODE_NOTIFY);
GATTC.read(dr.conn.connId, dr.handle+1);
print('set??', set)
let adr = GATTC.getDiscoveryResultArg(evdata);
print('xxxxx', JSON.stringify(adr));
}
// else if ((dr.chr === 'a6ed0203-d344-460a-8075-b9e8ec90d71b') && (ntf === true)) {
// GATTC.read(dr.conn.connId, dr.handle);
// print('writing?', conn.connId, dr.handle, "data", true);
// GATTC.write(conn.connId, dr.handle, "data", true);
// }
}, null);
I do have GATTC.EV_NOTIFY
event handlers in the code. Omitted for brevity.
3. The result I see is: [show the result - log, etc]
...
[May 6 16:42:36.280] Found {"conn":{"addr":"ea:cb:3e:cf:00:0f,1","connId":0,"mtu":60},"svc":"180a","chr":"2a29","handle":26,"prop":0}
[May 6 16:42:36.293] discovered!
[May 6 16:42:36.302] Found {"conn":{"addr":"ea:cb:3e:cf:00:0f,1","connId":0,"mtu":60},"svc":"180a","chr":"2a2a","handle":28,"prop":0}
[May 6 16:42:36.316] discovered!
[May 6 16:42:36.325] Found {"conn":{"addr":"ea:cb:3e:cf:00:0f,1","connId":0,"mtu":60},"svc":"180a","chr":"2a50","handle":30,"prop":0}
[May 6 16:42:36.338] discovered!
[May 6 16:42:36.351] Found {"conn":{"addr":"ea:cb:3e:cf:00:0f,1","connId":0,"mtu":60},"svc":"a6ed0201-d344-460a-8075-b9e8ec90d71b","chr":"a6ed0202-d344-460a-8075-b9e8ec90d71b","handle":33,"prop":0}
[May 6 16:42:36.379] setting notifier 0 34 1
[May 6 16:42:36.383] set?? true
[May 6 16:42:36.396] xxxxx {"conn":{"addr":"ea:cb:3e:cf:00:0f,1","connId":0,"mtu":60},"svc":"a6ed0201-d344-460a-8075-b9e8ec90d71b","chr":"a6ed0202-d344-460a-8075-b9e8ec90d71b","handle":33,"prop":0}
[May 6 16:42:36.413] discovered!
[May 6 16:42:36.421] Found {"conn":{"addr":"ea:cb:3e:cf:00:0f,1","connId":0,"mtu":60},"svc":"a6ed0201-d344-460a-8075-b9e8ec90d71b","chr":"a6ed0203-d344-460a-8075-b9e8ec90d71b","handle":36,"prop":0}
[May 6 16:42:36.439] discovered!
[May 6 16:42:36.447] Found {"conn":{"addr":"ea:cb:3e:cf:00:0f,1","connId":0,"mtu":60},"svc":"a6ed0201-d344-460a-8075-b9e8ec90d71b","chr":"a6ed0204-d344-460a-8075-b9e8ec90d71b","handle":38,"prop":0}
[May 6 16:42:36.469] /////Read data: 33 false
[May 6 16:42:36.474] /////Read data: 34 true \x00\x00
[May 6 16:42:39.265] idle...
...
- My expectation & question is: [describe your expectation and your question]
My expectation & question is: [describe your expectation and your question] The example has the handle +1 I have tried with and without adding one to this. I have tried notifications and indications. I have tried staying connected and disconectiong. Any thoughts would be helpful. But I think I should be getting the notifications from the peripheral with what I have??? Thanks