AWS IoT Firmware
Firmware code for AWS IoT Devices
|
Files | |
file | temp_sensor_handler.cpp |
TempSensorHandler source files for pc controller. | |
file | temp_sensor_handler.hpp |
header file for TempSensorHandler class of the pc controller device | |
Classes | |
class | PowerCtrlHandler |
power controller class for the bed room light controller, responsible for handling an requests pertaining to the power controller namespace More... | |
class | TempSensorHandler |
TempSensorHandler class, responsible for handling temperature sensor endpoint functionalities of aws. More... | |
Macros | |
#define | SUBSCRIBE_TOPIC "/pcReq" |
topic that the pc controller subscribe to | |
#define | PUBLISH_TOPIC "/pcRes" |
topic that the pc controller will publish replise to | |
#define | PC_CTRL_PIN 5 |
pins used to control the relay controlling the pc motherboard pins | |
#define | PC_BUTTON_PIN 4 |
pins used to sense the pc case switch actuation | |
#define | ANALOG_PIN 0 |
analog pins used for reading temperature sensor reading | |
#define | TOTAL_HANDLER 2 |
change this if you use more or less handler | |
#define | REGISTER_INTERRUPT() |
Reigiter pc controller interrupt. More... | |
#define | INITIALIZE_HANDLER() |
change this function to customize the list of handler More... | |
#define | SWITCH_ON_STATE 1 |
state of the pin when the relay is on | |
#define | BUTTON_DEBOUNCE_MS 50 |
debouncing period for the pc case switch | |
#define | SWITCH_DELAY_MS 150 |
the delay between turning on and turning off the relay controlling the pc motherboard pins, used to make sure that the switching actually has an observable effect | |
#define | TMP36_COEFF 3300 / 1024 |
TMP36 coefficient to convert from analog voltage to celsius. | |
Functions | |
void | handlePolling (struct mg_connection *mgCon, ParentHandler *handlerList[], char *jsonBuf) |
dummy empty function since pc controller has no polling need More... | |
static void | PowerCtrlHandler::buttonInterruptHandler (int pin, void *arg) |
handle the case power on switch interrupt More... | |
static void | PowerCtrlHandler::setPcStatus (bool pcStatus) |
setter for the pc status variable More... | |
static bool | PowerCtrlHandler::getPcStatus (void) |
used to get whether the pc is on or off More... | |
HandlerError | TempSensorHandler::handleRequest (struct mg_connection *mgCon, struct mg_str *message, char *commandName, char *response) |
handle aws request pertainting to temperature sensor endpoint for the pc controller More... | |
HandlerError | TempSensorHandler::handleReport (char *stateReport) |
handle state report pertainting to temperature sensor endpoint for the pc controller The function will mesasure the temperature(using the TMP36 sensor for now) and put it in areport and write it to a buffer More... | |
#define INITIALIZE_HANDLER | ( | ) |
change this function to customize the list of handler
#define REGISTER_INTERRUPT | ( | ) |
Reigiter pc controller interrupt.
Register a button interrupt to actuate on pc's case power button
|
static |
handle the case power on switch interrupt
pin | pin that the interrupt comes from |
arg | any custom arguments that is to be passed to the interrupt handler, not used in This case When the user presses the power on swithc on the case, the interrupt will be called to actuate on that switch as well as update the status of the pc |
|
static |
used to get whether the pc is on or off
void handlePolling | ( | struct mg_connection * | mgCon, |
ParentHandler * | handlerList[], | ||
char * | jsonBuf | ||
) |
dummy empty function since pc controller has no polling need
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 |
handle state report pertainting to temperature sensor endpoint for the pc controller The function will mesasure the temperature(using the TMP36 sensor for now) and put it in areport and write it to a buffer
stateReport | buffer to write report to |
Implements ParentHandler.
|
virtual |
handle aws request pertainting to temperature sensor endpoint for the pc controller
mgCon | struct representing connection to server |
message | message sent to the mcu by the server |
response | buffer to write the response to |
This function is empty and is only here to fulfill the contract with the parent handler because the aws temperature sensor gets reading only through state report and not regular request
Implements ParentHandler.
|
static |
setter for the pc status variable
pcStatus | the status to change the variable to |