AWS IoT Firmware
Firmware code for AWS IoT Devices
Classes | Macros | Enumerations | Functions
event_handler_util.hpp File Reference

header file for event handler utils More...

#include "mgos.h"
#include "mgos_mqtt.h"
#include <stdarg.h>
#include <stdint.h>
Include dependency graph for event_handler_util.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ErrDescript
 used for storing the error code and its corresponding error message More...
 

Macros

#define MAX_COMMAND_LEN   30
 maximum length in characters of command name sent by the server
 
#define MAX_NAMESPACE_LEN   30
 maximum length in characters of the namespace name sent by the server
 

Enumerations

enum  HandlerError {
  HANDLER_NO_ERR = 0, MQTT_ERR_UNKNOWN_COMMAND, MQTT_ERR_GPIO, JSON_NOT_ENOUGH_ARG,
  MQTT_CONFIG_NOT_SET, JSON_UNKNOWN_NAMESPACE, JSON_VPRINTF_ERROR, JSON_VSCANF_ERROR,
  HANDLER_NULL
}
 enum defining errors that the system(including master handler and other child handler) may have
 

Functions

HandlerError getCommandInfo (struct mg_str *message, char *commandName, char *nameSpace)
 get command name as well as command namespace of messages sent from aws lambda More...
 
HandlerError getAwsPayload (const struct mg_str *message, const char *awsPayloadFormat, const uint8_t &totalArg,...)
 Get the Aws Payload json key. More...
 
HandlerError write_pin (const uint8_t pinNum, const uint8_t pinState)
 used for writing to a digital pin given its pin number and state More...
 
HandlerError read_pin (const uint8_t pinNum, uint8_t *pinState)
 used to reat the status of a digital pin More...
 
HandlerError create_error_message (const HandlerError error, struct mg_str *payload, char *errorMessage)
 create error message based on the error code given and stores it in the given buffer More...
 
HandlerError printStateReportOpen (char *jsonOut)
 print the beginning of an aws smarthome state report More...
 
HandlerError printStateReportDelimiter (char *jsonOut)
 print the delimiter between endpoints reports in aws iot state report More...
 
HandlerError printStateReportEnd (char *jsonOut)
 print the ending part of an aws iot state report More...
 

Detailed Description

header file for event handler utils

Author
Khoi Trinh
Date
2018-09-01