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,25 +11,13 @@
|
|||
|
||||
#include <string.h>
|
||||
#include "LenovoMotherboardController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
LenovoMotherboardController::LenovoMotherboardController(hid_device* dev_handle, const hid_device_info& info)
|
||||
{
|
||||
dev = dev_handle;
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
LenovoMotherboardController::~LenovoMotherboardController()
|
||||
|
|
@ -44,7 +32,15 @@ std::string LenovoMotherboardController::GetDeviceLocation()
|
|||
|
||||
std::string LenovoMotherboardController::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 LenovoMotherboardController::GetFirmwareVersion()
|
||||
|
|
|
|||
|
|
@ -55,6 +55,5 @@ public:
|
|||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string serial_number;
|
||||
std::string version;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue