ble client: used att_dispatch_register_client

This commit is contained in:
mila@ringwald.ch 2014-05-02 08:06:50 +00:00
parent 0288801cf0
commit 8f5e31a822
9 changed files with 35 additions and 1813 deletions

View File

@ -43,6 +43,10 @@
#include <btstack/btstack.h>
#if defined __cplusplus
extern "C" {
#endif
/**
* @brief reset att dispatchter
* @param packet_hander for ATT client packets
@ -55,4 +59,8 @@ void att_dispatch_register_client(btstack_packet_handler_t packet_handler);
*/
void att_dispatch_register_server(btstack_packet_handler_t packet_handler);
#if defined __cplusplus
}
#endif
#endif // __ATT_DISPATCH_H

View File

@ -51,6 +51,7 @@
#include "hci_dump.h"
#include "l2cap.h"
#include "att.h"
#include "att_dispatch.h"
#ifdef HAVE_UART_CC2564
#include "bt_control_cc256x.h"
@ -61,13 +62,15 @@ static linked_list_t gatt_client_connections = NULL;
static uint16_t att_client_start_handle = 0x0001;
static void gatt_client_att_packet_handler(uint8_t packet_type, uint16_t handle, uint8_t *packet, uint16_t size);
void (*gatt_client_callback)(le_event_t * event);
void gatt_client_init(){
att_client_start_handle = 0x0000;
gatt_client_connections = NULL;
l2cap_register_fixed_channel(gatt_client_att_packet_handler, L2CAP_CID_ATTRIBUTE_PROTOCOL);
//l2cap_register_fixed_channel(gatt_client_att_packet_handler, L2CAP_CID_ATTRIBUTE_PROTOCOL);
att_dispatch_register_client(gatt_client_att_packet_handler);
}
static void dummy_notify(le_event_t* event){}

View File

@ -146,10 +146,10 @@ void l2cap_event_handler( uint8_t *packet, uint16_t size ){
(*packet_handler)(NULL, HCI_EVENT_PACKET, 0, packet, size);
}
if (attribute_protocol_packet_handler){
(*attribute_protocol_packet_handler)(HCI_EVENT_PACKET, 0, packet, size)
(*attribute_protocol_packet_handler)(HCI_EVENT_PACKET, 0, packet, size);
}
if (security_protocol_packet_handler) {
(*security_protocol_packet_handler)(HCI_EVENT_PACKET, 0, packet, size)
(*security_protocol_packet_handler)(HCI_EVENT_PACKET, 0, packet, size);
}
}

View File

