added icsneo_device_type_from_type
parent
79293216af
commit
64f038f781
|
|
@ -53,6 +53,21 @@ ICSNEO_API icsneo_error_t icsneo_error_code(icsneo_error_t error_code, const cha
|
||||||
return icsneo_error_success;
|
return icsneo_error_success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ICSNEO_API icsneo_error_t icsneo_device_type_from_type(icsneo_devicetype_t device_type, const char* value, uint32_t* value_length) {
|
||||||
|
if (!value || !value_length) {
|
||||||
|
return icsneo_error_invalid_parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto device_type_str = DeviceType::getGenericProductName(device_type);
|
||||||
|
// Find the minimum length of the device type string and set value_length
|
||||||
|
auto min_length = std::minmax(static_cast<uint32_t>(device_type_str.length()), *value_length).first;
|
||||||
|
*value_length = min_length;
|
||||||
|
// Copy the string into value
|
||||||
|
strncpy(const_cast<char *>(value), device_type_str.c_str(), min_length);
|
||||||
|
|
||||||
|
return icsneo_error_success;
|
||||||
|
}
|
||||||
|
|
||||||
ICSNEO_API icsneo_error_t icsneo_find(icsneo_device_t** devices, uint32_t* devices_count, void* reserved) {
|
ICSNEO_API icsneo_error_t icsneo_find(icsneo_device_t** devices, uint32_t* devices_count, void* reserved) {
|
||||||
if (!devices || !devices_count) {
|
if (!devices || !devices_count) {
|
||||||
return icsneo_error_invalid_parameters;
|
return icsneo_error_invalid_parameters;
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,16 @@ typedef uint32_t icsneo_error_t;
|
||||||
*/
|
*/
|
||||||
ICSNEO_API icsneo_error_t icsneo_error_code(icsneo_error_t error_code, const char* value, uint32_t* value_length);
|
ICSNEO_API icsneo_error_t icsneo_error_code(icsneo_error_t error_code, const char* value, uint32_t* value_length);
|
||||||
|
|
||||||
|
/** @brief Get the device type string for a icsneo_devicetype_t.
|
||||||
|
*
|
||||||
|
* @param[in] icsneo_devicetype_t device_type The device type to get the description of.
|
||||||
|
* @param[out] const char* value Pointer to a buffer to copy the description into. Null terminated.
|
||||||
|
* @param[in,out] uint32_t* value_length Size of the value buffer. Modified with the length of the description.
|
||||||
|
*
|
||||||
|
* @return icsneo_error_t icsneo_error_success if successful, icsneo_error_invalid_parameters otherwise.
|
||||||
|
*/
|
||||||
|
ICSNEO_API icsneo_error_t icsneo_device_type_from_type(icsneo_devicetype_t device_type, const char* value, uint32_t* value_length);
|
||||||
|
|
||||||
/** @brief Find all hardware attached to the system.
|
/** @brief Find all hardware attached to the system.
|
||||||
*
|
*
|
||||||
* @param[out] icsneo_device_t array of devices to be filled with found devices.
|
* @param[out] icsneo_device_t array of devices to be filled with found devices.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue