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 /include/device.h | |
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 'include/device.h')
-rw-r--r-- | include/device.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/include/device.h b/include/device.h index 7b300e5..674d66b 100644 --- a/include/device.h +++ b/include/device.h @@ -96,6 +96,11 @@ public: void set_last_command_status(uint8_t _err) { last_command_status = _err;} ; bool last_command_sucessfull() const {return last_command_status == 0;}; DeviceModel get_device_model() const {return m_model;} + void set_receiving_delay(std::chrono::milliseconds delay); + void set_retry_delay(std::chrono::milliseconds delay); + static void set_default_device_speed(int delay); + void setDefaultDelay(); + private: std::atomic<uint8_t> last_command_status; void _reconnect(); @@ -114,18 +119,21 @@ protected: */ const int m_retry_sending_count; const int m_retry_receiving_count; - const std::chrono::milliseconds m_retry_timeout; - const std::chrono::milliseconds m_send_receive_delay; + std::chrono::milliseconds m_retry_timeout; + std::chrono::milliseconds m_send_receive_delay; std::atomic<hid_device *>mp_devhandle; static std::atomic_int instances_count; + + static std::chrono::milliseconds default_delay ; }; class Stick10 : public Device { public: Stick10(); + }; class Stick20 : public Device { |