mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-14 01:27:41 +00:00
add event types for security manager events, define sm_event_t
This commit is contained in:
parent
63360865c4
commit
8225f33562
@ -61,6 +61,7 @@
|
||||
|
||||
#include "rijndael.h"
|
||||
|
||||
// Bluetooth Spec definitions
|
||||
typedef enum {
|
||||
SM_CODE_PAIRING_REQUEST = 0X01,
|
||||
SM_CODE_PAIRING_RESPONSE,
|
||||
@ -105,9 +106,24 @@ typedef enum {
|
||||
IO_CAPABILITY_DISPLAY_YES_NO,
|
||||
IO_CAPABILITY_KEYBOARD_ONLY,
|
||||
IO_CAPABILITY_NO_INPUT_NO_OUTPUT,
|
||||
IO_CAPABILITY_KEYBOARD_DISPLAY
|
||||
IO_CAPABILITY_KEYBOARD_DISPLAY, // not used by secure simple pairing
|
||||
} io_capability_t;
|
||||
|
||||
//
|
||||
// types used by client
|
||||
//
|
||||
|
||||
typedef struct sm_event {
|
||||
uint8_t type; // see <btstack/hci_cmds.h> SM_...
|
||||
uint8_t addr_type;
|
||||
bd_addr_t address;
|
||||
uint32_t passkey; // only used for SM_PASSKEY_DISPLAY_NUMBER
|
||||
} sm_event_t;
|
||||
|
||||
//
|
||||
// internal types and globals
|
||||
//
|
||||
|
||||
typedef uint8_t key_t[16];
|
||||
|
||||
typedef enum {
|
||||
@ -330,7 +346,6 @@ static int sm_is_null_random(uint8_t random[8]){
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static void print_key(const char * name, key_t key){
|
||||
printf("%-6s ", name);
|
||||
hexdump(key, 16);
|
||||
@ -426,6 +441,11 @@ static void sm_s1_r_prime(key_t r1, key_t r2, key_t r_prime){
|
||||
memcpy(&r_prime[0], &r1[8], 8);
|
||||
}
|
||||
|
||||
static void sm_notify_client(sm_event_t * event){
|
||||
// dummy implementation
|
||||
printf("sm_notify_client: event 0x%02x, addres_type %u, address (), num '%06u'", event->type, event->addr_type, event->passkey);
|
||||
}
|
||||
|
||||
void sm_reset_tk(){
|
||||
int i;
|
||||
for (i=0;i<16;i++){
|
||||
@ -1236,6 +1256,7 @@ void sm_test2(){
|
||||
}
|
||||
|
||||
// Security Manager Client API
|
||||
|
||||
void sm_register_oob_data_callback( int (*get_oob_data_callback)(uint8_t addres_type, bd_addr_t * addr, uint8_t * oob_data)){
|
||||
sm_get_oob_data = get_oob_data_callback;
|
||||
}
|
||||
|
@ -222,6 +222,13 @@ extern "C" {
|
||||
#define GATT_CHARACTERISTIC_QUERY_RESULT 0xA4
|
||||
#define GATT_CHARACTERISTIC_QUERY_COMPLETE 0xA5
|
||||
|
||||
// data: event(8), address_type(8), address (48), [number(32)]
|
||||
#define SM_JUST_WORKS_REQUEST 0xb0
|
||||
#define SM_JUST_WORKS_CANCEL 0xb1
|
||||
#define SM_PASSKEY_DISPLAY_NUMBER 0xb2
|
||||
#define SM_PASSKEY_DISPLAY_CANCEL 0xb3
|
||||
#define SM_PASSKEY_INPUT_NUMBER 0xb1
|
||||
#define SM_PASSKEY_INPUT_CANCEL 0xb2
|
||||
|
||||
// last error code in 2.1 is 0x38 - we start with 0x50 for BTstack errors
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user