Generalized-Core-Counter 3.20
Particle-based generalized core counter firmware
Loading...
Searching...
No Matches
State_Common.h File Reference
#include "Particle.h"
#include "StateHandlers.h"
#include "StateMachine.h"

Go to the source code of this file.

Functions

void dailyCleanup ()
 Cleanup function that is run at the beginning of the day.
void ensureSensorEnabled (const char *context)
bool isRadioPoweredOn ()
void publishData ()
 Publish sensor data to Ubidots webhook and device-data ledger.
bool publishDiagnosticSafe (const char *eventName, const char *data, PublishFlags flags)
 Publish a state transition to the log handler.
void requestFullDisconnectAndRadioOff ()
void requestRadioPowerOff ()

Function Documentation

◆ dailyCleanup()

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.

◆ ensureSensorEnabled()

void ensureSensorEnabled ( const char * context)

◆ isRadioPoweredOn()

bool isRadioPoweredOn ( )

Definition at line 21 of file State_Connect.cpp.

Referenced by handleSleepingState().

◆ publishData()

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.

◆ publishDiagnosticSafe()

bool publishDiagnosticSafe ( const char * eventName,
const char * data,
PublishFlags flags )
extern

Publish a state transition to the log handler.

Safely publish diagnostic message through queue with depth guard.

Routes low-priority diagnostic messages through PublishQueuePosix only when queue depth is below threshold, preventing displacement of critical telemetry data during tight loops or error conditions.

Parameters
eventNameThe event name for the publish.
dataThe event data payload.
flagsParticle publish flags (e.g., PRIVATE).
Returns
true if message was queued or published, false if queue was too full.

Definition at line 633 of file Generalized-Core-Counter.cpp.

Referenced by dailyCleanup(), handleConnectingState(), sysStatusData::initialize(), and UbidotsHandler().

◆ requestFullDisconnectAndRadioOff()

void requestFullDisconnectAndRadioOff ( )

◆ requestRadioPowerOff()

void requestRadioPowerOff ( )

Definition at line 31 of file State_Connect.cpp.

Referenced by requestFullDisconnectAndRadioOff().