this is using the mbed os version 5-13-1

Dependencies:   mbed-http

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers common_config.h Source File

common_config.h

00001 #ifndef __COMMON_CONFIG_H__
00002 #define __COMMON_CONFIG_H__
00003 
00004 #define DEFAULT_BAUD_RATE   115200
00005 #define MAX_BLE_PACKET_SIZE   256
00006 #define TX_BUFFER_LEN 4*256
00007 #define RX_BUFFER_LEN 4*256
00008 #define BTLE_THREAD_PRIORITY osPriorityRealtime
00009 #define WIFI_THREAD_PRIORITY osPriorityRealtime
00010 #define ATCMD_THREAD_PRIORITY osPriorityHigh
00011 #ifndef UBLOX_ODIN_W2_RECV_TIMEOUT
00012 #define UBLOX_ODIN_W2_RECV_TIMEOUT    5
00013 #endif
00014 #define USE_MALLOC_FOR_COMMAND_MEMORY_POOL
00015 #define WIFI_CONNECT_TIMEOUT_SECS 30
00016 #define MAIN_LOOP_WAIT_TIME_MS 100 // milliseconds
00017 #define WIFI_MAIN_LOOP_WAIT_TIME_MS 101 // milliseconds
00018 #define MAX_RESPONSE_STRING_LEN   512 // maximum response string length of 512 bytes
00019 #define DEFAULT_WIFI_CHANNEL      0
00020 #define DEFAULT_BTLE_CHANNEL      1
00021 #define WIFI_LINK_ENABLED         "+UUWLE:"
00022 #define WIFI_LINK_DISABLED        "+UUWLD:"
00023 #define NETWORK_UP_URC            "+UUNU"
00024 #define NETWORK_DOWN_URC          "+UUND"
00025 #define PEER_CONNECTED_URC        "+UUDPC:"
00026 #define PEER_DISCONNECTED_URC     "+UUDPD:"
00027 #define NETWORK_STATUS            "+UNSTAT:"
00028 #define WIFI_NETWORK_STATUS       "+UWSSTAT:"
00029 #define UDDRP_ERROR               "\r\nERROR\r\n"
00030 #define UDDRP_WRITE_OK            "\r\nOK\r\n" 
00031 #define HOSTNAME_RESPONSE_LEN     14
00032 #define WIFI_STATION              1
00033 #define WIFI_CONFIG_ID            0
00034 #define WIFI_INTERFACE_ID         0
00035 #define DEFAULT_DNS_ADDRESS       "0.0.0.0"
00036 #define BLE_CONNECTION            1
00037 #define TCP_PROTOCOL              0
00038 #define UDP_PROTOCOL              1
00039 #define IPv4_CONNECTION           0x02
00040 #define IP_PEER_HANDLE            0x02
00041 #define BTLE_PEER_HANDLE          0x01
00042 #define GATT_TYPE                 0x00
00043 #define BLE_UUID_PROFILE          3
00044 #define BLE_FRAME_SIZE            64
00045 #define DEFAULT_LOCAL_PORT        0
00046 #define PQDSZ                     2  // size of Wifi Pool/Queue data structures
00047 #define PQDSZ_BLE                 8  // size of BLE Pool/Queue data structures
00048 #define MAX_HTTP_HDR_LEN          512
00049 #define HTTP_HEADER_START_LINE    "HTTP/1.1 "
00050 #define HTTP_HEADER_CONTENT_TYPE  "Content-Type:"
00051 #define HTTP_HEADER_CONTENT_LEN   "Content-Length:"
00052 #define QUEUE_WAIT_TIMEOUT_MS     1000
00053 #define CLOUD_RETRY_TIME_MS       10000
00054 #define MAX_BLE_POOL_DATA_SIZE    40
00055 #define BLE_PROCESS_QUEUES_INTERVAL_MS  200 // check BLE queues every 200 ms
00056 #define BLE_IF_ID                       1
00057 #define WIFI_IF_ID                      2
00058 #define LOCAL_ADDRESS_RESP              "+UMLA:"
00059 #define BLE_DEVICE_NAME_RESP            "+UBTLN:"
00060 #define ATCMD_MGR_FULL_DEBUG_ENA        0x01
00061 #define WIFI_MGR_FULL_DEBUG_ENA         0x02
00062 #define BTLE_MGR_FULL_DEBUG_ENA         0x04
00063 #define ONE_SECOND                      1000 // 1000 ms
00064 #define HTTPS_URL_PREFIX                "https://"
00065 #define TLS_RETRY_TIMEOUT_MS            2000
00066 //#define ENABLE_MEMORY_CHECKS
00067 //#define SEND_DEBUG_MESSAGES
00068 
00069 #define TRIM_AWS_HEADER_ENTRIES
00070 #define SEND_CLOUD_OK_MSG
00071 typedef enum
00072 {
00073   IF_HW_ADDRESS = 0,
00074   NETWORK_IF_STATUS = 1,
00075   INTERFACE_TYPE = 2,
00076   IPv4_ADDRESS = 101,
00077   SUBNET_MASK = 102,
00078   GATEWAY_ADDRESS = 103,
00079   PRIMARY_DNS_SERVER = 104,
00080   SECONDARY_DNS_SERVER = 105,
00081   IPv6_ADDRESS = 201
00082 }net_stat_id_t;
00083 
00084 typedef enum
00085 {
00086   WIFI_SSID = 0,
00087   WIFI_BSSID = 1,
00088   WIFI__CURRENT_CHANNEL = 2,
00089   WIFI_STA_STATUS = 3,
00090   WIFI_RSSI = 6
00091 }wifi_stat_id_t;
00092 
00093 const net_stat_id_t netStatusIds[]  =  {IF_HW_ADDRESS, NETWORK_IF_STATUS, 
00094                                         INTERFACE_TYPE, IPv4_ADDRESS, 
00095                                         SUBNET_MASK, GATEWAY_ADDRESS, 
00096                                         PRIMARY_DNS_SERVER, SECONDARY_DNS_SERVER, 
00097                                         IPv6_ADDRESS};
00098                                         
00099                                         
00100 const int NumNetworkStatus    = sizeof(netStatusIds)/sizeof(uint8_t);
00101 
00102 
00103 const wifi_stat_id_t wifiStatusIds[] = {WIFI_SSID, WIFI_BSSID, 
00104                                         WIFI__CURRENT_CHANNEL, WIFI_STA_STATUS, 
00105                                         WIFI_RSSI};
00106 
00107 const int NumWiFiStatus    = sizeof(wifiStatusIds)/sizeof(uint8_t);
00108 
00109 const uint8_t hello_msg[] = {0xaa,0x00,0x96,0x00,0x36,0x00,0x50,0x4f
00110                             ,0x53,0x54,0x20,0x2f,0x6e,0x75,0x64,0x67
00111                             ,0x65,0x62,0x6f,0x78,0x2f,0x76,0x31,0x20
00112                             ,0x48,0x54,0x54,0x50,0x2f,0x31,0x2e,0x31
00113                             ,0x0d,0x0a,0x48,0x6f,0x73,0x74,0x3a,0x20
00114                             ,0x33,0x35,0x2e,0x31,0x37,0x36,0x2e,0x31
00115                             ,0x39,0x32,0x2e,0x33,0x33,0x3a,0x38,0x30
00116                             ,0x0d,0x0a,0x41,0x63,0x63,0x65,0x70,0x74
00117                             ,0x3a,0x20,0x2a,0x2f,0x2a,0x0d,0x0a,0x43
00118                             ,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x54
00119                             ,0x79,0x70,0x65,0x3a,0x20,0x61,0x70,0x70
00120                             ,0x6c,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e
00121                             ,0x2f,0x6f,0x63,0x74,0x65,0x74,0x2d,0x73
00122                             ,0x74,0x72,0x65,0x61,0x6d,0x0d,0x0a,0x43
00123                             ,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x4c
00124                             ,0x65,0x6e,0x67,0x74,0x68,0x3a,0x20,0x32
00125                             ,0x30,0x0d,0x0a,0x0d,0x0a,0x00,0x08,0xd4
00126                             ,0xca,0x6e,0x79,0x05,0x4e,0x01,0x68,0x65
00127                             ,0x6c,0x6c,0x6f,0x00,0x00,0x91,0xb5,0xa4
00128                             ,0x10,0x55};
00129 #endif // __COMMON_CONFIG_H__