@ -1,153 +0,0 @@
/*
* Copyright (C) 2011-2013 by BlueKitchen GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* 4. This software may not be used in a commercial product
* without an explicit license granted by the copyright holder.
*
* THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
//*****************************************************************************
//
// Advertising Data Parser
//
//*****************************************************************************
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <btstack/utils.h>
#include <btstack/sdp_util.h>
#include <btstack/hci_cmds.h>
#include "hci.h"
#include "ad_parser.h"
typedef enum {
IncompleteList16 = 0x02,
CompleteList16 = 0x03,
IncompleteList128 = 0x06,
CompleteList128 = 0x07
} UUID_TYPE;
void ad_iterator_init(ad_context_t *context, uint8_t ad_len, uint8_t * ad_data){
context->data = ad_data;
context->length = ad_len;
context->offset = 0;
}
int ad_iterator_has_more(ad_context_t * context){
return context->offset < context->length;
}
void ad_iterator_next(ad_context_t * context){
uint8_t chunk_len = context->data[context->offset];
context->offset += 1 + chunk_len;
}
uint8_t ad_iterator_get_data_len(ad_context_t * context){
return context->data[context->offset] - 1;
}
uint8_t ad_iterator_get_data_type(ad_context_t * context){
return context->data[context->offset + 1];
}
uint8_t * ad_iterator_get_data(ad_context_t * context){
return &context->data[context->offset + 2];
}
int ad_data_contains_uuid16(uint8_t ad_len, uint8_t * ad_data, uint16_t uuid16){
ad_context_t context;
for (ad_iterator_init(&context, ad_len, ad_data) ; ad_iterator_has_more(&context) ; ad_iterator_next(&context)){
uint8_t data_type = ad_iterator_get_data_type(&context);
uint8_t data_len = ad_iterator_get_data_len(&context);
uint8_t * data = ad_iterator_get_data(&context);
int i;
uint8_t ad_uuid128[16], uuid128_bt[16];
switch (data_type){
case IncompleteList16:
case CompleteList16:
for (i=0; i<data_len; i+=2){
uint16_t uuid = READ_BT_16(data, i);
if ( uuid == uuid16 ) return 1;
}
break;
case IncompleteList128:
case CompleteList128:
sdp_normalize_uuid(ad_uuid128, uuid16);
swap128(ad_uuid128, uuid128_bt);
for (i=0; i<data_len; i+=16){
if (memcmp(uuid128_bt, &data[i], 16) == 0) return 1;
}
break;
default:
break;
}
}
return 0;
}
int ad_data_contains_uuid128(uint8_t ad_len, uint8_t * ad_data, uint8_t * uuid128){
ad_context_t context;
for (ad_iterator_init(&context, ad_len, ad_data) ; ad_iterator_has_more(&context) ; ad_iterator_next(&context)){
uint8_t data_type = ad_iterator_get_data_type(&context);
uint8_t data_len = ad_iterator_get_data_len(&context);
uint8_t * data = ad_iterator_get_data(&context);
int i;
uint8_t ad_uuid128[16];
switch (data_type){
case IncompleteList16:
case CompleteList16:
for (i=0; i<data_len; i+=2){
uint16_t uuid16 = READ_BT_16(data, i);
sdp_normalize_uuid(ad_uuid128, uuid16);
if (memcmp(ad_uuid128, uuid128, 16) == 0) return 1;
}
break;
case IncompleteList128:
case CompleteList128:
for (i=0; i<data_len; i+=16){
if (memcmp(uuid128, &data[i], 16) == 0) return 1;
}
break;
default:
break;
}
}
return 0;
}

View File

@ -1,73 +0,0 @@
/*
* Copyright (C) 2011-2013 by BlueKitchen GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* 4. This software may not be used in a commercial product
* without an explicit license granted by the copyright holder.
*
* THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
//*****************************************************************************
//
// Advertising Data Parser
//
//*****************************************************************************
#ifndef __AD_PARSER_H
#define __AD_PARSER_H
#include "btstack-config.h"
#if defined __cplusplus
extern "C" {
#endif
typedef struct ad_context {
uint8_t * data;
uint8_t offset;
uint8_t length;
} ad_context_t;
// Advertising or Scan Response data iterator
void ad_iterator_init(ad_context_t *context, uint8_t ad_len, uint8_t * ad_data);
int ad_iterator_has_more(ad_context_t * context);
void ad_iterator_next(ad_context_t * context);
// Access functions
uint8_t ad_iterator_get_data_type(ad_context_t * context);
uint8_t ad_iterator_get_data_len(ad_context_t * context);
uint8_t * ad_iterator_get_data(ad_context_t * context);
// convenience function on complete advertisements
int ad_data_contains_uuid16(uint8_t ad_len, uint8_t * ad_data, uint16_t uuid);
int ad_data_contains_uuid128(uint8_t ad_len, uint8_t * ad_data, uint8_t * uuid128);
#if defined __cplusplus
}
#endif
#endif // __AD_PARSER_H

File diff suppressed because it is too large Load Diff

View File

@ -1,295 +0,0 @@
/*
* Copyright (C) 2011-2014 by BlueKitchen GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* 4. This software may not be used in a commercial product
* without an explicit license granted by the copyright holder.
*
* THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#ifndef btstack_gatt_client_h
#define btstack_gatt_client_h
#if defined __cplusplus
extern "C" {
#endif
//*************** le client
typedef struct le_event {
uint8_t type;
} le_event_t;
typedef enum {
BLE_PERIPHERAL_OK = 0,
BLE_PERIPHERAL_IN_WRONG_STATE,
BLE_PERIPHERAL_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS,
BLE_PERIPHERAL_NOT_CONNECTED,
BLE_VALUE_TOO_LONG,
BLE_PERIPHERAL_BUSY,
BLE_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED,
BLE_CHARACTERISTIC_INDICATION_NOT_SUPPORTED
} le_command_status_t;
//*************** gatt client
typedef enum {
P_READY,
P_W2_SEND_SERVICE_QUERY,
P_W4_SERVICE_QUERY_RESULT,
P_W2_SEND_SERVICE_WITH_UUID_QUERY,
P_W4_SERVICE_WITH_UUID_RESULT,
P_W2_SEND_CHARACTERISTIC_QUERY,
P_W4_CHARACTERISTIC_QUERY_RESULT,
P_W2_SEND_CHARACTERISTIC_WITH_UUID_QUERY,
P_W4_CHARACTERISTIC_WITH_UUID_QUERY_RESULT,
P_W2_SEND_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY,
P_W4_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT,
P_W2_SEND_INCLUDED_SERVICE_QUERY,
P_W4_INCLUDED_SERVICE_QUERY_RESULT,
P_W2_SEND_INCLUDED_SERVICE_WITH_UUID_QUERY,
P_W4_INCLUDED_SERVICE_UUID_WITH_QUERY_RESULT,
P_W2_SEND_READ_CHARACTERISTIC_VALUE_QUERY,
P_W4_READ_CHARACTERISTIC_VALUE_RESULT,
P_W2_SEND_READ_BLOB_QUERY,
P_W4_READ_BLOB_RESULT,
P_W2_SEND_WRITE_CHARACTERISTIC_VALUE,
P_W4_WRITE_CHARACTERISTIC_VALUE_RESULT,
P_W2_PREPARE_WRITE,
P_W4_PREPARE_WRITE_RESULT,
P_W2_PREPARE_RELIABLE_WRITE,
P_W4_PREPARE_RELIABLE_WRITE_RESULT,
P_W2_EXECUTE_PREPARED_WRITE,
P_W4_EXECUTE_PREPARED_WRITE_RESULT,
P_W2_CANCEL_PREPARED_WRITE,
P_W4_CANCEL_PREPARED_WRITE_RESULT,
P_W2_SEND_READ_CLIENT_CHARACTERISTIC_CONFIGURATION_QUERY,
P_W4_READ_CLIENT_CHARACTERISTIC_CONFIGURATION_QUERY_RESULT,
P_W2_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION,
P_W4_CLIENT_CHARACTERISTIC_CONFIGURATION_RESULT,
P_W2_SEND_READ_CHARACTERISTIC_DESCRIPTOR_QUERY,
P_W4_READ_CHARACTERISTIC_DESCRIPTOR_RESULT,
P_W2_SEND_READ_BLOB_CHARACTERISTIC_DESCRIPTOR_QUERY,
P_W4_READ_BLOB_CHARACTERISTIC_DESCRIPTOR_RESULT,
P_W2_SEND_WRITE_CHARACTERISTIC_DESCRIPTOR,
P_W4_WRITE_CHARACTERISTIC_DESCRIPTOR_RESULT,
P_W2_PREPARE_WRITE_CHARACTERISTIC_DESCRIPTOR,
P_W4_PREPARE_WRITE_CHARACTERISTIC_DESCRIPTOR_RESULT,
P_W2_EXECUTE_PREPARED_WRITE_CHARACTERISTIC_DESCRIPTOR,
P_W4_EXECUTE_PREPARED_WRITE_CHARACTERISTIC_DESCRIPTOR_RESULT
} gatt_client_state_t;
typedef enum{
SEND_MTU_EXCHANGE,
SENT_MTU_EXCHANGE,
MTU_EXCHANGED
} gatt_client_mtu_t;
typedef struct gatt_client{
linked_item_t item;
gatt_client_state_t gatt_client_state;
// le_central_state_t le_central_state;
uint16_t handle;
uint8_t address_type;
bd_addr_t address;
uint16_t mtu;
gatt_client_mtu_t mtu_state;
uint16_t uuid16;
uint8_t uuid128[16];
uint16_t start_group_handle;
uint16_t end_group_handle;
uint16_t query_start_handle;
uint16_t query_end_handle;
uint8_t characteristic_properties;
uint16_t characteristic_start_handle;
uint16_t attribute_handle;
uint16_t attribute_offset;
uint16_t attribute_length;
uint8_t* attribute_value;
uint16_t client_characteristic_configuration_handle;
uint8_t client_characteristic_configuration_value[2];
uint8_t filter_with_uuid;
uint8_t send_confirmation;
} gatt_client_t;
typedef struct gatt_complete_event{
uint8_t type;
gatt_client_t * device;
uint8_t status;
} gatt_complete_event_t;
typedef struct le_service{
uint16_t start_group_handle;
uint16_t end_group_handle;
uint16_t uuid16;
uint8_t uuid128[16];
} le_service_t;
typedef struct le_service_event{
uint8_t type;
le_service_t service;
} le_service_event_t;
typedef struct le_characteristic{
uint8_t properties;
uint16_t start_handle;
uint16_t value_handle;
uint16_t end_handle;
uint16_t uuid16;
uint8_t uuid128[16];
} le_characteristic_t;
typedef struct le_characteristic_event{
uint8_t type;
le_characteristic_t characteristic;
} le_characteristic_event_t;
typedef struct le_characteristic_descriptor{
uint16_t handle;
uint16_t uuid16;
uint8_t uuid128[16];
uint16_t value_length;
uint16_t value_offset;
uint8_t * value;
} le_characteristic_descriptor_t;
typedef struct le_characteristic_descriptor_event{
uint8_t type;
le_characteristic_descriptor_t characteristic_descriptor;
} le_characteristic_descriptor_event_t;
typedef struct le_characteristic_value{
} le_characteristic_value_t;
typedef struct le_characteristic_value_event{
uint8_t type;
uint16_t characteristic_value_handle;
uint16_t characteristic_value_blob_length;
uint16_t characteristic_value_offset;
uint8_t * characteristic_value;
} le_characteristic_value_event_t;
void gatt_client_init();
void gatt_client_register_handler(void (*le_callback)(le_event_t * event));
void gatt_packet_handler(void * connection, uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
// start/stop gatt client
void gatt_client_start(gatt_client_t *context, uint16_t handle);
void gatt_client_stop(gatt_client_t *context);
// returns primary services
le_command_status_t gatt_client_discover_primary_services(gatt_client_t *context);
// { type (8), gatt_client_t *context, le_service * }
//TODO: define uuid type
le_command_status_t gatt_client_discover_primary_services_by_uuid16(gatt_client_t *context, uint16_t uuid16);
le_command_status_t gatt_client_discover_primary_services_by_uuid128(gatt_client_t *context, const uint8_t * uuid);
// Returns included services.
// Information about service type (primary/secondary) can be retrieved either by sending an ATT find query or
// by comparing the service to the list of primary services obtained by calling le_central_get_services.
le_command_status_t gatt_client_find_included_services_for_service(gatt_client_t *context, le_service_t *service);
// { type (8), gatt_client_t *context, le_service * }
// returns characteristics, no included services
le_command_status_t gatt_client_discover_characteristics_for_service(gatt_client_t *context, le_service_t *service);
// { type (8), gatt_client_t *context, service_handle, le_characteristic *}
// gets all characteristics in handle range, and returns those that match the given UUID.
le_command_status_t gatt_client_discover_characteristics_for_handle_range_by_uuid16(gatt_client_t *context, uint16_t start_handle, uint16_t end_handle, uint16_t uuid16);
// { type (8), gatt_client_t *context, service_handle, le_characteristic *}
le_command_status_t gatt_client_discover_characteristics_for_handle_range_by_uuid128(gatt_client_t *context, uint16_t start_handle, uint16_t end_handle, uint8_t * uuid);
// { type (8), gatt_client_t *context, service_handle, le_characteristic *}
// more convenience
le_command_status_t gatt_client_discover_characteristics_for_service_by_uuid16 (gatt_client_t *context, le_service_t *service, uint16_t uuid16);
le_command_status_t gatt_client_discover_characteristics_for_service_by_uuid128(gatt_client_t *context, le_service_t *service, uint8_t * uuid128);
// returns handle and uuid16 of a descriptor
le_command_status_t gatt_client_discover_characteristic_descriptors(gatt_client_t *context, le_characteristic_t *characteristic);
// Reads value of characteristic using characteristic value handle
le_command_status_t gatt_client_read_value_of_characteristic(gatt_client_t *context, le_characteristic_t *characteristic);
le_command_status_t gatt_client_read_value_of_characteristic_using_value_handle(gatt_client_t *context, uint16_t characteristic_value_handle);
// Reads long caharacteristic value.
le_command_status_t gatt_client_read_long_value_of_characteristic(gatt_client_t *context, le_characteristic_t *characteristic);
le_command_status_t gatt_client_read_long_value_of_characteristic_using_value_handle(gatt_client_t *context, uint16_t characteristic_value_handle);
le_command_status_t gatt_client_write_value_of_characteristic_without_response(gatt_client_t *context, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data);
le_command_status_t gatt_client_write_value_of_characteristic(gatt_client_t *context, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data);
le_command_status_t gatt_client_write_long_value_of_characteristic(gatt_client_t *context, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data);
le_command_status_t gatt_client_reliable_write_long_value_of_characteristic(gatt_client_t *context, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data);
le_command_status_t gatt_client_read_characteristic_descriptor(gatt_client_t *context, le_characteristic_descriptor_t * descriptor);
le_command_status_t gatt_client_read_long_characteristic_descriptor(gatt_client_t *context, le_characteristic_descriptor_t * descriptor);
le_command_status_t gatt_client_write_characteristic_descriptor(gatt_client_t *context, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * data);
le_command_status_t gatt_client_write_long_characteristic_descriptor(gatt_client_t *context, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * data);
le_command_status_t gatt_client_write_client_characteristic_configuration(gatt_client_t *context, le_characteristic_t * characteristic, uint16_t configuration);
// { read/write/subscribe/unsubscribe confirm/result}
// { type, le_peripheral *, characteristic handle, int len, uint8_t data[]?}
#if defined __cplusplus
}
#endif
#endif

View File

@ -9,11 +9,20 @@ CFLAGS = -g -Wall -I. -I${BTSTACK_ROOT}/example/libusb -I${BTSTACK_ROOT}/src -I
LDFLAGS += -L$(CPPUTEST_HOME) -lCppUTest -lCppUTestExt
COMMON = \
${BTSTACK_ROOT}/example/libusb/ad_parser.c \
${BTSTACK_ROOT}/src/sdp_util.c \
${BTSTACK_ROOT}/src/utils.c \
${BTSTACK_ROOT}/ble/att.c \
${BTSTACK_ROOT}/example/libusb/ble_client.c \
${BTSTACK_ROOT}/src/utils.c \
${BTSTACK_ROOT}/src/btstack_memory.c \
${BTSTACK_ROOT}/src/memory_pool.c \
${BTSTACK_ROOT}/src/linked_list.c \
${BTSTACK_ROOT}/src/sdp_util.c \
${BTSTACK_ROOT}/src/remote_device_db_memory.c \
${BTSTACK_ROOT}/src/run_loop.c \
${BTSTACK_ROOT}/src/run_loop_posix.c \
${BTSTACK_ROOT}/src/hci_cmds.c \
${BTSTACK_ROOT}/ble/att_dispatch.c \
${BTSTACK_ROOT}/ble/att.c \
${BTSTACK_ROOT}/ble/ad_parser.c \
${BTSTACK_ROOT}/ble/gatt_client.c \
${BTSTACK_ROOT}/example/libusb/ble_client.c \
COMMON_OBJ = $(COMMON:.c=.o)

View File

@ -11,11 +11,16 @@
#include <stdlib.h>
#include <string.h>
#include "ad_parser.h"
#include "CppUTest/TestHarness.h"
#include "CppUTest/CommandLineTestRunner.h"
#include <btstack/hci_cmds.h>
#include "btstack_memory.h"
#include "hci.h"
#include "ad_parser.h"
#include "l2cap.h"
static uint8_t ad_data[] = {0x02, 0x01, 0x05, 0x03, 0x02, 0xF0, 0xFF};
static uint8_t ad_uuid16[] = {0x02, 0x04, 0x78, 0x56, 0x34, 0x12,