#include <chrono>
#include <thread>
#include <spdlog/spdlog.h>
void onEdgeChange(std::vector<IrSensor> sensors)
{
spdlog::info("Edge Change Detected:");
{
spdlog::info("Sensor id: {} state: {}", static_cast<uint8_t>(sensor.id), static_cast<uint8_t>(sensor.state));
}
}
int main()
{
spdlog::set_level(spdlog::level::info);
spdlog::flush_on(spdlog::level::trace);
spdlog::error("Doly service stop failed");
return -1;
}
{
spdlog::error("EdgeControl init failed");
return -2;
}
std::this_thread::sleep_for(std::chrono::seconds(20));
return 0;
}
Public API for Doly edge/gap detection control (IR sensors).
Shared helper utilities and common types used across the Doly SDK.
float getVersion()
Get current library version.
int8_t init()
Initialize edge sensor control.
int8_t dispose()
Dispose edge sensor control and release resources.
void AddListenerOnChange(void(*onChange)(std::vector< IrSensor > sensors))
Register a function callback for sensor state changes.
void RemoveListenerOnChange(void(*onChange)(std::vector< IrSensor > sensors))
Unregister a function callback for sensor state changes.
int8_t stopDolyService()
Stop the background Doly service (if running).
Simple POD representing the state of an individual IR sensor.
Definition EdgeEventListener.h:66