ESP_IOT v2.5
IOT ESP Coding
ATOMQRCodeModule.cpp File Reference
#include "../../Defines.h"
#include "ATOMQRCodeModule.h"
#include "ATOM_SM.h"
#include "../SensorClass/SensorClassType.h"
#include "../SensorClass/KeyUnitSensorClass.h"
Include dependency graph for ATOMQRCodeModule.cpp:

Go to the source code of this file.

Macros

#define MAX_SM   500
 
#define DEFAULT_TO_FEED
 
#define RX   5
 
#define TX   6
 
#define TRY_CONTINUOUS
 
#define DEFAULT_TO_FEED
 
#define LONG_PRESS_TOGGLE_SCANNING
 

Functions

void ATOM_setSemanticMarkerInvocationState (boolean state)
 
void M5AtomCallback (char *parameter, boolean flag)
 
void setHostMode_ATOMQRCodeModule (boolean flag)
 turn on/off the scanning .. actually go to Host mode .. More...
 
void messageSetVal_ATOMQRCodeModule (char *setName, char *valValue, boolean deviceNameSpecified)
 
void loopCode_ATOMQRCodeModule ()
 forward reference .. since if button press called externally.. More...
 
void buttonA_ShortPress_ATOMQRCodeModule ()
 
void buttonA_LongPress_ATOMQRCodeModule ()
 long press on buttonA (top button) More...
 
void checkButtonB_ATOMQRCodeModule ()
 big button on front of M5StickC Plus More...
 
void initGlobals_ATOMQRCodeModule ()
 
void setup_ATOMQRCodeModule ()
 the setup() for this ATOM More...
 
void loop_ATOMQRCodeModule ()
 the loop More...
 
char * parsedSM_fromSemanticMarker (char *semanticMarker)
 
char * currentStatusURL_ATOMQRCodeModule ()
 returns a string in in URL so: status&battery=84'&buzzon='off' } .. etc More...
 
char * currentStatusJSON_ATOMQRCodeModule ()
 

Variables

boolean _validPins_ATOMQRCodeModule = true
 semantic marker processing More...
 
boolean _shortPress_ATOMQRCodeModule = false
 
boolean _longPress_ATOMQRCodeModule = false
 
boolean _longLongPress_ATOMQRCodeModule = false
 
char _lastSemanticMarker [MAX_SM]
 needs to be initialized More...
 
boolean _ATOM_semanticMarkerInvocationState = true
 temporary state of invoking the semantic marker (versus just sending as DOCFOLLOW) More...
 
KeyUnitSensorClass * _KeyUnitSensorClass_ATOMQRCodeModule
 keyUnitSensorClass object for the BUTTON More...
 
boolean _scanningQRonMode = true
 
boolean _isOn_ATOMQRCodeModule = true
 ability to turn on/off the ATOMQRCodeModule's scanning More...
 
uint8_t wakeup_cmd = 0x00
 
uint8_t start_scan_cmd [] = {0x04, 0xE4, 0x04, 0x00, 0xFF, 0x14}
 
uint8_t stop_scan_cmd [] = {0x04, 0xE5, 0x04, 0x00, 0xFF, 0x13}
 
uint8_t host_mode_cmd [] = {0x07, 0xC6, 0x04, 0x08, 0x00, 0x8A, 0x08, 0xFE, 0x95}
 
uint8_t buzzerVolumeHigh [] = {0x07, 0xC6, 0x04, 0x08, 0x00, 0xFE, 0x9B}
 
uint8_t buzzerVolumeMiddle [] = {0x07, 0xC6, 0x04, 0x08, 0x01, 0xFE, 0x9A}
 
uint8_t buzzerVolumeLow [] = {0x07, 0xC6, 0x04, 0x08, 0x02, 0xFE, 0x99}
 
uint8_t bootSoundProhibit [] = {0x08, 0xC6, 0x04, 0x08, 0x00, 0xF2, 0x0D, 0x00, 0xFE, 0x27}
 
uint8_t continuous_mode_cmd [] = {0x07, 0xC6, 0x04, 0x08, 0x00, 0x8A, 0x04, 0xFE, 0x99}
 
uint8_t enable_scanning_config_mode_cmd [] = {0x07, 0xC6, 0x04, 0x08, 0x00, 0xEC, 0x01, 0xFE, 0x3A}
 
