style
[RRG-proxmark3.git] / client / lualibs / hf_reader.lua
blob894a0d8ef66e5f77bd438675ec99ce497be5aff5
1 --[[
2 THIS IS WORK IN PROGREESS, very much not finished.
4 This library utilises other libraries under the hood, but can be used as a generic reader for 13.56MHz tags.
5 ]]
7 local reader14443A = require('read14a')
8 local reader14443B = require('read14b')
9 local reader15693 = require('read15')
11 ---
12 -- This method library can be set waits or a 13.56 MHz tag, and when one is found, returns info about
13 -- what tag it is.
15 -- @return if successful: an table containing card info
16 -- @return if unsuccessful : nil, error
17 local function waitForTag()
18 print("Waiting for card... press <Enter> to quit")
19 local readers = {reader14443A, reader14443B, reader15693}
20 local i = 0;
21 while not core.kbd_enter_pressed() do
22 i = (i % 3) +1
23 r = readers[i]
24 print("Reading with ",i)
25 res, err = r.read()
26 if res then return res end
27 print(err)
28 -- err means that there was no response from card
29 end
30 return nil, "Aborted by user"
31 end
33 return {
34 waitForTag = waitForTag,