aboutsummaryrefslogtreecommitdiff
path: root/include/CommandFailedException.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/CommandFailedException.h')
-rw-r--r--include/CommandFailedException.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/include/CommandFailedException.h b/include/CommandFailedException.h
index 190eabc..6ff9a2d 100644
--- a/include/CommandFailedException.h
+++ b/include/CommandFailedException.h
@@ -14,11 +14,11 @@ using cs = nitrokey::proto::stick10::command_status;
class CommandFailedException : public std::exception {
public:
- const uint8_t last_command_code;
+ const uint8_t last_command_id;
const uint8_t last_command_status;
- CommandFailedException(uint8_t last_command_code, uint8_t last_command_status) :
- last_command_code(last_command_code),
+ CommandFailedException(uint8_t last_command_id, uint8_t last_command_status) :
+ last_command_id(last_command_id),
last_command_status(last_command_status){
nitrokey::log::Log::instance()(std::string("CommandFailedException, status: ")+ std::to_string(last_command_status), nitrokey::log::Loglevel::DEBUG);
}
@@ -27,6 +27,19 @@ public:
return "Command execution has failed on device";
}
+
+ bool reason_timestamp_warning() const throw(){
+ return last_command_status == static_cast<uint8_t>(cs::timestamp_warning);
+ }
+
+ bool reason_AES_not_initialized() const throw(){
+ return last_command_status == static_cast<uint8_t>(cs::AES_dec_failed);
+ }
+
+ bool reason_not_authorized() const throw(){
+ return last_command_status == static_cast<uint8_t>(cs::not_authorized);
+ }
+
bool reason_slot_not_programmed() const throw(){
return last_command_status == static_cast<uint8_t>(cs::slot_not_programmed);
}