Add remaining documentation
[libcontrac.git] / include / contrac / rpi.h
1 /** \ingroup RandomProximityIdentifier
2 * @file
3 * @author David Llewellyn-Jones <david@flypig.co.uk>
4 * @version $(VERSION)
5 *
6 * @section LICENSE
7 *
8 * Copyright David Llewellyn-Jones, 2020
9 * Released under the GPLv2.
10 *
11 * @brief Random Proximity Identifier functionality
12 * @section DESCRIPTION
13 *
14 * This class is used to generate and manage the Random Proximity Identifier
15 * (RPI). It's largely internal. The functionality from \ref Contrac should
16 * generally be used in preference to this.
17 *
18 */
19
20 /** \addtogroup RandomProximityIdentifier
21 * @{
22 */
23
24 #ifndef __RPI_H
25 #define __RPI_H
26
27 // Includes
28
29 #include "contrac/contrac.h"
30 #include "contrac/dtk.h"
31
32 // Defines
33
34 /**
35 * The size in bytes of an RPI in binary format.
36 *
37 */
38 #define RPI_SIZE (16)
39
40 /**
41 * The size in bytes of an RPI in base64 format, not including the null
42 * terminator.
43 *
44 */
45 #define RPI_SIZE_BASE64 (24)
46
47 /**
48 * The maximum value a time interval number can take. Time interval numbers
49 * are measured from the start of the day and increment every 10 minutes, so
50 * must fall within the interval [0, 143].
51 *
52 */
53 #define RPI_INTERVAL_MAX (144)
54
55 // Structures
56
57 /**
58 * An opaque structure for representing a DTK.
59 *
60 * The internal structure can be found in rpi.c
61 */
62 typedef struct _Rpi Rpi;
63
64 // Function prototypes
65
66 Rpi * rpi_new();
67 void rpi_delete(Rpi * data);
68
69 bool rpi_generate_proximity_id(Rpi * data, Dtk const * dtk, uint8_t time_interval_number);
70 unsigned char const * rpi_get_proximity_id(Rpi const * data);
71 uint8_t rpi_get_time_interval_number(Rpi const * data);
72 void rpi_assign(Rpi * data, unsigned char const * rpi_bytes, uint8_t time_interval_number);
73 bool rpi_compare(Rpi const * data, Rpi const * comparitor);
74
75 // Function definitions
76
77 #endif // __RPI_H
78
79 /** @} addtogroup RandomProximityIdentifier */
80