Doly C++ SDK v1.00
Loading...
Searching...
No Matches
TofControl Namespace Reference

Functions

int8_t init (int8_t offset_left=0, int8_t offset_right=0)
 Initialize ToF sensors.
int8_t dispose ()
 Dispose/stop the ToF subsystem and release resources.
int8_t setup_continuous (uint16_t interval_ms=50, uint8_t distance=0)
 Configure continuous reading for gesture detection and threshold events.
std::vector< TofDatagetSensorsData ()
 Read both sensors once and return the latest values.
bool isActive ()
 Check whether the ToF subsystem is active (initialized).
bool isReading ()
 Check whether the subsystem is currently performing frequent/continuous readings.
float getVersion ()
 Get current library version.

Function Documentation

◆ dispose()

int8_t TofControl::dispose ( )

Dispose/stop the ToF subsystem and release resources.

Returns
Status code:
  • 0 : success
  • 1 : not initialized
Examples
TofControl/main.cpp.

◆ getSensorsData()

std::vector< TofData > TofControl::getSensorsData ( )

Read both sensors once and return the latest values.

Continuous setup is not required for single reads.

Returns
Vector containing left and right sensor data.
Examples
TofControl/main.cpp.

◆ getVersion()

float TofControl::getVersion ( )

Get current library version.

Original note: format 0.XYZ (3 digits after major).

Returns
Version as float.
Examples
TofControl/main.cpp.

◆ init()

int8_t TofControl::init ( int8_t offset_left = 0,
int8_t offset_right = 0 )

Initialize ToF sensors.

Parameters
offset_leftOffset to apply to left sensor readings.
offset_rightOffset to apply to right sensor readings.
Returns
Status code:
  • 0 : success
  • 1 : already running
  • -1 : both sensor init failed
  • -2 : left sensor init failed
  • -3 : right sensor init failed
Examples
TofControl/main.cpp.

◆ isActive()

bool TofControl::isActive ( )

Check whether the ToF subsystem is active (initialized).

Returns
true if initialized; false otherwise.

◆ isReading()

bool TofControl::isReading ( )

Check whether the subsystem is currently performing frequent/continuous readings.

Returns
true if continuous reading is active; false otherwise.

◆ setup_continuous()

int8_t TofControl::setup_continuous ( uint16_t interval_ms = 50,
uint8_t distance = 0 )

Configure continuous reading for gesture detection and threshold events.

Parameters
interval_msRead interval in milliseconds (max = 2550 ms). Use 0 to stop continuous reading.
distanceProximity threshold distance in millimeters:
  • 0 disables proximity threshold events
  • 120 mm is the maximum supported threshold
Returns
Status code:
  • 0 : success
  • 1 : already running
  • -1 : interval_ms out of range (max = 2550)
  • -2 : ToF devices not ready
  • -3 : proximity distance out of range (0..120 mm)
Note
For better gesture detection, recommended interval is 30..80 ms (ideal: 50 ms).
Examples
TofControl/main.cpp.