![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
BLE fota Robot Demo
Dependencies: mbed-rtos mbed mbed_fota_fan_control
Fork of mbed_fota_lamp_control by
dialog_fota/gap.h@5:e11b23f9aacc, 2015-07-13 (annotated)
- Committer:
- dudnwjs
- Date:
- Mon Jul 13 06:32:05 2015 +0000
- Revision:
- 5:e11b23f9aacc
- Child:
- 9:fcf91f563147
Fota Service Add complete
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dudnwjs | 5:e11b23f9aacc | 1 | #ifndef GAP_H |
dudnwjs | 5:e11b23f9aacc | 2 | #define GAP_H |
dudnwjs | 5:e11b23f9aacc | 3 | #include "dialog_fota_config.h" |
dudnwjs | 5:e11b23f9aacc | 4 | |
dudnwjs | 5:e11b23f9aacc | 5 | namespace sevencore_fota{ |
dudnwjs | 5:e11b23f9aacc | 6 | |
dudnwjs | 5:e11b23f9aacc | 7 | #define KEY_LEN 0x10 |
dudnwjs | 5:e11b23f9aacc | 8 | |
dudnwjs | 5:e11b23f9aacc | 9 | |
dudnwjs | 5:e11b23f9aacc | 10 | /// Generic Security key structure |
dudnwjs | 5:e11b23f9aacc | 11 | struct gap_sec_key |
dudnwjs | 5:e11b23f9aacc | 12 | { |
dudnwjs | 5:e11b23f9aacc | 13 | /// Key value MSB -> LSB |
dudnwjs | 5:e11b23f9aacc | 14 | uint8_t key[KEY_LEN]; |
dudnwjs | 5:e11b23f9aacc | 15 | }; |
dudnwjs | 5:e11b23f9aacc | 16 | |
dudnwjs | 5:e11b23f9aacc | 17 | /// Address information about a device address |
dudnwjs | 5:e11b23f9aacc | 18 | struct gap_bdaddr |
dudnwjs | 5:e11b23f9aacc | 19 | { |
dudnwjs | 5:e11b23f9aacc | 20 | /// BD Address of device |
dudnwjs | 5:e11b23f9aacc | 21 | struct bd_addr addr; |
dudnwjs | 5:e11b23f9aacc | 22 | /// Address type of the device 0=public/1=private random |
dudnwjs | 5:e11b23f9aacc | 23 | uint8_t addr_type; |
dudnwjs | 5:e11b23f9aacc | 24 | }; |
dudnwjs | 5:e11b23f9aacc | 25 | |
dudnwjs | 5:e11b23f9aacc | 26 | /// Advertising mode |
dudnwjs | 5:e11b23f9aacc | 27 | enum gap_adv_mode |
dudnwjs | 5:e11b23f9aacc | 28 | { |
dudnwjs | 5:e11b23f9aacc | 29 | /// Mode in non-discoverable |
dudnwjs | 5:e11b23f9aacc | 30 | GAP_NON_DISCOVERABLE, |
dudnwjs | 5:e11b23f9aacc | 31 | /// Mode in general discoverable |
dudnwjs | 5:e11b23f9aacc | 32 | GAP_GEN_DISCOVERABLE, |
dudnwjs | 5:e11b23f9aacc | 33 | /// Mode in limited discoverable |
dudnwjs | 5:e11b23f9aacc | 34 | GAP_LIM_DISCOVERABLE, |
dudnwjs | 5:e11b23f9aacc | 35 | /// Broadcaster mode which is a non discoverable and non connectable mode. |
dudnwjs | 5:e11b23f9aacc | 36 | GAP_BROADCASTER_MODE, |
dudnwjs | 5:e11b23f9aacc | 37 | }; |
dudnwjs | 5:e11b23f9aacc | 38 | /****************** GAP Role **********************/ |
dudnwjs | 5:e11b23f9aacc | 39 | enum gap_role |
dudnwjs | 5:e11b23f9aacc | 40 | { |
dudnwjs | 5:e11b23f9aacc | 41 | /// No role set yet |
dudnwjs | 5:e11b23f9aacc | 42 | GAP_NO_ROLE = 0x00, |
dudnwjs | 5:e11b23f9aacc | 43 | |
dudnwjs | 5:e11b23f9aacc | 44 | /// Observer role |
dudnwjs | 5:e11b23f9aacc | 45 | GAP_OBSERVER_SCA = 0x01, |
dudnwjs | 5:e11b23f9aacc | 46 | |
dudnwjs | 5:e11b23f9aacc | 47 | /// Broadcaster role |
dudnwjs | 5:e11b23f9aacc | 48 | GAP_BROADCASTER_ADV = 0x02, |
dudnwjs | 5:e11b23f9aacc | 49 | |
dudnwjs | 5:e11b23f9aacc | 50 | /// Master/Central role |
dudnwjs | 5:e11b23f9aacc | 51 | GAP_CENTRAL_MST = (0x04 | GAP_OBSERVER_SCA), |
dudnwjs | 5:e11b23f9aacc | 52 | |
dudnwjs | 5:e11b23f9aacc | 53 | /// Peripheral/Slave role |
dudnwjs | 5:e11b23f9aacc | 54 | GAP_PERIPHERAL_SLV = (0x08 | GAP_BROADCASTER_ADV), |
dudnwjs | 5:e11b23f9aacc | 55 | }; |
dudnwjs | 5:e11b23f9aacc | 56 | /// Authentication mask |
dudnwjs | 5:e11b23f9aacc | 57 | enum gap_auth_mask |
dudnwjs | 5:e11b23f9aacc | 58 | { |
dudnwjs | 5:e11b23f9aacc | 59 | /// No Flag set |
dudnwjs | 5:e11b23f9aacc | 60 | GAP_AUTH_NONE = 0, |
dudnwjs | 5:e11b23f9aacc | 61 | /// Bond authentication |
dudnwjs | 5:e11b23f9aacc | 62 | GAP_AUTH_BOND = (1 << 0), |
dudnwjs | 5:e11b23f9aacc | 63 | /// Man In the middle protection |
dudnwjs | 5:e11b23f9aacc | 64 | GAP_AUTH_MITM = (1 << 2), |
dudnwjs | 5:e11b23f9aacc | 65 | }; |
dudnwjs | 5:e11b23f9aacc | 66 | |
dudnwjs | 5:e11b23f9aacc | 67 | |
dudnwjs | 5:e11b23f9aacc | 68 | /// Authentication Requirements |
dudnwjs | 5:e11b23f9aacc | 69 | enum gap_auth |
dudnwjs | 5:e11b23f9aacc | 70 | { |
dudnwjs | 5:e11b23f9aacc | 71 | /// No MITM No Bonding |
dudnwjs | 5:e11b23f9aacc | 72 | GAP_AUTH_REQ_NO_MITM_NO_BOND = (GAP_AUTH_NONE), |
dudnwjs | 5:e11b23f9aacc | 73 | /// No MITM Bonding |
dudnwjs | 5:e11b23f9aacc | 74 | GAP_AUTH_REQ_NO_MITM_BOND = (GAP_AUTH_BOND), |
dudnwjs | 5:e11b23f9aacc | 75 | /// MITM No Bonding |
dudnwjs | 5:e11b23f9aacc | 76 | GAP_AUTH_REQ_MITM_NO_BOND = (GAP_AUTH_MITM), |
dudnwjs | 5:e11b23f9aacc | 77 | /// MITM and Bonding |
dudnwjs | 5:e11b23f9aacc | 78 | GAP_AUTH_REQ_MITM_BOND = (GAP_AUTH_MITM | GAP_AUTH_BOND), |
dudnwjs | 5:e11b23f9aacc | 79 | GAP_AUTH_REQ_LAST |
dudnwjs | 5:e11b23f9aacc | 80 | }; |
dudnwjs | 5:e11b23f9aacc | 81 | |
dudnwjs | 5:e11b23f9aacc | 82 | /// Authorization setting |
dudnwjs | 5:e11b23f9aacc | 83 | enum gap_authz |
dudnwjs | 5:e11b23f9aacc | 84 | { |
dudnwjs | 5:e11b23f9aacc | 85 | /// Authorization not set, application informed when authorization requested |
dudnwjs | 5:e11b23f9aacc | 86 | GAP_AUTHZ_NOT_SET = 0x00, |
dudnwjs | 5:e11b23f9aacc | 87 | /// Authorization request automatically accepted |
dudnwjs | 5:e11b23f9aacc | 88 | GAP_AUTHZ_ACCEPT = 0x01, |
dudnwjs | 5:e11b23f9aacc | 89 | /// Authorization request automatically rejected |
dudnwjs | 5:e11b23f9aacc | 90 | GAP_AUTHZ_REJECT = 0x02, |
dudnwjs | 5:e11b23f9aacc | 91 | }; |
dudnwjs | 5:e11b23f9aacc | 92 | |
dudnwjs | 5:e11b23f9aacc | 93 | //////////////~GAP~ |
dudnwjs | 5:e11b23f9aacc | 94 | }//namespace |
dudnwjs | 5:e11b23f9aacc | 95 | #endif//GAP_H |