Move wstring to string conversion to StringUtils.cpp and update most HID get serial number functions to use it
This commit is contained in:
parent
366fda30f5
commit
b4d15b9545
159 changed files with 623 additions and 930 deletions
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <string.h>
|
||||
#include "LegoDimensionsToypadBaseController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
LegoDimensionsToypadBaseController::LegoDimensionsToypadBaseController(hid_device* dev_handle, const hid_device_info& info)
|
||||
{
|
||||
|
|
@ -18,19 +19,6 @@ LegoDimensionsToypadBaseController::LegoDimensionsToypadBaseController(hid_devic
|
|||
location = info.path;
|
||||
version = "";
|
||||
|
||||
wchar_t serial_string[128];
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
if(ret != 0)
|
||||
{
|
||||
serial_number = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring return_wstring = serial_string;
|
||||
serial_number = std::string(return_wstring.begin(), return_wstring.end());
|
||||
}
|
||||
|
||||
Activate();
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +34,15 @@ std::string LegoDimensionsToypadBaseController::GetDeviceLocation()
|
|||
|
||||
std::string LegoDimensionsToypadBaseController::GetSerialString()
|
||||
{
|
||||
return(serial_number);
|
||||
wchar_t serial_string[128];
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
if(ret != 0)
|
||||
{
|
||||
return("");
|
||||
}
|
||||
|
||||
return(StringUtils::wstring_to_string(serial_string));
|
||||
}
|
||||
|
||||
std::string LegoDimensionsToypadBaseController::GetFirmwareVersion()
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ protected:
|
|||
|
||||
private:
|
||||
std::string location;
|
||||
std::string serial_number;
|
||||
std::string version;
|
||||
|
||||
void Activate();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue