TactilityC: Forgot the most important function, getting the unit string of course!
This commit is contained in:
parent
9c6fa9d152
commit
fad1980f98
@ -128,6 +128,18 @@ RadioParameterStatus tt_hal_radio_set_parameter(RadioHandle handle, RadioParamet
|
|||||||
*/
|
*/
|
||||||
RadioParameterStatus tt_hal_radio_get_parameter(RadioHandle handle, RadioParameter parameter, float *value);
|
RadioParameterStatus tt_hal_radio_get_parameter(RadioHandle handle, RadioParameter parameter, float *value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the unit string of a parameter.
|
||||||
|
* If the parameter isn't available, the returned string is empty.
|
||||||
|
* If the unit string does not fit into the provided character array,
|
||||||
|
* it is truncated but always null terminated.
|
||||||
|
* @param[in] handle the radio driver handle
|
||||||
|
* @param[in] parameter the parameter
|
||||||
|
* @param[out] str character array to store the unit string into
|
||||||
|
* @param[in] maxSize the maximum size the array str can hold
|
||||||
|
*/
|
||||||
|
void tt_hal_radio_get_parameter_unit_str(RadioHandle handle, RadioParameter parameter, char str[], unsigned maxSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whenever the radio driver object can transmit a certain modulation.
|
* Check whenever the radio driver object can transmit a certain modulation.
|
||||||
* @param[in] handle the radio driver handle
|
* @param[in] handle the radio driver handle
|
||||||
|
|||||||
@ -69,6 +69,17 @@ extern "C" {
|
|||||||
return fromCpp(wrapper->device->getParameter(toCpp(parameter), *value));
|
return fromCpp(wrapper->device->getParameter(toCpp(parameter), *value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tt_hal_radio_get_parameter_unit_str(RadioHandle handle, RadioParameter parameter, char str[], unsigned maxSize) {
|
||||||
|
auto wrapper = static_cast<DeviceWrapper*>(handle);
|
||||||
|
assert(str);
|
||||||
|
std::string unitString = wrapper->device->getParameterUnit(toCpp(parameter)).toString();
|
||||||
|
size_t i = 0;
|
||||||
|
for (; i < (maxSize - 1); ++i) {
|
||||||
|
str[i] = unitString[i];
|
||||||
|
}
|
||||||
|
str[i] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
bool tt_hal_radio_can_transmit(RadioHandle handle, Modulation modulation) {
|
bool tt_hal_radio_can_transmit(RadioHandle handle, Modulation modulation) {
|
||||||
auto wrapper = static_cast<DeviceWrapper*>(handle);
|
auto wrapper = static_cast<DeviceWrapper*>(handle);
|
||||||
return wrapper->device->canTransmit(toCpp(modulation));
|
return wrapper->device->canTransmit(toCpp(modulation));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user