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

Committer:
jburhenn
Date:
Wed Oct 26 16:33:46 2016 -0600
Revision:
8:aec9cfdd4c8e
Parent:
0:09ef59d2d0f7
Child:
20:996a5c660063
Updated credential ordering to match dashboard. Added init function to set the credentials. Added setDefaultMessageHandler override so member functions can be used for message handling. Updated namesspace name to be more specific.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jburhenn 0:09ef59d2d0f7 1 /*
jburhenn 0:09ef59d2d0f7 2 The MIT License(MIT)
jburhenn 0:09ef59d2d0f7 3
jburhenn 0:09ef59d2d0f7 4 Cayenne MQTT Client Library
jburhenn 0:09ef59d2d0f7 5 Copyright (c) 2016 myDevices
jburhenn 0:09ef59d2d0f7 6
jburhenn 0:09ef59d2d0f7 7 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
jburhenn 0:09ef59d2d0f7 8 documentation files(the "Software"), to deal in the Software without restriction, including without limitation
jburhenn 0:09ef59d2d0f7 9 the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software,
jburhenn 0:09ef59d2d0f7 10 and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
jburhenn 0:09ef59d2d0f7 11 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
jburhenn 0:09ef59d2d0f7 12 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
jburhenn 0:09ef59d2d0f7 13 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR
jburhenn 0:09ef59d2d0f7 14 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
jburhenn 0:09ef59d2d0f7 15 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
jburhenn 0:09ef59d2d0f7 16 */
jburhenn 0:09ef59d2d0f7 17
jburhenn 0:09ef59d2d0f7 18 #ifndef _CAYENNEDEFINES_h
jburhenn 0:09ef59d2d0f7 19 #define _CAYENNEDEFINES_h
jburhenn 0:09ef59d2d0f7 20
jburhenn 0:09ef59d2d0f7 21 #define CAYENNE_VERSION "v1"
jburhenn 0:09ef59d2d0f7 22 #define CAYENNE_DOMAIN "mqtt.mydevices.com"
jburhenn 0:09ef59d2d0f7 23 #define CAYENNE_PORT 1883
jburhenn 0:09ef59d2d0f7 24 #define CAYENNE_TLS_PORT 8883
jburhenn 0:09ef59d2d0f7 25
jburhenn 0:09ef59d2d0f7 26 #ifndef CAYENNE_MAX_MESSAGE_SIZE
jburhenn 0:09ef59d2d0f7 27 #define CAYENNE_MAX_MESSAGE_SIZE 128 // Redefine this for different message size
jburhenn 0:09ef59d2d0f7 28 #endif
jburhenn 0:09ef59d2d0f7 29
jburhenn 0:09ef59d2d0f7 30 #ifndef CAYENNE_MAX_MESSAGE_HANDLERS
jburhenn 0:09ef59d2d0f7 31 #define CAYENNE_MAX_MESSAGE_HANDLERS 5 /* Redefine to change number of handlers */
jburhenn 0:09ef59d2d0f7 32 #endif
jburhenn 0:09ef59d2d0f7 33
jburhenn 0:09ef59d2d0f7 34 #ifndef CAYENNE_MAX_MESSAGE_VALUES
jburhenn 0:09ef59d2d0f7 35 #define CAYENNE_MAX_MESSAGE_VALUES 4 /* Redefine to change max number of values in a message, must be at least 1 */
jburhenn 0:09ef59d2d0f7 36 #endif
jburhenn 0:09ef59d2d0f7 37
jburhenn 0:09ef59d2d0f7 38 //Comment this out to prevent digital and analog specific code from being compiled. If you only need to send
jburhenn 0:09ef59d2d0f7 39 //and receive standard channel data you can comment this out to decrease the program size.
jburhenn 8:aec9cfdd4c8e 40 //#define DIGITAL_AND_ANALOG_SUPPORT
jburhenn 0:09ef59d2d0f7 41
jburhenn 0:09ef59d2d0f7 42 //Comment this out if you don't need to subscribe to data or system info payloads.
jburhenn 0:09ef59d2d0f7 43 //#define PARSE_INFO_PAYLOADS
jburhenn 0:09ef59d2d0f7 44
jburhenn 0:09ef59d2d0f7 45 //Some defines for AVR microcontrollers to allow easier usage of memory in program space.
jburhenn 8:aec9cfdd4c8e 46 #if defined(__AVR__) || defined(ARDUINO_ARCH_SAM)
jburhenn 0:09ef59d2d0f7 47 #include <avr/pgmspace.h>
jburhenn 0:09ef59d2d0f7 48 #define CAYENNE_USING_PROGMEM
jburhenn 0:09ef59d2d0f7 49 #define CAYENNE_PROGMEM PROGMEM
jburhenn 0:09ef59d2d0f7 50 #define CAYENNE_PSTR(s) PSTR(s)
jburhenn 0:09ef59d2d0f7 51 #define CAYENNE_STRLEN(s) strlen_P(s)
jburhenn 0:09ef59d2d0f7 52 #define CAYENNE_STRCAT(s1, s2) strcat_P(s1, s2)
jburhenn 0:09ef59d2d0f7 53 #define CAYENNE_STRNCMP(s1, s2, n) strncmp_P(s1, s2, n)
jburhenn 0:09ef59d2d0f7 54 #define CAYENNE_MEMCPY(s1, s2, n) memcpy_P(s1, s2, n)
jburhenn 0:09ef59d2d0f7 55 #define CAYENNE_READ_BYTE(b) pgm_read_byte(b);
jburhenn 0:09ef59d2d0f7 56 #else
jburhenn 0:09ef59d2d0f7 57 #define CAYENNE_PROGMEM
jburhenn 0:09ef59d2d0f7 58 #define CAYENNE_PSTR(s) s
jburhenn 0:09ef59d2d0f7 59 #define CAYENNE_STRLEN(s) strlen(s)
jburhenn 0:09ef59d2d0f7 60 #define CAYENNE_STRCAT(s1, s2) strcat(s1, s2)
jburhenn 0:09ef59d2d0f7 61 #define CAYENNE_STRNCMP(s1, s2, n) strncmp(s1, s2, n)
jburhenn 0:09ef59d2d0f7 62 #define CAYENNE_MEMCPY(s1, s2, n) memcpy(s1, s2, n)
jburhenn 0:09ef59d2d0f7 63 #define CAYENNE_READ_BYTE(b) *b;
jburhenn 0:09ef59d2d0f7 64 #endif
jburhenn 0:09ef59d2d0f7 65
jburhenn 0:09ef59d2d0f7 66 #include "CayenneTypes.h"
jburhenn 0:09ef59d2d0f7 67 #include "CayenneTopics.h"
jburhenn 0:09ef59d2d0f7 68
jburhenn 0:09ef59d2d0f7 69 #endif