Skip to content

Communication Functions

Joachim Stolberg edited this page Jan 27, 2023 · 15 revisions

send_msg

Send a message via router to another controller.

Note: Word 0 of each messages buffer is the msg size, which is the number of words without the msg size word itself!

  • address is the number of the destination block
  • msg is message (array/string)
send_msg(address, msg)

recv_msg

Receive a message via the local router. Function returns the sender address or 0.

  • buff is for the message
  • size is the size of buff in words
recv_msg(buff, size)

publish_msg

Send a message to the broker.

Note: Word 0 of each messages buffer is the msg size, which is the number of words without the msg size word itself!

  • address is the number of the broker

  • msg is message array with size, topic, and additional data. like:

    var msg[] = {size, topic, data, ...};

publish_msg(address, msg)

fetch_msg

Read a message from the broker. Function returns 1 (success) or 0 (no msg).

  • address is the number of the broker
  • topic is the message topic number
  • buff is a buffer, used for the received message
  • size is the size of buff in words
fetch_msg(address, topic, buff, size)

request_msg

Request a message from the broker. The response is received asynchron via 'recv_msg'.

The broker only sends the response when it has received a new message.

Function returns 1 (success) or 0 (error).

  • address is the number of the broker
  • topic is the message topic number
request_msg(address, topic)