Okundu Omeni
/
wifi-https-ble-sm-uart-atcmd-5-13-1
this is using the mbed os version 5-13-1
source/common_config.h@129:590bdc2dcf5b, 2019-07-19 (annotated)
- Committer:
- ocomeni
- Date:
- Fri Jul 19 16:49:26 2019 +0000
- Branch:
- PassingRegression
- Revision:
- 129:590bdc2dcf5b
- Parent:
- 127:a21788227ca6
Implementation of Access token acquisition; 1. make request with credentials - DONE; 2. get response - DONE; 3. extract Id and refresh tokens from response - DONE; 4. integrate with code - DONE; Testing ongoing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ocomeni | 74:f26e846adfe9 | 1 | #ifndef __COMMON_CONFIG_H__ |
ocomeni | 74:f26e846adfe9 | 2 | #define __COMMON_CONFIG_H__ |
ocomeni | 74:f26e846adfe9 | 3 | |
ocomeni | 119:8d939a902333 | 4 | #define DEFAULT_BAUD_RATE 115200 |
ocomeni | 119:8d939a902333 | 5 | #define MAX_BLE_PACKET_SIZE 256 |
ocomeni | 74:f26e846adfe9 | 6 | #define TX_BUFFER_LEN 4*256 |
ocomeni | 74:f26e846adfe9 | 7 | #define RX_BUFFER_LEN 4*256 |
ocomeni | 74:f26e846adfe9 | 8 | #define BTLE_THREAD_PRIORITY osPriorityRealtime |
ocomeni | 105:e5ce023eee93 | 9 | #define WIFI_THREAD_PRIORITY osPriorityRealtime |
ocomeni | 105:e5ce023eee93 | 10 | #define ATCMD_THREAD_PRIORITY osPriorityHigh |
ocomeni | 74:f26e846adfe9 | 11 | #ifndef UBLOX_ODIN_W2_RECV_TIMEOUT |
ocomeni | 103:7b566b522427 | 12 | #define UBLOX_ODIN_W2_RECV_TIMEOUT 5 |
ocomeni | 74:f26e846adfe9 | 13 | #endif |
ocomeni | 92:ec9550034276 | 14 | #define USE_MALLOC_FOR_COMMAND_MEMORY_POOL |
ocomeni | 126:9bc33f8b57d5 | 15 | #define WIFI_CONNECT_TIMEOUT_SECS 30 |
ocomeni | 105:e5ce023eee93 | 16 | #define MAIN_LOOP_WAIT_TIME_MS 100 // milliseconds |
ocomeni | 105:e5ce023eee93 | 17 | #define WIFI_MAIN_LOOP_WAIT_TIME_MS 101 // milliseconds |
ocomeni | 95:290859010c8c | 18 | #define MAX_RESPONSE_STRING_LEN 512 // maximum response string length of 512 bytes |
ocomeni | 95:290859010c8c | 19 | #define DEFAULT_WIFI_CHANNEL 0 |
ocomeni | 99:05398b3184f8 | 20 | #define DEFAULT_BTLE_CHANNEL 1 |
ocomeni | 95:290859010c8c | 21 | #define WIFI_LINK_ENABLED "+UUWLE:" |
ocomeni | 124:eae4512b131b | 22 | #define WIFI_LINK_DISABLED "+UUWLD:" |
ocomeni | 99:05398b3184f8 | 23 | #define NETWORK_UP_URC "+UUNU" |
ocomeni | 124:eae4512b131b | 24 | #define NETWORK_DOWN_URC "+UUND" |
ocomeni | 100:80ef4bc31b7a | 25 | #define PEER_CONNECTED_URC "+UUDPC:" |
ocomeni | 124:eae4512b131b | 26 | #define PEER_DISCONNECTED_URC "+UUDPD:" |
ocomeni | 104:11e9605093c9 | 27 | #define NETWORK_STATUS "+UNSTAT:" |
ocomeni | 104:11e9605093c9 | 28 | #define WIFI_NETWORK_STATUS "+UWSSTAT:" |
ocomeni | 99:05398b3184f8 | 29 | #define UDDRP_ERROR "\r\nERROR\r\n" |
ocomeni | 99:05398b3184f8 | 30 | #define UDDRP_WRITE_OK "\r\nOK\r\n" |
ocomeni | 99:05398b3184f8 | 31 | #define HOSTNAME_RESPONSE_LEN 14 |
ocomeni | 95:290859010c8c | 32 | #define WIFI_STATION 1 |
ocomeni | 95:290859010c8c | 33 | #define WIFI_CONFIG_ID 0 |
ocomeni | 95:290859010c8c | 34 | #define WIFI_INTERFACE_ID 0 |
ocomeni | 95:290859010c8c | 35 | #define DEFAULT_DNS_ADDRESS "0.0.0.0" |
ocomeni | 121:ac4f59839e4f | 36 | #define BLE_CONNECTION 1 |
ocomeni | 99:05398b3184f8 | 37 | #define TCP_PROTOCOL 0 |
ocomeni | 99:05398b3184f8 | 38 | #define UDP_PROTOCOL 1 |
ocomeni | 99:05398b3184f8 | 39 | #define IPv4_CONNECTION 0x02 |
ocomeni | 100:80ef4bc31b7a | 40 | #define IP_PEER_HANDLE 0x02 |
ocomeni | 100:80ef4bc31b7a | 41 | #define BTLE_PEER_HANDLE 0x01 |
ocomeni | 121:ac4f59839e4f | 42 | #define GATT_TYPE 0x00 |
ocomeni | 121:ac4f59839e4f | 43 | #define BLE_UUID_PROFILE 3 |
ocomeni | 121:ac4f59839e4f | 44 | #define BLE_FRAME_SIZE 64 |
ocomeni | 100:80ef4bc31b7a | 45 | #define DEFAULT_LOCAL_PORT 0 |
ocomeni | 118:8df0e9c2ee3f | 46 | #define PQDSZ 2 // size of Wifi Pool/Queue data structures |
ocomeni | 118:8df0e9c2ee3f | 47 | #define PQDSZ_BLE 8 // size of BLE Pool/Queue data structures |
ocomeni | 102:9748f290a1a5 | 48 | #define MAX_HTTP_HDR_LEN 512 |
ocomeni | 102:9748f290a1a5 | 49 | #define HTTP_HEADER_START_LINE "HTTP/1.1 " |
ocomeni | 102:9748f290a1a5 | 50 | #define HTTP_HEADER_CONTENT_TYPE "Content-Type:" |
ocomeni | 102:9748f290a1a5 | 51 | #define HTTP_HEADER_CONTENT_LEN "Content-Length:" |
ocomeni | 110:c722dda4f2ff | 52 | #define QUEUE_WAIT_TIMEOUT_MS 1000 |
ocomeni | 118:8df0e9c2ee3f | 53 | #define CLOUD_RETRY_TIME_MS 10000 |
ocomeni | 121:ac4f59839e4f | 54 | #define MAX_BLE_POOL_DATA_SIZE 40 |
ocomeni | 119:8d939a902333 | 55 | #define BLE_PROCESS_QUEUES_INTERVAL_MS 200 // check BLE queues every 200 ms |
ocomeni | 123:a49e9ffbaca6 | 56 | #define BLE_IF_ID 1 |
ocomeni | 123:a49e9ffbaca6 | 57 | #define WIFI_IF_ID 2 |
ocomeni | 123:a49e9ffbaca6 | 58 | #define LOCAL_ADDRESS_RESP "+UMLA:" |
ocomeni | 123:a49e9ffbaca6 | 59 | #define BLE_DEVICE_NAME_RESP "+UBTLN:" |
ocomeni | 129:590bdc2dcf5b | 60 | #define ATCMD_MGR_FULL_DEBUG_ENA 0x01 |
ocomeni | 129:590bdc2dcf5b | 61 | #define WIFI_MGR_FULL_DEBUG_ENA 0x02 |
ocomeni | 129:590bdc2dcf5b | 62 | #define BTLE_MGR_FULL_DEBUG_ENA 0x04 |
ocomeni | 129:590bdc2dcf5b | 63 | #define ONE_SECOND 1000 // 1000 ms |
ocomeni | 129:590bdc2dcf5b | 64 | #define HTTPS_URL_PREFIX "https://" |
ocomeni | 129:590bdc2dcf5b | 65 | #define TLS_RETRY_TIMEOUT_MS 2000 |
ocomeni | 103:7b566b522427 | 66 | //#define ENABLE_MEMORY_CHECKS |
ocomeni | 122:62166886db5f | 67 | //#define SEND_DEBUG_MESSAGES |
ocomeni | 122:62166886db5f | 68 | |
ocomeni | 122:62166886db5f | 69 | #define TRIM_AWS_HEADER_ENTRIES |
ocomeni | 122:62166886db5f | 70 | #define SEND_CLOUD_OK_MSG |
ocomeni | 95:290859010c8c | 71 | typedef enum |
ocomeni | 95:290859010c8c | 72 | { |
ocomeni | 95:290859010c8c | 73 | IF_HW_ADDRESS = 0, |
ocomeni | 95:290859010c8c | 74 | NETWORK_IF_STATUS = 1, |
ocomeni | 95:290859010c8c | 75 | INTERFACE_TYPE = 2, |
ocomeni | 95:290859010c8c | 76 | IPv4_ADDRESS = 101, |
ocomeni | 95:290859010c8c | 77 | SUBNET_MASK = 102, |
ocomeni | 95:290859010c8c | 78 | GATEWAY_ADDRESS = 103, |
ocomeni | 95:290859010c8c | 79 | PRIMARY_DNS_SERVER = 104, |
ocomeni | 95:290859010c8c | 80 | SECONDARY_DNS_SERVER = 105, |
ocomeni | 95:290859010c8c | 81 | IPv6_ADDRESS = 201 |
ocomeni | 95:290859010c8c | 82 | }net_stat_id_t; |
ocomeni | 95:290859010c8c | 83 | |
ocomeni | 95:290859010c8c | 84 | typedef enum |
ocomeni | 95:290859010c8c | 85 | { |
ocomeni | 95:290859010c8c | 86 | WIFI_SSID = 0, |
ocomeni | 95:290859010c8c | 87 | WIFI_BSSID = 1, |
ocomeni | 95:290859010c8c | 88 | WIFI__CURRENT_CHANNEL = 2, |
ocomeni | 95:290859010c8c | 89 | WIFI_STA_STATUS = 3, |
ocomeni | 95:290859010c8c | 90 | WIFI_RSSI = 6 |
ocomeni | 95:290859010c8c | 91 | }wifi_stat_id_t; |
ocomeni | 95:290859010c8c | 92 | |
ocomeni | 95:290859010c8c | 93 | const net_stat_id_t netStatusIds[] = {IF_HW_ADDRESS, NETWORK_IF_STATUS, |
ocomeni | 95:290859010c8c | 94 | INTERFACE_TYPE, IPv4_ADDRESS, |
ocomeni | 95:290859010c8c | 95 | SUBNET_MASK, GATEWAY_ADDRESS, |
ocomeni | 95:290859010c8c | 96 | PRIMARY_DNS_SERVER, SECONDARY_DNS_SERVER, |
ocomeni | 95:290859010c8c | 97 | IPv6_ADDRESS}; |
ocomeni | 95:290859010c8c | 98 | |
ocomeni | 95:290859010c8c | 99 | |
ocomeni | 95:290859010c8c | 100 | const int NumNetworkStatus = sizeof(netStatusIds)/sizeof(uint8_t); |
ocomeni | 95:290859010c8c | 101 | |
ocomeni | 95:290859010c8c | 102 | |
ocomeni | 95:290859010c8c | 103 | const wifi_stat_id_t wifiStatusIds[] = {WIFI_SSID, WIFI_BSSID, |
ocomeni | 95:290859010c8c | 104 | WIFI__CURRENT_CHANNEL, WIFI_STA_STATUS, |
ocomeni | 95:290859010c8c | 105 | WIFI_RSSI}; |
ocomeni | 95:290859010c8c | 106 | |
ocomeni | 95:290859010c8c | 107 | const int NumWiFiStatus = sizeof(wifiStatusIds)/sizeof(uint8_t); |
ocomeni | 95:290859010c8c | 108 | |
ocomeni | 83:9c271a50a70b | 109 | const uint8_t hello_msg[] = {0xaa,0x00,0x96,0x00,0x36,0x00,0x50,0x4f |
ocomeni | 83:9c271a50a70b | 110 | ,0x53,0x54,0x20,0x2f,0x6e,0x75,0x64,0x67 |
ocomeni | 83:9c271a50a70b | 111 | ,0x65,0x62,0x6f,0x78,0x2f,0x76,0x31,0x20 |
ocomeni | 83:9c271a50a70b | 112 | ,0x48,0x54,0x54,0x50,0x2f,0x31,0x2e,0x31 |
ocomeni | 83:9c271a50a70b | 113 | ,0x0d,0x0a,0x48,0x6f,0x73,0x74,0x3a,0x20 |
ocomeni | 83:9c271a50a70b | 114 | ,0x33,0x35,0x2e,0x31,0x37,0x36,0x2e,0x31 |
ocomeni | 83:9c271a50a70b | 115 | ,0x39,0x32,0x2e,0x33,0x33,0x3a,0x38,0x30 |
ocomeni | 83:9c271a50a70b | 116 | ,0x0d,0x0a,0x41,0x63,0x63,0x65,0x70,0x74 |
ocomeni | 83:9c271a50a70b | 117 | ,0x3a,0x20,0x2a,0x2f,0x2a,0x0d,0x0a,0x43 |
ocomeni | 83:9c271a50a70b | 118 | ,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x54 |
ocomeni | 83:9c271a50a70b | 119 | ,0x79,0x70,0x65,0x3a,0x20,0x61,0x70,0x70 |
ocomeni | 83:9c271a50a70b | 120 | ,0x6c,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e |
ocomeni | 83:9c271a50a70b | 121 | ,0x2f,0x6f,0x63,0x74,0x65,0x74,0x2d,0x73 |
ocomeni | 83:9c271a50a70b | 122 | ,0x74,0x72,0x65,0x61,0x6d,0x0d,0x0a,0x43 |
ocomeni | 83:9c271a50a70b | 123 | ,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x4c |
ocomeni | 83:9c271a50a70b | 124 | ,0x65,0x6e,0x67,0x74,0x68,0x3a,0x20,0x32 |
ocomeni | 83:9c271a50a70b | 125 | ,0x30,0x0d,0x0a,0x0d,0x0a,0x00,0x08,0xd4 |
ocomeni | 83:9c271a50a70b | 126 | ,0xca,0x6e,0x79,0x05,0x4e,0x01,0x68,0x65 |
ocomeni | 83:9c271a50a70b | 127 | ,0x6c,0x6c,0x6f,0x00,0x00,0x91,0xb5,0xa4 |
ocomeni | 83:9c271a50a70b | 128 | ,0x10,0x55}; |
ocomeni | 74:f26e846adfe9 | 129 | #endif // __COMMON_CONFIG_H__ |