- start 15693 implementation
[librfid] / include / rfid / rfid_layer2.h
1 #ifndef _RFID_LAYER2_H
2 #define _RFID_LAYER2_H
3
4 struct rfid_layer2_handle;
5 struct rfid_reader_handle;
6
7 #include <rfid/rfid_layer2_iso14443a.h>
8 #include <rfid/rfid_layer2_iso14443b.h>
9 #include <rfid/rfid_layer2_iso15693.h>
10
11
12 struct rfid_layer2 {
13         unsigned int id;
14         char *name;
15
16         struct {
17                 struct rfid_layer2_handle *(*init)(struct rfid_reader_handle *h);
18                 int (*open)(struct rfid_layer2_handle *h);
19                 int (*transcieve)(struct rfid_layer2_handle *h,
20                                   const unsigned char *tx_buf, 
21                                   unsigned int tx_len, unsigned char *rx_buf, 
22                                   unsigned int *rx_len, unsigned int timeout, 
23                                   unsigned int flags);
24                 int (*close)(struct rfid_layer2_handle *h);
25                 int (*fini)(struct rfid_layer2_handle *h);
26         } fn;
27         struct rfid_layer2 *next;
28 };
29
30 struct rfid_layer2_handle {
31         struct rfid_reader_handle *rh;
32         union {
33                 struct iso14443a_handle iso14443a;
34                 struct iso14443b_handle iso14443b;
35                 struct iso15693_handle iso15693;
36         } priv;
37         struct rfid_layer2 *l2;
38 };
39
40 enum rfid_layer2_id {
41         RFID_LAYER2_NONE,
42         RFID_LAYER2_ISO14443A,
43         RFID_LAYER2_ISO14443B,
44         RFID_LAYER2_ISO15693,
45 };
46
47 struct rfid_layer2_handle *rfid_layer2_init(struct rfid_reader_handle *rh,
48                                             unsigned int id);
49 int rfid_layer2_open(struct rfid_layer2_handle *l2h);
50 int rfid_layer2_transcieve(struct rfid_layer2_handle *l2h,
51                            const unsigned char *tx_buf, unsigned int tx_len,
52                            unsigned char *rx_buf, unsigned int *rx_len,
53                            unsigned int timeout, unsigned int flags);
54 int rfid_layer2_close(struct rfid_layer2_handle *l2h);
55 int rfid_layer2_fini(struct rfid_layer2_handle *l2h);
56
57 #endif