blob: ae6d14584b53dcdca077c68f5fd964142614a688 (
plain)
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
|
--
-- ~~~ response record utils
--
require("src/utils")
-- setup pawsd
local pawsd = {}
pawsd.tag = require("src/pawsd/tag")
-- get number of tags
function getrecordtagnumber(response, offset)
return tonumber(table.extracthex(response, offset, offset + 1), 16)
end
-- get all record information
function getrecord(response, offset)
local tagcount = getrecordtagnumber(response, offset)
print("R>------ Number Of Tags: " .. tagcount)
local tagoffset = offset + 2
local tags = {}
for tagindex = 1, tagcount, 1 do
print("\nT>------ Getting Tag " .. tagindex .. "...")
local tag = pawsd.tag.get(response, tagoffset)
tags[tagindex] = tag.value
tagoffset = tag.endoffset
end
return {
tags = tags,
endoffset = tagoffset
}
end
-- return
return {
get = getrecord
}
|