From 8617a13371d087b1eb67bd066926038d289ab331 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Fri, 17 Feb 2017 09:27:38 +0100 Subject: Handle SD card related functions Signed-off-by: Szczepan Zalega --- NitrokeyManager.cc | 10 ++++++++++ include/NitrokeyManager.h | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index 57ef878..176f516 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -745,6 +745,11 @@ namespace nitrokey{ return strdup(p.data().dissect().c_str()); } + std::pair NitrokeyManager::get_SD_usage_data(){ + auto p = stick20::GetSDCardOccupancy::CommandTransaction::run(device); + return std::make_pair(p.data().WriteLevelMin, p.data().WriteLevelMax); + } + int NitrokeyManager::get_progress_bar_value(){ try{ stick20::GetDeviceStatus::CommandTransaction::run(device); @@ -782,4 +787,9 @@ namespace nitrokey{ misc::execute_password_command(device, ""); } + int NitrokeyManager::get_SD_card_size() { + auto data = stick20::ProductionTest::CommandTransaction::run(device); + return data.data().SD_Card_Size_u8; + } + } diff --git a/include/NitrokeyManager.h b/include/NitrokeyManager.h index b89db63..2200955 100644 --- a/include/NitrokeyManager.h +++ b/include/NitrokeyManager.h @@ -106,6 +106,8 @@ namespace nitrokey { void fill_SD_card_with_random_data(const char *admin_pin); + int get_SD_card_size(); + void change_update_password(const char *current_update_password, const char *new_update_password); void create_hidden_volume(uint8_t slot_nr, uint8_t start_percent, uint8_t end_percent, @@ -117,8 +119,10 @@ namespace nitrokey { stick20::DeviceConfigurationResponsePacket::ResponsePayload get_status_storage(); const char *get_SD_usage_data_as_string(); + std::pair get_SD_usage_data(); + - int get_progress_bar_value(); + int get_progress_bar_value(); ~NitrokeyManager(); bool is_authorization_command_supported(); @@ -159,6 +163,7 @@ namespace nitrokey { const char *temporary_password) const; bool _disconnect_no_lock(); + }; } -- cgit v1.2.3