You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.3 KiB
36 lines
1.3 KiB
/*
|
|
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
|
|
|
Unless required by applicable law or agreed to in writing, this
|
|
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
CONDITIONS OF ANY KIND, either express or implied.
|
|
*/
|
|
|
|
/****************************************************************************
|
|
*
|
|
* 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)
|
|
{
|
|
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,%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);
|
|
}
|
|
}
|
|
}
|