local DEBUG = false -- the debug flag
local RANDOM = '20436F707972696768742028432920323031302041637469766973696F6E2E20416C6C205269676874732052657365727665642E20'
-local band = bit32.band
-local bor = bit32.bor
-local lshift = bit32.lshift
-local rshift = bit32.rshift
-local byte = string.byte
-local char = string.char
-local sub = string.sub
-local format = string.format
-
-
-
local band = bit32.band
local bor = bit32.bor
local lshift = bit32.lshift
-- This is only meant to be used when errors occur
function oops(err)
print("ERROR: ",err)
+ return nil,err
end
---
-- Usage help
calc = CalcCheckSum(blocks,2,3)
if crc == calc then isOk='Ok' else isOk = 'Error' end
io.write( ('TYPE 3 area 2: %04x = %04x -- %s\n'):format(crc,calc,isOk))
-end
+end
+local function LoadEmulator(blocks)
local cmd
local blockdata
for _,b in pairs(blocks) do
end
end
- cmd = Command:new{cmd = cmds.CMD_MIFARE_EML_MEMSET, arg1 = _ ,arg2 = 1,arg3 = 0, data = blockdata}
+ cmd = Command:new{cmd = cmds.CMD_MIFARE_EML_MEMSET, arg1 = _ ,arg2 = 1,arg3 = 16, data = blockdata}
local err = core.SendCommand(cmd:getBytes())
- if err then
- return err
- end
+ if err then return err end
end
io.write('\n')
end