summaryrefslogtreecommitdiff
path: root/NitrokeyManager.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 /NitrokeyManager.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 'NitrokeyManager.cc')
-rw-r--r--NitrokeyManager.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index a950e4b..8825fce 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -109,7 +109,12 @@ using nitrokey::misc::strcpyT;
std::lock_guard<std::mutex> lock(mex_dev_com_manager);
auto p = make_shared<Stick20>();
- return p->enumerate(); // make static
+ auto device_infos = p->enumerate();
+ std::vector<std::string> strings;
+ strings.resize(device_infos.size());
+ std::transform(device_infos.begin(), device_infos.end(), strings.begin(),
+ [](auto device_info) { return device_info.m_path; });
+ return strings;
}
std::vector<std::string> NitrokeyManager::list_devices_by_cpuID(){
@@ -130,7 +135,8 @@ using nitrokey::misc::strcpyT;
auto d = make_shared<Stick20>();
const auto v = d->enumerate();
LOGD1("Discovering IDs");
- for (auto & p: v){
+ for (auto & i: v){
+ auto p = i.m_path;
d = make_shared<Stick20>();
LOGD1( std::string("Found: ") + p );
d->set_path(p);