aboutsummaryrefslogtreecommitdiff
path: root/NitrokeyManager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r--NitrokeyManager.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index 085bf78..a950e4b 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -234,12 +234,14 @@ using nitrokey::misc::strcpyT;
bool NitrokeyManager::connect() {
std::lock_guard<std::mutex> lock(mex_dev_com_manager);
vector< shared_ptr<Device> > devices = { make_shared<Stick10>(), make_shared<Stick20>() };
+ bool connected = false;
for( auto & d : devices ){
if (d->connect()){
device = std::shared_ptr<Device>(d);
+ connected = true;
}
}
- return device != nullptr;
+ return connected;
}
@@ -666,11 +668,15 @@ using nitrokey::misc::strcpyT;
return false;
}
- bool NitrokeyManager::get_time(uint64_t time) {
+ void NitrokeyManager::set_time_soft(uint64_t time) {
auto p = get_payload<SetTime>();
p.reset = 0;
p.time = time;
SetTime::CommandTransaction::run(device, p);
+ }
+
+ bool NitrokeyManager::get_time(uint64_t time) {
+ set_time_soft(time);
return true;
}
@@ -1131,5 +1137,13 @@ using nitrokey::misc::strcpyT;
return current_device_id;
}
+ void NitrokeyManager::wink(){
+ stick20::Wink::CommandTransaction::run(device);
+ };
+
+ stick20::ProductionTest::ResponsePayload NitrokeyManager::production_info(){
+ auto data = stick20::ProductionTest::CommandTransaction::run(device);
+ return data.data();
+ };
}