diff options
author | Robin Krahl <me@robin-krahl.de> | 2019-01-13 12:04:31 +0100 |
---|---|---|
committer | Robin Krahl <me@robin-krahl.de> | 2019-01-13 13:26:53 +0100 |
commit | 14635f49813df1699569d3b13456ea33955de54b (patch) | |
tree | 929f82436e1e7b77865b3e408ea79155cf68591a /libnitrokey | |
parent | 1751759356bd64cc78f8f71543c3edd5cdce8376 (diff) | |
download | libnitrokey-14635f49813df1699569d3b13456ea33955de54b.tar.gz libnitrokey-14635f49813df1699569d3b13456ea33955de54b.tar.bz2 |
Add Device::create static method
The method makes it easier to create a std::shared_ptr<Device> from a
model enum instance.
Diffstat (limited to 'libnitrokey')
-rw-r--r-- | libnitrokey/device.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libnitrokey/device.h b/libnitrokey/device.h index 418d335..eab3888 100644 --- a/libnitrokey/device.h +++ b/libnitrokey/device.h @@ -24,6 +24,7 @@ #include <chrono> #include "hidapi/hidapi.h" #include <cstdint> +#include <memory> #include <string> #include <vector> #include "misc.h" @@ -154,6 +155,11 @@ public: */ static std::vector<DeviceInfo> enumerate(); + /** + * Create a Device of the given model. + */ + static std::shared_ptr<Device> create(DeviceModel model); + void show_stats(); // ErrorCounters get_stats(){ return m_counters; } |