Home  Contents

bis:sendQuery

Bis Core4 Lua Event System

SYNOPSIS

Master mode
  1. bishandle:sendQuery(addr, ptype, data)
  2. bishandle:sendQuery(addr, mtd16)
Slave mode
  1. bishandle:sendResponse(data)
  2. bishandle:sendResponse(mtd16)
  3. bishandle:sendAck()

DESCRIPTION

The bis:send...() functions perform 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 this is a reply, no address is necessary, as addressing information is automatically taken from the initial query packet.

Form 3 sends arbitrary data, just as form 1. The PType is automatically taken from query packet that asked for this reply.

Form 4 sends a MTD16 formatted message. mtd16 is a MTD16 message instance.

Form 5 sends an empty response. It is equivalent to bishandle:sendResponse("").

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