14.12.2021, 12:23
CANx-DALI sends all received bus telegrams which you can get capture via a script and parse as needed:
Code:
if not canx then
canx = require('applibs.canx')
canx.getlistener(1)
function parse(frame)
local hdr = frame:byte(1) or 0
local typ = bit.rshift(hdr, 4)
local len = bit.band(hdr, 0x3)
-- bus data frame type
if typ == 7 and len > 0 then
loghex(frame)
end
end
end
canx.step(function(msg)
-- message from CANx device 0.1
if msg.lineid == 0 and msg.nodeid == 1 and msg.objectid == 1
and msg.frombus and type(msg.data) == 'string' then
parse(msg.data)
end
end)