- local result, infoReqb, infoAttrib, infoPong, err, resp, len, data
- local goodReqbResponse = false
- --REQB
- local p = 20
- while p > 0 do
- -- 05 00 08
- -- 05
- -- command (REQB/WUPB)
- -- 00
- -- AFI application family identifier ( 00 == all sorts)
- -- 08 (ie WUPB)
- -- bit 0-1-2 | N slots ( 0 = 1, 1 = 2, 2 = 4, 3 = 8, 4 == 16)
- -- bit 3 | (1== WUPB, 0 == REQB)
- -- bit 4-5-6-7 | AFI application family identifier
- local result, err = sendRaw('050008', 1, 1)
- if result then
- resp = Command.parse( result )
- len = tonumber(resp.arg1) * 2
- local data = string.sub(resp.data, 0, len)
- if ( resp.arg1 == 14 ) then
- --print ('DATA ::', data)
- infoReqb, err = parse1443b_reqb(data)
- --print(infoReqb.pcb, infoReqb.uid, infoReqb.pps, infoReqb.ats, infoReqb.crc)
- goodReqbResponse = true
- break -- break while loop. REQB got a good response
- end
- end
-
- -- send some strange 0A/0C
- -- if ( p < 3) then
- -- sendRaw('0A', 0, 0)
- -- sendRaw('0C', 0, 0)
- -- end
-
- p = p - 1
- print('retrying')