| Airoha M0 BLE API 1.0.5.4

sm.h
1 /******************************************************************************
2 Copyright (c) Airoha 2016 - All rights reserved
3
4 FILE NAME
5 sm.h
6 DESCRIPTION
7 NOTES
8 ********************************************************************************/
9
10 #ifndef __SM_H__
11 #define __SM_H__
12
13 #include "sm_hal.h"
14
15 #if (SM_HAL_AB1600_ENABLED)
16 #include <stdbool.h>
17 #endif
18
19 #ifdef _MSC_VER
20 __pragma(pack(push, 1))
21 #define __attribute__(x)
22 #endif
23
24
25 typedef struct
26 {
27 uint8_t status;
28 uint16_t connHandle;
29 uint8_t encryptionEnabled;
30 }PACKED_STRUCT sm_hci_encryption_change_t;
31
32 #ifdef _MSC_VER
33 __pragma(pack(pop))
34 #undef __attribute__
35 #endif
36 /* pairingMethod */
37 //Legacy
38 #define SM_JUST_WORKS 0x00
39 #define SM_PASSKEY_ENTRY_DISPLAY 0x01
40 #define SM_PASSKEY_ENTRY_INPUT 0x02
41 #define SM_OUT_OF_BAND 0x03
42 //Secure connections
43 #define SM_USE_SECURE_CONNECTION 0x04
44 #define SM_SC_JUST_WORKS 0x04 //(SM_USE_SECURE_CONNECTION | SM_JUST_WORKS)
45 #define SM_SC_PASSKEY_ENTRY_DISPLAY 0x05 //(SM_USE_SECURE_CONNECTION | SM_PASSKEY_ENTRY_DISPLAY)
46 #define SM_SC_PASSKEY_ENTRY_INPUT 0x06 //(SM_USE_SECURE_CONNECTION | SM_PASSKEY_ENTRY_INPUT)
47 #define SM_SC_OUT_OF_BAND 0x07 //(SM_USE_SECURE_CONNECTION | SM_OUT_OF_BAND)
48 #define SM_NUMERIC_COMPARISON 0x08
49
50 uint8_t SM_SetKeySize(uint8_t idx, uint8_t ownKeySize, uint8_t peerKeySize);
51 void SM_SendKeypressNotification(uint8_t idx, uint8_t type);
52 bool SM_GetLTK(uint8_t *addr, uint8_t *LTK);
53 bool SM_GetPeerLTK(uint8_t *addr, uint8_t *peerLTK);
54 void SM_LinkDisconnected(uint8_t idx);
55 void SM_StartKeyDistribution(uint8_t idx, uint8_t keyDistFlag);
56 void SM_WaitKeyDistribution(uint8_t key, uint8_t idx, uint8_t keyDistFlag);
57 void SM_FinishPairing(uint8_t idx, bool isSuccessful, uint8_t status);
58 void SM_PairingFailed(uint8_t idx, uint8_t failedReason);
59 void sm_init(void);
60
61 #endif