Added a new event to the ble_service_state_change event callback function to be able to detect when a BLE master device subscribed to a particular characteristic. Also reworked the allocated buffers for the BLE stack, because of a strage issue, where it is hard for the phone to reconnect to the watch.

This commit is contained in:
anschrammh 2023-04-13 13:34:38 +02:00
parent cfc42779dd
commit 92de986dba
3 changed files with 11 additions and 4 deletions

View File

@ -660,6 +660,12 @@ static int ble_gap_event_cb(struct ble_gap_event *event, void *arg)
event->subscribe.cur_notify,
event->subscribe.prev_notify
);
if(gatt_nus_char_tx_handle == event->subscribe.attr_handle && (event->subscribe.cur_notify || event->subscribe.cur_indicate))
{
//We call the state change callback if registered
if(_ble_service_state_change_cb)_ble_service_state_change_cb(BLE_SERVICE_MODE_SUBSCRIBED);
}
break;
case BLE_GAP_EVENT_MTU:
TLS_BT_APPL_TRACE_VERBOSE("MTU update : %u"NEW_LINE, event->mtu.value);

View File

@ -15,6 +15,7 @@ typedef enum
BLE_SERVICE_MODE_IDLE,
BLE_SERVICE_MODE_ADVERTISING,
BLE_SERVICE_MODE_CONNECTED,
BLE_SERVICE_MODE_SUBSCRIBED,
BLE_SERVICE_MODE_INDICATING,
BLE_SERVICE_MODE_EXITING
} ble_service_state_e;

View File

@ -65,7 +65,7 @@
#endif
#ifndef MYNEWT_VAL_MSYS_1_BLOCK_SIZE
#define MYNEWT_VAL_MSYS_1_BLOCK_SIZE (100) // Default 292
#define MYNEWT_VAL_MSYS_1_BLOCK_SIZE (150) // Default 292
#endif
#ifndef MYNEWT_VAL_MSYS_1_SANITY_MIN_COUNT
@ -925,7 +925,7 @@
/*** @apache-mynewt-nimble/nimble/transport/socket */
#ifndef MYNEWT_VAL_BLE_ACL_BUF_COUNT
#define MYNEWT_VAL_BLE_ACL_BUF_COUNT (8) // Default 36
#define MYNEWT_VAL_BLE_ACL_BUF_COUNT (15) // Default 36
#endif
#ifndef MYNEWT_VAL_BLE_ACL_BUF_SIZE
@ -947,11 +947,11 @@
#endif
#ifndef MYNEWT_VAL_BLE_HCI_EVT_HI_BUF_COUNT
#define MYNEWT_VAL_BLE_HCI_EVT_HI_BUF_COUNT (5) // Default 16
#define MYNEWT_VAL_BLE_HCI_EVT_HI_BUF_COUNT (10) // Default 16
#endif
#ifndef MYNEWT_VAL_BLE_HCI_EVT_LO_BUF_COUNT
#define MYNEWT_VAL_BLE_HCI_EVT_LO_BUF_COUNT (5) // Default 96
#define MYNEWT_VAL_BLE_HCI_EVT_LO_BUF_COUNT (20) // Default 96
#endif
#ifndef MYNEWT_VAL_BLE_SOCK_CLI_SYSINIT_STAGE