|
ESP_IOT v2.5
IOT ESP Coding
|
#include "../../Defines.h"#include "ATOM_SocketModule.h"#include "AtomSocket.h"#include "../ATOM_LED_Module/M5Display.h"#include "../SensorClass/SensorClassType.h"#include "../SensorClass/KeyUnitSensorClass.h"
Go to the source code of this file.
Macros | |
| #define | RXD 22 |
| #define | RELAY 23 |
Functions | |
| HardwareSerial | AtomSerial (2) |
| interface to the hardware More... | |
| void | loopCode_ATOM_SocketModule () |
| LOOP code.. refactored so it's also called when a buttonPress message arrives. More... | |
| void | checkButtonB_ATOM_SocketModule () |
| big button on front of M5StickC Plus More... | |
| void | toggle_ATOM_SocketModule () |
| turn on/off the socket More... | |
| void | M5AtomSocketCallback (char *parameter, boolean flag) |
| void | set_ATOM_SocketModule (boolean flag) |
| turn on/off the socket More... | |
| void | messageSetVal_ATOM_SocketModule (char *setName, char *valValue, boolean deviceNameSpecified) |
| void | messageSend_ATOM_SocketModule (char *sendValue) |
| void | initGlobals_ATOM_SocketModule () |
| void | setup_ATOM_SocketModule () |
| void | loop_ATOM_SocketModule () |
| called for the loop() of this plugin More... | |
| void | buttonA_ShortPress_ATOM_SocketModule () |
| void | buttonA_LongPress_ATOM_SocketModule () |
| long press on buttonA (top button) More... | |
| char * | currentStatusURL_ATOM_SocketModule () |
| returns a string in in URL so: status&battery=84'&buzzon='off' } .. etc More... | |
| char * | currentStatusJSON_ATOM_SocketModule () |
Variables | |
| int | _Voltage = 0 |
| info from the socket power More... | |
| int | _ActivePower = 0 |
| float | _Current = 0 |
| ATOMSOCKET | ATOM |
| create the ATOMSOCKET connection to the power socket More... | |
| boolean | _shortPress_ATOM_SocketModule = false |
| not beware of linking another ATOM these names will overload.. More... | |
| boolean | _longPress_ATOM_SocketModule = false |
| boolean | _longLongPress_ATOM_SocketModule = false |
| boolean | _isOn_ATOM_SocketModule |
| KeyUnitSensorClass * | _KeyUnitSensorClass_ATOMSocketModule = NULL |
| #define RELAY 23 |
Definition at line 31 of file ATOM_SocketModule.cpp.
| #define RXD 22 |
Definition at line 30 of file ATOM_SocketModule.cpp.
| HardwareSerial AtomSerial | ( | 2 | ) |
interface to the hardware

| void buttonA_LongPress_ATOM_SocketModule | ( | ) |
long press on buttonA (top button)
Definition at line 269 of file ATOM_SocketModule.cpp.


| void buttonA_ShortPress_ATOM_SocketModule | ( | ) |
BUTTON PROCESSING abstraction short press on buttonA (top button)
Definition at line 258 of file ATOM_SocketModule.cpp.


| void checkButtonB_ATOM_SocketModule | ( | ) |
big button on front of M5StickC Plus
NOTE: ths issue is the timer is interruped by the scanner.. so make long-long very long..
Definition at line 281 of file ATOM_SocketModule.cpp.

| char * currentStatusJSON_ATOM_SocketModule | ( | ) |
returns a string in in JSON so: status&battery=84'&buzzon='off' } .. etc starts with "&"*
Definition at line 394 of file ATOM_SocketModule.cpp.

| char * currentStatusURL_ATOM_SocketModule | ( | ) |
returns a string in in URL so: status&battery=84'&buzzon='off' } .. etc
returns a string in in URL so: status&battery=84'&buzzon='off' } .. etc starts with "&"*
8.4.25 add k=PWR
Definition at line 383 of file ATOM_SocketModule.cpp.

| void initGlobals_ATOM_SocketModule | ( | ) |
init any globals 1.5.24
Definition at line 153 of file ATOM_SocketModule.cpp.

| void loop_ATOM_SocketModule | ( | ) |
called for the loop() of this plugin
TODO..
do loop code
Definition at line 225 of file ATOM_SocketModule.cpp.


