MBED MQTT Lighting Endpoint for NXP Ublox (cellular enabled)

Dependencies:   C027_Support C12832 StatusReporter LM75B MQTT-ansond c027_radios endpoint_core endpoint_mqtt mbed-rtos mbed

Committer:
ansond
Date:
Thu Feb 27 00:14:58 2014 +0000
Revision:
11:59ee476fda24
Parent:
10:748fc7052e61
Child:
13:25448d92c205
updates

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 0:ae2a45502448 1 /* Copyright C2013 Doug Anson, MIT License
ansond 0:ae2a45502448 2 *
ansond 0:ae2a45502448 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
ansond 0:ae2a45502448 4 * and associated documentation files the "Software", to deal in the Software without restriction,
ansond 0:ae2a45502448 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
ansond 0:ae2a45502448 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
ansond 0:ae2a45502448 7 * furnished to do so, subject to the following conditions:
ansond 0:ae2a45502448 8 *
ansond 0:ae2a45502448 9 * The above copyright notice and this permission notice shall be included in all copies or
ansond 0:ae2a45502448 10 * substantial portions of the Software.
ansond 0:ae2a45502448 11 *
ansond 0:ae2a45502448 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
ansond 0:ae2a45502448 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
ansond 0:ae2a45502448 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
ansond 0:ae2a45502448 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
ansond 0:ae2a45502448 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ansond 0:ae2a45502448 17 */
ansond 0:ae2a45502448 18
ansond 0:ae2a45502448 19 #ifndef _DEFINITIONS_H_
ansond 0:ae2a45502448 20 #define _DEFINITIONS_H_
ansond 0:ae2a45502448 21
ansond 0:ae2a45502448 22 // platform
ansond 0:ae2a45502448 23 #include "mbed.h"
ansond 0:ae2a45502448 24
ansond 0:ae2a45502448 25 // Our Endpoint Version Annoucement
ansond 0:ae2a45502448 26 #define ENDPOINT_VERSION_ANNOUNCE "\r\nMBED IMPACT(MQTT) Endpoint v1.0"
ansond 0:ae2a45502448 27
ansond 0:ae2a45502448 28 // Error Handler
ansond 0:ae2a45502448 29 #define MAX_LOG_MESSAGE 256 // maximum size of a logging message
ansond 0:ae2a45502448 30
ansond 0:ae2a45502448 31 // Light Configuration
ansond 0:ae2a45502448 32 #define NUM_LIGHTS 1 // number of lights in this endpoint
ansond 0:ae2a45502448 33 #define LIGHT_NAME "mbed-mqtt-light-%d" // name of each light in this endpoint
ansond 0:ae2a45502448 34 #define LIGHT_NAME_LEN 64 // buffer size for the light name
ansond 0:ae2a45502448 35 #define LIGHT_ON_STATE "0" // initial state of each light in this endpoint
ansond 0:ae2a45502448 36 #define LIGHT_DIM_STATE "25" // initial dimming state of each light in this endpoint
ansond 0:ae2a45502448 37
ansond 9:ff877db53cfd 38 // Endpoint GPS Coordinates
ansond 9:ff877db53cfd 39 #define ENDPOINT_LOCATION "Oulo Finland" // Where this light/endpoint lives
ansond 9:ff877db53cfd 40 #define ENDPOINT_GPS_COORDS "65.017210,25.492411" // Where this light/endpoint lives
ansond 9:ff877db53cfd 41
ansond 10:748fc7052e61 42 // IOC REST URL for Load/Updates
ansond 10:748fc7052e61 43 #define IOC_USERNAME "anson"
ansond 10:748fc7052e61 44 #define IOC_PASSWORD "savetheplanet1"
ansond 10:748fc7052e61 45 #define IOC_REST_URL_LEN 128
ansond 10:748fc7052e61 46 #define IOC_RESULT_LEN 192
ansond 10:748fc7052e61 47 #define IOC_PAYLOAD_LEN 192
ansond 11:59ee476fda24 48 #define IOC_IOC_ID_LEN 16
ansond 10:748fc7052e61 49 #define IOC_DATASOURCE_ID "198"
ansond 10:748fc7052e61 50 #define IOC_HOST_NAME "iocweb.bcu.ac.uk"
ansond 10:748fc7052e61 51 #define IOC_REST_URL "https://%s/ibm/ioc/api/data-injection-service/datablocks/%s/dataitems%s"
ansond 10:748fc7052e61 52
ansond 0:ae2a45502448 53 // Resource Configuration
ansond 0:ae2a45502448 54 #define RESOURCE_NAME_LEN 64 // Resource name max length
ansond 0:ae2a45502448 55 #define RESOURCE_VALUE_LEN 64 // Resource value max length
ansond 0:ae2a45502448 56
ansond 0:ae2a45502448 57 // Transport Configuration
ansond 0:ae2a45502448 58 #define NUM_TRANSPORTS 2 // MQTT, HTTP
ansond 0:ae2a45502448 59 #define MQTT_TRANSPORT 0 // MQTT Transport index
ansond 0:ae2a45502448 60 #define HTTP_TRANSPORT 1 // HTTP Transport index
ansond 0:ae2a45502448 61
ansond 9:ff877db53cfd 62 // Index for Transport to use for Update/Load
ansond 9:ff877db53cfd 63 #define LOAD_TRANSPORT 1 // 0 - MQTT, 1 - HTTP
ansond 9:ff877db53cfd 64
ansond 0:ae2a45502448 65 // MQTT connect information
ansond 0:ae2a45502448 66 #define MQTT_HOSTNAME "iocana.bcu.ac.uk" // IOC MQTT Broker Host - iocana.bcu.ac.uk
ansond 0:ae2a45502448 67 #define MQTT_HOSTPORT 1883 // IOC MQTT Broker Port
ansond 0:ae2a45502448 68 #define MQTT_ENDPOINT_ID "mbed%d" // IOC MQTT Endpoint ID template
ansond 0:ae2a45502448 69 #define MQTT_MAXID_VALUE 99 // IOC MQTT Endpoint ID maximum integer value
ansond 0:ae2a45502448 70 #define MQTT_ENDPOINT_IDLEN 64 // IOC MQTT Endpoint ID length (max)
ansond 8:45f9a920e82c 71 #define MQTT_IOC_TOPIC "ARM/sensinode/control/%s" // IOC MQTT Topic
ansond 8:45f9a920e82c 72 #define MQTT_IOC_TOPIC_LEN 42 // max length for the topic string
ansond 0:ae2a45502448 73 #define MQTT_USERNAME "" // IOC MQTT Username
ansond 0:ae2a45502448 74 #define MQTT_PASSWORD "" // IOC MQTT Password
ansond 0:ae2a45502448 75
ansond 0:ae2a45502448 76 // Main Loop
ansond 0:ae2a45502448 77 #define MAIN_LOOP_SLEEP 100 // sleep time (ms) between main loop iterations
ansond 0:ae2a45502448 78
ansond 0:ae2a45502448 79 // LED Blink Time
ansond 0:ae2a45502448 80 #define BLINK_TIME 100 // LED blink times
ansond 0:ae2a45502448 81
ansond 0:ae2a45502448 82 #endif // _DEFINITIONS_H