-
Notifications
You must be signed in to change notification settings - Fork 468
Component Abstract Bus
Josh edited this page Apr 20, 2014
·
6 revisions
This card allows for interfacing with Stargate Tech 2's Abstract Bus system.
Component name: abstract_bus.
Callbacks:
-
getEnabled(): booleanReturns whether the local bus interface is enabled. -
setEnabled(enabled: boolean)Sets whether the local bus interface should be enabled -
getAddress(): numberReturns the local interface address.numberis a 16bit hexadecimal number (0xFFFF being a broadcast). Returns0if an address has not yet been set. -
setAddress(address: number)Sets the local interface address.numberis a 16bit hexadecimal number. -
send(address: number, data: table): booleanSends data across the abstract bus. The tabledatais in the form of key,value pairs, i.elua abstract_bus.send(0xFFF, { ["action"]="dial", ["address"]="Losomdeh Salothirt Erpac" })- See SGTech2 documentation for more info on the Abstract Bus
-
maxPacketSize(): numberReturns the maximum size a packet can be sent over the bus.
The abstract bus generates a signal named bus_message if a message is received. The values are;
protocol id: number, sender address: number, target address: number, data: table, metadata: table
-
protocol idis the protocol version that was used. -
sender addressis the address of the device sending the message -
target addressis the address of the device that the messages was intended for (-1 for network broadcasts) -
datais a table of the data that was sent -
metadatais a table of data that are unique to the device that send the address