diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-03-29 12:22:37 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-03-29 12:49:14 +0200 |
commit | c196b45789377dc2cb76a203853695928872dbb4 (patch) | |
tree | baa78ecddf5e0a8f5ab7485227aa6706d407cfd5 /NitrokeyManager.cc | |
parent | 887929bfdefd5894bce2de6821a948b205915fcc (diff) | |
download | libnitrokey-c196b45789377dc2cb76a203853695928872dbb4.tar.gz libnitrokey-c196b45789377dc2cb76a203853695928872dbb4.tar.bz2 |
Allow to change device commands delays runtime
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r-- | NitrokeyManager.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index 12f4671..ec74f18 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -69,6 +69,14 @@ namespace nitrokey{ NitrokeyManager::~NitrokeyManager() { } + bool NitrokeyManager::set_current_device_speed(int retry_delay, int send_receive_delay){ + std::lock_guard<std::mutex> lock(mex_dev_com); + if(device != nullptr){ + device->set_receiving_delay(std::chrono::duration<int, std::milli>(send_receive_delay)); + device->set_retry_delay(std::chrono::duration<int, std::milli>(retry_delay)); + } + } + bool NitrokeyManager::connect() { std::lock_guard<std::mutex> lock(mex_dev_com); vector< shared_ptr<Device> > devices = { make_shared<Stick10>(), make_shared<Stick20>() }; @@ -80,6 +88,9 @@ namespace nitrokey{ return device != nullptr; } + bool NitrokeyManager::set_default_commands_delay(int delay){ + Device::set_default_device_speed(delay); + } bool NitrokeyManager::connect(const char *device_model) { std::lock_guard<std::mutex> lock(mex_dev_com); |