aboutsummaryrefslogtreecommitdiff
path: root/device.cc
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2019-01-13 12:03:34 +0100
committerRobin Krahl <me@robin-krahl.de>2019-01-13 12:03:34 +0100
commit4a7ce051bd4004fb62f1c7022d92efa2ce42b6ab (patch)
tree35eef9d44c5c9a6413131599ddacb51e5c1ff140 /device.cc
parenteb55579c1c0e03ea98372280a344c79bb52a1f1a (diff)
downloadlibnitrokey-4a7ce051bd4004fb62f1c7022d92efa2ce42b6ab.tar.gz
libnitrokey-4a7ce051bd4004fb62f1c7022d92efa2ce42b6ab.tar.bz2
Change Device::enumerate return type to use DeviceInfo
The return type of Device::enumerate is changed from std::vector<std::string> to std::vector<DeviceInfo> to expose the additional information contained in the DeviceInfo struct.
Diffstat (limited to 'device.cc')
-rw-r--r--device.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/device.cc b/device.cc
index 80e4b38..506a68c 100644
--- a/device.cc
+++ b/device.cc
@@ -171,14 +171,17 @@ int Device::recv(void *packet) {
return status;
}
-std::vector<std::string> Device::enumerate(){
+std::vector<DeviceInfo> Device::enumerate(){
//TODO make static
auto pInfo = hid_enumerate(m_vid, m_pid);
auto pInfo_ = pInfo;
- std::vector<std::string> res;
+ std::vector<DeviceInfo> res;
while (pInfo != nullptr){
- std::string a (pInfo->path);
- res.push_back(a);
+ std::string path(pInfo->path);
+ std::wstring serialNumber(pInfo->serial_number);
+ auto deviceModel = this->get_device_model();
+ DeviceInfo info = { deviceModel, path, serialNumber };
+ res.push_back(info);
pInfo = pInfo->next;
}