The Cayenne MQTT mbed Library provides functions to easily connect to the Cayenne IoT project builder.

Dependents:   Cayenne-ESP8266Interface Cayenne-WIZnet_Library Cayenne-WIZnetInterface Cayenne-X-NUCLEO-IDW01M1 ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CayenneDefines.h Source File

CayenneDefines.h

00001 /*
00002 The MIT License(MIT)
00003 
00004 Cayenne MQTT Client Library
00005 Copyright (c) 2016 myDevices
00006 
00007 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
00008 documentation files(the "Software"), to deal in the Software without restriction, including without limitation
00009 the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software,
00010 and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
00011 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
00012 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
00013 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR
00014 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00015 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00016 */
00017 
00018 #ifndef _CAYENNEDEFINES_h
00019 #define _CAYENNEDEFINES_h
00020 
00021 #define CAYENNE_VERSION "v1"
00022 #define CAYENNE_DOMAIN "mqtt.mydevices.com"
00023 #define CAYENNE_PORT 1883
00024 #define CAYENNE_TLS_PORT 8883
00025 
00026 #ifndef CAYENNE_MAX_MESSAGE_SIZE
00027 #define CAYENNE_MAX_MESSAGE_SIZE 140 // Redefine this for different message size
00028 #endif
00029 
00030 #ifndef CAYENNE_MAX_MESSAGE_HANDLERS
00031 #define CAYENNE_MAX_MESSAGE_HANDLERS 5 /* Redefine to change number of handlers */
00032 #endif
00033 
00034 #ifndef CAYENNE_MAX_MESSAGE_VALUES
00035 #define CAYENNE_MAX_MESSAGE_VALUES 4 /* Redefine to change max number of values in a message, must be at least 1 */
00036 #endif
00037 
00038 //Comment this out to prevent digital and analog specific code from being compiled. If you only need to send
00039 //and receive standard channel data you can comment this out to decrease the program size.
00040 //#define DIGITAL_AND_ANALOG_SUPPORT
00041 
00042 //Comment this out if you don't need to subscribe to data or system info payloads.
00043 //#define PARSE_INFO_PAYLOADS
00044 
00045 //Some defines for AVR microcontrollers to allow easier usage of memory in program space.
00046 #if defined(__AVR__) || defined(ARDUINO_ARCH_SAM)
00047 #include <avr/pgmspace.h>
00048 #define CAYENNE_USING_PROGMEM
00049 #define CAYENNE_PROGMEM PROGMEM
00050 #define CAYENNE_PSTR(s) PSTR(s)
00051 #define CAYENNE_STRLEN(s) strlen_P(s)
00052 #define CAYENNE_STRCAT(s1, s2) strcat_P(s1, s2)
00053 #define CAYENNE_STRNCMP(s1, s2, n) strncmp_P(s1, s2, n)
00054 #define CAYENNE_MEMCPY(s1, s2, n) memcpy_P(s1, s2, n)
00055 #define CAYENNE_READ_BYTE(b) pgm_read_byte(b);
00056 #else
00057 #define CAYENNE_PROGMEM
00058 #define CAYENNE_PSTR(s) s
00059 #define CAYENNE_STRLEN(s) strlen(s)
00060 #define CAYENNE_STRCAT(s1, s2) strcat(s1, s2)
00061 #define CAYENNE_STRNCMP(s1, s2, n) strncmp(s1, s2, n)
00062 #define CAYENNE_MEMCPY(s1, s2, n) memcpy(s1, s2, n)
00063 #define CAYENNE_READ_BYTE(b) *b;
00064 #endif
00065 
00066 #include "CayenneTypes.h"
00067 #include "CayenneTopics.h"
00068 
00069 #endif