diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2019-01-24 18:43:19 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2019-01-24 18:43:19 +0100 |
commit | f7cbdc09858b7d26765e819c89e4289d30877f74 (patch) | |
tree | d6f9b5046e86501ab5b0ecc3c1ec3688e22a0307 /NK_C_API.h | |
parent | 8e4c28de760033dde2469bb69b76a80076d0fc39 (diff) | |
parent | af8ee6d30ac8ae45cf440c6bc2e03a873e3db584 (diff) | |
download | libnitrokey-f7cbdc09858b7d26765e819c89e4289d30877f74.tar.gz libnitrokey-f7cbdc09858b7d26765e819c89e4289d30877f74.tar.bz2 |
Merge branch 'pr_148'
Generate documentation for C API using Doxygen
Fixes #148
Diffstat (limited to 'NK_C_API.h')
-rw-r--r-- | NK_C_API.h | 52 |
1 files changed, 52 insertions, 0 deletions
@@ -33,6 +33,58 @@ #define NK_C_API #endif +/** + * \file + * + * C API for libnitrokey + * + * \mainpage + * + * **libnitrokey** provides access to Nitrokey Pro and Nitrokey Storage devices. + * This documentation describes libnitrokey’s C API. For a list of the + * available functions, see the NK_C_API.h file. + * + * \section getting_started Example + * + * \code{.c} + * #include <stdio.h> + * #include <stdlib.h> + * #include <libnitrokey/NK_C_API.h> + * + * int main(void) + * { + * if (NK_login_auto() != 1) { + * fprintf(stderr, "No Nitrokey found.\n"); + * return 1; + * } + * + * NK_device_model model = NK_get_device_model(); + * printf("Connected to "); + * switch (model) { + * case NK_PRO: + * printf("a Nitrokey Pro"); + * break; + * case NK_STORAGE: + * printf("a Nitrokey Storage"); + * break; + * default: + * printf("an unsupported Nitrokey"); + * break; + * } + * + * char* serial_number = NK_device_serial_number(); + * if (serial_number) + * printf(" with serial number %s\n", serial_number); + * else + * printf(" -- could not query serial number!\n"); + * free(serial_number); + * + * NK_logout(); + * return 0; + * } + * \endcode + */ + #ifdef __cplusplus extern "C" { #endif |