Home > HMS NETWORKS > HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide
HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide
Lua API Funcon and Module Reference
CAN@net NT/CANbridge NT Lua ADK
5. Lua API Funcon and Module Reference
5.1. Lua Callback Funcons Called from C
Funcon 'initialize'
initialize()
Called once while the rmware is being inialized. It is used to register CAN and MQTT messages for recepon
and to inialize variables.
Funcon 'loop'
loop(ticks, elapsed)
Called cyclically every 100 ms afer the inializaon phase, when the device is up and running. It is used to
trigger cyclically recurring tasks.
• ticks: counter value that is incremented with each call of loop
• elapsed: me in ms since the last call of loop
Funcon 'on_can'
on_can(topic, port, format, ident, data)
Called on each CAN message recepon, based on message regisraons via can.register_msg.
• topic: user dened reference value used by can.register_msg
port: CAN port number (1.. 4), depending on the available CAN ports of the target device
• format: combinaon of three characters to specify the message format, e.g.:
– "csr"means: "classic CAN", "standard idener (11 bit)", "remote frame"
– "fed"means: "CAN-FD", "extended idener (29 bit)", "data frame"
• ident: CAN message idener (0.. 0x7FFfor standard messages and 0.. 0x1FFFFFFFfor extended
messages)
• data: message data bytes provided as Lua table or as byte array (see module array)
Funcon 'on_mqtt'
on_mqtt(handle, topic, payload, qos)
Called on each MQTT message recepon, based on message regisraons via mqtt.subscribe.
• handle: user dened reference value used by mqtt.subscribe
• topic: message topic as string
• payload: message data as string
• qos: quality of service (0, 1, 2)
4.02.0332.20002 Version 1.5
Page 9 of 20
| General | Details |
|---|---|
| Name | HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide |
| Make | HMS NETWORKS |
| Language | English |
| Filetype | PDF (Download) |
| File size | MB |
If you have any questions regarding HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide, please ask here and describe the problem in detail.













