diff options
author | Robin Krahl <me@robin-krahl.de> | 2019-01-16 19:41:58 +0100 |
---|---|---|
committer | Robin Krahl <me@robin-krahl.de> | 2019-01-16 19:41:58 +0100 |
commit | 2491bcac250ea7036a4f39b06f4c8dcefea1650b (patch) | |
tree | b4139f57d03232e8e00a44670e1feaff0ad77aa0 | |
parent | 5d79387008dc81f9504103259a21f23962a5a966 (diff) | |
download | libnitrokey-2491bcac250ea7036a4f39b06f4c8dcefea1650b.tar.gz libnitrokey-2491bcac250ea7036a4f39b06f4c8dcefea1650b.tar.bz2 |
Add \mainpage to the C API documentation
The main page contains a reference to the header containing all
functions of the C API and a short example of how to use it.
-rw-r--r-- | NK_C_API.h | 46 |
1 files changed, 46 insertions, 0 deletions
@@ -37,6 +37,52 @@ * \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 |