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:
Fri Oct 07 17:21:45 2016 +0000
Revision:
0:09ef59d2d0f7
Initial commit.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jburhenn 0:09ef59d2d0f7 1 /*******************************************************************************
jburhenn 0:09ef59d2d0f7 2 * Copyright (c) 2014 IBM Corp.
jburhenn 0:09ef59d2d0f7 3 *
jburhenn 0:09ef59d2d0f7 4 * All rights reserved. This program and the accompanying materials
jburhenn 0:09ef59d2d0f7 5 * are made available under the terms of the Eclipse Public License v1.0
jburhenn 0:09ef59d2d0f7 6 * and Eclipse Distribution License v1.0 which accompany this distribution.
jburhenn 0:09ef59d2d0f7 7 *
jburhenn 0:09ef59d2d0f7 8 * The Eclipse Public License is available at
jburhenn 0:09ef59d2d0f7 9 * http://www.eclipse.org/legal/epl-v10.html
jburhenn 0:09ef59d2d0f7 10 * and the Eclipse Distribution License is available at
jburhenn 0:09ef59d2d0f7 11 * http://www.eclipse.org/org/documents/edl-v10.php.
jburhenn 0:09ef59d2d0f7 12 *
jburhenn 0:09ef59d2d0f7 13 * Contributors:
jburhenn 0:09ef59d2d0f7 14 * Ian Craggs - initial API and implementation and/or initial documentation
jburhenn 0:09ef59d2d0f7 15 *******************************************************************************/
jburhenn 0:09ef59d2d0f7 16
jburhenn 0:09ef59d2d0f7 17 #if !defined(MQTT_LOGGING_H)
jburhenn 0:09ef59d2d0f7 18 #define MQTT_LOGGING_H
jburhenn 0:09ef59d2d0f7 19
jburhenn 0:09ef59d2d0f7 20 #define STREAM stdout
jburhenn 0:09ef59d2d0f7 21 #if !defined(DEBUG)
jburhenn 0:09ef59d2d0f7 22 #define DEBUG(...) \
jburhenn 0:09ef59d2d0f7 23 {\
jburhenn 0:09ef59d2d0f7 24 fprintf(STREAM, "DEBUG: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \
jburhenn 0:09ef59d2d0f7 25 fprintf(STREAM, ##__VA_ARGS__); \
jburhenn 0:09ef59d2d0f7 26 fflush(STREAM); \
jburhenn 0:09ef59d2d0f7 27 }
jburhenn 0:09ef59d2d0f7 28 #endif
jburhenn 0:09ef59d2d0f7 29 #if !defined(LOG)
jburhenn 0:09ef59d2d0f7 30 #define LOG(...) \
jburhenn 0:09ef59d2d0f7 31 {\
jburhenn 0:09ef59d2d0f7 32 fprintf(STREAM, "LOG: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \
jburhenn 0:09ef59d2d0f7 33 fprintf(STREAM, ##__VA_ARGS__); \
jburhenn 0:09ef59d2d0f7 34 fflush(STREAM); \
jburhenn 0:09ef59d2d0f7 35 }
jburhenn 0:09ef59d2d0f7 36 #endif
jburhenn 0:09ef59d2d0f7 37 #if !defined(WARN)
jburhenn 0:09ef59d2d0f7 38 #define WARN(...) \
jburhenn 0:09ef59d2d0f7 39 { \
jburhenn 0:09ef59d2d0f7 40 fprintf(STREAM, "WARN: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \
jburhenn 0:09ef59d2d0f7 41 fprintf(STREAM, ##__VA_ARGS__); \
jburhenn 0:09ef59d2d0f7 42 fflush(STREAM); \
jburhenn 0:09ef59d2d0f7 43 }
jburhenn 0:09ef59d2d0f7 44 #endif
jburhenn 0:09ef59d2d0f7 45 #if !defined(ERROR)
jburhenn 0:09ef59d2d0f7 46 #define ERROR(...) \
jburhenn 0:09ef59d2d0f7 47 { \
jburhenn 0:09ef59d2d0f7 48 fprintf(STREAM, "ERROR: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \
jburhenn 0:09ef59d2d0f7 49 fprintf(STREAM, ##__VA_ARGS__); \
jburhenn 0:09ef59d2d0f7 50 fflush(STREAM); \
jburhenn 0:09ef59d2d0f7 51 exit(1); \
jburhenn 0:09ef59d2d0f7 52 }
jburhenn 0:09ef59d2d0f7 53 #endif
jburhenn 0:09ef59d2d0f7 54
jburhenn 0:09ef59d2d0f7 55 #endif