|
|
@ -7,22 +7,31 @@ |
|
|
|
*/ |
|
|
|
|
|
|
|
/**************************************************************************** |
|
|
|
* |
|
|
|
* This demo showcases creating a GATT database using a predefined attribute table. |
|
|
|
* It acts as a GATT server and can send adv data, be connected by client. |
|
|
|
* Run the gatt_client demo, the client demo will automatically connect to the gatt_server_service_table demo. |
|
|
|
* Client demo will enable GATT server's notify after connection. The two devices will then exchange |
|
|
|
* data. |
|
|
|
* |
|
|
|
****************************************************************************/ |
|
|
|
* |
|
|
|
* This demo showcases creating a GATT database using a predefined attribute table. |
|
|
|
* It acts as a GATT server and can send adv data, be connected by client. |
|
|
|
* Run the gatt_client demo, the client demo will automatically connect to the gatt_server_service_table demo. |
|
|
|
* Client demo will enable GATT server's notify after connection. The two devices will then exchange |
|
|
|
* data. |
|
|
|
* |
|
|
|
****************************************************************************/ |
|
|
|
#include "ble_gatts_table.h" |
|
|
|
|
|
|
|
uint16_t table_conn_id_m; |
|
|
|
esp_gatt_if_t table_gatts_if_m; |
|
|
|
uint16_t table_handle_m; |
|
|
|
|
|
|
|
void app_main(void){ |
|
|
|
ble_init(&table_conn_id_m); |
|
|
|
void app_main(void) |
|
|
|
{ |
|
|
|
uint8_t temp[5] = {68, 69, 70, 71, 72}; |
|
|
|
ble_init(&table_conn_id_m, &table_gatts_if_m, &table_handle_m); |
|
|
|
|
|
|
|
while(true){ |
|
|
|
ESP_LOGI("test","%d",table_conn_id_m); |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
// ESP_LOGI("test", "%d,%d,%d", table_conn_id_m, table_gatts_if_m, table_handle_m); |
|
|
|
if (table_handle_m != 0) |
|
|
|
{ |
|
|
|
esp_ble_gatts_send_indicate(table_gatts_if_m, table_conn_id_m, table_handle_m, 5, temp, false); |
|
|
|
} |
|
|
|
} |
|
|
|
} |