#include <spdlog/spdlog.h>
#include <thread>
{
spdlog::info(
"TOF GESTURE L[{}] R[{}] ",
static_cast<int>(left.
type),
static_cast<int>(right.
type));
}
{
spdlog::warn(
"TOF PROXIMITY L[{}] R[{}] ",
static_cast<int>(left.
range_mm),
static_cast<int>(right.
range_mm));
}
int main()
{
spdlog::set_level(spdlog::level::info);
spdlog::flush_on(spdlog::level::trace);
spdlog::error("Doly service stop failed");
return -1;
}
{
spdlog::error("TofControl init failed");
return -2;
}
{
spdlog::error("TofControl setup failed");
return -3;
}
std::this_thread::sleep_for(std::chrono::seconds(30));
spdlog::info("Single Read Sensor[{}] Range[{}mm] Error[{}]", static_cast<int>(sensors[0].side), sensors[0].range_mm, static_cast<int>(sensors[0].error));
spdlog::info("Single Read Sensor[{}] Range[{}mm] Error[{}]", static_cast<int>(sensors[1].side), sensors[1].range_mm, static_cast<int>(sensors[1].error));
return 0;
}
Shared helper utilities and common types used across the Doly SDK.
Public API for Doly ToF (Time of Flight) sensor control.
int8_t stopDolyService()
Stop the background Doly service (if running).
int8_t init(int8_t offset_left=0, int8_t offset_right=0)
Initialize ToF sensors.
int8_t setup_continuous(uint16_t interval_ms=50, uint8_t distance=0)
Configure continuous reading for gesture detection and threshold events.
float getVersion()
Get current library version.
int8_t dispose()
Dispose/stop the ToF subsystem and release resources.
std::vector< TofData > getSensorsData()
Read both sensors once and return the latest values.
void AddListenerOnProximityGesture(void(*onEvent)(TofGesture left, TofGesture right))
Register a static/free function to receive proximity gesture events.
void RemoveListenerOnProximityGesture(void(*onEvent)(TofGesture left, TofGesture right))
Unregister a previously registered proximity gesture callback.
void RemoveListenerOnProximityThreshold(void(*onEvent)(TofData left, TofData right))
Unregister a previously registered proximity threshold callback.
void AddListenerOnProximityThreshold(void(*onEvent)(TofData left, TofData right))
Register a static/free function to receive proximity threshold events.
Latest ToF sample snapshot for one sensor.
Definition TofEventListener.h:89
int range_mm
Definition TofEventListener.h:93
Gesture description for a ToF sensor.
Definition TofEventListener.h:78
TofGestureType type
Definition TofEventListener.h:80