uint8_t prohibit_scanning_config_mode_cmd [] = {0x07, 0xC6, 0x04, 0x08, 0x00, 0xEC, 0x00, 0xFE, 0x3B}
 
uint8_t prohibit_prompt_sound_decode_mode_cmd [] = {0x07, 0xC6, 0x04, 0x08, 0x38, 0x00, 0xFE, 0xEF}
 
uint8_t enable_prompt_sound_decode_mode_cmd [] = {0x07, 0xC6, 0x04, 0x08, 0x38, 0x01, 0xFE, 0xEF}
 
char _statusBuffer_ATOMQRCodeModule [100]
 3.31.25 add buffer to store More...
 

Macro Definition Documentation

◆ DEFAULT_TO_FEED [1/2]

#define DEFAULT_TO_FEED

◆ DEFAULT_TO_FEED [2/2]

#define DEFAULT_TO_FEED

◆ LONG_PRESS_TOGGLE_SCANNING

#define LONG_PRESS_TOGGLE_SCANNING

◆ MAX_SM

#define MAX_SM   500

Definition at line 39 of file ATOMQRCodeModule.cpp.

◆ RX

#define RX   5

◆ TRY_CONTINUOUS

#define TRY_CONTINUOUS

◆ TX

#define TX   6

Function Documentation

◆ ATOM_setSemanticMarkerInvocationState()

void ATOM_setSemanticMarkerInvocationState ( boolean  state)

3.26.24 set a temporary state of invoking the semantic marker (versus just sending as DOCFOLLOW) invocationState - true then "invoke"

Definition at line 61 of file ATOMQRCodeModule.cpp.

◆ buttonA_LongPress_ATOMQRCodeModule()

void buttonA_LongPress_ATOMQRCodeModule ( )

long press on buttonA (top button)

Definition at line 201 of file ATOMQRCodeModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buttonA_ShortPress_ATOMQRCodeModule()

void buttonA_ShortPress_ATOMQRCodeModule ( )

BUTTON PROCESSING abstraction short press on buttonA (top button)

Definition at line 191 of file ATOMQRCodeModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkButtonB_ATOMQRCodeModule()

void checkButtonB_ATOMQRCodeModule ( )

big button on front of M5StickC Plus

Definition at line 213 of file ATOMQRCodeModule.cpp.

Here is the caller graph for this function:

◆ currentStatusJSON_ATOMQRCodeModule()

char * currentStatusJSON_ATOMQRCodeModule ( )

returns a string in in JSON so: status&battery=84'&buzzon='off' } .. etc starts with "&"*

3.29.25 Raiiiinier Beeer movie last night add returning a UUID.FLOWNUM if valid, or nil if nota

Definition at line 714 of file ATOMQRCodeModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ currentStatusURL_ATOMQRCodeModule()

char * currentStatusURL_ATOMQRCodeModule ( )

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 QR

Definition at line 704 of file ATOMQRCodeModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initGlobals_ATOMQRCodeModule()

void initGlobals_ATOMQRCodeModule ( )

init any globals 1.5.24

8.20.24 for version with just the button, do a feed, if a QR Scanner.. this lastSemanticMarker will be sed..

3.29.25 init with empty

Definition at line 288 of file ATOMQRCodeModule.cpp.

Here is the caller graph for this function:

◆ loop_ATOMQRCodeModule()

void loop_ATOMQRCodeModule ( )

the loop

called for the loop() of this plugin

do loop code

4.10.24 GPS sensor 4.14.24 finally creating instance

Definition at line 457 of file ATOMQRCodeModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loopCode_ATOMQRCodeModule()

void loopCode_ATOMQRCodeModule ( )

forward reference .. since if button press called externally..

LOOP code.. refactored so it's also called when a buttonPress message arrives.

this might be a mode..

This read from the Serial2 – the QR Scanner device, and outputs to the serial debug BUT there seems to be strange charancters...

sometimes it's not valid scan..

if a valid scanned Semantic Marker .. process it

process the semantic marker. It will save to _lastSemanticMarker unless scannedDevice

save globally..

send this as a DOCFOLLOW message

save to SPIFF

