Core Base Classes for the Light Endpoints

Dependencies:   BufferedSerial

Dependents:   mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more

CommonDefinitions.h

Committer:
ansond
Date:
2014-03-26
Revision:
127:58cd1d28f734
Parent:
119:c620eb98af8b
Child:
128:fde8d042a9af

File content as of revision 127:58cd1d28f734:

/* Copyright C2013 Doug Anson, MIT License
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
 * and associated documentation files the "Software", to deal in the Software without restriction,
 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or
 * substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 
#ifndef _COMMON_DEFINITIONS_H_
#define _COMMON_DEFINITIONS_H_

// Error Handler Log Message Length
#define MAX_LOG_MESSAGE             900           // maximum size of a logging message
#define TEMP_BUFFER_LEN             128           // working/temp buffer length

// Resource Configuration
#define RESOURCE_NAME_LEN           25            // Resource name max length
#define RESOURCE_VALUE_LEN          33            // Resource value max length

// Number of Resources our Endpoint has
#define NUM_RESOURCES               50            // do not exceed this number of resources in the endpoint. currently at 25

// IOC <--> Resource Mapping
#define NUM_MAPPINGS                50            // do not exceed this number of IOC <--> NSP resource mappings. currently at 17

// MapEntry Name length
#define MAX_NAME_LENGTH             25

// Preferences configuration
#define MAX_NUM_PREFERENCES         10                    // support a total of 10 unique preferences
#define PREFERENCE_NAME_LEN         32                    // largest preference name
#define PREFERENCE_VALUE_LEN        48                    // largest preference value

// Common Light Definition
#define NUM_LIGHTS                  1              // number of lights in this endpoint
#define LIGHT_NAME_LEN              48             // buffer size for the light name
#define LIGHT_ON_STATE              "0"            // initial state of each light in this endpoint
#define LIGHT_DIM_STATE             "25"           // initial dimming state of each light in this endpoint

// Main Loop
#define MAIN_LOOP_SLEEP             250            // sleep time (ms) between main loop iterations

// LED Blink Time
#define BLINK_TIME                  100            // LED blink times

// Default Light State
#define LIGHT_DEFAULT_STATE         1              // ON by default

// IOC Linkage Resource
#define IOC_LINKAGE_RESOURCE        "/dev/addldata"                 // resource containing IOC linkage ID
#define IOC_LINKAGE_UNSET           "id:0"                          // IOC linkage not set

// Philips Light Support
#define PL_LIGHT_ID_DOUG            1                               // Dougs Light
#define PL_LIGHT_ID_BILL            2                               // Bills Light
#define PL_LIGHT_ID_KERRY           3                               // Kerrys Light
//#define PL_GW_ADDRESS               "192.168.1.178"                 // Philips Gateway in IOT lab (Austin)
#define PL_GW_ADDRESS               "10.1.0.82"                     // Philips Gateway in IOT lab (Home)
#define PL_DEFAULT_STATE            LIGHT_DEFAULT_STATE             // on
#define PL_DEFAULT_DIM              11                              // dim value
#define PL_URL_BUFFER_LEN           128
#define PL_PAYLOAD_BUFFER_LEN       128
#define PL_RESPONSE_BUFFER_LEN      128
#define PL_URL_TEMPLATE             "http://%s/api/newdeveloper/lights/%d/state"  
#define PL_ON_COMMAND_TEMPLATE      "{ \"on\":%s, \"sat\":211, \"bri\":%d, \"hue\":13122 } "

// Error Handler - use mutexes?
#define EH_USE_MUTEXES              true                            // true - yes, undef - no

// Network - use mutexes?
#define NETWORK_MUTEX               true                            // true - yes, undef - no

// Platform String (for all supported platforms that may be compiled against)
#ifdef _ENDPOINT_UBLOX_PLATFORM
    #define PLATFORM_STRING         "U-Blox MBED"
#endif

#ifdef _ENDPOINT_NXP_PLATFORM
    #define PLATFORM_STRING         "NXP MBED"
#endif

#ifdef _ENDPOINT_FREEDOM_PLATFORM
    #define PLATFORM_STRING         "Freescale MBED"
#endif

#endif // _COMMON_DEFINITIONS_H_