this is using the mbed os version 5-13-1
source/common_types.h@119:8d939a902333, 2019-05-27 (annotated)
- Committer:
- ocomeni
- Date:
- Mon May 27 12:34:58 2019 +0000
- Branch:
- PassingRegression
- Revision:
- 119:8d939a902333
- Parent:
- 118:8df0e9c2ee3f
- Child:
- 120:779b74689747
- implemented cloud connection keep-alive mechanism; - implemented BLE manager state machine for processing messages from radio RX and AT commands.; this version passes end-2-end testing
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ocomeni | 78:07bb86e3ce14 | 1 | #ifndef __COMMON_TYPES_H__ |
| ocomeni | 78:07bb86e3ce14 | 2 | #define __COMMON_TYPES_H__ |
| ocomeni | 78:07bb86e3ce14 | 3 | #include <mbed.h> |
| ocomeni | 81:637a87eb8170 | 4 | #include <string> |
| ocomeni | 79:a2187bbfa407 | 5 | #include "ble/BLE.h" |
| ocomeni | 79:a2187bbfa407 | 6 | #include "SecurityManager.h" |
| ocomeni | 84:7c7add00f4bf | 7 | #include "http_request.h" |
| ocomeni | 80:e8f0e92e3ac9 | 8 | #include "common_config.h" |
| ocomeni | 78:07bb86e3ce14 | 9 | #define BLE_MAX_DEVICE_NAME_LEN 10 |
| ocomeni | 78:07bb86e3ce14 | 10 | #define MAX_SSID_LEN 32 |
| ocomeni | 78:07bb86e3ce14 | 11 | #define MAX_PASSKEY_LEN 32 |
| ocomeni | 84:7c7add00f4bf | 12 | #define EDM_START_BYTE 0xAA |
| ocomeni | 84:7c7add00f4bf | 13 | #define EDM_STOP_BYTE 0x55 |
| ocomeni | 90:ed0267eca7b5 | 14 | #define EDM_HDR_LEN 6 |
| ocomeni | 84:7c7add00f4bf | 15 | #define MAX_EDM_PAYLOAD_LEN (4096-1) |
| ocomeni | 84:7c7add00f4bf | 16 | #define MIN_EDM_PAYLOAD_LEN (2) |
| ocomeni | 84:7c7add00f4bf | 17 | #define MAX_HTTP_HEADER_LINES |
| ocomeni | 84:7c7add00f4bf | 18 | #define MAX_URL_LEN 100 |
| ocomeni | 100:80ef4bc31b7a | 19 | #define MAX_IPv4_LEN 16 |
| ocomeni | 116:2296cf274661 | 20 | #define MAX_CLOUD_USER_ID_LEN 32 |
| ocomeni | 116:2296cf274661 | 21 | #define MAX_CLOUD_PASSWORD_LEN 32 |
| ocomeni | 118:8df0e9c2ee3f | 22 | #define REC_DB_MSGTYPE 0x09 |
| ocomeni | 118:8df0e9c2ee3f | 23 | #define BAR_DB_MSGTYPE 0x06 |
| ocomeni | 78:07bb86e3ce14 | 24 | /** ble configuration structure |
| ocomeni | 78:07bb86e3ce14 | 25 | */ |
| ocomeni | 92:ec9550034276 | 26 | typedef struct { |
| ocomeni | 79:a2187bbfa407 | 27 | char deviceName[BLE_MAX_DEVICE_NAME_LEN]; /* BLE Device Name */ |
| ocomeni | 79:a2187bbfa407 | 28 | uint16_t advInterval; /* advertising interval in msecs */ |
| ocomeni | 79:a2187bbfa407 | 29 | uint16_t advTimeout; /* advertising timeout in secs */ |
| ocomeni | 79:a2187bbfa407 | 30 | //Passkey_t pairingKey; /* pairing Key */ |
| ocomeni | 79:a2187bbfa407 | 31 | uint8_t pairingKey[6]; /* pairing Key */ |
| ocomeni | 78:07bb86e3ce14 | 32 | } ble_config_t; |
| ocomeni | 78:07bb86e3ce14 | 33 | |
| ocomeni | 116:2296cf274661 | 34 | /** login token configuration structure |
| ocomeni | 116:2296cf274661 | 35 | */ |
| ocomeni | 116:2296cf274661 | 36 | typedef struct { |
| ocomeni | 116:2296cf274661 | 37 | char userid[MAX_CLOUD_USER_ID_LEN]; /* cloud login userid */ |
| ocomeni | 116:2296cf274661 | 38 | char pass[MAX_CLOUD_PASSWORD_LEN]; /* cloud login password */ |
| ocomeni | 116:2296cf274661 | 39 | } login_config_t; |
| ocomeni | 116:2296cf274661 | 40 | |
| ocomeni | 103:7b566b522427 | 41 | /** wifi configuration structure |
| ocomeni | 78:07bb86e3ce14 | 42 | */ |
| ocomeni | 92:ec9550034276 | 43 | typedef struct { |
| ocomeni | 78:07bb86e3ce14 | 44 | char ssid[MAX_SSID_LEN]; /* WiFi SSID */ |
| ocomeni | 78:07bb86e3ce14 | 45 | char pass[MAX_PASSKEY_LEN]; /* WiFi Passkey */ |
| ocomeni | 78:07bb86e3ce14 | 46 | nsapi_security_t security; /* WiFi security */ |
| ocomeni | 78:07bb86e3ce14 | 47 | } wifi_config_t; |
| ocomeni | 78:07bb86e3ce14 | 48 | |
| ocomeni | 78:07bb86e3ce14 | 49 | |
| ocomeni | 92:ec9550034276 | 50 | typedef enum |
| ocomeni | 79:a2187bbfa407 | 51 | { |
| ocomeni | 114:b11bb96c09f3 | 52 | MAIN_IDLE, |
| ocomeni | 114:b11bb96c09f3 | 53 | START_BLE, |
| ocomeni | 114:b11bb96c09f3 | 54 | STOP_BLE, |
| ocomeni | 114:b11bb96c09f3 | 55 | START_WIFI, |
| ocomeni | 114:b11bb96c09f3 | 56 | STOP_WIFI |
| ocomeni | 114:b11bb96c09f3 | 57 | }main_states_t; |
| ocomeni | 114:b11bb96c09f3 | 58 | |
| ocomeni | 114:b11bb96c09f3 | 59 | |
| ocomeni | 114:b11bb96c09f3 | 60 | typedef enum |
| ocomeni | 114:b11bb96c09f3 | 61 | { |
| ocomeni | 104:11e9605093c9 | 62 | RESPONSE_OK, |
| ocomeni | 104:11e9605093c9 | 63 | TLS_CONNECTION_FAILED, |
| ocomeni | 104:11e9605093c9 | 64 | HTTP_REQUEST_FAILED |
| ocomeni | 104:11e9605093c9 | 65 | }http_result_t; |
| ocomeni | 104:11e9605093c9 | 66 | |
| ocomeni | 104:11e9605093c9 | 67 | typedef enum |
| ocomeni | 104:11e9605093c9 | 68 | { |
| ocomeni | 95:290859010c8c | 69 | WIFI_CONFIG_RESET, |
| ocomeni | 95:290859010c8c | 70 | WIFI_CONFIG_STORE, |
| ocomeni | 95:290859010c8c | 71 | WIFI_CONFIG_LOAD, |
| ocomeni | 95:290859010c8c | 72 | WIFI_CONFIG_ACTIVATE, |
| ocomeni | 95:290859010c8c | 73 | WIFI_CONFIG_DEACTIVATE |
| ocomeni | 95:290859010c8c | 74 | }action_id_t; |
| ocomeni | 95:290859010c8c | 75 | |
| ocomeni | 95:290859010c8c | 76 | |
| ocomeni | 95:290859010c8c | 77 | typedef enum |
| ocomeni | 95:290859010c8c | 78 | { |
| ocomeni | 79:a2187bbfa407 | 79 | WIFI_CMD_NONE, |
| ocomeni | 81:637a87eb8170 | 80 | WIFI_CMD_CONFIG, |
| ocomeni | 81:637a87eb8170 | 81 | WIFI_CMD_INTERNET_CONFIG, |
| ocomeni | 79:a2187bbfa407 | 82 | WIFI_CMD_SCAN, |
| ocomeni | 81:637a87eb8170 | 83 | WIFI_CMD_DETAILED_SCAN, |
| ocomeni | 79:a2187bbfa407 | 84 | WIFI_CMD_CONNECT, |
| ocomeni | 79:a2187bbfa407 | 85 | WIFI_CMD_DISCONNECT, |
| ocomeni | 95:290859010c8c | 86 | WIFI_CMD_NETWORK_STATUS, |
| ocomeni | 95:290859010c8c | 87 | WIFI_CMD_WIFI_STATUS, |
| ocomeni | 79:a2187bbfa407 | 88 | WIFI_CMD_SEND_HTTPS_REQ, |
| ocomeni | 119:8d939a902333 | 89 | WIFI_CMD_SEND_HTTP_REQ, |
| ocomeni | 119:8d939a902333 | 90 | WIFI_CMD_INTERNET_KEEP_ALIVE |
| ocomeni | 79:a2187bbfa407 | 91 | }wifi_cmd_t; |
| ocomeni | 79:a2187bbfa407 | 92 | |
| ocomeni | 92:ec9550034276 | 93 | typedef enum |
| ocomeni | 81:637a87eb8170 | 94 | { |
| ocomeni | 100:80ef4bc31b7a | 95 | AT_RESP_NONE = 0, |
| ocomeni | 100:80ef4bc31b7a | 96 | AT_SCAN_RESP = 1, |
| ocomeni | 100:80ef4bc31b7a | 97 | AT_DETAILED_SCAN_RESP = 2, |
| ocomeni | 100:80ef4bc31b7a | 98 | AT_CONNECT_RESP = 3, |
| ocomeni | 100:80ef4bc31b7a | 99 | AT_DISCONNECT_RESP = 4, |
| ocomeni | 100:80ef4bc31b7a | 100 | WIFI_RECONNECT_INFO = 5, |
| ocomeni | 100:80ef4bc31b7a | 101 | WIFI_DISCONNECT_INFO = 6, |
| ocomeni | 100:80ef4bc31b7a | 102 | AT_CONFIG_RESP = 7, |
| ocomeni | 100:80ef4bc31b7a | 103 | AT_INTERNET_CONFIG_RESP = 8, |
| ocomeni | 100:80ef4bc31b7a | 104 | AT_NETWORK_STATUS_RESP = 9, |
| ocomeni | 100:80ef4bc31b7a | 105 | AT_WIFI_STATUS_RESP = 10, |
| ocomeni | 100:80ef4bc31b7a | 106 | AT_HTTPS_RESP = 11, |
| ocomeni | 100:80ef4bc31b7a | 107 | AT_HTTPS_RESP_DOWNLOAD = 12, |
| ocomeni | 100:80ef4bc31b7a | 108 | AT_HTTP_RESP = 13, |
| ocomeni | 100:80ef4bc31b7a | 109 | AT_HTTP_RESP_DOWNLOAD = 14, |
| ocomeni | 100:80ef4bc31b7a | 110 | AT_EVENT = 15, |
| ocomeni | 100:80ef4bc31b7a | 111 | CONNECT_EVENT = 16, |
| ocomeni | 100:80ef4bc31b7a | 112 | DATA_EVENT = 17, |
| ocomeni | 104:11e9605093c9 | 113 | AT_COMMAND_FAILED = 18, |
| ocomeni | 118:8df0e9c2ee3f | 114 | WIFI_WATCH_DOG = 19, |
| ocomeni | 119:8d939a902333 | 115 | BLE_CONNECT_EVENT = 20, |
| ocomeni | 119:8d939a902333 | 116 | AT_BLE_EVENT = 21, |
| ocomeni | 119:8d939a902333 | 117 | AT_BLE_RESPONSE = 22, |
| ocomeni | 119:8d939a902333 | 118 | AT_SOCKET_KEEP_ALIVE_OK = 23, |
| ocomeni | 119:8d939a902333 | 119 | AT_SOCKET_KEEP_ALIVE_FAILED = 24 |
| ocomeni | 81:637a87eb8170 | 120 | }at_cmd_resp_t; |
| ocomeni | 81:637a87eb8170 | 121 | |
| ocomeni | 90:ed0267eca7b5 | 122 | typedef enum edm_msg_id |
| ocomeni | 90:ed0267eca7b5 | 123 | { |
| ocomeni | 90:ed0267eca7b5 | 124 | CONNECT_MSG_ID = 0x0010, |
| ocomeni | 90:ed0267eca7b5 | 125 | DISCONNECT_MSG_ID = 0x0020, |
| ocomeni | 90:ed0267eca7b5 | 126 | DATA_MSG_ID = 0x0030, |
| ocomeni | 90:ed0267eca7b5 | 127 | AT_MSG_ID = 0x0040 |
| ocomeni | 90:ed0267eca7b5 | 128 | }edm_msg_id_t; |
| ocomeni | 90:ed0267eca7b5 | 129 | |
| ocomeni | 90:ed0267eca7b5 | 130 | |
| ocomeni | 90:ed0267eca7b5 | 131 | typedef enum edm_msg_type |
| ocomeni | 90:ed0267eca7b5 | 132 | { |
| ocomeni | 90:ed0267eca7b5 | 133 | EVENT_MSG_TYPE = 0x01, |
| ocomeni | 90:ed0267eca7b5 | 134 | INDICATION_MSG_TYPE = 0x02, |
| ocomeni | 90:ed0267eca7b5 | 135 | RESPONSE_MSG_TYPE = 0x03, |
| ocomeni | 90:ed0267eca7b5 | 136 | REQUEST_MSG_TYPE = 0x04, |
| ocomeni | 90:ed0267eca7b5 | 137 | CONFIRMATION_MSG_TYPE = 0x05, |
| ocomeni | 90:ed0267eca7b5 | 138 | COMMAND_MSG_TYPE = 0x06 |
| ocomeni | 90:ed0267eca7b5 | 139 | }edm_msg_type_t; |
| ocomeni | 90:ed0267eca7b5 | 140 | |
| ocomeni | 90:ed0267eca7b5 | 141 | typedef enum channel_id |
| ocomeni | 90:ed0267eca7b5 | 142 | { |
| ocomeni | 90:ed0267eca7b5 | 143 | WIFI_CHANNEL = 0x00, |
| ocomeni | 93:06e755a80187 | 144 | BLE_CHANNEL = 0x01, |
| ocomeni | 93:06e755a80187 | 145 | NO_CHANNEL = 0xFF |
| ocomeni | 90:ed0267eca7b5 | 146 | }channel_id_t; |
| ocomeni | 90:ed0267eca7b5 | 147 | |
| ocomeni | 90:ed0267eca7b5 | 148 | |
| ocomeni | 81:637a87eb8170 | 149 | |
| ocomeni | 81:637a87eb8170 | 150 | typedef enum at_data_mode |
| ocomeni | 81:637a87eb8170 | 151 | { |
| ocomeni | 81:637a87eb8170 | 152 | AT_CMD_DATA_MODE, |
| ocomeni | 81:637a87eb8170 | 153 | AT_STD_DATA_MODE, |
| ocomeni | 81:637a87eb8170 | 154 | AT_EXT_DATA_MODE |
| ocomeni | 81:637a87eb8170 | 155 | }at_data_mode_t; |
| ocomeni | 81:637a87eb8170 | 156 | |
| ocomeni | 83:9c271a50a70b | 157 | typedef enum edm_payload_id |
| ocomeni | 83:9c271a50a70b | 158 | { |
| ocomeni | 99:05398b3184f8 | 159 | CONNECT_EVENT_ID = 0x0011, |
| ocomeni | 99:05398b3184f8 | 160 | DISCONNECT_EVENT_ID = 0x0021, |
| ocomeni | 99:05398b3184f8 | 161 | DATA_EVENT_ID = 0x0031, |
| ocomeni | 99:05398b3184f8 | 162 | DATA_COMMAND_ID = 0x0036, |
| ocomeni | 99:05398b3184f8 | 163 | AT_REQUEST_ID = 0x0044, |
| ocomeni | 99:05398b3184f8 | 164 | AT_CONFIRMATION_ID = 0x0045, |
| ocomeni | 99:05398b3184f8 | 165 | AT_EVENT_ID = 0x0041 |
| ocomeni | 83:9c271a50a70b | 166 | }edm_payload_id_t; |
| ocomeni | 83:9c271a50a70b | 167 | |
| ocomeni | 81:637a87eb8170 | 168 | typedef enum conn_scheme |
| ocomeni | 81:637a87eb8170 | 169 | { |
| ocomeni | 81:637a87eb8170 | 170 | INVALID_SCHEME, |
| ocomeni | 81:637a87eb8170 | 171 | ALWAYS_CONNECTED, |
| ocomeni | 81:637a87eb8170 | 172 | EXTERNAL_CONNECT |
| ocomeni | 81:637a87eb8170 | 173 | }conn_scheme_t; |
| ocomeni | 81:637a87eb8170 | 174 | |
| ocomeni | 79:a2187bbfa407 | 175 | |
| ocomeni | 117:8fd05113efc1 | 176 | typedef enum nvstore_key |
| ocomeni | 117:8fd05113efc1 | 177 | { |
| ocomeni | 117:8fd05113efc1 | 178 | APP_CONFIG_0 = 1, |
| ocomeni | 117:8fd05113efc1 | 179 | APP_CONFIG_1 = 2, |
| ocomeni | 117:8fd05113efc1 | 180 | APP_CONFIG_2 = 4 |
| ocomeni | 117:8fd05113efc1 | 181 | }nvstore_key_t; |
| ocomeni | 117:8fd05113efc1 | 182 | |
| ocomeni | 117:8fd05113efc1 | 183 | |
| ocomeni | 117:8fd05113efc1 | 184 | typedef struct { |
| ocomeni | 117:8fd05113efc1 | 185 | int baudrate; /* baud rate */ |
| ocomeni | 117:8fd05113efc1 | 186 | uint8_t flow_ctrl; /* 2 = no flow control */ |
| ocomeni | 117:8fd05113efc1 | 187 | uint8_t data_bits; /* 8 data bits */ |
| ocomeni | 117:8fd05113efc1 | 188 | uint8_t stop_bits; /* 1 start bit */ |
| ocomeni | 117:8fd05113efc1 | 189 | uint8_t parity; /* 1 parity bit */ |
| ocomeni | 117:8fd05113efc1 | 190 | uint8_t change_after_confirm; /* 1 */ |
| ocomeni | 117:8fd05113efc1 | 191 | } uart_config_t; |
| ocomeni | 117:8fd05113efc1 | 192 | |
| ocomeni | 117:8fd05113efc1 | 193 | |
| ocomeni | 117:8fd05113efc1 | 194 | |
| ocomeni | 79:a2187bbfa407 | 195 | typedef struct { |
| ocomeni | 79:a2187bbfa407 | 196 | wifi_cmd_t wifi_cmd; /* wifi command */ |
| ocomeni | 93:06e755a80187 | 197 | uint8_t padding[4-sizeof(wifi_cmd_t)]; /* padding */ |
| ocomeni | 79:a2187bbfa407 | 198 | } wifi_cmd_message_t; |
| ocomeni | 79:a2187bbfa407 | 199 | |
| ocomeni | 80:e8f0e92e3ac9 | 200 | typedef struct { |
| ocomeni | 81:637a87eb8170 | 201 | at_cmd_resp_t at_resp; /* AT response */ |
| ocomeni | 81:637a87eb8170 | 202 | } at_resp_message_t; |
| ocomeni | 81:637a87eb8170 | 203 | |
| ocomeni | 81:637a87eb8170 | 204 | typedef struct { |
| ocomeni | 80:e8f0e92e3ac9 | 205 | wifi_cmd_t wifi_cmd; /* wifi data command */ |
| ocomeni | 93:06e755a80187 | 206 | uint8_t padding[4-sizeof(wifi_cmd_t)]; /* padding */ |
| ocomeni | 81:637a87eb8170 | 207 | int dataLen; /* size of data in buffer */ |
| ocomeni | 81:637a87eb8170 | 208 | uint8_t buffer[TX_BUFFER_LEN]; /* buffer length */ |
| ocomeni | 80:e8f0e92e3ac9 | 209 | } wifi_data_msg_t; |
| ocomeni | 80:e8f0e92e3ac9 | 210 | |
| ocomeni | 81:637a87eb8170 | 211 | typedef struct { |
| ocomeni | 81:637a87eb8170 | 212 | at_cmd_resp_t at_resp; /* AT response */ |
| ocomeni | 81:637a87eb8170 | 213 | int dataLen; /* size of data in buffer */ |
| ocomeni | 81:637a87eb8170 | 214 | uint8_t buffer[TX_BUFFER_LEN]; /* buffer length */ |
| ocomeni | 81:637a87eb8170 | 215 | } at_data_msg_t; |
| ocomeni | 81:637a87eb8170 | 216 | |
| ocomeni | 81:637a87eb8170 | 217 | typedef struct { |
| ocomeni | 84:7c7add00f4bf | 218 | http_method method; /* POST/GET etc... */ |
| ocomeni | 90:ed0267eca7b5 | 219 | char * request_URI; /* request URI/path */ |
| ocomeni | 90:ed0267eca7b5 | 220 | char * http_version; /* http verstion HTTP/1.1 */ |
| ocomeni | 90:ed0267eca7b5 | 221 | char * hostName; /* host name */ |
| ocomeni | 90:ed0267eca7b5 | 222 | char * AcceptVal; /* types accepted */ |
| ocomeni | 90:ed0267eca7b5 | 223 | char * contentType; /* content type */ |
| ocomeni | 90:ed0267eca7b5 | 224 | char * contentLen; /* content length */ |
| ocomeni | 90:ed0267eca7b5 | 225 | uint8_t * body; /* body */ |
| ocomeni | 90:ed0267eca7b5 | 226 | uint8_t buffer[TX_BUFFER_LEN - 8*sizeof(char *) |
| ocomeni | 90:ed0267eca7b5 | 227 | - sizeof(http_method)]; // buffer |
| ocomeni | 84:7c7add00f4bf | 228 | } http_request_t; |
| ocomeni | 81:637a87eb8170 | 229 | |
| ocomeni | 81:637a87eb8170 | 230 | typedef struct { |
| ocomeni | 83:9c271a50a70b | 231 | uint8_t startByte; /* start Byte 0xAA */ |
| ocomeni | 83:9c271a50a70b | 232 | uint16_t payloadLen; /* payload Length */ |
| ocomeni | 83:9c271a50a70b | 233 | uint16_t payloadID; /* payload identifier */ |
| ocomeni | 90:ed0267eca7b5 | 234 | channel_id_t channel_id; /* channel_id_t*/ |
| ocomeni | 83:9c271a50a70b | 235 | } edm_header_t; |
| ocomeni | 83:9c271a50a70b | 236 | |
| ocomeni | 83:9c271a50a70b | 237 | typedef struct { |
| ocomeni | 81:637a87eb8170 | 238 | string contentType; /* content type */ |
| ocomeni | 81:637a87eb8170 | 239 | int bodyLen; /* body length */ |
| ocomeni | 81:637a87eb8170 | 240 | uint8_t body[900]; /* body */ |
| ocomeni | 81:637a87eb8170 | 241 | } http_response_t; |
| ocomeni | 81:637a87eb8170 | 242 | |
| ocomeni | 81:637a87eb8170 | 243 | typedef struct { |
| ocomeni | 81:637a87eb8170 | 244 | uint8_t peer_id ; /* peer id */ |
| ocomeni | 81:637a87eb8170 | 245 | conn_scheme_t connectionScheme; /* connection scheme */ |
| ocomeni | 90:ed0267eca7b5 | 246 | char url[MAX_URL_LEN]; /* url string */ |
| ocomeni | 100:80ef4bc31b7a | 247 | char local_IPv4Address[MAX_IPv4_LEN]; /* local Ip address */ |
| ocomeni | 100:80ef4bc31b7a | 248 | char remote_IPv4Address[MAX_IPv4_LEN]; /* remote IP address */ |
| ocomeni | 100:80ef4bc31b7a | 249 | uint16_t remote_port; /* remote port */ |
| ocomeni | 81:637a87eb8170 | 250 | } internet_config_t; |
| ocomeni | 81:637a87eb8170 | 251 | |
| ocomeni | 116:2296cf274661 | 252 | |
| ocomeni | 116:2296cf274661 | 253 | /** application configuration structure |
| ocomeni | 116:2296cf274661 | 254 | */ |
| ocomeni | 116:2296cf274661 | 255 | typedef struct { |
| ocomeni | 117:8fd05113efc1 | 256 | uart_config_t uart_config; /* UART configuration */ |
| ocomeni | 117:8fd05113efc1 | 257 | wifi_config_t wifi_config; /* wifi configuration */ |
| ocomeni | 117:8fd05113efc1 | 258 | ble_config_t ble_config; /* ble configuration */ |
| ocomeni | 117:8fd05113efc1 | 259 | internet_config_t internet_config; /* cloud configuration */ |
| ocomeni | 116:2296cf274661 | 260 | login_config_t login_config; /* cloud login credentials */ |
| ocomeni | 116:2296cf274661 | 261 | } app_config_t; |
| ocomeni | 116:2296cf274661 | 262 | |
| ocomeni | 116:2296cf274661 | 263 | |
| ocomeni | 118:8df0e9c2ee3f | 264 | /* BLE data types */ |
| ocomeni | 118:8df0e9c2ee3f | 265 | |
| ocomeni | 118:8df0e9c2ee3f | 266 | typedef enum |
| ocomeni | 118:8df0e9c2ee3f | 267 | { |
| ocomeni | 118:8df0e9c2ee3f | 268 | BLE_CMD_NONE, |
| ocomeni | 118:8df0e9c2ee3f | 269 | BLE_CMD_CONFIG, |
| ocomeni | 118:8df0e9c2ee3f | 270 | BLE_CMD_CONNECT, |
| ocomeni | 118:8df0e9c2ee3f | 271 | BLE_CMD_DISCONNECT, |
| ocomeni | 119:8d939a902333 | 272 | BLE_CMD_SEND_RX_DATA_2AT, |
| ocomeni | 118:8df0e9c2ee3f | 273 | BLE_CMD_SEND_AT_DATA_2BLE |
| ocomeni | 118:8df0e9c2ee3f | 274 | }ble_cmd_t; |
| ocomeni | 118:8df0e9c2ee3f | 275 | |
| ocomeni | 118:8df0e9c2ee3f | 276 | |
| ocomeni | 118:8df0e9c2ee3f | 277 | |
| ocomeni | 118:8df0e9c2ee3f | 278 | typedef struct { |
| ocomeni | 118:8df0e9c2ee3f | 279 | ble_cmd_t ble_cmd; /* BLE command */ |
| ocomeni | 118:8df0e9c2ee3f | 280 | int dataLen; /* size of data in buffer */ |
| ocomeni | 118:8df0e9c2ee3f | 281 | uint8_t buffer[MAX_BLE_PACKET_SIZE]; /* buffer length */ |
| ocomeni | 118:8df0e9c2ee3f | 282 | } at_ble_msg_t; |
| ocomeni | 118:8df0e9c2ee3f | 283 | |
| ocomeni | 118:8df0e9c2ee3f | 284 | |
| ocomeni | 118:8df0e9c2ee3f | 285 | typedef struct { |
| ocomeni | 118:8df0e9c2ee3f | 286 | at_cmd_resp_t at_resp; /* AT response */ |
| ocomeni | 118:8df0e9c2ee3f | 287 | int dataLen; /* size of data in buffer */ |
| ocomeni | 118:8df0e9c2ee3f | 288 | uint8_t buffer[MAX_BLE_PACKET_SIZE]; /* buffer length */ |
| ocomeni | 118:8df0e9c2ee3f | 289 | } ble_at_msg_t; |
| ocomeni | 118:8df0e9c2ee3f | 290 | |
| ocomeni | 118:8df0e9c2ee3f | 291 | |
| ocomeni | 78:07bb86e3ce14 | 292 | #endif // __COMMON_TYPES_H__ |