aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-01-11 16:04:52 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2017-01-11 16:04:52 +0100
commitc2d3de8820cc2ad3f394b6672853af257d32e6f6 (patch)
tree5adebf80eb9ff293694146ac48363c2fc8ae2c30 /include
parent0c6f3234acea5888dd6c3c3aeee8cebcce59ba06 (diff)
downloadlibnitrokey-c2d3de8820cc2ad3f394b6672853af257d32e6f6.tar.gz
libnitrokey-c2d3de8820cc2ad3f394b6672853af257d32e6f6.tar.bz2
Helper functions for getting device state
get status for Pro and Storage check is device connected use make_shared for keeping instance reference fixed accessing active volume flag Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'include')
-rw-r--r--include/NitrokeyManager.h11
-rw-r--r--include/stick20_commands.h9
2 files changed, 15 insertions, 5 deletions
diff --git a/include/NitrokeyManager.h b/include/NitrokeyManager.h
index fd39445..d6b70a4 100644
--- a/include/NitrokeyManager.h
+++ b/include/NitrokeyManager.h
@@ -39,8 +39,11 @@ namespace nitrokey {
bool connect(const char *device_model);
bool connect();
bool disconnect();
- void set_debug(bool state);
- string get_status();
+ bool is_connected();
+ DeviceModel get_connected_device_model();
+ void set_debug(bool state);
+ stick10::GetStatus::ResponsePayload get_status();
+ string get_status_as_string();
string get_serial_number();
const char * get_totp_slot_name(uint8_t slot_number);
@@ -105,6 +108,7 @@ namespace nitrokey {
void send_startup(uint64_t seconds_from_epoch);
const char * get_status_storage_as_string();
+ stick20::DeviceConfigurationResponsePacket::ResponsePayload get_status_storage();
const char *get_SD_usage_data_as_string();
@@ -117,11 +121,10 @@ namespace nitrokey {
void authorize_packet(T &package, const char *admin_temporary_password, shared_ptr<Device> device);
int get_major_firmware_version();
+ explicit NitrokeyManager();
private:
- NitrokeyManager();
static shared_ptr <NitrokeyManager> _instance;
- bool connected;
std::shared_ptr<Device> device;
bool is_valid_hotp_slot_number(uint8_t slot_number) const;
diff --git a/include/stick20_commands.h b/include/stick20_commands.h
index 386cbda..8080117 100644
--- a/include/stick20_commands.h
+++ b/include/stick20_commands.h
@@ -141,7 +141,14 @@ namespace nitrokey {
uint8_t NewSDCardFound_u8;
uint8_t SDFillWithRandomChars_u8;
uint32_t ActiveSD_CardID_u32;
- uint8_t VolumeActiceFlag_u8;
+ union{
+ uint8_t VolumeActiceFlag_u8;
+ struct {
+ bool unencrypted :1;
+ bool encrypted :1;
+ bool hidden :1;
+ } __packed VolumeActiceFlag_st;
+ } __packed;
uint8_t NewSmartCardFound_u8;
uint8_t UserPwRetryCount;
uint8_t AdminPwRetryCount;