b5a5fc4d |
1 | //----------------------------------------------------------------------------- |
2 | // Copyright (C) 2018 grauerfuchs |
3 | // |
4 | // This code is licensed to you under the terms of the GNU GPL, version 2 or, |
5 | // at your option, any later version. See the LICENSE.txt file for the text of |
6 | // the license. |
7 | //----------------------------------------------------------------------------- |
8 | // HID card format packing/unpacking routines |
9 | //----------------------------------------------------------------------------- |
10 | |
11 | #ifndef HIDCARDFORMATS_H__ |
12 | #define HIDCARDFORMATS_H__ |
13 | |
14 | #include <stdint.h> |
15 | #include <stdbool.h> |
16 | #include "hidcardformatutils.h" |
17 | |
be59094d |
18 | |
19 | typedef struct hidcardformatdescriptor_s{ |
20 | bool hasCardNumber; |
21 | bool hasFacilityCode; |
22 | bool hasIssueLevel; |
23 | bool hasOEMCode; |
24 | bool hasParity; |
25 | } hidcardformatdescriptor_t; |
26 | |
b5a5fc4d |
27 | // Structure for defined HID card formats available for packing/unpacking |
28 | typedef struct hidcardformat_s{ |
29 | const char* Name; |
30 | bool (*Pack)(/*in*/hidproxcard_t* card, /*out*/hidproxmessage_t* packed); |
31 | bool (*Unpack)(/*in*/hidproxmessage_t* packed, /*out*/hidproxcard_t* card); |
32 | const char* Descrp; |
be59094d |
33 | hidcardformatdescriptor_t Fields; |
b5a5fc4d |
34 | } hidcardformat_t; |
35 | |
36 | void HIDListFormats(); |
37 | int HIDFindCardFormat(const char *format); |
38 | hidcardformat_t HIDGetCardFormat(int idx); |
39 | bool HIDPack(/* in */int FormatIndex, /* in */hidproxcard_t* card, /* out */hidproxmessage_t* packed); |
5d643cc0 |
40 | bool HIDTryUnpack(/* in */hidproxmessage_t* packed, /* in */bool ignoreParity); |
b5a5fc4d |
41 | |
42 | #endif |