example/hog_host_demo: setup GATT DB

This commit is contained in:
Matthias Ringwald 2023-08-29 19:18:09 +02:00
parent c9de93a98c
commit 68a70b347e
2 changed files with 12 additions and 0 deletions

View File

@ -263,6 +263,7 @@ EXAMPLES_GATT_FILES = \
gatt_counter.gatt \
gatt_device_information_query.gatt \
gatt_streamer_server.gatt \
hog_host_demo.gatt \
hog_keyboard_demo.gatt \
hog_mouse_demo.gatt \
le_credit_based_flow_control_mode_server.gatt \
@ -346,6 +347,8 @@ hog_boot_host_demo: ${CORE_OBJ} ${COMMON_OBJ} ${ATT_OBJ} ${GATT_CLIENT_OBJ} hog_
${CC} $^ ${LDFLAGS} -o $@
hog_host_demo.o: hog_host_demo.h hog_host_demo.c
${CC} ${CFLAGS} -c $(filter-out hog_host_demo.h,$^) -o $@
hog_host_demo: ${CORE_OBJ} ${COMMON_OBJ} ${ATT_OBJ} ${GATT_CLIENT_OBJ} btstack_hid_parser.o btstack_hid.o hog_host_demo.o
${CC} $^ ${LDFLAGS} -o $@

View File

@ -55,6 +55,12 @@
#include "btstack_config.h"
#include "btstack.h"
// hog_host_demo.gatt contains the declaration of the provided GATT Services + Characteristics
// hog_host_demo.h contains the binary representation of gatt_browser.gatt
// it is generated by the build system by calling: $BTSTACK_ROOT/tool/compile_gatt.py hog_host_demo.gatt hog_host_demo.h
// it needs to be regenerated when the GATT Database declared in gatt_browser.gatt file is modified
#include "hog_host_demo.h"
// TAG to store remote device address and type in TLV
#define TLV_TAG_HOGD ((((uint32_t) 'H') << 24 ) | (((uint32_t) 'O') << 16) | (((uint32_t) 'G') << 8) | 'D')
@ -512,6 +518,9 @@ int btstack_main(int argc, const char * argv[]){
sm_init();
gatt_client_init();
// setup ATT server - only needed if LE Peripheral does ATT queries on its own, e.g. Android and iOS
att_server_init(profile_data, NULL, NULL);
hids_client_init(hid_descriptor_storage, sizeof(hid_descriptor_storage));
/* LISTING_END */