AWS IoT Firmware
Firmware code for AWS IoT Devices
|
Classes | |
class | PowerCtrlHandler |
power controller class for the bed room light controller, responsible for handling an requests pertaining to the power controller namespace More... | |
Macros | |
#define | SUBSCRIBE_TOPIC "/bedRoomLightReq" |
topic that the bed room light controller subscribe to | |
#define | PUBLISH_TOPIC "/bedRoomLightRes" |
topic that the bed room light controller will publish replies to | |
#define | LIGHT_CTRL_PIN 21 |
pins used for controlling the relay to turn on/off the light | |
#define | TOTAL_HANDLER 1 |
change this if you use more or less handler | |
#define | REGISTER_INTERRUPT() {} |
empty since we don't use any interrupts | |
#define | INITIALIZE_HANDLER() |
change this function to customize the list of handler More... | |
Functions | |
void | handlePolling (struct mg_connection *mgCon, ParentHandler *handlerList[], char *jsonBuf) |
dummy empty function since bed room light controller has no polling need More... | |
PowerCtrlHandler::PowerCtrlHandler (void) | |
Construct a new Power Ctrl Handler:: Power Ctrl Handler object intialize a power controller handler for the bed room light controller. | |
HandlerError | PowerCtrlHandler::handleRequest (struct mg_connection *mgCon, struct mg_str *message, char *commandName, char *response) |
implement the handle request function for the power control endpoint for the bedroom light controller More... | |
static void | PowerCtrlHandler::setLightStatus (bool lightStatus) |
set the light status variable More... | |
static bool | PowerCtrlHandler::getLightStatus (void) |
retrieve the status of the bed room lgiht More... | |
HandlerError | PowerCtrlHandler::handleReport (char *stateReport) |
write a state report for the powercontroller endpoint to the given buffer More... | |
#define INITIALIZE_HANDLER | ( | ) |
change this function to customize the list of handler
|
static |
retrieve the status of the bed room lgiht
void handlePolling | ( | struct mg_connection * | mgCon, |
ParentHandler * | handlerList[], | ||
char * | jsonBuf | ||
) |
dummy empty function since bed room light controller has no polling need
mgCon | mongoose network connection |
handlerList | list of pointer to handler object |
jsonBuf | json buffer for writing data |
|
virtual |
write a state report for the powercontroller endpoint to the given buffer
handle reports pertaining to power controller endpoint for pc controller
stateReport | buffer to write report to |
stateReport | buffer to write report to |
Implements ParentHandler.
|
virtual |
implement the handle request function for the power control endpoint for the bedroom light controller
handle request pertaining to power control endpoint for the pc controller
mgCon | struct representing connection to server |
message | message sent to the mcu by the server |
commandName | name of the command in the payload sent by the server |
response | buffer to write the response to |
Turn the light on or off based on the command name then make a report of the new state
mgCon | struct representing connection to server |
message | message sent to the mcu by the server |
commandName | name of the command in the payload sent by the server |
response | buffer to write the response to |
Implements ParentHandler.
|
static |
set the light status variable
lightStatus | the status to set |