fix(nimble): Fixes for AI reported issues

This commit is contained in:
Rahul Tank
2026-06-11 11:42:05 +05:30
parent 7a79a3f242
commit 86297605f9
7 changed files with 112 additions and 129 deletions

View File

@@ -367,7 +367,7 @@ bleprph_gap_event(struct ble_gap_event *event, void *arg)
rc = ble_gap_conn_find(event->enc_change.conn_handle, &desc);
assert(rc == 0);
bleprph_print_conn_desc(&desc);
struct ble_cs_reflector_setup_params params;
struct ble_cs_reflector_setup_params params = {0};
params.cb=blecs_gap_event;
ble_cs_reflector_setup(&params);

View File

@@ -97,7 +97,7 @@ blecent_l2cap_coc_send_data(struct ble_l2cap_chan *chan)
static void
blecent_l2cap_coc_on_disc_complete(const struct peer *peer, int status, void *arg)
{
uint16_t psm = 0x1002;
uint16_t psm = 0x0080;
struct os_mbuf *sdu_rx = NULL;
int rc;

View File

@@ -34,7 +34,7 @@ void ble_store_config_init(void);
#define COC_BUF_COUNT (20 * MYNEWT_VAL(BLE_L2CAP_COC_MAX_NUM))
#define MTU 512
uint16_t psm = 0x1002;
uint16_t psm = 0x0080;
static os_membuf_t sdu_coc_mem[OS_MEMPOOL_SIZE(COC_BUF_COUNT, MTU)];
static struct os_mempool sdu_coc_mbuf_mempool;
static struct os_mbuf_pool sdu_os_mbuf_pool;
@@ -332,16 +332,6 @@ bleprph_gap_event(struct ble_gap_event *event, void *arg)
ext_bleprph_advertise();
#else
bleprph_advertise();
#endif
} else {
rc = ble_gap_conn_find(event->connect.conn_handle, &desc);
assert(rc == 0);
bleprph_print_conn_desc(&desc);
#if MYNEWT_VAL(BLE_L2CAP_COC_MAX_NUM) >= 1
rc = ble_l2cap_create_server(psm, MTU, bleprph_l2cap_coc_event_cb, NULL);
if (rc != 0) {
MODLOG_DFLT(ERROR, "Failed to create L2CAP CoC server; rc=%d", rc);
}
#endif
}
return 0;
@@ -413,6 +403,15 @@ bleprph_on_sync(void)
MODLOG_DFLT(INFO, "Device Address: ");
print_addr(addr_val);
MODLOG_DFLT(INFO, "\n");
#if MYNEWT_VAL(BLE_L2CAP_COC_MAX_NUM) >= 1
rc = ble_l2cap_create_server(psm, MTU, bleprph_l2cap_coc_event_cb, NULL);
if (rc != 0 && rc != BLE_HS_EALREADY) {
MODLOG_DFLT(ERROR, "Failed to create L2CAP COC server; rc=%d\n", rc);
return;
}
#endif
/* Begin advertising. */
#if CONFIG_EXAMPLE_EXTENDED_ADV
ext_bleprph_advertise();