Generates firmware-compatible commands for tuning performance parameters. More...
#include <command.h>
Public Member Functions | |
Command (TsParam param, float value) | |
Command (TsService service) | |
char * | getBytes () |
TsParam | getParam () |
std::string | getParamName () |
float | getValue () |
Private Member Functions | |
std::string | _getKey (TsParam param) |
std::string | _getKey (TsService service) |
Private Attributes | |
char | _bytes [50] |
TsParam | _param |
float | _value |
const int | MAX_VALUE = 9999 |
const int | MIN_VALUE = -9999 |
Static Private Attributes | |
static const char | kPrefix = 'C' |
Generates firmware-compatible commands for tuning performance parameters.
Firmware defines commands in two formats, singular and dimensional. Singular commands expect one parameter value, dimensional commands expect XYZ limits defining a spatial cuboid. Currently, only the voxel filtering command is dimensionally formatted.
Note that all desired values are transmitted as zero-padded 5-byte strings, and the first byte is always reserved for the arithmetic sign: 0 for positive values, - for negative values.
Note that modifications on these parameters are done on the sensor chip, not in this driver
toposens_driver::Command::Command | ( | TsParam | param, |
float | value | ||
) |
Builds a command message accepted by the TS firmware.
param | Setting name from the enumerated TsParam list. |
value | Desired integer value for sensor parameter. |
All desired values are transmitted as zero-padded 5-byte string. The first byte is always reserved for the arithmetic sign: 0 for positive values, - for negative values. The function also clips desired parameter values to predefined bounds.
Command format:
- Starts with kPrefix
- 5 bytes defining firmware parameter to update
- 5 bytes with desired parameter value
- Terminating carriage return
Definition at line 21 of file command.cpp.
toposens_driver::Command::Command | ( | TsService | service | ) |
Builds a command message accepted by the TS firmware to invoke a service.
param | Service name from the enumerated TsService list. |
Compiles command string for service requests.
Command format:
- Starts with kPrefix
- 5 bytes defining firmware service
- Terminating carriage return
Definition at line 55 of file command.cpp.
|
private |
Looks up command keys defined by the TS firmware corresponding to given setting parameters.
param | Setting name from the enumerated command list. |
Paramter keys are 5-byte strings hard-coded in the TS device firmware.
Definition at line 65 of file command.cpp.
|
private |
Looks up service keys defined by the TS firmware.
param | service name from the enumerated command list. |
Command keys are 5-byte strings hard-coded in the TS device firmware.
Definition at line 83 of file command.cpp.
|
inline |
Returns the latest command message produced by generate().
|
inline |
std::string toposens_driver::Command::getParamName | ( | ) |
Looks up command name defined by the TsDriver configuration to given setting parameters.
Command keys are 5-byte strings hard-coded in the TS device firmware.
Definition at line 93 of file command.cpp.
|
inline |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |