MBED MQTT Lighting Endpoint for NXP LPC1768+AppBoard

Dependencies:   C12832_lcd EthernetInterface StatusReporter LM75B MQTT-ansond endpoint_core endpoint_mqtt mbed-rtos mbed

Revision:
174:4da75aabdd67
Parent:
173:b8f479524c92
Child:
181:f78020a9b78a
diff -r b8f479524c92 -r 4da75aabdd67 Definitions.h
--- a/Definitions.h	Wed Mar 26 20:01:43 2014 +0000
+++ b/Definitions.h	Wed Mar 26 20:17:19 2014 +0000
@@ -23,41 +23,15 @@
 #include "mbed.h"
 
 // Platform Switch
-#define   _ENDPOINT_UBLOX_PLATFORM  true                // uncomment for the U-Blox MBED platform
-#define   _ENDPOINT_NXP_PLATFORM    true                // uncomment for the NXP MBED platform
+//#define   _ENDPOINT_UBLOX_PLATFORM      true                // uncomment for the U-Blox MBED platform
+//#define   _ENDPOINT_FREESCALE_PLATFORM  true                // uncomment for the Freescale Freedom MBED platform
+#define   _ENDPOINT_NXP_PLATFORM        true                // uncomment for the NXP MBED platform
 
 // include common definitions
 #include "CommonDefinitions.h"
 
-// Until we get HTTPS with BasicAuth working in MBED...
-#define GW_IPADDRESS                "192.168.1.220"     // gateway IP address (default)
-#define USE_GW_HTTP_REDIRECTOR      true                // true - make http calls to IOC via GW, false - make http calls directly to IOC
-
-// Gateway REST API URL
-#define GW_REDIRECT_URL             "http://%s:8888/NSP-IOC-Gateway/IOCRestAPI"
-
-// Memory Debug Enable/Disable
-// #define ENABLE_MEMORY_DEBUG         true             // false - disable, true - enable
-
-// Hush Logging
-//#define HUSH_LOG                     true             // false - logging output, true - no logging
-
-// Hush LED usage
-//define HUSH_LEDS                     true             // false - enable LEDs, true - disable LEDs
-
-// Our Endpoint Version Annoucement
-#define ENDPOINT_VERSION_ANNOUNCE "\r\nMBED IMPACT(MQTT) Endpoint v1.0"
-
-// Preference File Configuration
-#define PREFERENCES_FILE            "/local/mqtt.cfg"               // preferences file for endpoint  
-
-// our MAC address
-//#define MAC_ADDRESS                   0xa0,0x12,0xAB,0xE3,0x4F,0x56
-
-// Light Configuration
-#define LIGHT_NAME                  "light-mqtt-%d"                 // name of each light in this endpoint
-#define LIGHT_BLINK_WAIT_MS         1000                            // time between blinks (ms)
-#define LIGHT_NAME_INDEX            1                               // start index for the ID of the light name
+// MQTT specific support
+#include "MQTTDefinitions.h"
 
 // Philips Light Config
 #define PL_ENABLE                   false                           // true - enable for endpoint light, false - disable
@@ -65,7 +39,6 @@
 
 // External LED Light Configuration
 #define EXT_LED_ENABLE              true                            // true - enable external LED endpoint light, false - disable
-#define EXT_LED_PIN                 p21                             // pin to use for external LED cathode 
 
 // Endpoint GPS Coordinates/Location
 #define ENDPOINT_LOCATION           "Las Vegas Country Club"         // Where this light/endpoint lives
@@ -76,59 +49,16 @@
 #define ENDPOINT_STOPTIME           "\"ENDDATETIME\":\"2015-03-10T03:35:55-07:00\","
 #define ENDPOINT_TIMEZONE           "\"TIMEZONEOFFSET\":\"-07:00\""
 
