aboutsummaryrefslogtreecommitdiff
path: root/include/device.h
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-02-16 17:48:13 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2017-03-11 15:41:46 +0100
commit3d96df28fe95deb096a19e3886381ef360b978d8 (patch)
treea0b60562a76d5c10bf03d8e2d5565ee2352e49c5 /include/device.h
parenta0df25c10bfc21574d474547bf2f25372bdbb417 (diff)
downloadlibnitrokey-3d96df28fe95deb096a19e3886381ef360b978d8.tar.gz
libnitrokey-3d96df28fe95deb096a19e3886381ef360b978d8.tar.bz2
Correct device counters
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'include/device.h')
-rw-r--r--include/device.h29
1 files changed, 19 insertions, 10 deletions
diff --git a/include/device.h b/include/device.h
index 281c4d9..40eb376 100644
--- a/include/device.h
+++ b/include/device.h
@@ -28,21 +28,30 @@ enum class DeviceModel{
STORAGE
};
+#include <atomic>
+
class Device {
public:
struct ErrorCounters{
- int wrong_CRC;
- int CRC_other_than_awaited;
- int busy;
- int total_retries;
- int sending_error;
- int receiving_error;
- int total_comm_runs;
- int storage_commands;
- int successful;
+ using cnt = std::atomic_int;
+ cnt wrong_CRC;
+ cnt CRC_other_than_awaited;
+ cnt busy;
+ cnt total_retries;
+ cnt sending_error;
+ cnt receiving_error;
+ cnt total_comm_runs;
+ cnt successful_storage_commands;
+ cnt command_successful_recv;
+ cnt recv_executed;
+ cnt sends_executed;
+ cnt busy_progressbar;
+ cnt command_result_not_equal_0_recv;
+ cnt communication_successful;
std::string get_as_string();
+
} m_counters = {};
@@ -71,7 +80,7 @@ public:
bool is_connected();
void show_stats();
- ErrorCounters get_stats(){ return m_counters; }
+// 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; };
std::chrono::milliseconds get_retry_timeout() const { return m_retry_timeout; };