aboutsummaryrefslogtreecommitdiff
path: root/NK_C_API.h
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2020-04-02 15:19:00 +0200
committerRobin Krahl <robin.krahl@ireas.org>2020-04-02 15:20:59 +0200
commitfedf828e394938fb6f84407b4de7412a3fb6ec40 (patch)
treeff101e273e82e16945576b424615c6a21031c0ee /NK_C_API.h
parent02f19713c155457e8cc7d80d581bdac35cb1716d (diff)
downloadlibnitrokey-fedf828e394938fb6f84407b4de7412a3fb6ec40.tar.gz
libnitrokey-fedf828e394938fb6f84407b4de7412a3fb6ec40.tar.bz2
Return serial number as uint32_t from C API
This patch adds the function NK_device_serial_number_as_u32 to the C API. It is similar to NK_device_serial_number but returns the raw unsigned integer instead of a formatted string. This patch also adds a simple test case that ensures that the number is not zero. Fixes #172.
Diffstat (limited to 'NK_C_API.h')
-rw-r--r--NK_C_API.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/NK_C_API.h b/NK_C_API.h
index d5c54a3..df3e992 100644
--- a/NK_C_API.h
+++ b/NK_C_API.h
@@ -386,6 +386,14 @@ extern "C" {
NK_C_API char * NK_device_serial_number();
/**
+ * Return the device's serial number string as an integer. Use
+ * NK_last_command_status to check for an error if this function
+ * returns zero.
+ * @return device's serial number as an integer
+ */
+ NK_C_API uint32_t NK_device_serial_number_as_u32();
+
+ /**
* Get last command processing status. Useful for commands which returns the results of their own and could not return
* an error code.
* @return previous command processing error code