AWS IoT Firmware
Firmware code for AWS IoT Devices
speaker_ctrl_handler.hpp
Go to the documentation of this file.
1 
15 #ifndef _SPEAKER_CONTROL_HPP
16 #define _SPEAKER_CONTROL_HPP
17 
18 #include "parent_handler.hpp"
19 
20 #include "event_handler_util.hpp"
21 
22 #include "frozen.h"
23 #include "mgos.h"
24 #include "mgos_mqtt.h"
25 
27  public:
28  HandlerError handleRequest(struct mg_connection* mgCon,
29  struct mg_str* message,
30  char* commandName,
31  char* response);
32  HandlerError handleReport(char* stateReport);
33  ~SpeakerCtrlHandler(void){};
34  SpeakerCtrlHandler(void);
35 
36  static void pwrInputIntHandler(int pin, void* arg);
37 
38  void checkPotVoltage(void);
39 
40  private:
41  void updatePotAdcVal(void);
42 
43  HandlerError switchPwr(const bool& isPowerOn);
44  HandlerError setVolume(const int32_t& targetVolume);
45  HandlerError setMute(const bool& isMuted);
46  HandlerError changeWiperDir(const bool& isUp);
47  bool switchIsOn_;
48  int32_t currentVolume_;
49  bool isMuted_;
50  int32_t lastKnownPotAdcVal_;
51 };
52 
53 #endif
54 
HandlerError handleReport(char *stateReport)
handle preparing report for the speaker handler used when the handler needs to respond to the ...
Definition: speaker_ctrl_handler.cpp:172
header file for event handler utils
void checkPotVoltage(void)
called by the main polling function to check and update the pot voltage if necessary read the adc vol...
Definition: speaker_ctrl_handler.cpp:277
Definition: speaker_ctrl_handler.hpp:26
static void pwrInputIntHandler(int pin, void *arg)
handler function for when the user turn on/off the physical pot on the speaker This function will eit...
Definition: speaker_ctrl_handler.cpp:40
HandlerError handleRequest(struct mg_connection *mgCon, struct mg_str *message, char *commandName, char *response)
function to handle request passed by aws mqtt Depending on the reques type, the handler will either m...
Definition: speaker_ctrl_handler.cpp:89
contain class declaration for the ParentHandler class
HandlerError
enum defining errors that the system(including master handler and other child handler) may have ...
Definition: event_handler_util.hpp:37
the parent handler class that is the blueprint for other child handlers to implement, it also defines a couple functions that child handler can use
Definition: parent_handler.hpp:31
SpeakerCtrlHandler(void)
Construct a new Speaker Ctrl Handler:: Speaker Ctrl Handler object create a new spekaer handler...
Definition: speaker_ctrl_handler.cpp:61