Move wstring to string conversion to StringUtils.cpp and update most HID get serial number functions to use it

This commit is contained in:
Adam Honse 2024-07-28 03:50:29 -05:00
parent 366fda30f5
commit b4d15b9545
159 changed files with 623 additions and 930 deletions

View file

@ -8,6 +8,7 @@
\*---------------------------------------------------------*/
#include <cstring>
#include "StringUtils.h"
#include "WushiL50USBController.h"
WushiL50USBController::WushiL50USBController(hidapi_wrapper hid_wrapper, hid_device* dev_handle, const char* path)
@ -74,5 +75,13 @@ std::string WushiL50USBController::getLocation()
std::string WushiL50USBController::GetSerialString()
{
return(serial_number);
wchar_t serial_string[128];
int ret = wrapper.hid_get_serial_number_string(dev, serial_string, 128);
if(ret != 0)
{
return("");
}
return(StringUtils::wstring_to_string(serial_string));
}

View file

@ -109,5 +109,4 @@ private:
hidapi_wrapper wrapper;
hid_device * dev;
std::string location;
std::string serial_number;
};