@@ -48,7 +48,13 @@ bool initialized = false; // Have we been initialized?
48
48
* @return A new instance of the client.
49
49
*/
50
50
/* STATIC */ BLEClient* BLEDevice::createClient () {
51
+ ESP_LOGD (LOG_TAG, " >> createClient" );
52
+ #ifndef CONFIG_GATTC_ENABLE // Check that BLE GATTC is enabled in make menuconfig
53
+ ESP_LOGE (LOG_TAG, " BLE GATTC is not enabled - CONFIG_GATTC_ENABLE not defined" );
54
+ abort ();
55
+ #endif // CONFIG_GATTC_ENABLE
51
56
m_pClient = new BLEClient ();
57
+ ESP_LOGD (LOG_TAG, " << createClient" );
52
58
return m_pClient;
53
59
} // createClient
54
60
@@ -59,6 +65,10 @@ bool initialized = false; // Have we been initialized?
59
65
*/
60
66
/* STATIC */ BLEServer* BLEDevice::createServer () {
61
67
ESP_LOGD (LOG_TAG, " >> createServer" );
68
+ #ifndef CONFIG_GATTS_ENABLE // Check that BLE GATTS is enabled in make menuconfig
69
+ ESP_LOGE (LOG_TAG, " BLE GATTS is not enabled - CONFIG_GATTS_ENABLE not defined" );
70
+ abort ();
71
+#endif // CONFIG_GATTS_ENABLE
62
72
m_pServer = new BLEServer ();
63
73
m_pServer->createApp (0 );
64
74
ESP_LOGD (LOG_TAG, " << createServer" );
@@ -260,17 +270,21 @@ bool initialized = false; // Have we been initialized?
260
270
return ;
261
271
}
262
272
273
+ #ifdef CONFIG_GATTC_ENABLE // Check that BLE client is configured in make menuconfig
263
274
errRc = esp_ble_gattc_register_callback (BLEDevice::gattClientEventHandler);
264
275
if (errRc != ESP_OK) {
265
276
ESP_LOGE (LOG_TAG, " esp_ble_gattc_register_callback: rc=%d %s" , errRc, GeneralUtils::errorToString (errRc));
266
277
return ;
267
278
}
279
+ #endif // CONFIG_GATTC_ENABLE
268
280
281
+ #ifdef CONFIG_GATTS_ENABLE // Check that BLE server is configured in make menuconfig
269
282
errRc = esp_ble_gatts_register_callback (BLEDevice::gattServerEventHandler);
270
283
if (errRc != ESP_OK) {
271
284
ESP_LOGE (LOG_TAG, " esp_ble_gatts_register_callback: rc=%d %s" , errRc, GeneralUtils::errorToString (errRc));
272
285
return ;
273
286
}
287
+ #endif // CONFIG_GATTS_ENABLE
274
288
275
289
errRc = ::esp_ble_gap_set_device_name (deviceName.c_str ());
276
290
if (errRc != ESP_OK) {
0 commit comments