151
38.
-- split ip address into chunks
39.
chunks
=
data.eth0.inetaddr:split
(
'.'
)
40.
41.
-- add ip address chunks
42.
for
i
=
1, 4
do
43.
chunk
=
tonumber
(
chunks
[
i
])
44.
HDL.iphdr
=
HDL.iphdr ..
string.char
(
chunk
)
45.
end
46.
end
47.
48.
HDL.decode
=
function
(
packet
)
49.
local
len, data, src, crc
50.
51.
-- primary header
52.
if
packet:sub
(
5, 14
)
~
=
HDL.magic
then
53.
returnnil
,
'magic'
54.
end
55.
56.
-- leading code
57.
if
packet:sub
(
15, 16
)
~
=
HDL.lcode
then
58.
returnnil
,
'lcode'
59.
end
60.
61.
-- get data length and check against
62.
len
=
packet:byte
(
17
)
63.
if
len
and
len + 16 ~
=
packet:len
()
then
64.
returnnil
,
'len'
65.
end
66.
67.
-- get packet data and check crc
68.
data
=
packet:sub
(
17, len + 14
)
69.
crc
=
packet:byte
(
len + 15
)*
0x100 + packet:byte
(
len + 16
)
70.
if
crc16
(
data
)
~
=
crc
then
71.
returnnil
,
'crc'
72.
end
73.
74.
-- return parsed packet
Change HDL parameters in the function to correct ones
Summary of Contents for LogicMachine3 Re:actor
Page 10: ...10 Terminal connection schemes KNX TP...
Page 12: ...12 24V power supply...
Page 13: ...13 Analog inputs e g reed contact...
Page 14: ...14 Analog inputs 0 10V...
Page 15: ...15 Digital output...
Page 16: ...16 Resistive sensor input...
Page 17: ...17 Analog output...
Page 26: ...26 Make sure that bus status is Online press button in ETS...
Page 35: ...35 o Then minimize side bar by pressing on left arrow icon to make the map more visible...
Page 83: ...83 66 if err then 67 alert FTP upload failed s err 68 end...
Page 107: ...107...
Page 108: ...108 1 14 Help Documentation for scripting syntaxes is displayed in Help tab...
Page 126: ...126 Datapoints can be shown also in a way of table which can be later exported as CSV file...
Page 141: ...141...