| void loopCode_ATOM_SocketModule | ( | ) |
LOOP code.. refactored so it's also called when a buttonPress message arrives.
1.11.24 one idea, use the PIR_SM and let this send that message That way a long press could turn on all the devices, for example.. OR: just have a long press toggle but for everyone.. TODO..
use STATUS, and Long Press to get info..
dispatches a call to the command specified. This is run on the next loop()
Definition at line 316 of file ATOM_SocketModule.cpp.


| void M5AtomSocketCallback | ( | char * | parameter, |
| boolean | flag | ||
| ) |
Definition at line 64 of file ATOM_SocketModule.cpp.


| void messageSend_ATOM_SocketModule | ( | char * | sendValue | ) |
12.28.23, 8.28.23 Adding a way for others to get informed on messages that arrive for the send
Definition at line 142 of file ATOM_SocketModule.cpp.


| void messageSetVal_ATOM_SocketModule | ( | char * | setName, |
| char * | valValue, | ||
| boolean | deviceNameSpecified | ||
| ) |
8.28.23 Adding a way for others to get informed on messages that arrive for the set,val 2.27.23 support setName == "socket" 1.10.24 if deviceNameSpecified then this matches this device, otherwise for all. It's up to the receiver to decide if it has to be specified 1.12.24 AtomSocketGlobalOnOff to turn on/off global onoff
see if global on/off is supported.. So if globalOnOff definitely perform action. If deviceNameSpecified - perform action so OR of them
Definition at line 123 of file ATOM_SocketModule.cpp.


| void set_ATOM_SocketModule | ( | boolean | flag | ) |
turn on/off the socket
store globally
1.1.24 syntax: socket=on or socket=off (somewhere in the string..) .. this version, only string avaialble..
1.1.24 syntax: socket=on or socket=off (somewhere in the string..)
send status after power on/off change..
Definition at line 79 of file ATOM_SocketModule.cpp.


| void setup_ATOM_SocketModule | ( | ) |
THIS IS the setup() and loop() but using the "component" name, eg AudioModule() This will perform preference initializtion as well called from the setup() Pass in the method to call on a loud (over a threshhold. The parameter for value will be sent
5.3.25 register our PIN use
1.1.24 syntax: socket=on or socket=off (somewhere in the string..)
TODO..
NOTE: this could probably be done by ESP_IOT.ino .. but for now keep here (and in the other ATOM code..)
ijnit the ATOM Socket
default whatever was the last mode Persistently..
NOTE: error without (char*) – warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings]
if the Buzzer isn't on .. then we are good to go try this 5.14.25 .. But this is probablly wrong .. is should be just the KeyUnitSensorClass .. and maybe more generic..
create instance..
specify the callback
call the setup
Definition at line 163 of file ATOM_SocketModule.cpp.


| void toggle_ATOM_SocketModule | ( | ) |
turn on/off the socket
Definition at line 111 of file ATOM_SocketModule.cpp.


| int _ActivePower = 0 |
Definition at line 24 of file ATOM_SocketModule.cpp.
| float _Current = 0 |
Definition at line 25 of file ATOM_SocketModule.cpp.
| boolean _isOn_ATOM_SocketModule |
whether the device is ON (default of) called "RelayFlag" is the example
Definition at line 50 of file ATOM_SocketModule.cpp.
| KeyUnitSensorClass* _KeyUnitSensorClass_ATOMSocketModule = NULL |
Definition at line 60 of file ATOM_SocketModule.cpp.
| boolean _longLongPress_ATOM_SocketModule = false |
Definition at line 46 of file ATOM_SocketModule.cpp.
| boolean _longPress_ATOM_SocketModule = false |
Definition at line 45 of file ATOM_SocketModule.cpp.
| boolean _shortPress_ATOM_SocketModule = false |
not beware of linking another ATOM these names will overload..
Definition at line 44 of file ATOM_SocketModule.cpp.
| int _Voltage = 0 |
info from the socket power
Use ATOM Socket to monitor the socket power, press the middle button of ATOM to switch the socket power on and off. Connect to the AP hotspot of the device and access 192.168.4.1 to wirelessly control the socket power and view the power voltage, current and power information. 使用ATOM插座监控插座电源,按ATOM的中间按钮即可打开和关闭插座电源。 连接到设备的AP热点,接入192.168.4.1,无线控制插座电源,查看电源电压、电流和电源信息。
Definition at line 23 of file ATOM_SocketModule.cpp.
| ATOMSOCKET ATOM |
create the ATOMSOCKET connection to the power socket
Definition at line 28 of file ATOM_SocketModule.cpp.