example: add characteristic that requires authentication, requrest le secure connecions

This commit is contained in:
Matthias Ringwald 2016-05-09 18:19:30 +02:00
parent 74a9b3d5e1
commit faccbb295e
4 changed files with 14 additions and 1 deletions

View File

@ -2,11 +2,13 @@ VPATH += ${BTSTACK_ROOT}/src
VPATH += ${BTSTACK_ROOT}/src/ble
VPATH += ${BTSTACK_ROOT}/src/classic
VPATH += ${BTSTACK_ROOT}/example
VPATH += ${BTSTACK_ROOT}/3rd-party/mbedtls/library
CFLAGS += -I.
CFLAGS += -I${BTSTACK_ROOT}/src/ble
CFLAGS += -I${BTSTACK_ROOT}/src/classic
CFLAGS += -I${BTSTACK_ROOT}/src
CFLAGS += -I${BTSTACK_ROOT}/3rd-party/mbedtls/include
CORE += \
btstack_memory.c \
@ -54,6 +56,11 @@ SM_MINIMAL += \
PAN += \
pan.c \
MBEDTLS = \
bignum.c \
ecp.c \
ecp_curves.c \
EXAMPLES = \
ancs_client_demo \
gap_dedicated_bonding \
@ -87,7 +94,7 @@ EXAMPLES_USING_LE = \
# .o for .c
CORE_OBJ = $(CORE:.c=.o)
COMMON_OBJ = $(COMMON:.c=.o)
SM_REAL_OBJ = $(SM_REAL:.c=.o)
SM_REAL_OBJ = $(SM_REAL:.c=.o) $(MBEDTLS:.c=.o)
SM_MINIMAL_OBJ = $(SM_MINIMAL:.c=.o)
ATT_OBJ = $(ATT:.c=.o)
GATT_CLIENT_OBJ = $(GATT_CLIENT:.c=.o)

View File

@ -98,6 +98,9 @@ static void le_counter_setup(void){
// setup SM: Display only
sm_init();
#ifdef ENABLE_LE_SECURE_CONNECTIONS
sm_set_authentication_requirements(SM_AUTHREQ_SECURE_CONNECTION);
#endif
// setup ATT server
att_server_init(profile_data, att_read_callback, att_write_callback);

View File

@ -8,5 +8,7 @@ CHARACTERISTIC, GATT_SERVICE_CHANGED, READ,
PRIMARY_SERVICE, 0000FF10-0000-1000-8000-00805F9B34FB
// Counter Characteristic, with read and notify
CHARACTERISTIC, 0000FF11-0000-1000-8000-00805F9B34FB, READ | NOTIFY | DYNAMIC,
// Counter Characteristic, with read and notify + authentication
CHARACTERISTIC, 0000FF12-0000-1000-8000-00805F9B34FB, READ | NOTIFY | DYNAMIC | AUTHENTICATION_REQUIRED,

View File

@ -14,6 +14,7 @@
// BTstack features that can be enabled
#define ENABLE_BLE
#define ENABLE_CLASSIC
#define ENABLE_LE_SECURE_CONNECTIONS
#define ENABLE_LOG_ERROR
#define ENABLE_LOG_INFO
#define ENABLE_LOG_INTO_HCI_DUMP