|
Generalized-Core-Counter 3.20
Particle-based generalized core counter firmware
|
#include "Particle.h"#include "AB1805_RK.h"Go to the source code of this file.
Enumerations | |
| enum | State { INITIALIZATION_STATE , ERROR_STATE , IDLE_STATE , SLEEPING_STATE , CONNECTING_STATE , REPORTING_STATE , FIRMWARE_UPDATE_STATE } |
Functions | |
| void | dailyCleanup () |
| Cleanup function that is run at the beginning of the day. | |
| bool | isWithinOpenHours () |
| void | publishData () |
| Publish sensor data to Ubidots webhook and device-data ledger. | |
| void | publishStateTransition () |
| int | secondsUntilNextOpen () |
Variables | |
| AB1805 | ab1805 |
| SystemSleepConfiguration | config |
| unsigned long | connectedStartMs |
| Timer | countSignalTimer |
| bool | dataInFlight |
| bool | firstConnectionObserved |
| bool | firstConnectionQueueDrainedLogged |
| bool | hibernateDisabledForSession |
| bool | lastLowPowerMode |
| const unsigned long | maxConnectAttemptMs |
| const unsigned long | maxOnlineWorkMs |
| State | oldState |
| int | outOfMemory |
| const unsigned long | resetWait |
| volatile bool | sensorDetect |
| State | state |
| char | stateNames [7][16] |
| const unsigned long | stayAwakeLong |
| volatile bool | userSwitchDetected |
| const int | wakeBoundary |
| enum State |
| Enumerator | |
|---|---|
| INITIALIZATION_STATE | |
| ERROR_STATE | |
| IDLE_STATE | |
| SLEEPING_STATE | |
| CONNECTING_STATE | |
| REPORTING_STATE | |
| FIRMWARE_UPDATE_STATE | |
Definition at line 7 of file StateMachine.h.
| void dailyCleanup | ( | ) |
Cleanup function that is run at the beginning of the day.
May or may not be in connected state. Syncs time with remote service and sets low power mode. Called from Reporting State ONLY. Cleans house at the beginning of a new day.
Definition at line 693 of file Generalized-Core-Counter.cpp.
References current, publishDiagnosticSafe(), and sysStatus.
Referenced by handleReportingState().
| bool isWithinOpenHours | ( | ) |
Definition at line 428 of file Generalized-Core-Counter.cpp.
References sysStatus.
Referenced by handleIdleState(), handleSleepingState(), secondsUntilNextOpen(), and setup().
| void publishData | ( | ) |
Publish sensor data to Ubidots webhook and device-data ledger.
1) Builds a compact JSON payload expected by the Ubidots webhook template and enqueues it via PublishQueuePosix to the "Ubidots-Parking-Hook-v1" event. 2) Updates the Particle Ledger "device-data" with a richer JSON snapshot via Cloud::publishDataToLedger() for Console visibility.
Definition at line 509 of file Generalized-Core-Counter.cpp.
References batteryContext, current, Cloud::instance(), and sysStatus.
Referenced by handleReportingState().
| void publishStateTransition | ( | ) |
Definition at line 651 of file Generalized-Core-Counter.cpp.
References IDLE_STATE, oldState, state, and stateNames.
Referenced by handleConnectingState(), handleErrorState(), handleFirmwareUpdateState(), handleIdleState(), handleReportingState(), and handleSleepingState().
| int secondsUntilNextOpen | ( | ) |
Definition at line 454 of file Generalized-Core-Counter.cpp.
References isWithinOpenHours(), and sysStatus.
Referenced by handleSleepingState().
|
extern |
Referenced by handleErrorState(), handleSleepingState(), loop(), and setup().
|
extern |
Definition at line 87 of file Generalized-Core-Counter.cpp.
Referenced by handleSleepingState().
|
extern |
Definition at line 115 of file Generalized-Core-Counter.cpp.
Referenced by handleConnectingState(), and handleIdleState().
|
extern |
Referenced by handleCountingMode(), handleIdleState(), and handleSleepingState().
|
extern |
Definition at line 105 of file Generalized-Core-Counter.cpp.
Referenced by UbidotsHandler().
|
extern |
Definition at line 109 of file Generalized-Core-Counter.cpp.
Referenced by handleConnectingState(), and handleIdleState().
|
extern |
Definition at line 110 of file Generalized-Core-Counter.cpp.
Referenced by handleConnectingState(), and handleIdleState().
|
extern |
Definition at line 112 of file Generalized-Core-Counter.cpp.
Referenced by handleSleepingState().
|
extern |
|
extern |
Definition at line 123 of file Generalized-Core-Counter.cpp.
Referenced by handleConnectingState().
|
extern |
|
extern |
Definition at line 100 of file Generalized-Core-Counter.cpp.
Referenced by handleConnectingState(), handleErrorState(), handleFirmwareUpdateState(), handleIdleState(), handleReportingState(), handleSleepingState(), and publishStateTransition().
|
extern |
Definition at line 93 of file Generalized-Core-Counter.cpp.
Referenced by loop(), and outOfMemoryHandler().
|
extern |
Definition at line 122 of file Generalized-Core-Counter.cpp.
Referenced by handleErrorState().
|
extern |
Definition at line 104 of file Generalized-Core-Counter.cpp.
Referenced by handleIdleState(), handleSleepingState(), and sensorISR().
|
extern |
Definition at line 99 of file Generalized-Core-Counter.cpp.
Referenced by handleConnectingState(), handleErrorState(), handleFirmwareUpdateState(), handleIdleState(), handleReportingState(), handleSleepingState(), loop(), publishStateTransition(), and setup().
|
extern |
Definition at line 96 of file Generalized-Core-Counter.cpp.
Referenced by publishStateTransition().
|
extern |
|
extern |
Definition at line 103 of file Generalized-Core-Counter.cpp.
Referenced by handleSleepingState(), loop(), and userSwitchISR().
|
extern |
Definition at line 121 of file Generalized-Core-Counter.cpp.
Referenced by handleSleepingState().