aboutsummaryrefslogtreecommitdiff
path: root/include/LongOperationInProgressException.h
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-10-25 18:40:30 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-11-26 18:56:24 +0100
commit385d33bb4c8bb7fe604f5e0acc8aeca5f2146fae (patch)
treeebf4ed2890ed88820317459b8f8d75915dfd2867 /include/LongOperationInProgressException.h
parentd02c321effbc8b1ae6e8e54f93df53d57ab0d7e1 (diff)
downloadlibnitrokey-385d33bb4c8bb7fe604f5e0acc8aeca5f2146fae.tar.gz
libnitrokey-385d33bb4c8bb7fe604f5e0acc8aeca5f2146fae.tar.bz2
Handle busy_progressbar device status
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'include/LongOperationInProgressException.h')
-rw-r--r--include/LongOperationInProgressException.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/LongOperationInProgressException.h b/include/LongOperationInProgressException.h
new file mode 100644
index 0000000..673a218
--- /dev/null
+++ b/include/LongOperationInProgressException.h
@@ -0,0 +1,28 @@
+//
+// Created by sz on 24.10.16.
+//
+
+#ifndef LIBNITROKEY_LONGOPERATIONINPROGRESSEXCEPTION_H
+#define LIBNITROKEY_LONGOPERATIONINPROGRESSEXCEPTION_H
+
+
+class LongOperationInProgressException : public std::exception {
+
+public:
+ unsigned char progress_bar_value;
+ unsigned char command_id;
+
+ LongOperationInProgressException(unsigned char _command_id, unsigned char _progress_bar_value) {
+ command_id = _command_id;
+ progress_bar_value = _progress_bar_value;
+ nitrokey::log::Log::instance()(
+ std::string("LongOperationInProgressException, progress bar status: ")+
+ std::to_string(progress_bar_value), nitrokey::log::Loglevel::DEBUG);
+ }
+ virtual const char *what() const throw() {
+ return "Device returned busy status with long operation in progress";
+ }
+};
+
+
+#endif //LIBNITROKEY_LONGOPERATIONINPROGRESSEXCEPTION_H