diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2016-10-18 15:29:20 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2016-10-19 16:40:25 +0200 |
commit | f9cc44df7e2882557e37cfb1e0ebe6d779d5eeb5 (patch) | |
tree | cb9b1ae90c6bfab9d6cd3d6b193b5941c00863ae | |
parent | b33580e849bbdc8162135e74c9bd0405da454883 (diff) | |
download | libnitrokey-f9cc44df7e2882557e37cfb1e0ebe6d779d5eeb5.tar.gz libnitrokey-f9cc44df7e2882557e37cfb1e0ebe6d779d5eeb5.tar.bz2 |
Code refactoring: variables names unification
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r-- | include/device_proto.h | 20 | ||||
-rw-r--r-- | include/dissect.h | 8 |
2 files changed, 14 insertions, 14 deletions
diff --git a/include/device_proto.h b/include/device_proto.h index d64c341..128eca8 100644 --- a/include/device_proto.h +++ b/include/device_proto.h @@ -100,12 +100,12 @@ namespace nitrokey { uint8_t _padding[HID_REPORT_SIZE - 12]; ResponsePayload payload; struct { - uint8_t _storageStatusPadding[20 - 8 + 1]; //starts on 20th byte minus already 8 used + zero byte - uint8_t CommandCounter_u8; - uint8_t LastCommand_u8; - uint8_t Status_u8; //general status - idle0/ok1/busy2/wrongpassword3 - uint8_t ProgressBarValue_u8; - } StorageStatus __packed; + uint8_t _storage_status_padding[20 - 8 + 1]; //starts on 20th byte minus already 8 used + zero byte + uint8_t command_counter; + uint8_t command_id; + uint8_t device_status; //@see stick20::device_status + uint8_t progress_bar_value; + } storage_status __packed; } __packed; uint32_t crc; @@ -238,10 +238,10 @@ namespace nitrokey { resp.command_id >= stick20::CMD_START_VALUE && resp.command_id < stick20::CMD_END_VALUE ) { Log::instance()(std::string("Detected storage device cmd, status: ") + - std::to_string(resp.StorageStatus.Status_u8), Loglevel::DEBUG_L2); + std::to_string(resp.storage_status.device_status), Loglevel::DEBUG_L2); resp.last_command_status = static_cast<uint8_t>(stick10::command_status::ok); - switch (static_cast<stick20::device_status>(resp.StorageStatus.Status_u8)) { + switch (static_cast<stick20::device_status>(resp.storage_status.device_status)) { case stick20::device_status::idle : case stick20::device_status::ok: resp.device_status = static_cast<uint8_t>(stick10::device_status::ok); @@ -256,8 +256,8 @@ namespace nitrokey { break; default: Log::instance()(std::string("Unknown storage device status, cannot translate: ") + - std::to_string(resp.StorageStatus.Status_u8), Loglevel::DEBUG); - resp.device_status = resp.StorageStatus.Status_u8; + std::to_string(resp.storage_status.device_status), Loglevel::DEBUG); + resp.device_status = resp.storage_status.device_status; break; }; } diff --git a/include/dissect.h b/include/dissect.h index 56c1403..59e6e9c 100644 --- a/include/dissect.h +++ b/include/dissect.h @@ -80,10 +80,10 @@ class ResponseDissector : semantics::non_constructible { out << "Storage stick status:" << std::endl; #define d(x) out << " "#x": \t"<< std::hex << std::setw(2) \ << std::setfill('0')<< static_cast<int>(x) << std::endl; - d(pod.StorageStatus.CommandCounter_u8); - d(pod.StorageStatus.LastCommand_u8); - d(pod.StorageStatus.Status_u8); - d(pod.StorageStatus.ProgressBarValue_u8); + d(pod.storage_status.command_counter); + d(pod.storage_status.command_id); + d(pod.storage_status.device_status); + d(pod.storage_status.progress_bar_value); #undef d out << "Payload:" << std::endl; |