Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event 'indicateconfirmed' added #2299

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libs/bluetooth/bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ typedef enum {
BLEP_CENTRAL_NOTIFICATION, //< A characteristic we were watching has changed
BLEP_CENTRAL_DISCONNECTED, //< Central: Disconnected (reason as data low byte, index in m_central_conn_handles as high byte )
BLEP_TASK_BONDING, //< Bonding negotiation complete (success in data)
BLEP_TASK_CHARACTERISTIC_WRITE_HVC, //< Central: ATT Handle Value Confirmation after an indication packet
#endif
BLEP_WRITE, //< One of our characteristics written by someone else
BLEP_TASK_PASSKEY_DISPLAY, //< We're pairing and have been provided with a passkey to display (data = conn_handle)
Expand Down
13 changes: 13 additions & 0 deletions targets/nrf5x/bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,11 @@ int jsble_exec_pending(IOEvent *event) {
}
break;
}
case BLEP_TASK_CHARACTERISTIC_WRITE_HVC: {
bleQueueEventAndUnLock(JS_EVENT_PREFIX"indicateconfirmed", 0);
jshHadEvent();
break;
}
#if CENTRAL_LINK_COUNT>0
case BLEP_RSSI_CENTRAL: { // rssi as data low byte, index in m_central_conn_handles as high byte
int centralIdx = data>>8; // index in m_central_conn_handles
Expand Down Expand Up @@ -1451,6 +1456,14 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context) {
jsble_peripheral_activity(); // flag that we've been busy
break;
}

case BLE_GATTS_EVT_HVC: {
// Peripheral sent a ATT Handle Value Confirmation
const ble_gatts_evt_hvc_t * p_evt_hvc = &p_ble_evt->evt.gatts_evt.params.hvc;
jsble_queue_pending(BLEP_TASK_CHARACTERISTIC_WRITE_HVC, 0); // send HVC event
jsble_peripheral_activity(); // flag that we've been busy
break;
}

#if CENTRAL_LINK_COUNT>0
// For discovery....
Expand Down