fix(nimble): Add support for minimilistic builds

This commit is contained in:
Rahul Tank
2025-05-27 11:07:33 +05:30
parent 89c26078da
commit 66c12d4efe
39 changed files with 2811 additions and 157 deletions
+12 -2
View File
@@ -53,6 +53,7 @@
#endif
#endif
#if MYNEWT_VAL(BLE_GATTC)
/*** The UUID of the service containing the subscribable characteristic ***/
static const ble_uuid_t * remote_svc_uuid =
BLE_UUID128_DECLARE(0x2d, 0x71, 0xa2, 0x59, 0xb4, 0x58, 0xc8, 0x12,
@@ -62,6 +63,7 @@ static const ble_uuid_t * remote_svc_uuid =
static const ble_uuid_t * remote_chr_uuid =
BLE_UUID128_DECLARE(0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11,
0x22, 0x22, 0x22, 0x22, 0x33, 0x33, 0x33, 0x33);
#endif
static const char *tag = "NimBLE_BLE_CENT";
static int blecent_gap_event(struct ble_gap_event *event, void *arg);
@@ -73,6 +75,7 @@ static uint16_t bearers;
void ble_store_config_init(void);
#if MYNEWT_VAL(BLE_GATTC)
/**
* Application Callback. Called when the custom subscribable chatacteristic
* in the remote GATT server is read.
@@ -430,6 +433,7 @@ blecent_on_disc_complete(const struct peer *peer, int status, void *arg)
*/
blecent_read_write_subscribe(peer);
}
#endif //MYNEWT_VAL(BLE_GATTC)
/**
* Initiates the GAP general discovery procedure.
@@ -782,6 +786,7 @@ blecent_gap_event(struct ble_gap_event *event, void *arg)
MODLOG_DFLT(INFO, "Connection secured\n");
}
#else
#if MYNEWT_VAL(BLE_GATTC)
/* Perform service discovery */
rc = peer_disc_all(event->connect.conn_handle,
blecent_on_disc_complete, NULL);
@@ -789,6 +794,7 @@ blecent_gap_event(struct ble_gap_event *event, void *arg)
MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc);
return 0;
}
#endif
#endif
} else {
/* Connection attempt failed; resume scanning. */
@@ -833,7 +839,7 @@ blecent_gap_event(struct ble_gap_event *event, void *arg)
assert(rc == 0);
print_conn_desc(&desc);
#if !MYNEWT_VAL(BLE_EATT_CHAN_NUM)
#if CONFIG_EXAMPLE_ENCRYPTION
#if CONFIG_EXAMPLE_ENCRYPTION && MYNEWT_VAL(BLE_GATTC)
/*** Go for service discovery after encryption has been successfully enabled ***/
rc = peer_disc_all(event->enc_change.conn_handle,
blecent_on_disc_complete, NULL);
@@ -949,7 +955,7 @@ blecent_gap_event(struct ble_gap_event *event, void *arg)
MODLOG_DFLT(INFO, "Cannot set default EATT bearer, rc = %d\n", rc);
return rc;
}
#if MYNEWT_VAL(BLE_GATTC)
/* Perform service discovery */
rc = peer_disc_all(event->eatt.conn_handle,
blecent_on_disc_complete, NULL);
@@ -957,6 +963,7 @@ blecent_gap_event(struct ble_gap_event *event, void *arg)
MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc);
return 0;
}
#endif
#endif
return 0;
default:
@@ -1062,9 +1069,12 @@ app_main(void)
rc = peer_init(MYNEWT_VAL(BLE_MAX_CONNECTIONS), 64, 64, 64);
assert(rc == 0);
#endif
#if CONFIG_BT_NIMBLE_GAP_SERVICE
/* Set the default device name. */
rc = ble_svc_gap_device_name_set("nimble-blecent");
assert(rc == 0);
#endif
/* XXX Need to have template for store */
ble_store_config_init();