todo: change long press to be TURN off scanning .. TOGGLE turning on/off scanning

toggle scan mode..

dispatches a call to the command specified. This is run on the next loop()

no

send this as a DOCFOLLOW message

feed always (done after the code below..)

Definition at line 482 of file ATOMQRCodeModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ M5AtomCallback()

void M5AtomCallback ( char *  parameter,
boolean  flag 
)

send this as a DOCFOLLOW message

process the semantic marker AGAIN used _lastSemanticMarker NOTE: this might be a TierII semantic marker (thus no UUID and FLOW) https://iDogWatch.com/bot/cmddevice/scott@konacurrents.com/PASS/M5AtomSocket/togglesocket

send this as a DOCFOLLOW message

save to spiff

Definition at line 86 of file ATOMQRCodeModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ messageSetVal_ATOMQRCodeModule()

void messageSetVal_ATOMQRCodeModule ( 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 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

process specific commands ...

3.22.25 - Nice day. Stormy week. add the ScannedSemanticMarker that will set the _lastSemanticMarker

3.29.25 add UUID/FLOW if set

Definition at line 151 of file ATOMQRCodeModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parsedSM_fromSemanticMarker()

char * parsedSM_fromSemanticMarker ( char *  semanticMarker)

6.16.26 try debug as crashing ..

3.29.25 Raiiiinier Beeer movie last night add returning a UUID.FLOWNUM if valid, or nil if nota

check for togleSocket (just for now)

Definition at line 684 of file ATOMQRCodeModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setHostMode_ATOMQRCodeModule()

void setHostMode_ATOMQRCodeModule ( boolean  flag)

turn on/off the scanning .. actually go to Host mode ..

4.10.24 GPS sensor 4.14.24 finally creating instance

Definition at line 447 of file ATOMQRCodeModule.cpp.

◆ setup_ATOMQRCodeModule()

void setup_ATOMQRCodeModule ( )

the setup() for this ATOM

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

7.13.26 test pins ..

specify the callback

call the setup

4.10.24 GPS sensor 4.14.24 finally creating instance

NOTE: it seems that a startup of a new ATOM with QRReader, requires the HOST most first, then the continuous will work ... 12.25.23

first wakeup the device

then send the command (host .. or maybe continuous)

4.25.24 in LA (ready for Star Wars/SDI at Regan Library)

See also
https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/atombase/AtomicQR/ATOM_QRCODE_CMD_EN.pdf

8.20.24 for version with just the button, do a feed, if a QR Scanner.. this lastSemanticMarker will be sed..

Definition at line 305 of file ATOMQRCodeModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ _ATOM_semanticMarkerInvocationState

boolean _ATOM_semanticMarkerInvocationState = true

temporary state of invoking the semantic marker (versus just sending as DOCFOLLOW)

3.29.25 Dead 3.29.90 great add UUID and FLOWnum not working .. 2.5.24 (birthday) the https call breaks (side effect some how) sendSecureRESTCall(getCommand);

Definition at line 56 of file ATOMQRCodeModule.cpp.

◆ _isOn_ATOMQRCodeModule

boolean _isOn_ATOMQRCodeModule = true

ability to turn on/off the ATOMQRCodeModule's scanning

Definition at line 145 of file ATOMQRCodeModule.cpp.

◆ _KeyUnitSensorClass_ATOMQRCodeModule

KeyUnitSensorClass* _KeyUnitSensorClass_ATOMQRCodeModule

keyUnitSensorClass object for the BUTTON

TODO.. have only 1 of these included in build, but change the callback That requires that ATOM be a class, OR there is a single Sensor but different callback..

Definition at line 82 of file ATOMQRCodeModule.cpp.

◆ _lastSemanticMarker

char _lastSemanticMarker[MAX_SM]

needs to be initialized

Definition at line 41 of file ATOMQRCodeModule.cpp.

◆ _longLongPress_ATOMQRCodeModule

boolean _longLongPress_ATOMQRCodeModule = false

Definition at line 38 of file ATOMQRCodeModule.cpp.

◆ _longPress_ATOMQRCodeModule

boolean _longPress_ATOMQRCodeModule = false

Definition at line 37 of file ATOMQRCodeModule.cpp.

◆ _scanningQRonMode

boolean _scanningQRonMode = true

4.28.24 LA (after Greg Browning walk-of-fame introduction) support toggling the scanning

Definition at line 143 of file ATOMQRCodeModule.cpp.

◆ _shortPress_ATOMQRCodeModule

boolean _shortPress_ATOMQRCodeModule = false

Definition at line 36 of file ATOMQRCodeModule.cpp.

◆ _statusBuffer_ATOMQRCodeModule

char _statusBuffer_ATOMQRCodeModule[100]

3.31.25 add buffer to store

Definition at line 682 of file ATOMQRCodeModule.cpp.

◆ _validPins_ATOMQRCodeModule

boolean _validPins_ATOMQRCodeModule = true

semantic marker processing

7.13.26 add valid pin (before putting into class wide)

Definition at line 34 of file ATOMQRCodeModule.cpp.

◆ bootSoundProhibit

uint8_t bootSoundProhibit[] = {0x08, 0xC6, 0x04, 0x08, 0x00, 0xF2, 0x0D, 0x00, 0xFE, 0x27}

Definition at line 271 of file ATOMQRCodeModule.cpp.

◆ buzzerVolumeHigh

uint8_t buzzerVolumeHigh[] = {0x07, 0xC6, 0x04, 0x08, 0x00, 0xFE, 0x9B}

Definition at line 267 of file ATOMQRCodeModule.cpp.

◆ buzzerVolumeLow

uint8_t buzzerVolumeLow[] = {0x07, 0xC6, 0x04, 0x08, 0x02, 0xFE, 0x99}

Definition at line 269 of file ATOMQRCodeModule.cpp.

◆ buzzerVolumeMiddle

uint8_t buzzerVolumeMiddle[] = {0x07, 0xC6, 0x04, 0x08, 0x01, 0xFE, 0x9A}

Definition at line 268 of file ATOMQRCodeModule.cpp.

◆ continuous_mode_cmd

uint8_t continuous_mode_cmd[] = {0x07, 0xC6, 0x04, 0x08, 0x00, 0x8A, 0x04, 0xFE, 0x99}

Definition at line 274 of file ATOMQRCodeModule.cpp.

◆ enable_prompt_sound_decode_mode_cmd

uint8_t enable_prompt_sound_decode_mode_cmd[] = {0x07, 0xC6, 0x04, 0x08, 0x38, 0x01, 0xFE, 0xEF}

Definition at line 283 of file ATOMQRCodeModule.cpp.

◆ enable_scanning_config_mode_cmd

uint8_t enable_scanning_config_mode_cmd[] = {0x07, 0xC6, 0x04, 0x08, 0x00, 0xEC, 0x01, 0xFE, 0x3A}

Definition at line 277 of file ATOMQRCodeModule.cpp.

◆ host_mode_cmd

uint8_t host_mode_cmd[] = {0x07, 0xC6, 0x04, 0x08, 0x00, 0x8A, 0x08, 0xFE, 0x95}

Definition at line 264 of file ATOMQRCodeModule.cpp.

◆ prohibit_prompt_sound_decode_mode_cmd

uint8_t prohibit_prompt_sound_decode_mode_cmd[] = {0x07, 0xC6, 0x04, 0x08, 0x38, 0x00, 0xFE, 0xEF}

sound settting prompt sound when decoding is successful

Definition at line 282 of file ATOMQRCodeModule.cpp.

◆ prohibit_scanning_config_mode_cmd

uint8_t prohibit_scanning_config_mode_cmd[] = {0x07, 0xC6, 0x04, 0x08, 0x00, 0xEC, 0x00, 0xFE, 0x3B}

Definition at line 278 of file ATOMQRCodeModule.cpp.

◆ start_scan_cmd

uint8_t start_scan_cmd[] = {0x04, 0xE4, 0x04, 0x00, 0xFF, 0x14}

Definition at line 262 of file ATOMQRCodeModule.cpp.

◆ stop_scan_cmd

uint8_t stop_scan_cmd[] = {0x04, 0xE5, 0x04, 0x00, 0xFF, 0x13}

Definition at line 263 of file ATOMQRCodeModule.cpp.

◆ wakeup_cmd

uint8_t wakeup_cmd = 0x00

Definition at line 261 of file ATOMQRCodeModule.cpp.