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@76:12126c125c6d, 2014-03-04 (annotated)
- Committer:
- ansond
- Date:
- Tue Mar 04 21:02:33 2014 +0000
- Revision:
- 76:12126c125c6d
- Parent:
- 75:9f3f3590f826
- Child:
- 79:beae5a9d7230
updates
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 | 38:825f8e834e77 | 22 | // Error Handler Log Message Length |
ansond | 50:daebff684b04 | 23 | #define MAX_LOG_MESSAGE 900 // maximum size of a logging message |
ansond | 53:a009aee720fe | 24 | #define TEMP_BUFFER_LEN 128 // working/temp buffer length |
ansond | 38:825f8e834e77 | 25 | |
ansond | 38:825f8e834e77 | 26 | // Resource Configuration |
ansond | 50:daebff684b04 | 27 | #define RESOURCE_NAME_LEN 24 // Resource name max length |
ansond | 50:daebff684b04 | 28 | #define RESOURCE_VALUE_LEN 32 // Resource value max length |
ansond | 38:825f8e834e77 | 29 | |
ansond | 38:825f8e834e77 | 30 | // Number of Resources our Endpoint has |
ansond | 76:12126c125c6d | 31 | #define NUM_RESOURCES 36 |
ansond | 38:825f8e834e77 | 32 | |
ansond | 38:825f8e834e77 | 33 | // MapEntry Name length |
ansond | 53:a009aee720fe | 34 | #define MAX_NAME_LENGTH 24 |
ansond | 38:825f8e834e77 | 35 | |
ansond | 38:825f8e834e77 | 36 | // IOC <--> Resource Mapping |
ansond | 38:825f8e834e77 | 37 | #define NUM_MAPPINGS NUM_RESOURCES // matches the number of resources |
ansond | 38:825f8e834e77 | 38 | |
ansond | 38:825f8e834e77 | 39 | // Common Light Definition |
ansond | 45:da431cd42313 | 40 | #define NUM_LIGHTS 1 // number of lights in this endpoint |
ansond | 53:a009aee720fe | 41 | #define LIGHT_NAME_LEN 48 // buffer size for the light name |
ansond | 45:da431cd42313 | 42 | #define LIGHT_ON_STATE "0" // initial state of each light in this endpoint |
ansond | 45:da431cd42313 | 43 | #define LIGHT_DIM_STATE "25" // initial dimming state of each light in this endpoint |
ansond | 38:825f8e834e77 | 44 | |
ansond | 38:825f8e834e77 | 45 | // Main Loop |
ansond | 45:da431cd42313 | 46 | #define MAIN_LOOP_SLEEP 100 // sleep time (ms) between main loop iterations |
ansond | 38:825f8e834e77 | 47 | |
ansond | 38:825f8e834e77 | 48 | // LED Blink Time |
ansond | 45:da431cd42313 | 49 | #define BLINK_TIME 100 // LED blink times |
ansond | 38:825f8e834e77 | 50 | |
ansond | 38:825f8e834e77 | 51 | // Philips Light Support |
ansond | 38:825f8e834e77 | 52 | #define PL_LIGHT_ID_DOUG 1 // Dougs Light |
ansond | 38:825f8e834e77 | 53 | #define PL_LIGHT_ID_BILL 2 // Bills Light |
ansond | 38:825f8e834e77 | 54 | #define PL_LIGHT_ID_KERRY 3 // Kerrys Light |
ansond | 38:825f8e834e77 | 55 | #define PL_GW_ADDRESS "192.168.1.178" // Philips Gateway in IOT lab (Austin) |
ansond | 38:825f8e834e77 | 56 | #define PL_DEFAULT_STATE 1 // on |
ansond | 38:825f8e834e77 | 57 | #define PL_DEFAULT_DIM 11 // dim value |
ansond | 38:825f8e834e77 | 58 | #define PL_URL_BUFFER_LEN 128 |
ansond | 38:825f8e834e77 | 59 | #define PL_PAYLOAD_BUFFER_LEN 128 |
ansond | 38:825f8e834e77 | 60 | #define PL_RESPONSE_BUFFER_LEN 128 |
ansond | 38:825f8e834e77 | 61 | #define PL_URL_TEMPLATE "http://%s/api/newdeveloper/lights/%d/state" |
ansond | 38:825f8e834e77 | 62 | #define PL_ON_COMMAND_TEMPLATE "{\"on\":%s,\"sat\":211,\"bri\":%d,\"hue\":13122}" |
ansond | 38:825f8e834e77 | 63 | |
ansond | 70:055ebf51f6ad | 64 | // Error Handler - use mutexes? |
ansond | 70:055ebf51f6ad | 65 | #define EH_USE_MUTEXES true // true - yes, false - no |
ansond | 70:055ebf51f6ad | 66 | |
ansond | 38:825f8e834e77 | 67 | #endif // _COMMON_DEFINITIONS_H_ |