1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2018 grauerfuchs
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
7 //-----------------------------------------------------------------------------
8 // Wiegand format packing/unpacking routines
9 //-----------------------------------------------------------------------------
11 #ifndef WIEGAND_FORMATS_H__
12 #define WIEGAND_FORMATS_H__
14 #include <string.h> // memset
21 #include "wiegand_formatutils.h"
22 #include "parity.h" // for parity
31 } cardformatdescriptor_t
;
33 // Structure for defined Wiegand card formats available for packing/unpacking
36 bool (*Pack
)(wiegand_card_t
*card
, wiegand_message_t
*packed
, bool preamble
);
37 bool (*Unpack
)(wiegand_message_t
*packed
, wiegand_card_t
*card
);
39 cardformatdescriptor_t Fields
;
42 void HIDListFormats(void);
43 int HIDFindCardFormat(const char *format
);
44 cardformat_t
HIDGetCardFormat(int idx
);
45 bool HIDPack(int format_idx
, wiegand_card_t
*card
, wiegand_message_t
*packed
, bool preamble
);
46 bool HIDTryUnpack(wiegand_message_t
*packed
);
47 void HIDPackTryAll(wiegand_card_t
*card
, bool preamble
);
48 void HIDUnpack(int idx
, wiegand_message_t
*packed
);
49 void print_wiegand_code(wiegand_message_t
*packed
);
50 void print_desc_wiegand(cardformat_t
*fmt
, wiegand_message_t
*packed
);