-// Keyword Definitions for MQTT packets
-#define IOC_REQUEST_LOAD_ALL_VERB   "load"
-#define IOC_REQUEST_UPDATE_ALL_VERB "update"
-#define IOC_ENDPOINT_VERB           "Endpoint"
-#define IOC_ENDPOINT_ALL_VERB       "all"
-#define IOC_CHANGE_VERB             "Change"
-#define IOC_REQUEST_VALUE_VERB      "Get"
-#define IOC_RESPONSE_VERB           "response"
-#define IOC_REPONSE_ID_KEY          "id"
-#define IOC_DATASOURCE_ID           "229"
+// DEBUG Memory Debug Enable/Disable
+// #define ENABLE_MEMORY_DEBUG         true             // false - disable, true - enable
 
-// IOC REST Buffer Lengths
-#define IOC_REST_URL_LEN            128
-#define IOC_RESULT_LEN              1024
-#define IOC_PAYLOAD_LEN             768
-#define IOC_IOC_ID_LEN              16
-
-// IOC REST URL for Load/Updates
-#define IOC_USERNAME                "anson"
-#define IOC_PASSWORD                "savetheplanet1"
-#define IOC_HOST_NAME               "iocweb.bcu.ac.uk"              // IOC Web - iocweb.bcu.ac.uk
-#define IOC_REST_URL                "https://%s/ibm/ioc/api/data-injection-service/datablocks/%s/dataitems%s"
-#define IOC_RESPONSE_TEMPLATE       "%s:{ENDPOINT=%s RESOURCE=%s VALUE=%s}:%s"
-#define IOC_RESPONSE_OK             "OK"
-#define IOC_RESPONSE_FAILED         "FAILED"
+// DEBUG Hush Logging
+//#define HUSH_LOG                     true             // false - logging output, true - no logging
 
-// Transport Configuration
-#define NUM_TRANSPORTS              2                               // MQTT, HTTP
-#define MQTT_TRANSPORT              0                               // MQTT Transport index
-#define HTTP_TRANSPORT              1                               // HTTP Transport index
-
-// Index for Transport to use for Update/Load
-#define LOAD_TRANSPORT              1                               // 0 - MQTT, 1 - HTTP
-
-// largest MQTT message that PubSubClient will send
-#define MAX_MQTT_MESSAGE_LENGTH     128
+// DEBUG Hush LED usage
+//define HUSH_LEDS                     true             // false - enable LEDs, true - disable LEDs
 
-// MQTT connect information
-#define MQTT_HOSTNAME               "iocana.bcu.ac.uk"              // IOC MQTT Broker Host - iocana.bcu.ac.uk
-#define MQTT_HOSTPORT               1883                            // IOC MQTT Broker Port
-#define MQTT_ENDPOINT_ID            "mbed%d%d"                      // IOC MQTT Endpoint ID template
-#define MQTT_MAXID_VALUE            99                              // IOC MQTT Endpoint ID maximum integer value
-#define MQTT_ENDPOINT_IDLEN         64                              // IOC MQTT Endpoint ID length (max)
-#define MQTT_IOC_TOPIC              "ARM/sensinode/control/%s"      // IOC MQTT Topic 
-#define MQTT_IOC_ALL_TOPIC          "ARM/sensinode/control/all"     // IOC MQTT Topic (broadcast)
-#define MQTT_PING_SEND_TOPIC        "ARM/sensinode/ping"            // IOC MQTT Ping Send Topic
-#define MQTT_IOC_ALL_ENDPOINT       "all"                           // must be the same as the last element of MATT_IOC_ANNOUNCE_TOPIC
-#define MQTT_IOC_TOPIC_LEN          64                              // max length for the topic string
-#define MQTT_PAYLOAD_SEGMENT_LEN    64                              // max length for a segment of the payload
-#define MQTT_USERNAME               ""                              // IOC MQTT Username
-#define MQTT_PASSWORD               ""                              // IOC MQTT Password
-#define MQTT_PING_VERB_LEN          10                              // Ping or Pong
-#define MQTT_PING_COUNTDOWN         1200                            // Send ping to GW every 1200'th 250ms iterations (5 minutes)
-#define MQTT_MAX_COUNTER            32768                           // largest Ping counter before reset back to 1
+// KEIL: our MAC address
+//#define MAC_ADDRESS                   0xa0,0x12,0xAB,0xE3,0x4F,0x56
 
 #endif // _DEFINITIONS_H
\ No newline at end of file