aboutsummaryrefslogtreecommitdiff
path: root/NitrokeyManager.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2018-04-10 08:15:09 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2018-04-10 08:15:09 +0200
commit92d4621442795b83dff55009c99e47d4a3d93bef (patch)
treec153252fee78ad705c7784737606d750b3eb9978 /NitrokeyManager.cc
parentd0eb7e950ef6535e82ee307937f51b2d3de7d777 (diff)
parent5a56b83084d797728e5ed557cce2637b3a1e7e56 (diff)
downloadlibnitrokey-92d4621442795b83dff55009c99e47d4a3d93bef.tar.gz
libnitrokey-92d4621442795b83dff55009c99e47d4a3d93bef.tar.bz2
Merge branch 'pr_105'
Fixes #105
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r--NitrokeyManager.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index db0c0a9..48196a9 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -273,6 +273,21 @@ using nitrokey::misc::strcpyT;
return device->connect();
}
+ bool NitrokeyManager::connect(device::DeviceModel device_model) {
+ const char *model_string;
+ switch (device_model) {
+ case device::DeviceModel::PRO:
+ model_string = "P";
+ break;
+ case device::DeviceModel::STORAGE:
+ model_string = "S";
+ break;
+ default:
+ throw std::runtime_error("Unknown model");
+ }
+ return connect(model_string);
+ }
+
shared_ptr<NitrokeyManager> NitrokeyManager::instance() {
static std::mutex mutex;
std::lock_guard<std::mutex> lock(mutex);