Protective Stop
Loading...
Searching...
No Matches
protective_stop_machine::FleetCheckin Class Reference

Periodically POSTs a device check-in to <base_url>/api/v1/checkin. More...

#include <fleet_checkin.hpp>

Public Member Functions

 FleetCheckin (FleetCheckinConfig config, uint32_t machine_id, std::function< MachineSnapshot()> snapshot_fn)
 FleetCheckin (const FleetCheckin &)=delete
FleetCheckin & operator= (const FleetCheckin &)=delete
bool start ()
 Launches the check-in thread.
void stop ()
 Stops the thread and joins. Idempotent.
bool enabled () const
 True while the check-in thread is running.

Detailed Description

Periodically POSTs a device check-in to <base_url>/api/v1/checkin.

The payload follows the ESP32 check-in schema, so the fleet registers this software machine as a device_type:"machine" device. An update_available directive in the response is logged only. Runs on its own thread, off the safety path: failures only log. Driven from the node's activate/deactivate transitions, so it runs only while the node is ACTIVE. start() and stop() are idempotent.

Constructor & Destructor Documentation

◆ FleetCheckin()

protective_stop_machine::FleetCheckin::FleetCheckin ( FleetCheckinConfig config,
uint32_t machine_id,
std::function< MachineSnapshot()> snapshot_fn )
Parameters
configDeployment values.
machine_idDevice ID of this machine.
snapshot_fnReturns the state to report; called from the check-in thread.

Member Function Documentation

◆ start()

bool protective_stop_machine::FleetCheckin::start ( )

Launches the check-in thread.

Returns
False when disabled (empty base_url) or the key file is unreadable. Non-fatal: check-in is off the safety path and never fails activation.

The documentation for this class was generated from the following file: