From 2491bcac250ea7036a4f39b06f4c8dcefea1650b Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Wed, 16 Jan 2019 19:41:58 +0100 Subject: 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. --- NK_C_API.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/NK_C_API.h b/NK_C_API.h index 289eaee..c803ef1 100644 --- a/NK_C_API.h +++ b/NK_C_API.h @@ -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 + * #include + * #include + * + * 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 -- cgit v1.2.1