aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NitrokeyManager.cc15
-rw-r--r--libnitrokey/NitrokeyManager.h1
2 files changed, 16 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);
diff --git a/libnitrokey/NitrokeyManager.h b/libnitrokey/NitrokeyManager.h
index ca58d24..1f4cec4 100644
--- a/libnitrokey/NitrokeyManager.h
+++ b/libnitrokey/NitrokeyManager.h
@@ -80,6 +80,7 @@ char * strndup(const char* str, size_t maxlen);
bool connect_with_ID(const std::string id);
bool connect_with_path (std::string path);
bool connect(const char *device_model);
+ bool connect(device::DeviceModel device_model);
bool connect();
bool disconnect();
bool is_connected() throw() ;