mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-04 06:39:53 +00:00
move Bluetooth related types to bluetooth.h and BTstack types to btstack_defines.h
This commit is contained in:
parent
ab49db6128
commit
8974fcd6cf
16
src/ble/sm.h
16
src/ble/sm.h
@ -38,16 +38,14 @@
|
|||||||
#ifndef __SM_H
|
#ifndef __SM_H
|
||||||
#define __SM_H
|
#define __SM_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#if defined __cplusplus
|
||||||
#include "btstack_util.h"
|
|
||||||
|
|
||||||
#if defined __cplusplus
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// PTS testing
|
#include <stdint.h>
|
||||||
void sm_test_set_irk(sm_key_t irk);
|
#include "btstack_util.h"
|
||||||
void sm_test_use_fixed_local_csrk(void);
|
#include "btstack_defines.h"
|
||||||
|
#include "hci.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
btstack_linked_item_t item;
|
btstack_linked_item_t item;
|
||||||
@ -204,6 +202,10 @@ int sm_address_resolution_lookup(uint8_t addr_type, bd_addr_t addr);
|
|||||||
int sm_le_device_index(uint16_t handle );
|
int sm_le_device_index(uint16_t handle );
|
||||||
/* API_END */
|
/* API_END */
|
||||||
|
|
||||||
|
// PTS testing
|
||||||
|
void sm_test_set_irk(sm_key_t irk);
|
||||||
|
void sm_test_use_fixed_local_csrk(void);
|
||||||
|
|
||||||
#if defined __cplusplus
|
#if defined __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -46,6 +46,55 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief hci connection handle type
|
||||||
|
*/
|
||||||
|
typedef uint16_t hci_con_handle_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Length of a bluetooth device address.
|
||||||
|
*/
|
||||||
|
#define BD_ADDR_LEN 6
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Bluetooth address
|
||||||
|
*/
|
||||||
|
typedef uint8_t bd_addr_t[BD_ADDR_LEN];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address types
|
||||||
|
* @note: BTstack uses a custom addr type to refer to classic ACL and SCO devices
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
BD_ADDR_TYPE_LE_PUBLIC = 0,
|
||||||
|
BD_ADDR_TYPE_LE_RANDOM = 1,
|
||||||
|
BD_ADDR_TYPE_SCO = 0xfe,
|
||||||
|
BD_ADDR_TYPE_CLASSIC = 0xff,
|
||||||
|
BD_ADDR_TYPE_UNKNOWN = 0xfe
|
||||||
|
} bd_addr_type_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief link key
|
||||||
|
*/
|
||||||
|
#define LINK_KEY_LEN 16
|
||||||
|
#define LINK_KEY_STR_LEN (LINK_KEY_LEN*2)
|
||||||
|
typedef uint8_t link_key_t[LINK_KEY_LEN];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief link key type
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
COMBINATION_KEY = 0, // standard pairing
|
||||||
|
LOCAL_UNIT_KEY, // ?
|
||||||
|
REMOTE_UNIT_KEY, // ?
|
||||||
|
DEBUG_COMBINATION_KEY, // SSP with debug
|
||||||
|
UNAUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P192, // SSP Simple Pairing
|
||||||
|
AUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P192, // SSP Passkey, Number confirm, OOB
|
||||||
|
CHANGED_COMBINATION_KEY, // Link key changed using Change Connection Lnk Key
|
||||||
|
UNAUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P256, // SSP Simpe Pairing
|
||||||
|
AUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P256, // SSP Passkey, Number confirm, OOB
|
||||||
|
} link_key_type_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HCI Transport
|
* HCI Transport
|
||||||
*/
|
*/
|
||||||
|
@ -43,17 +43,24 @@
|
|||||||
#ifndef __BTSTACK_DEFINES_H
|
#ifndef __BTSTACK_DEFINES_H
|
||||||
#define __BTSTACK_DEFINES_H
|
#define __BTSTACK_DEFINES_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "btstack_linked_list.h"
|
||||||
|
|
||||||
|
// TYPES
|
||||||
|
|
||||||
|
// packet handler
|
||||||
|
typedef void (*btstack_packet_handler_t) (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
|
||||||
|
|
||||||
|
// packet callback supporting multiple registrations
|
||||||
|
typedef struct {
|
||||||
|
btstack_linked_item_t item;
|
||||||
|
btstack_packet_handler_t callback;
|
||||||
|
} btstack_packet_callback_registration_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Address types
|
* @brief 128 bit key used with AES128 in Security Manager
|
||||||
* @note: BTstack uses a custom addr type to refer to classic ACL and SCO devices
|
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef uint8_t sm_key_t[16];
|
||||||
BD_ADDR_TYPE_LE_PUBLIC = 0,
|
|
||||||
BD_ADDR_TYPE_LE_RANDOM = 1,
|
|
||||||
BD_ADDR_TYPE_SCO = 0xfe,
|
|
||||||
BD_ADDR_TYPE_CLASSIC = 0xff,
|
|
||||||
BD_ADDR_TYPE_UNKNOWN = 0xfe
|
|
||||||
} bd_addr_type_t;
|
|
||||||
|
|
||||||
// DEFINES
|
// DEFINES
|
||||||
|
|
||||||
|
@ -52,42 +52,11 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "bluetooth.h"
|
||||||
|
#include "btstack_defines.h"
|
||||||
#include "btstack_linked_list.h"
|
#include "btstack_linked_list.h"
|
||||||
|
|
||||||
/**
|
// will be moved to daemon/btstack_device_name_db.h
|
||||||
* @brief hci connection handle type
|
|
||||||
*/
|
|
||||||
typedef uint16_t hci_con_handle_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Length of a bluetooth device address.
|
|
||||||
*/
|
|
||||||
#define BD_ADDR_LEN 6
|
|
||||||
typedef uint8_t bd_addr_t[BD_ADDR_LEN];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief link key and its type
|
|
||||||
*/
|
|
||||||
#define LINK_KEY_LEN 16
|
|
||||||
#define LINK_KEY_STR_LEN (LINK_KEY_LEN*2)
|
|
||||||
typedef uint8_t link_key_t[LINK_KEY_LEN];
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
COMBINATION_KEY = 0, // standard pairing
|
|
||||||
LOCAL_UNIT_KEY, // ?
|
|
||||||
REMOTE_UNIT_KEY, // ?
|
|
||||||
DEBUG_COMBINATION_KEY, // SSP with debug
|
|
||||||
UNAUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P192, // SSP Simple Pairing
|
|
||||||
AUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P192, // SSP Passkey, Number confirm, OOB
|
|
||||||
CHANGED_COMBINATION_KEY, // Link key changed using Change Connection Lnk Key
|
|
||||||
UNAUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P256, // SSP Simpe Pairing
|
|
||||||
AUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P256, // SSP Passkey, Number confirm, OOB
|
|
||||||
} link_key_type_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 128 bit key used with AES128 in Security Manager
|
|
||||||
*/
|
|
||||||
typedef uint8_t sm_key_t[16];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The device name type
|
* @brief The device name type
|
||||||
@ -95,16 +64,7 @@ typedef uint8_t sm_key_t[16];
|
|||||||
#define DEVICE_NAME_LEN 248
|
#define DEVICE_NAME_LEN 248
|
||||||
typedef uint8_t device_name_t[DEVICE_NAME_LEN+1];
|
typedef uint8_t device_name_t[DEVICE_NAME_LEN+1];
|
||||||
|
|
||||||
// packet handler
|
|
||||||
typedef void (*btstack_packet_handler_t) (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
|
|
||||||
|
|
||||||
// packet callback supporting multiple registrations
|
|
||||||
typedef struct {
|
|
||||||
btstack_linked_item_t item;
|
|
||||||
btstack_packet_handler_t callback;
|
|
||||||
} btstack_packet_callback_registration_t;
|
|
||||||
|
|
||||||
|
|
||||||
// helper for BT little endian format
|
// helper for BT little endian format
|
||||||
#define little_endian_read_16( buffer, pos) ( ((uint16_t) buffer[pos]) | (((uint16_t)buffer[(pos)+1]) << 8))
|
#define little_endian_read_16( buffer, pos) ( ((uint16_t) buffer[pos]) | (((uint16_t)buffer[(pos)+1]) << 8))
|
||||||
#define little_endian_read_24( buffer, pos) ( ((uint32_t) buffer[pos]) | (((uint32_t)buffer[(pos)+1]) << 8) | (((uint32_t)buffer[(pos)+2]) << 16))
|
#define little_endian_read_24( buffer, pos) ( ((uint32_t) buffer[pos]) | (((uint32_t)buffer[(pos)+1]) << 8) | (((uint32_t)buffer[(pos)+2]) << 16))
|
||||||
|
@ -42,8 +42,7 @@
|
|||||||
#ifndef __BTSTACK_LINK_KEY_DB_H
|
#ifndef __BTSTACK_LINK_KEY_DB_H
|
||||||
#define __BTSTACK_LINK_KEY_DB_H
|
#define __BTSTACK_LINK_KEY_DB_H
|
||||||
|
|
||||||
#include "btstack_util.h"
|
#include "bluetooth.h"
|
||||||
#include "gap.h"
|
|
||||||
|
|
||||||
#if defined __cplusplus
|
#if defined __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include "btstack_util.h"
|
#include "btstack_util.h"
|
||||||
#include "classic/btstack_link_key_db.h"
|
#include "classic/btstack_link_key_db.h"
|
||||||
#include "hci_cmd.h"
|
#include "hci_cmd.h"
|
||||||
|
#include "gap.h"
|
||||||
#include "hci_transport.h"
|
#include "hci_transport.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user