MQTT version for enno SDK
Dependencies: EthernetInterface MQTT mbed-rtos mbed serialzation_lib
Fork of HelloMQTT by
Diff: protocol/enno_api.h
- Revision:
- 21:c5f6350a292d
- Parent:
- 20:3858e42b0cd3
diff -r 3858e42b0cd3 -r c5f6350a292d protocol/enno_api.h --- a/protocol/enno_api.h Wed Nov 25 07:07:31 2015 +0000 +++ b/protocol/enno_api.h Wed Dec 02 01:54:31 2015 +0000 @@ -2,16 +2,12 @@ * enno_api.h * * Created on: 2015年11月20日 - * Author: wzy + * Author: v-chawei */ - #ifndef PROTOCOL_ENNO_API_H_ #define PROTOCOL_ENNO_API_H_ -// -// Created by root on 11/10/15. -// -#if definded(__cplusplus) +#if defined(__cplusplus) extern "C" { #endif @@ -68,25 +64,26 @@ Location_enno Location; Alert_enno Alert; } EnnoMessages; -//extern EnnoMessages EnnoMessagesDefault; -EnnoMessages EnnoMessagesDefault = { - .messageType = 'R', - .Register = {.pHardwareId = "enno-default-test-id-11", .pSpecificationToken = "417b36a8-21ef-4196-a8fe-cc756f994d0b", .pOriginator = NULL}, //7dfd6d63-5e8d-4380-be04-fc5c73801dfb - .Acknowledge = {.pMessage = NULL, .pOriginator = NULL}, - .Measurement = {.pName = "Temperature", .pOriginator = NULL, .value = 16, .eventDate = 0}, - .Location = {.pOriginator = NULL, .lat = 27.59, .lon = 86.5, .ele = 8844.43, .eventDate = 0}, - .Alert = {.pAlertType = "enno.info", .pAlertMessage = "I am alive", .pOriginator = NULL, .eventDate = 0} -}; +#define EnnoMessagesDefault {'R',{"enno-xbed-test-25", "417b36a8-21ef-4196-a8fe-cc756f994d0b", NULL},{"enno-xbed-test-25", NULL, NULL},{"enno-xbed-test-25", "temperature", NULL, 10, 0},{"enno-xbed-test-25", NULL, 27.59, 86.55, 8844.43, 0},{"enno-xbed-test-25", "enno.info", "I am alive", NULL, 0}} /** * @brief Handles the system callback message * - * params: topic the topic subscribed by client + * params: topic the system topic subscribed by client * payload the received payload * length the length of payload * */ void ennoSystemMessageHandler(char* topic, char* payload, int length); +/** + * @brief Handles the command callback message + * + * params: topic the command topic subscribed by client + * payload the received payload + * length the length of payload + * + */ +void ennoCommandMessageHandler(char* topic, char* payload, int length); /** * @brief Connection Function @@ -110,7 +107,7 @@ * callback Pointer to a callback function * @return An IoT Error Type defining successful/failed subscription */ -Error_t enno_subscribe(char *topic, void *callback); +Error_t enno_subscribe(char *topic, char *topicType); /** * @brief Publish a message to a path * @@ -120,8 +117,6 @@ * messages_enno Pointer to the published message * @return An IoT Error Type defining successful/failed publish */ - -//Error_t enno_publish(char path, EnnoParams *Params_enno, PublishParams *pParams); Error_t enno_publish(char *path, EnnoMessages *messages_enno); /** * @brief Unsubscribe to an topic.