diff --git a/TactilityC/Include/tt_hal_radio.h b/TactilityC/Include/tt_hal_radio.h index 7d2a69bf..fc2ee3b3 100644 --- a/TactilityC/Include/tt_hal_radio.h +++ b/TactilityC/Include/tt_hal_radio.h @@ -82,6 +82,21 @@ RadioHandle tt_hal_radio_alloc(DeviceId radioId); */ void tt_hal_radio_free(RadioHandle handle); +/** + * Get the name for the radio driver object. + * @param[in] handle the radio driver handle + * @return the name of the radio + */ +const char* const tt_hal_radio_get_name(RadioHandle handle); + +/** + * Get the description for the radio driver object. + * @param[in] handle the radio driver handle + * @return the description for the radio + */ +const char* const tt_hal_radio_get_desc(RadioHandle handle); + + /** * Get the state for the radio driver object. * @param[in] handle the radio driver handle diff --git a/TactilityC/Source/tt_hal_radio.cpp b/TactilityC/Source/tt_hal_radio.cpp index f9fa5f4c..d66b8182 100644 --- a/TactilityC/Source/tt_hal_radio.cpp +++ b/TactilityC/Source/tt_hal_radio.cpp @@ -18,7 +18,12 @@ static tt::hal::radio::RadioDevice::TransmissionState toCpp(RadioTxState state); struct DeviceWrapper { std::shared_ptr device; - DeviceWrapper(std::shared_ptr device) : device(device) {} + std::string name; + std::string description; + DeviceWrapper(std::shared_ptr device) + : device(device) + , name(device->getName()) + , description(device->getDescription()) {} }; static std::shared_ptr findValidRadioDevice(tt::hal::Device::Id id) { @@ -41,6 +46,16 @@ extern "C" { delete wrapper; } + const char* const tt_hal_radio_get_name(RadioHandle handle) { + auto wrapper = static_cast(handle); + return wrapper->name.c_str(); + } + + const char* const tt_hal_radio_get_desc(RadioHandle handle) { + auto wrapper = static_cast(handle); + return wrapper->description.c_str(); + } + RadioState tt_hal_radio_get_state(RadioHandle handle) { auto wrapper = static_cast(handle); return fromCpp(wrapper->device->getState());