aboutsummaryrefslogtreecommitdiff
path: root/NitrokeyManager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r--NitrokeyManager.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index c49a449..f71c362 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -90,7 +90,7 @@ namespace nitrokey{
}
bool NitrokeyManager::disconnect() {
- if (device == nullptr){
+ if (!is_connected()){
return false;
}
const auto res = device->disconnect();
@@ -98,6 +98,10 @@ namespace nitrokey{
return res;
}
+ bool NitrokeyManager::is_connected(){
+ return device != nullptr;
+ }
+
void NitrokeyManager::set_debug(bool state) {
if (state){
Log::instance().set_loglevel(Loglevel::DEBUG);
@@ -111,7 +115,12 @@ namespace nitrokey{
return response.data().get_card_serial_hex();
}
- string NitrokeyManager::get_status() {
+ stick10::GetStatus::ResponsePayload NitrokeyManager::get_status(){
+ auto response = GetStatus::CommandTransaction::run(*device);
+ return response.data();
+ }
+
+ string NitrokeyManager::get_status_as_string() {
auto response = GetStatus::CommandTransaction::run(*device);
return response.data().dissect();
}
@@ -597,6 +606,10 @@ namespace nitrokey{
return get_major_firmware_version() <= m[device->get_device_model()];
}
+ DeviceModel NitrokeyManager::get_connected_device_model(){
+ return device->get_device_model();
+ }
+
int NitrokeyManager::get_major_firmware_version(){
switch(device->get_device_model()){
case DeviceModel::PRO:{
@@ -682,6 +695,11 @@ namespace nitrokey{
return strdup(p.data().dissect().c_str());
}
+ stick20::DeviceConfigurationResponsePacket::ResponsePayload NitrokeyManager::get_status_storage(){
+ auto p = stick20::GetDeviceStatus::CommandTransaction::run(*device);
+ return p.data();
+ }
+
const char * NitrokeyManager::get_SD_usage_data_as_string(){
auto p = stick20::GetSDCardOccupancy::CommandTransaction::run(*device);
return strdup(p.data().dissect().c_str());