Core Base Classes for the Light Endpoints
Dependents: mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more
CommonDefinitions.h@191:c83c1c5010ed, 2014-09-24 (annotated)
- Committer:
- ansond
- Date:
- Wed Sep 24 19:12:35 2014 +0000
- Revision:
- 191:c83c1c5010ed
- Parent:
- 190:25d4e4cada40
- Child:
- 192:54b758a8eaaa
updates for new status reporter
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 38:825f8e834e77 | 1 | /* Copyright C2013 Doug Anson, MIT License |
ansond | 38:825f8e834e77 | 2 | * |
ansond | 38:825f8e834e77 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
ansond | 38:825f8e834e77 | 4 | * and associated documentation files the "Software", to deal in the Software without restriction, |
ansond | 38:825f8e834e77 | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
ansond | 38:825f8e834e77 | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
ansond | 38:825f8e834e77 | 7 | * furnished to do so, subject to the following conditions: |
ansond | 38:825f8e834e77 | 8 | * |
ansond | 38:825f8e834e77 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
ansond | 38:825f8e834e77 | 10 | * substantial portions of the Software. |
ansond | 38:825f8e834e77 | 11 | * |
ansond | 38:825f8e834e77 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
ansond | 38:825f8e834e77 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
ansond | 38:825f8e834e77 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
ansond | 38:825f8e834e77 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
ansond | 38:825f8e834e77 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
ansond | 38:825f8e834e77 | 17 | */ |
ansond | 38:825f8e834e77 | 18 | |
ansond | 38:825f8e834e77 | 19 | #ifndef _COMMON_DEFINITIONS_H_ |
ansond | 38:825f8e834e77 | 20 | #define _COMMON_DEFINITIONS_H_ |
ansond | 38:825f8e834e77 | 21 | |
ansond | 190:25d4e4cada40 | 22 | // maximum memory buffer chunk (including HTTPS requests) |
ansond | 190:25d4e4cada40 | 23 | #define MAX_BUFFER_LENGTH 256 |
ansond | 190:25d4e4cada40 | 24 | |
ansond | 38:825f8e834e77 | 25 | // Error Handler Log Message Length |
ansond | 190:25d4e4cada40 | 26 | #define MAX_LOG_MESSAGE MAX_BUFFER_LENGTH // maximum size of a logging message |
ansond | 134:58e7537a8c5f | 27 | #define TEMP_BUFFER_LEN 128 // working/temp buffer length |
ansond | 38:825f8e834e77 | 28 | |
ansond | 38:825f8e834e77 | 29 | // Resource Configuration |
ansond | 134:58e7537a8c5f | 30 | #define RESOURCE_NAME_LEN 25 // Resource name max length |
ansond | 134:58e7537a8c5f | 31 | #define RESOURCE_VALUE_LEN 33 // Resource value max length |
ansond | 38:825f8e834e77 | 32 | |
ansond | 38:825f8e834e77 | 33 | // Number of Resources our Endpoint has |
ansond | 155:582462821bd7 | 34 | #define NUM_RESOURCES 30 // do not exceed this number of resources in the endpoint. currently at 25 |
ansond | 85:8af3f3101ba3 | 35 | |
ansond | 85:8af3f3101ba3 | 36 | // IOC <--> Resource Mapping |
ansond | 155:582462821bd7 | 37 | #define NUM_MAPPINGS 20 // do not exceed this number of IOC <--> NSP resource mappings. currently at 17 |
ansond | 38:825f8e834e77 | 38 | |
ansond | 38:825f8e834e77 | 39 | // MapEntry Name length |
ansond | 93:ac4a8d3c2a4f | 40 | #define MAX_NAME_LENGTH 25 |
ansond | 38:825f8e834e77 | 41 | |
ansond | 112:1fb53d4729af | 42 | // Preferences configuration |
ansond | 155:582462821bd7 | 43 | #define MAX_NUM_PREFERENCES 5 // support a total of 5 unique preferences |
ansond | 155:582462821bd7 | 44 | #define PREFERENCE_NAME_LEN 24 // largest preference name |
ansond | 155:582462821bd7 | 45 | #define PREFERENCE_VALUE_LEN 40 // largest preference value |
ansond | 134:58e7537a8c5f | 46 | |
ansond | 134:58e7537a8c5f | 47 | // Personality Configuration |
ansond | 134:58e7537a8c5f | 48 | #define NUM_PERSONALITY_INSTANCES 1 // number of isntances of a specific personality (i.e. light) in this endpoint |
ansond | 185:8a7fa652f394 | 49 | #define PERSONALITY_NAME_LEN 24 // buffer size for the personality name |
ansond | 134:58e7537a8c5f | 50 | #define PERSONALITY_NAME_INDEX 1 // start index for the ID of the personality name |
ansond | 112:1fb53d4729af | 51 | |
ansond | 38:825f8e834e77 | 52 | // Common Light Definition |
ansond | 171:3f07e1df766c | 53 | #define LIGHT_DIM_STATE "75" // initial dimming state of each light in this endpoint |
ansond | 134:58e7537a8c5f | 54 | #define LIGHT_TYPE_STRING "Light" // Type of Light (string) |
ansond | 134:58e7537a8c5f | 55 | #define LIGHT_BLINK_WAIT_MS 1000 // time between blinks (ms) |
ansond | 140:df0ca2c95982 | 56 | #define LIGHT_DEFAULT_STATE 1 // ON by default |
ansond | 140:df0ca2c95982 | 57 | |
ansond | 158:0cecb265bb18 | 58 | // Multitech probe for temperature reporting |
ansond | 158:0cecb265bb18 | 59 | //#define MULTITECH_TEMP_PROBE true |
ansond | 158:0cecb265bb18 | 60 | |
ansond | 184:b73d6c976063 | 61 | // Disable local filesystem (required for Keil debugging) |
ansond | 184:b73d6c976063 | 62 | //#define NO_LOCAL_FILESYSTEM true |
ansond | 184:b73d6c976063 | 63 | |
ansond | 183:2f586f91ff23 | 64 | // Until we get HTTPS with BasicAuth working in MBED... |
ansond | 183:2f586f91ff23 | 65 | #define GW_IPADDRESS "192.168.1.220" // gateway IP address (default) |
ansond | 183:2f586f91ff23 | 66 | #define GW_PORT "8888" // gateway port (default) |
ansond | 183:2f586f91ff23 | 67 | |
ansond | 183:2f586f91ff23 | 68 | // IOC REST URL for AutoRegister |
ansond | 183:2f586f91ff23 | 69 | #define IOC_USERNAME "anson" |
ansond | 183:2f586f91ff23 | 70 | #define IOC_PASSWORD "savetheplanet1" |
ansond | 183:2f586f91ff23 | 71 | |
ansond | 182:85c62a9f146d | 72 | // Auto Registration with IOC on init/startup |
ansond | 182:85c62a9f146d | 73 | #define AUTO_REGISTER_WITH_IOC true // true - auto register, false - dont |
ansond | 182:85c62a9f146d | 74 | |
ansond | 140:df0ca2c95982 | 75 | // Personalities may have unique default light states |
ansond | 140:df0ca2c95982 | 76 | #ifdef LIGHT_PERSONALITY |
ansond | 140:df0ca2c95982 | 77 | #undef LIGHT_DEFAULT_STATE |
ansond | 140:df0ca2c95982 | 78 | #undef LIGHT_BLINK_WAIT_MS |
ansond | 141:26dca377597f | 79 | #define LIGHT_DEFAULT_STATE "1" // ON by default |
ansond | 140:df0ca2c95982 | 80 | #define LIGHT_BLINK_WAIT_MS 1000 // time between blinks (ms) |
ansond | 167:2529c18d0eb1 | 81 | #if APM_LIGHT_ENABLE |
ansond | 167:2529c18d0eb1 | 82 | #define APM_LIGHT_PERSONALITY true |
ansond | 167:2529c18d0eb1 | 83 | #endif |
ansond | 140:df0ca2c95982 | 84 | #endif |
ansond | 140:df0ca2c95982 | 85 | #ifdef COPCAR_PERSONALITY |
ansond | 140:df0ca2c95982 | 86 | #undef LIGHT_DEFAULT_STATE |
ansond | 140:df0ca2c95982 | 87 | #undef LIGHT_BLINK_WAIT_MS |
ansond | 141:26dca377597f | 88 | #define LIGHT_DEFAULT_STATE "0" // OFF by default |
ansond | 140:df0ca2c95982 | 89 | #define LIGHT_BLINK_WAIT_MS 400 // time between blinks (ms) |
ansond | 140:df0ca2c95982 | 90 | #endif |
ansond | 38:825f8e834e77 | 91 | |
ansond | 38:825f8e834e77 | 92 | // Main Loop |
ansond | 134:58e7537a8c5f | 93 | #define MAIN_LOOP_SLEEP 250 // sleep time (ms) between main loop iterations |
ansond | 38:825f8e834e77 | 94 | |
ansond | 38:825f8e834e77 | 95 | // LED Blink Time |
ansond | 134:58e7537a8c5f | 96 | #define BLINK_TIME 100 // LED blink times |
ansond | 38:825f8e834e77 | 97 | |
ansond | 134:58e7537a8c5f | 98 | // External Linkage Resource |
ansond | 134:58e7537a8c5f | 99 | #define EXTERNAL_LINKAGE_RESOURCE "/dev/addldata" // resource containing IOC linkage ID |
ansond | 134:58e7537a8c5f | 100 | #define EXTERNAL_LINKAGE_UNSET "id:0" // IOC linkage not set |
ansond | 114:bd38ad417d6a | 101 | |
ansond | 174:e8f11d1b5e3f | 102 | // Salesforce Case generation (Status Report) |
ansond | 176:3c86e0cf7e21 | 103 | #define SF_STATUS_REPORTING true // true - enable, false - disable |
ansond | 174:e8f11d1b5e3f | 104 | |
ansond | 175:d17460899bc9 | 105 | // ----------------- Status Reporting TUNABLES ----------------- |
ansond | 175:d17460899bc9 | 106 | |
ansond | 191:c83c1c5010ed | 107 | // 3 Reports for RFID-tag based support/repair conditions |
ansond | 191:c83c1c5010ed | 108 | #define FIRST_REPORT_RFID 7550993 |
ansond | 191:c83c1c5010ed | 109 | #define FIRST_REPORT_NAME "Tech 49" |
ansond | 191:c83c1c5010ed | 110 | #define FIRST_REPORT_DESCRIPTION "Light Out" |
ansond | 191:c83c1c5010ed | 111 | #define FIRST_REPORT_CONDITION "Investigating Issue" |
ansond | 191:c83c1c5010ed | 112 | #define FIRST_REPORT_LATITUDE "37.404120" |
ansond | 191:c83c1c5010ed | 113 | #define FIRST_REPORT_LONGITUDE "-121.973195" |
ansond | 191:c83c1c5010ed | 114 | |
ansond | 191:c83c1c5010ed | 115 | #define SECOND_REPORT_RFID 7567145 |
ansond | 191:c83c1c5010ed | 116 | #define SECOND_REPORT_NAME "Tech 49" |
ansond | 191:c83c1c5010ed | 117 | #define SECOND_REPORT_DESCRIPTION "Light Out" |
ansond | 191:c83c1c5010ed | 118 | #define SECOND_REPORT_CONDITION "Resolved - lightbulb burned out" |
ansond | 191:c83c1c5010ed | 119 | #define SECOND_REPORT_LATITUDE "37.404120" |
ansond | 191:c83c1c5010ed | 120 | #define SECOND_REPORT_LONGITUDE "-121.973195" |
ansond | 191:c83c1c5010ed | 121 | |
ansond | 191:c83c1c5010ed | 122 | #define THIRD_REPORT_RFID 7559217 |
ansond | 191:c83c1c5010ed | 123 | #define THIRD_REPORT_NAME "Tech 49" |
ansond | 191:c83c1c5010ed | 124 | #define THIRD_REPORT_DESCRIPTION "Light Out" |
ansond | 191:c83c1c5010ed | 125 | #define THIRD_REPORT_CONDITION "Unresolved - escalate" |
ansond | 191:c83c1c5010ed | 126 | #define THIRD_REPORT_LATITUDE "37.404120" |
ansond | 191:c83c1c5010ed | 127 | #define THIRD_REPORT_LONGITUDE "-121.973195" |
ansond | 175:d17460899bc9 | 128 | |
ansond | 175:d17460899bc9 | 129 | // ----------------- Status Reporting TUNABLES ----------------- |
ansond | 175:d17460899bc9 | 130 | |
ansond | 175:d17460899bc9 | 131 | // DF2014 CaseGenerator Relay for mbed - ties into the Salesforce APEX host for case generation |
ansond | 175:d17460899bc9 | 132 | #define DF_CASE_GEN_URL "https://df2014-arm-developer-edition.na15.force.com/services/apexrest/CaseService" |
ansond | 174:e8f11d1b5e3f | 133 | |
ansond | 175:d17460899bc9 | 134 | // Buffer length for HTTPS requests |
ansond | 175:d17460899bc9 | 135 | #define BUFFER_LENGTH 256 |
ansond | 175:d17460899bc9 | 136 | |
ansond | 191:c83c1c5010ed | 137 | // Tunables for ReportDB |
ansond | 191:c83c1c5010ed | 138 | #define DB_MAX_NAME_LENGTH 64 |
ansond | 191:c83c1c5010ed | 139 | #define DB_MAX_DESCRIPTION_LENGTH 128 |
ansond | 191:c83c1c5010ed | 140 | #define DB_MAX_CONDITION_LENGTH 128 |
ansond | 191:c83c1c5010ed | 141 | #define DB_MAX_LATLONG_LENGTH 32 |
ansond | 191:c83c1c5010ed | 142 | #define DB_MAX_NUM_REPORTS 3 |
ansond | 191:c83c1c5010ed | 143 | |
ansond | 191:c83c1c5010ed | 144 | // convenience definitions for ReportDB... 3 RFID tags/station |
ansond | 191:c83c1c5010ed | 145 | #define FIRST_REPORT 0 |
ansond | 191:c83c1c5010ed | 146 | #define SECOND_REPORT 1 |
ansond | 191:c83c1c5010ed | 147 | #define THIRD_REPORT 2 |
ansond | 174:e8f11d1b5e3f | 148 | |
ansond | 38:825f8e834e77 | 149 | // Philips Light Support |
ansond | 38:825f8e834e77 | 150 | #define PL_LIGHT_ID_DOUG 1 // Dougs Light |
ansond | 38:825f8e834e77 | 151 | #define PL_LIGHT_ID_BILL 2 // Bills Light |
ansond | 38:825f8e834e77 | 152 | #define PL_LIGHT_ID_KERRY 3 // Kerrys Light |
ansond | 134:58e7537a8c5f | 153 | #define PL_GW_ADDRESS "192.168.1.178" // Philips Gateway in IOT lab (Austin) |
ansond | 90:0fed8d3e0b81 | 154 | #define PL_DEFAULT_STATE LIGHT_DEFAULT_STATE // on |
ansond | 38:825f8e834e77 | 155 | #define PL_DEFAULT_DIM 11 // dim value |
ansond | 38:825f8e834e77 | 156 | #define PL_URL_BUFFER_LEN 128 |
ansond | 38:825f8e834e77 | 157 | #define PL_PAYLOAD_BUFFER_LEN 128 |
ansond | 38:825f8e834e77 | 158 | #define PL_RESPONSE_BUFFER_LEN 128 |
ansond | 38:825f8e834e77 | 159 | #define PL_URL_TEMPLATE "http://%s/api/newdeveloper/lights/%d/state" |
ansond | 97:d631edbc157b | 160 | #define PL_ON_COMMAND_TEMPLATE "{ \"on\":%s, \"sat\":211, \"bri\":%d, \"hue\":13122 } " |
ansond | 38:825f8e834e77 | 161 | |
ansond | 160:24337c83dd1d | 162 | #ifndef CELLULAR_NETWORK |
ansond | 161:a85cb6cba5ed | 163 | // Error Handler - use mutexes? |
ansond | 161:a85cb6cba5ed | 164 | #define EH_USE_MUTEXES true // true - yes, undef - no |
ansond | 161:a85cb6cba5ed | 165 | |
ansond | 161:a85cb6cba5ed | 166 | // Network - use mutexes? |
ansond | 161:a85cb6cba5ed | 167 | #define NETWORK_MUTEX true // true - yes, undef - no |
ansond | 161:a85cb6cba5ed | 168 | |
ansond | 161:a85cb6cba5ed | 169 | // Has Threads? |
ansond | 161:a85cb6cba5ed | 170 | #define ENABLE_THREADS true // true - yes, undef - no |
ansond | 160:24337c83dd1d | 171 | #endif |
ansond | 160:24337c83dd1d | 172 | |
ansond | 128:fde8d042a9af | 173 | // Platform specific customizations |
ansond | 127:58cd1d28f734 | 174 | #ifdef _ENDPOINT_UBLOX_PLATFORM |
ansond | 128:fde8d042a9af | 175 | #define PLATFORM_STRING "U-Blox MBED" // platform string |
ansond | 136:f433e40f8d65 | 176 | #define EXT_LED_PIN D3 // pin to use for external LED cathode, use D6 for speaker |
ansond | 145:24ac7ac92777 | 177 | #define EXT_LED_PIN_COPCAR D10 // pin to use for external LED cathode (copcar personality only) |
ansond | 130:630d05daed77 | 178 | #define BATTERY_POT_PIN A0 // pin for the battery POT |
ansond | 130:630d05daed77 | 179 | #define VOLTAGE_POT_PIN A1 // pin for the voltage POT |
ansond | 130:630d05daed77 | 180 | #define TEMP_SENSOR_PIN1 P0_0 // pin for temp sensor |
ansond | 130:630d05daed77 | 181 | #define TEMP_SENSOR_PIN2 P0_1 // pin for temp sensor |
ansond | 191:c83c1c5010ed | 182 | #define RFID_TX_PIN D1 // pin for RFID sensor |
ansond | 191:c83c1c5010ed | 183 | #define RFID_RX_PIN D0 // pin for RFID sensor |
ansond | 191:c83c1c5010ed | 184 | #define TEMP_PIN A3 // pin for TMP36 temp sensor |
ansond | 127:58cd1d28f734 | 185 | #endif |
ansond | 127:58cd1d28f734 | 186 | |
ansond | 127:58cd1d28f734 | 187 | #ifdef _ENDPOINT_NXP_PLATFORM |
ansond | 128:fde8d042a9af | 188 | #define PLATFORM_STRING "NXP MBED" // platform string |
ansond | 128:fde8d042a9af | 189 | #define EXT_LED_PIN p21 // pin to use for external LED cathode |
ansond | 143:1388cb37c27e | 190 | #define EXT_LED_PIN_COPCAR p22 // pin to use for external LED cathode (copcar personality only) |
ansond | 128:fde8d042a9af | 191 | #define BATTERY_POT_PIN p20 // pin for the battery POT |
ansond | 128:fde8d042a9af | 192 | #define VOLTAGE_POT_PIN p19 // pin for the voltage POT |
ansond | 128:fde8d042a9af | 193 | #define TEMP_SENSOR_PIN1 p28 // pin for temp sensor |
ansond | 128:fde8d042a9af | 194 | #define TEMP_SENSOR_PIN2 p27 // pin for temp sensor |
ansond | 178:670bd170f3eb | 195 | #define RFID_TX_PIN p13 // pin for RFID sensor |
ansond | 178:670bd170f3eb | 196 | #define RFID_RX_PIN p14 // pin for RFID sensor |
ansond | 191:c83c1c5010ed | 197 | #define TEMP_PIN p15 // pin for TMP36 temp sensor |
ansond | 127:58cd1d28f734 | 198 | #endif |
ansond | 127:58cd1d28f734 | 199 | |
ansond | 128:fde8d042a9af | 200 | #ifdef _ENDPOINT_FREEDOM_PLATFORM |
ansond | 128:fde8d042a9af | 201 | #define PLATFORM_STRING "Freescale MBED" // platform string |
ansond | 128:fde8d042a9af | 202 | #define EXT_LED_PIN p21 // pin to use for external LED cathode |
ansond | 143:1388cb37c27e | 203 | #define EXT_LED_PIN_COPCAR p22 // pin to use for external LED cathode (copcar personality only) |
ansond | 128:fde8d042a9af | 204 | #define BATTERY_POT_PIN p20 // pin for the battery POT |
ansond | 128:fde8d042a9af | 205 | #define VOLTAGE_POT_PIN p19 // pin for the voltage POT |
ansond | 128:fde8d042a9af | 206 | #define TEMP_SENSOR_PIN1 p28 // pin for temp sensor |
ansond | 128:fde8d042a9af | 207 | #define TEMP_SENSOR_PIN2 p27 // pin for temp sensor |
ansond | 191:c83c1c5010ed | 208 | #define RFID_TX_PIN D1 // pin for RFID sensor |
ansond | 191:c83c1c5010ed | 209 | #define RFID_RX_PIN D0 // pin for RFID sensor |
ansond | 191:c83c1c5010ed | 210 | #define TEMP_PIN A3 // pin for TMP36 temp sensor |
ansond | 127:58cd1d28f734 | 211 | #endif |
ansond | 127:58cd1d28f734 | 212 | |
ansond | 38:825f8e834e77 | 213 | #endif // _COMMON_DEFINITIONS_H_ |