blob: 4a8532e7594b36025c3e9dd0ca001e16b0fe1c03 (
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
|
--
-- ~~~ response metadata utils
--
require("src/utils")
-- load pawsd
local PawSD = require("src/pawsd/variables")
-- get response type
function getType (response)
return table.extracthex(response, 1, 8)
end
-- get response status
function getStatus (response)
return table.extracthex(response, 11, 12)
end
-- validate response status
function validateStatus (response)
-- check type
local type = getType(response)
if not (type == PawSD.Magic.RESPONSE) then return false end
-- check status
local status = getStatus(response)
if not (status == PawSD.Responses.OK) then return false end
return true
end
-- return
return {
type = getType,
status = getStatus,
validate = validateStatus
}
|