Closed NSExceptional closed 4 years ago
On Thu, 21 Nov 2019 at 15:56, Tanner Bennett notifications@github.com wrote:
I modified it to take a hard-coded address and a different characteristic, and ran it against a BLE fitness watch. It connects, and finds the characteristic (which has .notify = true in the debugger) but the notify callback is never executed.
If you do the same thing by hand in a bluetooth explorer (such as nRF's app), do you receive notifications?
-Ed
Here is the code, in case it helps, but it's 99% of what is in
temperature.cc
int main(int argc, char **argv) { log_level = Error;
BLEGATTStateMachine gatt;
std::function<void(const PDUNotificationOrIndication&)> notifyCallback = [&](const PDUNotificationOrIndication& n) { auto ms_since_epoch = duration_cast
(system_clock::now().time_since_epoch()); float temp = bluetooth_float_to_IEEE754(n.value().first+1); cout << setprecision(15) << ms_since_epoch.count()/1000. << " " << setprecision(5) << temp << endl;
};
std::function<void()> found_services_and_characteristics_cb = [&gatt, ¬ifyCallback]() { for (auto& service: gatt.primary_services) { for (auto& characteristic: service.characteristics) { if (characteristic.uuid == UUID("3ea6")) { characteristic.cb_notify_or_indicate = notifyCallback; characteristic.set_notify_and_indicate(true, false); } } } };
gatt.setup_standard_scan(found_services_and_characteristics_cb);
gatt.cb_disconnected = [](BLEGATTStateMachine::Disconnect d) { cerr << "Disconnect for reason " << BLEGATTStateMachine::get_disconnect_string(d) << endl; exit(1); };
gatt.connect_blocking("88:6B:0F:64:2E:0D");
for (;;) { gatt.read_and_process_next(); } }
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/edrosten/libblepp/issues/48?email_source=notifications&email_token=AAIZN26TCC5EFWKTSJIA56DQU2VRHA5CNFSM4JQEN67KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H3ESCNQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIZN2ZS2BHTPQ5DGQNSFBDQU2VRHANCNFSM4JQEN67A .
I do not, it appears to be the watch acting funny. It won't notify
me of anything it tells me I can be notified about.
My bad, I'll close this!
I modified it to take a hard-coded address and a different characteristic, and ran it against a BLE fitness watch. It connects, and finds the characteristic (which has
.notify = true
in the debugger) but the notify callback is never executed.Here is the code, in case it helps, but it's 99% of what is in
temperature.cc