aboutsummaryrefslogtreecommitdiff
path: root/include/device.h
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2018-03-02 11:41:13 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2018-03-02 11:41:13 +0100
commit379daf936caa7fc8d7311a5dda101edb40d35ca5 (patch)
tree2d186dec6976b12a9f7b37e589c02703275a30ef /include/device.h
parentd5486ba77235a874245fbee07a75cea89fa59ea2 (diff)
parentc3d615b659b608f3a1d624f6fc78c303efbe1f8e (diff)
downloadlibnitrokey-379daf936caa7fc8d7311a5dda101edb40d35ca5.tar.gz
libnitrokey-379daf936caa7fc8d7311a5dda101edb40d35ca5.tar.bz2
Merge branch 'wip-multiple_devices'
Allow to use multiple devices, iteratively. Storage only.
Diffstat (limited to 'include/device.h')
-rw-r--r--include/device.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/device.h b/include/device.h
index 1bd4773..f6d2380 100644
--- a/include/device.h
+++ b/include/device.h
@@ -25,6 +25,7 @@
#include "hidapi/hidapi.h"
#include <cstdint>
#include <string>
+#include <vector>
#define HID_REPORT_SIZE 65
@@ -105,8 +106,10 @@ public:
* @return true if visible by OS
*/
bool could_be_enumerated();
+ std::vector<std::string> enumerate();
- void show_stats();
+
+ void show_stats();
// ErrorCounters get_stats(){ return m_counters; }
int get_retry_receiving_count() const { return m_retry_receiving_count; };
int get_retry_sending_count() const { return m_retry_sending_count; };
@@ -121,8 +124,10 @@ public:
void set_retry_delay(std::chrono::milliseconds delay);
static void set_default_device_speed(int delay);
void setDefaultDelay();
+ void set_path(const std::string path);
+
-private:
+ private:
std::atomic<uint8_t> last_command_status;
void _reconnect();
bool _connect();
@@ -143,6 +148,7 @@ protected:
std::chrono::milliseconds m_retry_timeout;
std::chrono::milliseconds m_send_receive_delay;
std::atomic<hid_device *>mp_devhandle;
+ std::string m_path;
static std::atomic_int instances_count;
static std::chrono::milliseconds default_delay ;