Bluetooth Low Energy based Firmware Over The Air with Mbed. Mbed part is a external processor of the IoT devices and communicate with a Bluetooth module. The Bluetooth module have to support BLE and implement BLE FOTA profile designed by ours. BLE FOTA profile specification is available from our GIT hub wiki(https://github.com/sevencore/BLEFOTA).
Dependencies: mbed
Fork of mbed_fota by
Bluetooth Low Energy based Firmware Over The Air with Mbed. Mbed part is a external processor of the IoT devices and communicate with a Bluetooth module. The Bluetooth module have to support BLE and implement BLE FOTA profile designed by ours. BLE FOTA profile specification is available from our GIT hub wiki.
dialog_fota/gap.h@10:18044afe4364, 2015-08-24 (annotated)
- Committer:
- dudnwjs
- Date:
- Mon Aug 24 03:11:00 2015 +0000
- Revision:
- 10:18044afe4364
- Parent:
- 9:fcf91f563147
Add header comment;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dudnwjs | 10:18044afe4364 | 1 | /** |
dudnwjs | 10:18044afe4364 | 2 | * @file gap.h |
dudnwjs | 10:18044afe4364 | 3 | * @brief Generic Access Profile. |
dudnwjs | 10:18044afe4364 | 4 | * Copyright 2015 SEVENCORE Co., Ltd. |
dudnwjs | 10:18044afe4364 | 5 | * |
dudnwjs | 10:18044afe4364 | 6 | * @author HyeongJun Kim |
dudnwjs | 10:18044afe4364 | 7 | * @version 1.0.0 |
dudnwjs | 10:18044afe4364 | 8 | * @date 2015-08-20 |
dudnwjs | 10:18044afe4364 | 9 | */ |
dudnwjs | 5:e11b23f9aacc | 10 | #ifndef GAP_H |
dudnwjs | 5:e11b23f9aacc | 11 | #define GAP_H |
dudnwjs | 5:e11b23f9aacc | 12 | #include "dialog_fota_config.h" |
dudnwjs | 5:e11b23f9aacc | 13 | |
dudnwjs | 9:fcf91f563147 | 14 | /** |
dudnwjs | 9:fcf91f563147 | 15 | **************************************************************************************** |
dudnwjs | 9:fcf91f563147 | 16 | * @addtogroup dialog_fota module |
dudnwjs | 9:fcf91f563147 | 17 | * @brief Generic Access Profile. |
dudnwjs | 9:fcf91f563147 | 18 | * |
dudnwjs | 9:fcf91f563147 | 19 | * @{ |
dudnwjs | 9:fcf91f563147 | 20 | **************************************************************************************** |
dudnwjs | 9:fcf91f563147 | 21 | */ |
dudnwjs | 9:fcf91f563147 | 22 | |
dudnwjs | 5:e11b23f9aacc | 23 | namespace sevencore_fota{ |
dudnwjs | 5:e11b23f9aacc | 24 | |
dudnwjs | 5:e11b23f9aacc | 25 | #define KEY_LEN 0x10 |
dudnwjs | 5:e11b23f9aacc | 26 | |
dudnwjs | 5:e11b23f9aacc | 27 | |
dudnwjs | 5:e11b23f9aacc | 28 | /// Generic Security key structure |
dudnwjs | 5:e11b23f9aacc | 29 | struct gap_sec_key |
dudnwjs | 5:e11b23f9aacc | 30 | { |
dudnwjs | 5:e11b23f9aacc | 31 | /// Key value MSB -> LSB |
dudnwjs | 5:e11b23f9aacc | 32 | uint8_t key[KEY_LEN]; |
dudnwjs | 5:e11b23f9aacc | 33 | }; |
dudnwjs | 5:e11b23f9aacc | 34 | |
dudnwjs | 5:e11b23f9aacc | 35 | /// Address information about a device address |
dudnwjs | 5:e11b23f9aacc | 36 | struct gap_bdaddr |
dudnwjs | 5:e11b23f9aacc | 37 | { |
dudnwjs | 5:e11b23f9aacc | 38 | /// BD Address of device |
dudnwjs | 5:e11b23f9aacc | 39 | struct bd_addr addr; |
dudnwjs | 5:e11b23f9aacc | 40 | /// Address type of the device 0=public/1=private random |
dudnwjs | 5:e11b23f9aacc | 41 | uint8_t addr_type; |
dudnwjs | 5:e11b23f9aacc | 42 | }; |
dudnwjs | 5:e11b23f9aacc | 43 | |
dudnwjs | 5:e11b23f9aacc | 44 | /// Advertising mode |
dudnwjs | 5:e11b23f9aacc | 45 | enum gap_adv_mode |
dudnwjs | 5:e11b23f9aacc | 46 | { |
dudnwjs | 5:e11b23f9aacc | 47 | /// Mode in non-discoverable |
dudnwjs | 5:e11b23f9aacc | 48 | GAP_NON_DISCOVERABLE, |
dudnwjs | 5:e11b23f9aacc | 49 | /// Mode in general discoverable |
dudnwjs | 5:e11b23f9aacc | 50 | GAP_GEN_DISCOVERABLE, |
dudnwjs | 5:e11b23f9aacc | 51 | /// Mode in limited discoverable |
dudnwjs | 5:e11b23f9aacc | 52 | GAP_LIM_DISCOVERABLE, |
dudnwjs | 5:e11b23f9aacc | 53 | /// Broadcaster mode which is a non discoverable and non connectable mode. |
dudnwjs | 5:e11b23f9aacc | 54 | GAP_BROADCASTER_MODE, |
dudnwjs | 5:e11b23f9aacc | 55 | }; |
dudnwjs | 9:fcf91f563147 | 56 | |
dudnwjs | 9:fcf91f563147 | 57 | /// Role GAP |
dudnwjs | 5:e11b23f9aacc | 58 | enum gap_role |
dudnwjs | 5:e11b23f9aacc | 59 | { |
dudnwjs | 5:e11b23f9aacc | 60 | /// No role set yet |
dudnwjs | 5:e11b23f9aacc | 61 | GAP_NO_ROLE = 0x00, |
dudnwjs | 5:e11b23f9aacc | 62 | |
dudnwjs | 5:e11b23f9aacc | 63 | /// Observer role |
dudnwjs | 5:e11b23f9aacc | 64 | GAP_OBSERVER_SCA = 0x01, |
dudnwjs | 5:e11b23f9aacc | 65 | |
dudnwjs | 5:e11b23f9aacc | 66 | /// Broadcaster role |
dudnwjs | 5:e11b23f9aacc | 67 | GAP_BROADCASTER_ADV = 0x02, |
dudnwjs | 5:e11b23f9aacc | 68 | |
dudnwjs | 5:e11b23f9aacc | 69 | /// Master/Central role |
dudnwjs | 5:e11b23f9aacc | 70 | GAP_CENTRAL_MST = (0x04 | GAP_OBSERVER_SCA), |
dudnwjs | 5:e11b23f9aacc | 71 | |
dudnwjs | 5:e11b23f9aacc | 72 | /// Peripheral/Slave role |
dudnwjs | 5:e11b23f9aacc | 73 | GAP_PERIPHERAL_SLV = (0x08 | GAP_BROADCASTER_ADV), |
dudnwjs | 5:e11b23f9aacc | 74 | }; |
dudnwjs | 5:e11b23f9aacc | 75 | /// Authentication mask |
dudnwjs | 5:e11b23f9aacc | 76 | enum gap_auth_mask |
dudnwjs | 5:e11b23f9aacc | 77 | { |
dudnwjs | 5:e11b23f9aacc | 78 | /// No Flag set |
dudnwjs | 5:e11b23f9aacc | 79 | GAP_AUTH_NONE = 0, |
dudnwjs | 5:e11b23f9aacc | 80 | /// Bond authentication |
dudnwjs | 5:e11b23f9aacc | 81 | GAP_AUTH_BOND = (1 << 0), |
dudnwjs | 5:e11b23f9aacc | 82 | /// Man In the middle protection |
dudnwjs | 5:e11b23f9aacc | 83 | GAP_AUTH_MITM = (1 << 2), |
dudnwjs | 5:e11b23f9aacc | 84 | }; |
dudnwjs | 5:e11b23f9aacc | 85 | |
dudnwjs | 5:e11b23f9aacc | 86 | |
dudnwjs | 5:e11b23f9aacc | 87 | /// Authentication Requirements |
dudnwjs | 5:e11b23f9aacc | 88 | enum gap_auth |
dudnwjs | 5:e11b23f9aacc | 89 | { |
dudnwjs | 5:e11b23f9aacc | 90 | /// No MITM No Bonding |
dudnwjs | 5:e11b23f9aacc | 91 | GAP_AUTH_REQ_NO_MITM_NO_BOND = (GAP_AUTH_NONE), |
dudnwjs | 5:e11b23f9aacc | 92 | /// No MITM Bonding |
dudnwjs | 5:e11b23f9aacc | 93 | GAP_AUTH_REQ_NO_MITM_BOND = (GAP_AUTH_BOND), |
dudnwjs | 5:e11b23f9aacc | 94 | /// MITM No Bonding |
dudnwjs | 5:e11b23f9aacc | 95 | GAP_AUTH_REQ_MITM_NO_BOND = (GAP_AUTH_MITM), |
dudnwjs | 5:e11b23f9aacc | 96 | /// MITM and Bonding |
dudnwjs | 5:e11b23f9aacc | 97 | GAP_AUTH_REQ_MITM_BOND = (GAP_AUTH_MITM | GAP_AUTH_BOND), |
dudnwjs | 5:e11b23f9aacc | 98 | GAP_AUTH_REQ_LAST |
dudnwjs | 5:e11b23f9aacc | 99 | }; |
dudnwjs | 5:e11b23f9aacc | 100 | |
dudnwjs | 5:e11b23f9aacc | 101 | /// Authorization setting |
dudnwjs | 5:e11b23f9aacc | 102 | enum gap_authz |
dudnwjs | 5:e11b23f9aacc | 103 | { |
dudnwjs | 5:e11b23f9aacc | 104 | /// Authorization not set, application informed when authorization requested |
dudnwjs | 5:e11b23f9aacc | 105 | GAP_AUTHZ_NOT_SET = 0x00, |
dudnwjs | 5:e11b23f9aacc | 106 | /// Authorization request automatically accepted |
dudnwjs | 5:e11b23f9aacc | 107 | GAP_AUTHZ_ACCEPT = 0x01, |
dudnwjs | 5:e11b23f9aacc | 108 | /// Authorization request automatically rejected |
dudnwjs | 5:e11b23f9aacc | 109 | GAP_AUTHZ_REJECT = 0x02, |
dudnwjs | 5:e11b23f9aacc | 110 | }; |
dudnwjs | 9:fcf91f563147 | 111 | |
dudnwjs | 9:fcf91f563147 | 112 | }//namespace |
dudnwjs | 5:e11b23f9aacc | 113 | |
dudnwjs | 9:fcf91f563147 | 114 | /// @} dialog_fota module |
dudnwjs | 9:fcf91f563147 | 115 | |
dudnwjs | 5:e11b23f9aacc | 116 | #endif//GAP_H |