-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathapidoc.txt
114 lines (108 loc) · 3.16 KB
/
apidoc.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
NAME
rfidhid.core - # Copyright (c) 2018 charlysan
CLASSES
PayloadResponse
RfidHid
class PayloadResponse(__builtin__.object)
| Object representation of the response coming from the device
|
| Methods defined here:
|
| __init__(self, data)
|
| get_crc_sum(self)
| Gets the UID+CID CRC Sum check coming from the device
|
| get_raw_data(self)
| Gets the response raw data coming from the device
|
| get_tag_cid(self)
| Gets the Tag's Customer ID as a 8 bits Integer
|
| get_tag_uid(self)
| Gets the Tag's UID as a 32 bits Integer
|
| get_tag_w26(self)
| Interprets the Tag's UID as W26 (H10301) format.
|
| Returns a tuple (facility_code, card_number) or None on format mismatch.
|
| get_tag_uid_as_byte_sequence(self)
| Gets the Tag's UID as a sequence of bytes. E.g. [0x23, 0xa4, 0x23, 0x56]
|
| has_id_data(self)
| Check if the response contains the Tag's ID information
|
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| CID_POS = 12
|
| CRC_READ_POS = 17
|
| RESPONSE_LENGTH_WITH_TAG = 19
|
| UID_LSB_POS = 16
|
| UID_MSB_POS = 13
class RfidHid(__builtin__.object)
| Main object used to communicate with the device
|
| Methods defined here:
|
| __init__(self, vendor_id=65535, product_id=53)
| Open the device using vid and pid
|
| If no arguments are supplied then the default vid and pid will be used.
|
| beep(self, times=1)
| Send a command to make the device to emit a "beep"
|
| Arguments:
| times -- Number of "beeps" to emit
|
| init(self)
| Initialize the device
|
| This method should be use to initialize the device in case the OS does not find it.
| Issuing a `sudo lsusb -vd vid:pid` should produce the same result.
|
| read_tag(self)
| Send a command to "read a tag" and retrieve the response from the device.
|
| Returns a PayloadResponse object
|
| write_tag(self, ids_bytes)
| Send a command to "write a tag"
|
| Arguments:
| ids_bytes -- Customer ID + UID to be written in binary byte format.
| Format: [cid, uid_b3, uid_b2, uid_b1, uid_b0]
|
| write_tag_from_cid_and_uid(self, cid, uid)
| Send a command to "write a tag"
|
| Arguments:
| cid -- (32 bits Integer) Customer ID
| uid -- (8 bits Integer) UID
|
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| BUFFER_SIZE = 256
|
| CLASS_TYPE_REPORT = 34
|
| CRC_WRITE_INIT_VALUE = 185
|
| DEFAULT_PID = 53
|
| DEFAULT_VID = 65535
|
| GET_REPORT = 1
|
| HID_REPORT_DESCRIPTOR_SIZE = 28
|
| SET_REPORT = 9