Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_mqtt_endpoint_nxp
MQTTDefinitions.h
00001 /* Copyright C2013 Doug Anson, MIT License 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00004 * and associated documentation files the "Software", to deal in the Software without restriction, 00005 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 00006 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00007 * furnished to do so, subject to the following conditions: 00008 * 00009 * The above copyright notice and this permission notice shall be included in all copies or 00010 * substantial portions of the Software. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00017 */ 00018 00019 #ifndef _MQTT_DEFINITIONS_H_ 00020 #define _MQTT_DEFINITIONS_H_ 00021 00022 // Our Endpoint Version Annoucement 00023 #define ENDPOINT_VERSION_ANNOUNCE "\r\nMBED MQTT Endpoint v1.0" 00024 00025 // Until we get HTTPS with BasicAuth working in MBED... 00026 #define USE_GW_HTTP_REDIRECTOR true // true - make http calls to IOC via GW, false - make http calls directly to IOC 00027 00028 // Gateway REST API URL 00029 #define GW_REDIRECT_URL "http://%s:%s/NSP-IOC-Gateway/IOCRestAPI" 00030 00031 // Preference File Configuration 00032 #define PREFERENCES_FILE "/local/mqtt.cfg" // preferences file for endpoint 00033 00034 // Personality Name Configuration 00035 #ifdef LIGHT_PERSONALITY 00036 #define PERSONALITY_NAME "light-mqtt-%d" // name of each personality (i.e. light) in this endpoint 00037 #define PERSONALITY_TYPE LIGHT_TYPE_STRING // type of personality 00038 #define MQTT_ENDPOINT_TYPE "MBED MQTT Light Node" // mfg type 00039 #endif 00040 #ifdef COPCAR_PERSONALITY 00041 #define PERSONALITY_NAME "copcar-mqtt-%d" // name of each personality (i.e. copcar) in this endpoint 00042 #define PERSONALITY_TYPE "Cop Car" // type of personality 00043 #define MQTT_ENDPOINT_TYPE "MBED MQTT Cop Car" // mfg type 00044 #endif 00045 00046 // Keyword Definitions for MQTT packets 00047 #define IOC_REQUEST_LOAD_ALL_VERB "load" 00048 #define IOC_REQUEST_UPDATE_ALL_VERB "update" 00049 #define IOC_ENDPOINT_VERB "Endpoint" 00050 #define IOC_ENDPOINT_ALL_VERB "all" 00051 #define IOC_CHANGE_VERB "Change" 00052 #define IOC_REQUEST_VALUE_VERB "Get" 00053 #define IOC_RESPONSE_VERB "response" 00054 #define IOC_REPONSE_ID_KEY "id" 00055 #define IOC_DATASOURCE_ID "386" 00056 00057 // remap the IOC Datasource ID if we are a copcar 00058 #ifdef COPCAR_PERSONALITY 00059 #undef IOC_DATASOURCE_ID 00060 #define IOC_DATASOURCE_ID "388" 00061 #endif 00062 00063 // IOC REST Buffer Lengths 00064 #define IOC_REST_URL_LEN 128 00065 #define IOC_RESULT_LEN 1024 00066 #define IOC_PAYLOAD_LEN 768 00067 #define IOC_IOC_ID_LEN 16 00068 00069 // IOC REST URL for Load/Updates 00070 #define IOC_HOST_NAME "iocweb.bcu.ac.uk" // IOC Web - iocweb.bcu.ac.uk 00071 #define IOC_REST_URL "https://%s/ibm/ioc/api/data-injection-service/datablocks/%s/dataitems%s" 00072 #define IOC_RESPONSE_TEMPLATE "%s:{ENDPOINT=%s RESOURCE=%s VALUE=%s}:%s" 00073 #define IOC_RESPONSE_OK "OK" 00074 #define IOC_RESPONSE_FAILED "FAILED" 00075 00076 // Transport Configuration 00077 #define NUM_TRANSPORTS 2 // MQTT, HTTP 00078 #define MQTT_TRANSPORT 0 // MQTT Transport index 00079 #define HTTP_TRANSPORT 1 // HTTP Transport index 00080 00081 // Index for Transport to use for Update/Load 00082 #define LOAD_TRANSPORT 1 // 0 - MQTT, 1 - HTTP 00083 00084 // largest MQTT message that PubSubClient will send 00085 #define MAX_MQTT_MESSAGE_LENGTH 128 00086 00087 // MQTT connect information 00088 #define MQTT_HOSTNAME "iocana.bcu.ac.uk" // IOC MQTT Broker Host - iocana.bcu.ac.uk 00089 #define MQTT_HOSTPORT 1883 // IOC MQTT Broker Port 00090 #define MQTT_ENDPOINT_ID "mbed%d%d" // IOC MQTT Endpoint ID template 00091 #define MQTT_MAXID_VALUE 99 // IOC MQTT Endpoint ID maximum integer value 00092 #define MQTT_ENDPOINT_IDLEN 20 // IOC MQTT Endpoint ID length (max) 00093 #define MQTT_IOC_TOPIC "ARM/sensinode/control/%s" // IOC MQTT Topic 00094 #define MQTT_IOC_ALL_TOPIC "ARM/sensinode/control/all" // IOC MQTT Topic (broadcast) 00095 #define MQTT_PING_SEND_TOPIC "ARM/sensinode/ping" // IOC MQTT Ping Send Topic 00096 #define MQTT_IOC_ALL_ENDPOINT "all" // must be the same as the last element of MATT_IOC_ANNOUNCE_TOPIC 00097 #define MQTT_IOC_TOPIC_LEN 64 // max length for the topic string 00098 #define MQTT_PAYLOAD_SEGMENT_LEN 64 // max length for a segment of the payload 00099 #define MQTT_USERNAME "" // IOC MQTT Username 00100 #define MQTT_PASSWORD "" // IOC MQTT Password 00101 #define MQTT_PING_VERB_LEN 10 // Ping or Pong 00102 #define MQTT_PING_COUNTDOWN 3600 // Send ping to GW every 3600'th 250ms iteration (approx 15 minutes) 00103 #define MQTT_MAX_COUNTER 32768 // largest Ping counter before reset back to 1 00104 00105 #endif // _MQTT_DEFINITIONS_H_
Generated on Thu Jul 14 2022 16:49:25 by
1.7.2