aboutsummaryrefslogtreecommitdiff
path: root/src/device/pro.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2020-01-14 18:11:02 +0100
committerRobin Krahl <robin.krahl@ireas.org>2020-01-14 18:11:02 +0100
commit62d37c8d4e7d1caca21f23978198b721efc5973b (patch)
treecae2b5f81bb1245caef37cba80f934878978878c /src/device/pro.rs
parent528e56a0ff759ea81b61eea368cf53b5540dc89a (diff)
parent43664ca3c449008e2859feb94e3142db3fa98625 (diff)
downloadnitrokey-rs-62d37c8d4e7d1caca21f23978198b721efc5973b.tar.gz
nitrokey-rs-62d37c8d4e7d1caca21f23978198b721efc5973b.tar.bz2
Merge branch 'release-0.5.0'
Diffstat (limited to 'src/device/pro.rs')
-rw-r--r--src/device/pro.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/device/pro.rs b/src/device/pro.rs
index a65345e..591b730 100644
--- a/src/device/pro.rs
+++ b/src/device/pro.rs
@@ -3,8 +3,10 @@
use nitrokey_sys;
-use crate::device::{Device, Model};
+use crate::device::{Device, Model, Status};
+use crate::error::Error;
use crate::otp::GenerateOtp;
+use crate::util::get_command_result;
/// A Nitrokey Pro device without user or admin authentication.
///
@@ -74,6 +76,20 @@ impl<'a> Device<'a> for Pro<'a> {
fn get_model(&self) -> Model {
Model::Pro
}
+
+ fn get_status(&self) -> Result<Status, Error> {
+ let mut raw_status = nitrokey_sys::NK_status {
+ firmware_version_major: 0,
+ firmware_version_minor: 0,
+ serial_number_smart_card: 0,
+ config_numlock: 0,
+ config_capslock: 0,
+ config_scrolllock: 0,
+ otp_user_password: false,
+ };
+ get_command_result(unsafe { nitrokey_sys::NK_get_status(&mut raw_status) })?;
+ Ok(raw_status.into())
+ }
}
impl<'a> GenerateOtp for Pro<'a> {}