mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-15 23:42:52 +00:00
MISRAC2012-Rule-8.9: inline const objects that are used by single function
This commit is contained in:
parent
b15ccad8bc
commit
8334d3d848
3
3rd-party/micro-ecc/uECC.c
vendored
3
3rd-party/micro-ecc/uECC.c
vendored
@ -368,7 +368,7 @@ typedef struct EccPoint {
|
||||
} EccPoint;
|
||||
|
||||
static const uECC_word_t curve_p[uECC_WORDS] = uECC_CONCAT(Curve_P_, uECC_CURVE);
|
||||
static const uECC_word_t curve_b[uECC_WORDS] = uECC_CONCAT(Curve_B_, uECC_CURVE);
|
||||
// Global object `curve_b' is only referenced from function `curve_x_side', it should be defined within that functions block scope
|
||||
static const EccPoint curve_G = uECC_CONCAT(Curve_G_, uECC_CURVE);
|
||||
static const uECC_word_t curve_n[uECC_N_WORDS] = uECC_CONCAT(Curve_N_, uECC_CURVE);
|
||||
|
||||
@ -2083,6 +2083,7 @@ void uECC_compress(const uint8_t public_key[uECC_BYTES*2], uint8_t compressed[uE
|
||||
|
||||
/* Computes result = x^3 + ax + b. result must not overlap x. */
|
||||
static void curve_x_side(uECC_word_t * RESTRICT result, const uECC_word_t * RESTRICT x) {
|
||||
static const uECC_word_t curve_b[uECC_WORDS] = uECC_CONCAT(Curve_B_, uECC_CURVE);
|
||||
#if (uECC_CURVE == uECC_secp256k1)
|
||||
vli_modSquare_fast(result, x); /* r = x^2 */
|
||||
vli_modMult_fast(result, result, x); /* r = x^3 */
|
||||
|
@ -72,21 +72,6 @@ typedef enum {
|
||||
TC_W4_DISCONNECT
|
||||
} tc_state_t;
|
||||
|
||||
static const char * ancs_attribute_names[] = {
|
||||
"AppIdentifier",
|
||||
"IDTitle",
|
||||
"IDSubtitle",
|
||||
"IDMessage",
|
||||
"IDMessageSize",
|
||||
"IDDate"
|
||||
};
|
||||
static const int ANCS_ATTRBUTE_NAMES_COUNT = sizeof(ancs_attribute_names) / sizeof(char *);
|
||||
|
||||
static const uint8_t ancs_service_uuid[] = {0x79,0x05,0xF4,0x31,0xB5,0xCE,0x4E,0x99,0xA4,0x0F,0x4B,0x1E,0x12,0x2D,0x00,0xD0};
|
||||
static const uint8_t ancs_notification_source_uuid[] = {0x9F,0xBF,0x12,0x0D,0x63,0x01,0x42,0xD9,0x8C,0x58,0x25,0xE6,0x99,0xA2,0x1D,0xBD};
|
||||
static const uint8_t ancs_control_point_uuid[] = {0x69,0xD1,0xD8,0xF3,0x45,0xE1,0x49,0xA8,0x98,0x21,0x9B,0xBD,0xFD,0xAA,0xD9,0xD9};
|
||||
static const uint8_t ancs_data_source_uuid[] = {0x22,0xEA,0xC6,0xE9,0x24,0xD6,0x4B,0xB5,0xBE,0x44,0xB3,0x6A,0xCE,0x7C,0x7B,0xFB};
|
||||
|
||||
static uint32_t ancs_notification_uid;
|
||||
static uint16_t gc_handle;
|
||||
static gatt_client_notification_t ancs_notification_source_notification;
|
||||
@ -144,6 +129,17 @@ static void ancs_chunk_parser_init(void){
|
||||
}
|
||||
|
||||
const char * ancs_client_attribute_name_for_id(int id){
|
||||
static const char * ancs_attribute_names[] = {
|
||||
"AppIdentifier",
|
||||
"IDTitle",
|
||||
"IDSubtitle",
|
||||
"IDMessage",
|
||||
"IDMessageSize",
|
||||
"IDDate"
|
||||
};
|
||||
|
||||
static const uint16_t ANCS_ATTRBUTE_NAMES_COUNT = sizeof(ancs_attribute_names) / sizeof(char *);
|
||||
|
||||
if (id >= ANCS_ATTRBUTE_NAMES_COUNT) return NULL;
|
||||
return ancs_attribute_names[id];
|
||||
}
|
||||
@ -185,6 +181,12 @@ static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *pac
|
||||
UNUSED(channel); // ok: there is no channel
|
||||
UNUSED(size); // ok: fixed format events read from HCI buffer
|
||||
|
||||
static const uint8_t ancs_service_uuid[] = {0x79,0x05,0xF4,0x31,0xB5,0xCE,0x4E,0x99,0xA4,0x0F,0x4B,0x1E,0x12,0x2D,0x00,0xD0};
|
||||
static const uint8_t ancs_notification_source_uuid[] = {0x9F,0xBF,0x12,0x0D,0x63,0x01,0x42,0xD9,0x8C,0x58,0x25,0xE6,0x99,0xA2,0x1D,0xBD};
|
||||
static const uint8_t ancs_control_point_uuid[] = {0x69,0xD1,0xD8,0xF3,0x45,0xE1,0x49,0xA8,0x98,0x21,0x9B,0xBD,0xFD,0xAA,0xD9,0xD9};
|
||||
static const uint8_t ancs_data_source_uuid[] = {0x22,0xEA,0xC6,0xE9,0x24,0xD6,0x4B,0xB5,0xBE,0x44,0xB3,0x6A,0xCE,0x7C,0x7B,0xFB};
|
||||
|
||||
|
||||
int connection_encrypted;
|
||||
|
||||
// handle connect / disconncet events first
|
||||
|
@ -55,11 +55,11 @@ typedef enum {
|
||||
ATT_WRITE,
|
||||
} att_operation_t;
|
||||
|
||||
// Buetooth Base UUID 00000000-0000-1000-8000-00805F9B34FB in little endian
|
||||
static const uint8_t bluetooth_base_uuid[] = { 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
|
||||
static int is_Bluetooth_Base_UUID(uint8_t const *uuid){
|
||||
// Bluetooth Base UUID 00000000-0000-1000-8000-00805F9B34FB in little endian
|
||||
static const uint8_t bluetooth_base_uuid[] = { 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
if (memcmp(&uuid[0], &bluetooth_base_uuid[0], 12) != 0) return false;
|
||||
if (memcmp(&uuid[14], &bluetooth_base_uuid[14], 2) != 0) return false;
|
||||
return true;
|
||||
|
@ -75,18 +75,6 @@ typedef struct {
|
||||
uint16_t value_handle;
|
||||
} device_information_field_t;
|
||||
|
||||
const uint16_t device_information_characteristic_uuids[] = {
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_MANUFACTURER_NAME_STRING,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_MODEL_NUMBER_STRING,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_SERIAL_NUMBER_STRING,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_HARDWARE_REVISION_STRING,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_FIRMWARE_REVISION_STRING,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_SOFTWARE_REVISION_STRING,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_SYSTEM_ID,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_IEEE_11073_20601_REGULATORY_CERTIFICATION_DATA_LIST,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_PNP_ID
|
||||
};
|
||||
|
||||
static device_information_field_t device_information_fields[NUM_INFORMATION_FIELDS];
|
||||
|
||||
static uint8_t device_information_system_id[8];
|
||||
@ -94,7 +82,6 @@ static uint8_t device_information_ieee_regulatory_certification[4];
|
||||
static uint8_t device_information_pnp_id[7];
|
||||
|
||||
static att_service_handler_t device_information_service;
|
||||
|
||||
static void set_string(device_information_field_id_t field_id, const char * text){
|
||||
device_information_fields[field_id].data = (uint8_t*) text;
|
||||
device_information_fields[field_id].len = strlen(text);
|
||||
@ -113,7 +100,20 @@ static uint16_t device_information_service_read_callback(hci_con_handle_t con_ha
|
||||
|
||||
void device_information_service_server_init(void){
|
||||
|
||||
// get service handle range
|
||||
const uint16_t device_information_characteristic_uuids[] = {
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_MANUFACTURER_NAME_STRING,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_MODEL_NUMBER_STRING,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_SERIAL_NUMBER_STRING,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_HARDWARE_REVISION_STRING,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_FIRMWARE_REVISION_STRING,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_SOFTWARE_REVISION_STRING,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_SYSTEM_ID,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_IEEE_11073_20601_REGULATORY_CERTIFICATION_DATA_LIST,
|
||||
ORG_BLUETOOTH_CHARACTERISTIC_PNP_ID
|
||||
};
|
||||
|
||||
|
||||
// get service handle range
|
||||
uint16_t start_handle;
|
||||
uint16_t end_handle;
|
||||
int service_found = gatt_server_get_get_handle_range_for_service_with_uuid16(ORG_BLUETOOTH_SERVICE_DEVICE_INFORMATION, &start_handle, &end_handle);
|
||||
|
@ -59,10 +59,6 @@
|
||||
#include "ble/gatt-service/nordic_spp_service_server.h"
|
||||
|
||||
//
|
||||
static const uint8_t nordic_spp_profile_uuid128[] = { 0x6E, 0x40, 0x00, 0x01, 0xB5, 0xA3, 0xF3, 0x93, 0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E };
|
||||
static const uint8_t nordic_spp_rx_uuid128[] = { 0x6E, 0x40, 0x00, 0x02, 0xB5, 0xA3, 0xF3, 0x93, 0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E };
|
||||
static const uint8_t nordic_spp_tx_uuid128[] = { 0x6E, 0x40, 0x00, 0x03, 0xB5, 0xA3, 0xF3, 0x93, 0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E };
|
||||
|
||||
static att_service_handler_t nordic_spp_service;
|
||||
static void (*client_callback)(hci_con_handle_t con_handle, const uint8_t * data, uint16_t size);
|
||||
|
||||
@ -108,7 +104,12 @@ static int nordic_spp_service_write_callback(hci_con_handle_t con_handle, uint16
|
||||
* @param callback for tx data from peer
|
||||
*/
|
||||
void nordic_spp_service_server_init(void (*callback)(hci_con_handle_t con_handle, const uint8_t * data, uint16_t size)){
|
||||
client_callback = callback;
|
||||
|
||||
static const uint8_t nordic_spp_profile_uuid128[] = { 0x6E, 0x40, 0x00, 0x01, 0xB5, 0xA3, 0xF3, 0x93, 0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E };
|
||||
static const uint8_t nordic_spp_rx_uuid128[] = { 0x6E, 0x40, 0x00, 0x02, 0xB5, 0xA3, 0xF3, 0x93, 0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E };
|
||||
static const uint8_t nordic_spp_tx_uuid128[] = { 0x6E, 0x40, 0x00, 0x03, 0xB5, 0xA3, 0xF3, 0x93, 0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E };
|
||||
|
||||
client_callback = callback;
|
||||
|
||||
// get service handle range
|
||||
uint16_t start_handle = 0;
|
||||
|
@ -58,9 +58,6 @@
|
||||
#define UBLOX_SPP_CREDITS_THRESHOLD 8
|
||||
|
||||
//
|
||||
static const uint8_t ublox_spp_profile_uuid128[] = { 0x24, 0x56, 0xE1, 0xB9, 0x26, 0xE2, 0x8F, 0x83, 0xE7, 0x44, 0xF3, 0x4F, 0x01, 0xE9, 0xD7, 0x01 };
|
||||
static const uint8_t ublox_spp_fifo_uuid128[] = { 0x24, 0x56, 0xE1, 0xB9, 0x26, 0xE2, 0x8F, 0x83, 0xE7, 0x44, 0xF3, 0x4F, 0x01, 0xE9, 0xD7, 0x03 };
|
||||
static const uint8_t ublox_spp_credits_uuid128[] = { 0x24, 0x56, 0xE1, 0xB9, 0x26, 0xE2, 0x8F, 0x83, 0xE7, 0x44, 0xF3, 0x4F, 0x01, 0xE9, 0xD7, 0x04 };
|
||||
|
||||
typedef struct {
|
||||
hci_con_handle_t con_handle;
|
||||
@ -206,6 +203,11 @@ static void ublox_spp_credits_callback(void * context){
|
||||
*/
|
||||
void ublox_spp_service_server_init(void (*client_data_callback)(hci_con_handle_t con_handle, const uint8_t * data, uint16_t size),
|
||||
void (*client_credits_callback)(hci_con_handle_t con_handle, uint16_t credits)){
|
||||
|
||||
static const uint8_t ublox_spp_profile_uuid128[] = { 0x24, 0x56, 0xE1, 0xB9, 0x26, 0xE2, 0x8F, 0x83, 0xE7, 0x44, 0xF3, 0x4F, 0x01, 0xE9, 0xD7, 0x01 };
|
||||
static const uint8_t ublox_spp_fifo_uuid128[] = { 0x24, 0x56, 0xE1, 0xB9, 0x26, 0xE2, 0x8F, 0x83, 0xE7, 0x44, 0xF3, 0x4F, 0x01, 0xE9, 0xD7, 0x03 };
|
||||
static const uint8_t ublox_spp_credits_uuid128[] = { 0x24, 0x56, 0xE1, 0xB9, 0x26, 0xE2, 0x8F, 0x83, 0xE7, 0x44, 0xF3, 0x4F, 0x01, 0xE9, 0xD7, 0x04 };
|
||||
|
||||
ublox_spp_service_t * instance = &ublox_spp;
|
||||
instance->client_data_callback = client_data_callback;
|
||||
instance->client_credits_callback = client_credits_callback;
|
||||
|
@ -100,11 +100,12 @@ static uint32_t num_valid_entries;
|
||||
static const btstack_tlv_t * le_device_db_tlv_btstack_tlv_impl;
|
||||
static void * le_device_db_tlv_btstack_tlv_context;
|
||||
|
||||
static const char tag_0 = 'B';
|
||||
static const char tag_1 = 'T';
|
||||
static const char tag_2 = 'D';
|
||||
|
||||
static uint32_t le_device_db_tlv_tag_for_index(uint8_t index){
|
||||
static const char tag_0 = 'B';
|
||||
static const char tag_1 = 'T';
|
||||
static const char tag_2 = 'D';
|
||||
|
||||
return (tag_0 << 24) | (tag_1 << 16) | (tag_2 << 8) | index;
|
||||
}
|
||||
|
||||
|
87
src/ble/sm.c
87
src/ble/sm.c
@ -376,27 +376,6 @@ static uint16_t sm_active_connection_handle = HCI_CON_HANDLE_INVALID;
|
||||
static int (*sm_get_oob_data)(uint8_t addres_type, bd_addr_t addr, uint8_t * oob_data) = NULL;
|
||||
static int (*sm_get_sc_oob_data)(uint8_t addres_type, bd_addr_t addr, uint8_t * oob_sc_peer_confirm, uint8_t * oob_sc_peer_random);
|
||||
|
||||
// horizontal: initiator capabilities
|
||||
// vertial: responder capabilities
|
||||
static const stk_generation_method_t stk_generation_method [5] [5] = {
|
||||
{ JUST_WORKS, JUST_WORKS, PK_INIT_INPUT, JUST_WORKS, PK_INIT_INPUT },
|
||||
{ JUST_WORKS, JUST_WORKS, PK_INIT_INPUT, JUST_WORKS, PK_INIT_INPUT },
|
||||
{ PK_RESP_INPUT, PK_RESP_INPUT, PK_BOTH_INPUT, JUST_WORKS, PK_RESP_INPUT },
|
||||
{ JUST_WORKS, JUST_WORKS, JUST_WORKS, JUST_WORKS, JUST_WORKS },
|
||||
{ PK_RESP_INPUT, PK_RESP_INPUT, PK_INIT_INPUT, JUST_WORKS, PK_RESP_INPUT },
|
||||
};
|
||||
|
||||
// uses numeric comparison if one side has DisplayYesNo and KeyboardDisplay combinations
|
||||
#ifdef ENABLE_LE_SECURE_CONNECTIONS
|
||||
static const stk_generation_method_t stk_generation_method_with_secure_connection[5][5] = {
|
||||
{ JUST_WORKS, JUST_WORKS, PK_INIT_INPUT, JUST_WORKS, PK_INIT_INPUT },
|
||||
{ JUST_WORKS, NUMERIC_COMPARISON, PK_INIT_INPUT, JUST_WORKS, NUMERIC_COMPARISON },
|
||||
{ PK_RESP_INPUT, PK_RESP_INPUT, PK_BOTH_INPUT, JUST_WORKS, PK_RESP_INPUT },
|
||||
{ JUST_WORKS, JUST_WORKS, JUST_WORKS, JUST_WORKS, JUST_WORKS },
|
||||
{ PK_RESP_INPUT, NUMERIC_COMPARISON, PK_INIT_INPUT, JUST_WORKS, NUMERIC_COMPARISON },
|
||||
};
|
||||
#endif
|
||||
|
||||
static void sm_run(void);
|
||||
static void sm_done_for_handle(hci_con_handle_t con_handle);
|
||||
static sm_connection_t * sm_get_connection_for_handle(hci_con_handle_t con_handle);
|
||||
@ -750,6 +729,27 @@ static void sm_notify_client_status_reason(sm_connection_t * sm_conn, uint8_t st
|
||||
// - OOB data availability
|
||||
static void sm_setup_tk(void){
|
||||
|
||||
// horizontal: initiator capabilities
|
||||
// vertial: responder capabilities
|
||||
static const stk_generation_method_t stk_generation_method [5] [5] = {
|
||||
{ JUST_WORKS, JUST_WORKS, PK_INIT_INPUT, JUST_WORKS, PK_INIT_INPUT },
|
||||
{ JUST_WORKS, JUST_WORKS, PK_INIT_INPUT, JUST_WORKS, PK_INIT_INPUT },
|
||||
{ PK_RESP_INPUT, PK_RESP_INPUT, PK_BOTH_INPUT, JUST_WORKS, PK_RESP_INPUT },
|
||||
{ JUST_WORKS, JUST_WORKS, JUST_WORKS, JUST_WORKS, JUST_WORKS },
|
||||
{ PK_RESP_INPUT, PK_RESP_INPUT, PK_INIT_INPUT, JUST_WORKS, PK_RESP_INPUT },
|
||||
};
|
||||
|
||||
// uses numeric comparison if one side has DisplayYesNo and KeyboardDisplay combinations
|
||||
#ifdef ENABLE_LE_SECURE_CONNECTIONS
|
||||
static const stk_generation_method_t stk_generation_method_with_secure_connection[5][5] = {
|
||||
{ JUST_WORKS, JUST_WORKS, PK_INIT_INPUT, JUST_WORKS, PK_INIT_INPUT },
|
||||
{ JUST_WORKS, NUMERIC_COMPARISON, PK_INIT_INPUT, JUST_WORKS, NUMERIC_COMPARISON },
|
||||
{ PK_RESP_INPUT, PK_RESP_INPUT, PK_BOTH_INPUT, JUST_WORKS, PK_RESP_INPUT },
|
||||
{ JUST_WORKS, JUST_WORKS, JUST_WORKS, JUST_WORKS, JUST_WORKS },
|
||||
{ PK_RESP_INPUT, NUMERIC_COMPARISON, PK_INIT_INPUT, JUST_WORKS, NUMERIC_COMPARISON },
|
||||
};
|
||||
#endif
|
||||
|
||||
// default: just works
|
||||
setup->sm_stk_generation_method = JUST_WORKS;
|
||||
|
||||
@ -1530,11 +1530,13 @@ static void f4_engine(sm_connection_t * sm_conn, const sm_key256_t u, const sm_k
|
||||
sm_cmac_message_start(x, message_len, sm_cmac_sc_buffer, &sm_sc_cmac_done);
|
||||
}
|
||||
|
||||
static const sm_key_t f5_salt = { 0x6C ,0x88, 0x83, 0x91, 0xAA, 0xF5, 0xA5, 0x38, 0x60, 0x37, 0x0B, 0xDB, 0x5A, 0x60, 0x83, 0xBE};
|
||||
static const uint8_t f5_key_id[] = { 0x62, 0x74, 0x6c, 0x65 };
|
||||
static const uint8_t f5_length[] = { 0x01, 0x00};
|
||||
|
||||
static void f5_calculate_salt(sm_connection_t * sm_conn){
|
||||
|
||||
static const sm_key_t f5_salt = { 0x6C ,0x88, 0x83, 0x91, 0xAA, 0xF5, 0xA5, 0x38, 0x60, 0x37, 0x0B, 0xDB, 0x5A, 0x60, 0x83, 0xBE};
|
||||
|
||||
log_info("f5_calculate_salt");
|
||||
// calculate salt for f5
|
||||
const uint16_t message_len = 32;
|
||||
@ -3439,27 +3441,27 @@ static int sm_validate_stk_generation_method(void){
|
||||
}
|
||||
}
|
||||
|
||||
// size of complete sm_pdu used to validate input
|
||||
static const uint8_t sm_pdu_size[] = {
|
||||
0, // 0x00 invalid opcode
|
||||
7, // 0x01 pairing request
|
||||
7, // 0x02 pairing response
|
||||
17, // 0x03 pairing confirm
|
||||
17, // 0x04 pairing random
|
||||
2, // 0x05 pairing failed
|
||||
17, // 0x06 encryption information
|
||||
11, // 0x07 master identification
|
||||
17, // 0x08 identification information
|
||||
8, // 0x09 identify address information
|
||||
17, // 0x0a signing information
|
||||
2, // 0x0b security request
|
||||
65, // 0x0c pairing public key
|
||||
17, // 0x0d pairing dhk check
|
||||
2, // 0x0e keypress notification
|
||||
};
|
||||
|
||||
static void sm_pdu_handler(uint8_t packet_type, hci_con_handle_t con_handle, uint8_t *packet, uint16_t size){
|
||||
|
||||
// size of complete sm_pdu used to validate input
|
||||
static const uint8_t sm_pdu_size[] = {
|
||||
0, // 0x00 invalid opcode
|
||||
7, // 0x01 pairing request
|
||||
7, // 0x02 pairing response
|
||||
17, // 0x03 pairing confirm
|
||||
17, // 0x04 pairing random
|
||||
2, // 0x05 pairing failed
|
||||
17, // 0x06 encryption information
|
||||
11, // 0x07 master identification
|
||||
17, // 0x08 identification information
|
||||
8, // 0x09 identify address information
|
||||
17, // 0x0a signing information
|
||||
2, // 0x0b security request
|
||||
65, // 0x0c pairing public key
|
||||
17, // 0x0d pairing dhk check
|
||||
2, // 0x0e keypress notification
|
||||
};
|
||||
|
||||
if ((packet_type == HCI_EVENT_PACKET) && (packet[0] == L2CAP_EVENT_CAN_SEND_NOW)){
|
||||
sm_run();
|
||||
}
|
||||
@ -4290,6 +4292,9 @@ static void sm_handle_random_result_oob(void * arg){
|
||||
sm_run();
|
||||
}
|
||||
uint8_t sm_generate_sc_oob_data(void (*callback)(const uint8_t * confirm_value, const uint8_t * random_value)){
|
||||
|
||||
static btstack_crypto_random_t sm_crypto_random_oob_request;
|
||||
|
||||
if (sm_sc_oob_state != SM_SC_OOB_IDLE) return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
sm_sc_oob_callback = callback;
|
||||
sm_sc_oob_state = SM_SC_OOB_W4_RANDOM;
|
||||
|
@ -45,26 +45,6 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// map ascii char to 6-bit value
|
||||
static const uint8_t table[256] = {
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 62, 99, 99, 99, 63,
|
||||
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 99, 99, 99, 99, 99, 99,
|
||||
99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 99, 99, 99, 99, 99,
|
||||
99, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Initialize base99 decoder
|
||||
* @param context
|
||||
@ -80,6 +60,26 @@ void btstack_base64_decoder_init(btstack_base64_decoder_t * context){
|
||||
*/
|
||||
int btstack_base64_decoder_process_byte(btstack_base64_decoder_t * context, uint8_t c){
|
||||
|
||||
// map ascii char to 6-bit value
|
||||
static const uint8_t table[256] = {
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 62, 99, 99, 99, 63,
|
||||
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 99, 99, 99, 99, 99, 99,
|
||||
99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 99, 99, 99, 99, 99,
|
||||
99, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99
|
||||
};
|
||||
|
||||
// handle '='
|
||||
if (c == '='){
|
||||
if ((context->pos == 2) || (context->pos == 3)){
|
||||
|
@ -54,8 +54,6 @@
|
||||
* btstack_hid_parser.c
|
||||
*/
|
||||
|
||||
const int hid_item_sizes[] = { 0, 1, 2, 4 };
|
||||
|
||||
#ifdef HID_PARSER_PRETTY_PRINT
|
||||
|
||||
static const char * type_names[] = {
|
||||
@ -150,6 +148,9 @@ static void hid_pretty_print_item(btstack_hid_parser_t * parser, hid_descriptor_
|
||||
|
||||
// parse descriptor item and read up to 32-bit bit value
|
||||
void btstack_hid_parse_descriptor_item(hid_descriptor_item_t * item, const uint8_t * hid_descriptor, uint16_t hid_descriptor_len){
|
||||
|
||||
const int hid_item_sizes[] = { 0, 1, 2, 4 };
|
||||
|
||||
// parse item header
|
||||
if (hid_descriptor_len < 1) return;
|
||||
uint16_t pos = 0;
|
||||
|
@ -174,9 +174,11 @@ int32_t btstack_time_delta(uint32_t time_a, uint32_t time_b){
|
||||
return (int32_t)(time_a - time_b);
|
||||
}
|
||||
|
||||
static const char * char_to_nibble = "0123456789ABCDEF";
|
||||
|
||||
char char_for_nibble(int nibble){
|
||||
|
||||
static const char * char_to_nibble = "0123456789ABCDEF";
|
||||
|
||||
if (nibble < 16){
|
||||
return char_to_nibble[nibble];
|
||||
} else {
|
||||
|
@ -110,10 +110,6 @@ pktlog_hdr;
|
||||
|
||||
static int dump_file = -1;
|
||||
static int dump_format;
|
||||
static union {
|
||||
uint8_t header_bluez[HCIDUMP_HDR_SIZE];
|
||||
uint8_t header_packetlogger[PKTLOG_HDR_SIZE];
|
||||
} header;
|
||||
#ifdef HAVE_POSIX_FILE_IO
|
||||
static char time_string[40];
|
||||
static int max_nr_packets = -1;
|
||||
@ -266,7 +262,12 @@ static void printf_timestamp(void){
|
||||
#endif
|
||||
}
|
||||
|
||||
void hci_dump_packet(uint8_t packet_type, uint8_t in, uint8_t *packet, uint16_t len) {
|
||||
void hci_dump_packet(uint8_t packet_type, uint8_t in, uint8_t *packet, uint16_t len) {
|
||||
|
||||
static union {
|
||||
uint8_t header_bluez[HCIDUMP_HDR_SIZE];
|
||||
uint8_t header_packetlogger[PKTLOG_HDR_SIZE];
|
||||
} header;
|
||||
|
||||
if (dump_file < 0) return; // not activated yet
|
||||
|
||||
|
@ -378,8 +378,6 @@ typedef enum {
|
||||
// write state
|
||||
static TX_STATE tx_state;
|
||||
|
||||
static uint8_t packet_sent_event[] = { HCI_EVENT_TRANSPORT_PACKET_SENT, 0};
|
||||
|
||||
static void (*packet_handler)(uint8_t packet_type, uint8_t *packet, uint16_t size) = dummy_handler;
|
||||
|
||||
// packet reader state machine
|
||||
@ -471,12 +469,15 @@ static void hci_transport_em9304_spi_block_read(void){
|
||||
}
|
||||
|
||||
static void hci_transport_em9304_spi_block_sent(void){
|
||||
|
||||
static const uint8_t packet_sent_event[] = { HCI_EVENT_TRANSPORT_PACKET_SENT, 0};
|
||||
|
||||
switch (tx_state){
|
||||
case TX_W4_PACKET_SENT:
|
||||
// packet fully sent, reset state
|
||||
tx_state = TX_IDLE;
|
||||
// notify upper stack that it can send again
|
||||
packet_handler(HCI_EVENT_PACKET, &packet_sent_event[0], sizeof(packet_sent_event));
|
||||
packet_handler(HCI_EVENT_PACKET, (uint8_t *) &packet_sent_event[0], sizeof(packet_sent_event));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -535,21 +536,22 @@ static void dummy_handler(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
||||
|
||||
// --- end of eHCILL implementation ---------
|
||||
|
||||
static const hci_transport_t hci_transport_em9304_spi = {
|
||||
/* const char * name; */ "H4",
|
||||
/* void (*init) (const void *transport_config); */ &hci_transport_em9304_spi_init,
|
||||
/* int (*open)(void); */ &hci_transport_em9304_spi_open,
|
||||
/* int (*close)(void); */ &hci_transport_em9304_spi_close,
|
||||
/* void (*register_packet_handler)(void (*handler)(...); */ &hci_transport_em9304_spi_register_packet_handler,
|
||||
/* int (*can_send_packet_now)(uint8_t packet_type); */ &hci_transport_em9304_spi_can_send_now,
|
||||
/* int (*send_packet)(...); */ &hci_transport_em9304_spi_send_packet,
|
||||
/* int (*set_baudrate)(uint32_t baudrate); */ NULL,
|
||||
/* void (*reset_link)(void); */ NULL,
|
||||
/* void (*set_sco_config)(uint16_t voice_setting, int num_connections); */ NULL,
|
||||
};
|
||||
|
||||
// configure and return h4 singleton
|
||||
const hci_transport_t * hci_transport_em9304_spi_instance(const btstack_em9304_spi_t * em9304_spi_driver) {
|
||||
|
||||
static const hci_transport_t hci_transport_em9304_spi = {
|
||||
/* const char * name; */ "H4",
|
||||
/* void (*init) (const void *transport_config); */ &hci_transport_em9304_spi_init,
|
||||
/* int (*open)(void); */ &hci_transport_em9304_spi_open,
|
||||
/* int (*close)(void); */ &hci_transport_em9304_spi_close,
|
||||
/* void (*register_packet_handler)(void (*handler)(...); */ &hci_transport_em9304_spi_register_packet_handler,
|
||||
/* int (*can_send_packet_now)(uint8_t packet_type); */ &hci_transport_em9304_spi_can_send_now,
|
||||
/* int (*send_packet)(...); */ &hci_transport_em9304_spi_send_packet,
|
||||
/* int (*set_baudrate)(uint32_t baudrate); */ NULL,
|
||||
/* void (*reset_link)(void); */ NULL,
|
||||
/* void (*set_sco_config)(uint16_t voice_setting, int num_connections); */ NULL,
|
||||
};
|
||||
|
||||
btstack_em9304_spi = em9304_spi_driver;
|
||||
return &hci_transport_em9304_spi;
|
||||
}
|
||||
|
@ -136,8 +136,6 @@ static uint8_t * ehcill_tx_data;
|
||||
static uint16_t ehcill_tx_len; // 0 == no outgoing packet
|
||||
#endif
|
||||
|
||||
static uint8_t packet_sent_event[] = { HCI_EVENT_TRANSPORT_PACKET_SENT, 0};
|
||||
|
||||
static void (*packet_handler)(uint8_t packet_type, uint8_t *packet, uint16_t size) = dummy_handler;
|
||||
|
||||
// packet reader state machine
|
||||
@ -314,6 +312,9 @@ static void hci_transport_h4_block_read(void){
|
||||
}
|
||||
|
||||
static void hci_transport_h4_block_sent(void){
|
||||
|
||||
static const uint8_t packet_sent_event[] = { HCI_EVENT_TRANSPORT_PACKET_SENT, 0};
|
||||
|
||||
switch (tx_state){
|
||||
case TX_W4_PACKET_SENT:
|
||||
// packet fully sent, reset state
|
||||
@ -715,21 +716,23 @@ static void hci_transport_h4_ehcill_handle_ehcill_command_sent(void){
|
||||
#endif
|
||||
// --- end of eHCILL implementation ---------
|
||||
|
||||
static const hci_transport_t hci_transport_h4 = {
|
||||
/* const char * name; */ "H4",
|
||||
/* void (*init) (const void *transport_config); */ &hci_transport_h4_init,
|
||||
/* int (*open)(void); */ &hci_transport_h4_open,
|
||||
/* int (*close)(void); */ &hci_transport_h4_close,
|
||||
/* void (*register_packet_handler)(void (*handler)(...); */ &hci_transport_h4_register_packet_handler,
|
||||
/* int (*can_send_packet_now)(uint8_t packet_type); */ &hci_transport_h4_can_send_now,
|
||||
/* int (*send_packet)(...); */ &hci_transport_h4_send_packet,
|
||||
/* int (*set_baudrate)(uint32_t baudrate); */ &hci_transport_h4_set_baudrate,
|
||||
/* void (*reset_link)(void); */ NULL,
|
||||
/* void (*set_sco_config)(uint16_t voice_setting, int num_connections); */ NULL,
|
||||
};
|
||||
|
||||
// configure and return h4 singleton
|
||||
const hci_transport_t * hci_transport_h4_instance(const btstack_uart_block_t * uart_driver) {
|
||||
|
||||
static const hci_transport_t hci_transport_h4 = {
|
||||
/* const char * name; */ "H4",
|
||||
/* void (*init) (const void *transport_config); */ &hci_transport_h4_init,
|
||||
/* int (*open)(void); */ &hci_transport_h4_open,
|
||||
/* int (*close)(void); */ &hci_transport_h4_close,
|
||||
/* void (*register_packet_handler)(void (*handler)(...); */ &hci_transport_h4_register_packet_handler,
|
||||
/* int (*can_send_packet_now)(uint8_t packet_type); */ &hci_transport_h4_can_send_now,
|
||||
/* int (*send_packet)(...); */ &hci_transport_h4_send_packet,
|
||||
/* int (*set_baudrate)(uint32_t baudrate); */ &hci_transport_h4_set_baudrate,
|
||||
/* void (*reset_link)(void); */ NULL,
|
||||
/* void (*set_sco_config)(uint16_t voice_setting, int num_connections); */ NULL,
|
||||
};
|
||||
|
||||
btstack_uart = uart_driver;
|
||||
return &hci_transport_h4;
|
||||
}
|
||||
|
@ -98,10 +98,7 @@ typedef enum {
|
||||
static const uint8_t link_control_sync[] = { 0x01, 0x7e};
|
||||
static const uint8_t link_control_sync_response[] = { 0x02, 0x7d};
|
||||
static const uint8_t link_control_config[] = { 0x03, 0xfc, LINK_CONFIG_FIELD};
|
||||
static const uint8_t link_control_config_prefix_len = 2;
|
||||
static const uint8_t link_control_config_response_empty[] = { 0x04, 0x7b};
|
||||
static const uint8_t link_control_config_response[] = { 0x04, 0x7b, LINK_CONFIG_FIELD};
|
||||
static const uint8_t link_control_config_response_prefix_len = 2;
|
||||
static const uint8_t link_control_wakeup[] = { 0x05, 0xfa};
|
||||
static const uint8_t link_control_woken[] = { 0x06, 0xf9};
|
||||
static const uint8_t link_control_sleep[] = { 0x07, 0x78};
|
||||
@ -159,14 +156,16 @@ static void hci_transport_slip_init(void);
|
||||
// -----------------------------
|
||||
// CRC16-CCITT Calculation - compromise: use 32 byte table - 512 byte table would be faster, but that's too large
|
||||
|
||||
static const uint16_t crc16_ccitt_table[] ={
|
||||
0x0000, 0x1081, 0x2102, 0x3183,
|
||||
0x4204, 0x5285, 0x6306, 0x7387,
|
||||
0x8408, 0x9489, 0xa50a, 0xb58b,
|
||||
0xc60c, 0xd68d, 0xe70e, 0xf78f
|
||||
};
|
||||
|
||||
static uint16_t crc16_ccitt_update (uint16_t crc, uint8_t ch){
|
||||
|
||||
static const uint16_t crc16_ccitt_table[] ={
|
||||
0x0000, 0x1081, 0x2102, 0x3183,
|
||||
0x4204, 0x5285, 0x6306, 0x7387,
|
||||
0x8408, 0x9489, 0xa50a, 0xb58b,
|
||||
0xc60c, 0xd68d, 0xe70e, 0xf78f
|
||||
};
|
||||
|
||||
crc = (crc >> 4) ^ crc16_ccitt_table[(crc ^ ch) & 0x000f];
|
||||
crc = (crc >> 4) ^ crc16_ccitt_table[(crc ^ (ch >> 4)) & 0x000f];
|
||||
return crc;
|
||||
@ -330,6 +329,7 @@ static void hci_transport_link_send_config_response(void){
|
||||
|
||||
static void hci_transport_link_send_config_response_empty(void){
|
||||
log_debug("link send config response empty");
|
||||
static const uint8_t link_control_config_response_empty[] = { 0x04, 0x7b};
|
||||
hci_transport_link_send_control(link_control_config_response_empty, sizeof(link_control_config_response_empty));
|
||||
}
|
||||
|
||||
@ -518,6 +518,9 @@ static void hci_transport_h5_emit_sleep_state(int sleep_active){
|
||||
|
||||
static void hci_transport_h5_process_frame(uint16_t frame_size){
|
||||
|
||||
static const uint8_t link_control_config_prefix_len = 2;
|
||||
static const uint8_t link_control_config_response_prefix_len = 2;
|
||||
|
||||
if (frame_size < 4) return;
|
||||
|
||||
uint8_t * slip_header = &hci_packet_with_pre_buffer[HCI_INCOMING_PRE_BUFFER_SIZE];
|
||||
@ -920,21 +923,22 @@ static void hci_transport_h5_reset_link(void){
|
||||
hci_transport_link_init();
|
||||
}
|
||||
|
||||
static const hci_transport_t hci_transport_h5 = {
|
||||
/* const char * name; */ "H5",
|
||||
/* void (*init) (const void *transport_config); */ &hci_transport_h5_init,
|
||||
/* int (*open)(void); */ &hci_transport_h5_open,
|
||||
/* int (*close)(void); */ &hci_transport_h5_close,
|
||||
/* void (*register_packet_handler)(void (*handler)(...); */ &hci_transport_h5_register_packet_handler,
|
||||
/* int (*can_send_packet_now)(uint8_t packet_type); */ &hci_transport_h5_can_send_packet_now,
|
||||
/* int (*send_packet)(...); */ &hci_transport_h5_send_packet,
|
||||
/* int (*set_baudrate)(uint32_t baudrate); */ &hci_transport_h5_set_baudrate,
|
||||
/* void (*reset_link)(void); */ &hci_transport_h5_reset_link,
|
||||
/* void (*set_sco_config)(uint16_t voice_setting, int num_connections); */ NULL,
|
||||
};
|
||||
|
||||
// configure and return h5 singleton
|
||||
const hci_transport_t * hci_transport_h5_instance(const btstack_uart_block_t * uart_driver) {
|
||||
|
||||
static const hci_transport_t hci_transport_h5 = {
|
||||
/* const char * name; */ "H5",
|
||||
/* void (*init) (const void *transport_config); */ &hci_transport_h5_init,
|
||||
/* int (*open)(void); */ &hci_transport_h5_open,
|
||||
/* int (*close)(void); */ &hci_transport_h5_close,
|
||||
/* void (*register_packet_handler)(void (*handler)(...); */ &hci_transport_h5_register_packet_handler,
|
||||
/* int (*can_send_packet_now)(uint8_t packet_type); */ &hci_transport_h5_can_send_packet_now,
|
||||
/* int (*send_packet)(...); */ &hci_transport_h5_send_packet,
|
||||
/* int (*set_baudrate)(uint32_t baudrate); */ &hci_transport_h5_set_baudrate,
|
||||
/* void (*reset_link)(void); */ &hci_transport_h5_reset_link,
|
||||
/* void (*set_sco_config)(uint16_t voice_setting, int num_connections); */ NULL,
|
||||
};
|
||||
|
||||
btstack_uart = uart_driver;
|
||||
return &hci_transport_h5;
|
||||
}
|
||||
|
@ -50,37 +50,36 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static const char *l2cap_signaling_commands_format[] = {
|
||||
"2D", // 0x01 command reject: reason {cmd not understood (0), sig MTU exceeded (2:max sig MTU), invalid CID (4:req CID)}, data len, data
|
||||
"22", // 0x02 connection request: PSM, Source CID
|
||||
"2222", // 0x03 connection response: Dest CID, Source CID, Result, Status
|
||||
"22D", // 0x04 config request: Dest CID, Flags, Configuration options
|
||||
"222D", // 0x05 config response: Source CID, Flags, Result, Configuration options
|
||||
"22", // 0x06 disconection request: Dest CID, Source CID
|
||||
"22", // 0x07 disconection response: Dest CID, Source CID
|
||||
"D", // 0x08 echo request: Data
|
||||
"D", // 0x09 echo response: Data
|
||||
"2", // 0x0a information request: InfoType {1=Connectionless MTU, 2=Extended features supported}
|
||||
"22D", // 0x0b information response: InfoType, Result, Data
|
||||
#ifdef ENABLE_BLE
|
||||
NULL, // 0x0c non-supported AMP command
|
||||
NULL, // 0x0d non-supported AMP command
|
||||
NULL, // 0x0e non-supported AMP command
|
||||
NULL, // 0x0f non-supported AMP command
|
||||
NULL, // 0x10 non-supported AMP command
|
||||
NULL, // 0x11 non-supported AMP command
|
||||
"2222", // 0x12 connection parameter update request: interval min, interval max, slave latency, timeout multipler
|
||||
"2", // 0x13 connection parameter update response: result
|
||||
"22222", // 0X14 le credit based connection request: le psm, source cid, mtu, mps, initial credits
|
||||
"22222", // 0x15 le credit based connection respone: dest cid, mtu, mps, initial credits, result
|
||||
"22", // 0x16 le flow control credit: source cid, credits
|
||||
#endif
|
||||
};
|
||||
|
||||
static const unsigned int num_l2cap_commands = sizeof(l2cap_signaling_commands_format) / sizeof(const char *);
|
||||
|
||||
static uint16_t l2cap_create_signaling_internal(uint8_t * acl_buffer, hci_con_handle_t handle, uint16_t cid, L2CAP_SIGNALING_COMMANDS cmd, uint8_t identifier, va_list argptr){
|
||||
|
||||
|
||||
static const char *l2cap_signaling_commands_format[] = {
|
||||
"2D", // 0x01 command reject: reason {cmd not understood (0), sig MTU exceeded (2:max sig MTU), invalid CID (4:req CID)}, data len, data
|
||||
"22", // 0x02 connection request: PSM, Source CID
|
||||
"2222", // 0x03 connection response: Dest CID, Source CID, Result, Status
|
||||
"22D", // 0x04 config request: Dest CID, Flags, Configuration options
|
||||
"222D", // 0x05 config response: Source CID, Flags, Result, Configuration options
|
||||
"22", // 0x06 disconection request: Dest CID, Source CID
|
||||
"22", // 0x07 disconection response: Dest CID, Source CID
|
||||
"D", // 0x08 echo request: Data
|
||||
"D", // 0x09 echo response: Data
|
||||
"2", // 0x0a information request: InfoType {1=Connectionless MTU, 2=Extended features supported}
|
||||
"22D", // 0x0b information response: InfoType, Result, Data
|
||||
#ifdef ENABLE_BLE
|
||||
NULL, // 0x0c non-supported AMP command
|
||||
NULL, // 0x0d non-supported AMP command
|
||||
NULL, // 0x0e non-supported AMP command
|
||||
NULL, // 0x0f non-supported AMP command
|
||||
NULL, // 0x10 non-supported AMP command
|
||||
NULL, // 0x11 non-supported AMP command
|
||||
"2222", // 0x12 connection parameter update request: interval min, interval max, slave latency, timeout multipler
|
||||
"2", // 0x13 connection parameter update response: result
|
||||
"22222", // 0X14 le credit based connection request: le psm, source cid, mtu, mps, initial credits
|
||||
"22222", // 0x15 le credit based connection respone: dest cid, mtu, mps, initial credits, result
|
||||
"22", // 0x16 le flow control credit: source cid, credits
|
||||
#endif
|
||||
};
|
||||
static const unsigned int num_l2cap_commands = sizeof(l2cap_signaling_commands_format) / sizeof(const char *);
|
||||
|
||||
const char *format = NULL;
|
||||
if ((cmd > 0) && (cmd <= num_l2cap_commands)) {
|
||||
format = l2cap_signaling_commands_format[cmd-1];
|
||||
|
Loading…
x
Reference in New Issue
Block a user