Home  Contents

bis:send

Bis Core4 Lua Event System

SYNOPSIS

Master mode
  1. bishandle:send(addr, ptype, data)
  2. bishandle:send(addr, mtd16)
Slave mode
  1. bishandle:send(data)
  2. bishandle:send(mtd16)

DESCRIPTION

bis:send allows sending of data using the BiS protocol.

Master mode

In master mode, the address parameter indicates the address of the slave node. If this is zero, then no addressing is used (point-to-point link).

Form 1 allows sending of arbitrary data. In that case ptype is placed into the PType field of the BiS header.

Form 2 sends a MTD16 formatted message. The PType is chosen automatically. mtd16 is a MTD16 message instance.

Slave mode

In slave mode, sending of messages is only allowed when a message has been received from the master before. Since we are sending to the master, no address is necessary.

Form 3 sends arbitrary data, as form 1. The PType is automatically taken from the last message that was received from the master.

Form 4 sends a MTD16 formatted message.

RETURN VALUE

All forms return a boolean, indicating success.

NOTES

The BiS protocol supports slave addresses of up to 32 bits. Some smaller devices support only 8 bit addressing, though.

EXAMPLE

>  >  >  >  > 
app = event.new() bis = bis.newmaster(app, "/dev/ttyS1", 38400) msg = mtd16.new(0xF00F) msg:append(0x3001, "FNORD!") bis:send(1, msg)

SEE ALSO