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
|
|
@ -9,6 +9,7 @@
|
|||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "StringUtils.h"
|
||||
#include "TecknetController.h"
|
||||
|
||||
static unsigned char tecknet_colour_mode_data[][16] =
|
||||
|
|
@ -38,10 +39,6 @@ TecknetController::TecknetController(hid_device* dev_handle, char *_path)
|
|||
wName = std::wstring(tmpName);
|
||||
device_name.append(" ").append(std::string(wName.begin(), wName.end()));
|
||||
|
||||
hid_get_serial_number_string(dev, tmpName, szTemp);
|
||||
wName = std::wstring(tmpName);
|
||||
serial = std::string(wName.begin(), wName.end());
|
||||
|
||||
location = _path;
|
||||
|
||||
current_mode = TECKNET_MODE_DIRECT;
|
||||
|
|
@ -61,7 +58,15 @@ std::string TecknetController::GetDeviceName()
|
|||
|
||||
std::string TecknetController::GetSerial()
|
||||
{
|
||||
return serial;
|
||||
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 TecknetController::GetLocation()
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ public:
|
|||
|
||||
private:
|
||||
std::string device_name;
|
||||
std::string serial;
|
||||
std::string location;
|
||||
hid_device* dev;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue