B0 Plugin API reference

BlueZero plugin

simB0.getHandles
simB0.nodeCleanup
simB0.nodeCreate
simB0.nodeDestroy
simB0.nodeInit
simB0.nodeSetAnnounceTimeout
simB0.nodeSpin
simB0.nodeSpinOnce
simB0.pingResolver
simB0.publisherCreate
simB0.publisherDestroy
simB0.publisherPublish
simB0.serviceClientCall
simB0.serviceClientCallJSON
simB0.serviceClientCreate
simB0.serviceClientDestroy
simB0.serviceServerCreate
simB0.serviceServerDestroy
simB0.socketCleanup
simB0.socketInit
simB0.socketPoll
simB0.socketRead
simB0.socketSetCompression
simB0.socketSetOption
simB0.socketSpinOnce
simB0.socketWrite
simB0.subscriberCreate
simB0.subscriberDestroy

simB0.getHandles

Description Return a list of active handles
Lua synopsis table[] handles=simB0.getHandles()
Lua parameters -
Lua return values
handles (table of string): list of handles.
Python synopsis list handles=simB0.getHandles()
See also

simB0.nodeCleanup

Description Cleanup a node.
Lua synopsis simB0.nodeCleanup(string handle)
Lua parameters
handle (string): node handle
Lua return values -
Python synopsis simB0.nodeCleanup(string handle)
See also simB0.nodeCreate simB0.nodeDestroy simB0.nodeInit simB0.nodeSetAnnounceTimeout simB0.nodeSpinOnce

simB0.nodeCreate

Description Create a new node.
Lua synopsis string handle=simB0.nodeCreate(string name)
Lua parameters
name (string): name of the node (will be changed if not unique during initialization)
Lua return values
handle (string): a handle to the new node
Python synopsis string handle=simB0.nodeCreate(string name)
See also simB0.nodeCleanup simB0.nodeDestroy simB0.nodeInit simB0.nodeSetAnnounceTimeout simB0.nodeSpinOnce

simB0.nodeDestroy

Description Destroy a node.
Lua synopsis simB0.nodeDestroy(string handle)
Lua parameters
handle (string): node handle
Lua return values -
Python synopsis simB0.nodeDestroy(string handle)
See also simB0.nodeCleanup simB0.nodeCreate simB0.nodeInit simB0.nodeSetAnnounceTimeout simB0.nodeSpinOnce

simB0.nodeInit

Description Initialize a node.
Lua synopsis string name=simB0.nodeInit(string handle)
Lua parameters
handle (string): node handle
Lua return values
name (string): final name of the node as assigned from resolver node
Python synopsis string name=simB0.nodeInit(string handle)
See also simB0.nodeCleanup simB0.nodeCreate simB0.nodeDestroy simB0.nodeSetAnnounceTimeout simB0.nodeSpinOnce

simB0.nodeSetAnnounceTimeout

Description Set the announceNode timeout.
Lua synopsis simB0.nodeSetAnnounceTimeout(string handle, int timeout)
Lua parameters
handle (string): node handle
timeout (int): timeout in milliseconds, or -1 for no timeout
Lua return values -
Python synopsis simB0.nodeSetAnnounceTimeout(string handle, int timeout)
See also simB0.nodeCleanup simB0.nodeCreate simB0.nodeDestroy simB0.nodeInit simB0.nodeSpinOnce

simB0.nodeSpin

Description Call nodeSpinOnce() continuously
Lua synopsis simB0.nodeSpin(string handle)
Lua parameters
handle (string): the node handle
Lua return values -
Python synopsis simB0.nodeSpin(string handle)
See also

simB0.nodeSpinOnce

Description Spin a node.
Lua synopsis simB0.nodeSpinOnce(string handle)
Lua parameters
handle (string): node handle
Lua return values -
Python synopsis simB0.nodeSpinOnce(string handle)
See also simB0.nodeCleanup simB0.nodeCreate simB0.nodeDestroy simB0.nodeInit simB0.nodeSetAnnounceTimeout

simB0.pingResolver

Description Check if resolver node is reachable
Lua synopsis bool running=simB0.pingResolver()
Lua parameters -
Lua return values
running (bool): true if the resolver node is running and reachable
Python synopsis bool running=simB0.pingResolver()
See also

simB0.publisherCreate

Description Create a new publisher.
Lua synopsis string handle=simB0.publisherCreate(string nodeHandle, string topic, bool managed=true, bool notifyGraph=true)
Lua parameters
nodeHandle (string): node handle
topic (string): topic name
managed (bool, default: true): managed flag
notifyGraph (bool, default: true): notify graph flag
Lua return values
handle (string): a handle to the new publisher
Python synopsis string handle=simB0.publisherCreate(string nodeHandle, string topic, bool managed=true, bool notifyGraph=true)
See also simB0.publisherDestroy simB0.publisherPublish simB0.socketCleanup simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite simB0.subscriberCreate simB0.subscriberDestroy

simB0.publisherDestroy

Description Destroy a publisher.
Lua synopsis simB0.publisherDestroy(string handle)
Lua parameters
handle (string): publisher handle
Lua return values -
Python synopsis simB0.publisherDestroy(string handle)
See also simB0.publisherCreate simB0.publisherPublish simB0.socketCleanup simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite simB0.subscriberCreate simB0.subscriberDestroy

simB0.publisherPublish

Description Publish some data.
Lua synopsis simB0.publisherPublish(string handle, string payload)
Lua parameters
handle (string): publisher handle
payload (string): message payload
Lua return values -
Python synopsis simB0.publisherPublish(string handle, string payload)
See also simB0.publisherCreate simB0.publisherDestroy simB0.socketCleanup simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite simB0.subscriberCreate simB0.subscriberDestroy

simB0.serviceClientCall

Description Call a service.
Lua synopsis string payload=simB0.serviceClientCall(string handle, string payload)
Lua parameters
handle (string): service client handle
payload (string): request payload
Lua return values
payload (string): response payload
Python synopsis string payload=simB0.serviceClientCall(string handle, string payload)
See also simB0.serviceClientCreate simB0.serviceClientDestroy simB0.serviceServerCreate simB0.serviceServerDestroy simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite

simB0.serviceClientCallJSON

Description wrap serviceClientCall with JSON encoding/decoding
Lua synopsis table[] response=simB0.serviceClientCallJSON(string serviceClientHandle, table[] request)
Lua parameters
serviceClientHandle (string): the service client handle
request (table): a Lua table to be serialized with JSON
Lua return values
response (table): a Lua table with the deserialized JSON payload
Python synopsis list response=simB0.serviceClientCallJSON(string serviceClientHandle, list request)
See also

simB0.serviceClientCreate

Description Create a new service client.
Lua synopsis string handle=simB0.serviceClientCreate(string nodeHandle, string service, bool managed=true, bool notifyGraph=true)
Lua parameters
nodeHandle (string): node handle
service (string): service name
managed (bool, default: true): managed flag
notifyGraph (bool, default: true): notify graph flag
Lua return values
handle (string): a handle to the new service client
Python synopsis string handle=simB0.serviceClientCreate(string nodeHandle, string service, bool managed=true, bool notifyGraph=true)
See also simB0.serviceClientCall simB0.serviceClientDestroy simB0.serviceServerCreate simB0.serviceServerDestroy simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite

simB0.serviceClientDestroy

Description Destroy a service client.
Lua synopsis simB0.serviceClientDestroy(string handle)
Lua parameters
handle (string): service client handle
Lua return values -
Python synopsis simB0.serviceClientDestroy(string handle)
See also simB0.serviceClientCall simB0.serviceClientCreate simB0.serviceServerCreate simB0.serviceServerDestroy simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite

simB0.serviceServerCreate

Description Create a new service server.
Lua synopsis string handle=simB0.serviceServerCreate(string nodeHandle, string service, string callback="", bool managed=true, bool notifyGraph=true)
Lua parameters
nodeHandle (string): node handle
service (string): service name
callback (string, default: ""): lua calback to call when a request is received
managed (bool, default: true): managed flag
notifyGraph (bool, default: true): notify graph flag
Lua return values
handle (string): a handle to the new service server
Python synopsis string handle=simB0.serviceServerCreate(string nodeHandle, string service, string callback="", bool managed=true, bool notifyGraph=true)
See also simB0.serviceClientCall simB0.serviceClientCreate simB0.serviceClientDestroy simB0.serviceServerDestroy simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite

simB0.serviceServerDestroy

Description Destroy a service server.
Lua synopsis simB0.serviceServerDestroy(string handle)
Lua parameters
handle (string): service server handle
Lua return values -
Python synopsis simB0.serviceServerDestroy(string handle)
See also simB0.serviceClientCall simB0.serviceClientCreate simB0.serviceClientDestroy simB0.serviceServerCreate simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite

simB0.socketCleanup

Description Cleanup a socket (only needed for unmanaged sockets).
Lua synopsis simB0.socketCleanup(string handle)
Lua parameters
handle (string): socket handle
Lua return values -
Python synopsis simB0.socketCleanup(string handle)
See also simB0.publisherCreate simB0.publisherDestroy simB0.publisherPublish simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite simB0.subscriberCreate simB0.subscriberDestroy

simB0.socketInit

Description Initialize a socket (only needed for unmanaged sockets).
Lua synopsis simB0.socketInit(string handle)
Lua parameters
handle (string): socket handle
Lua return values -
Python synopsis simB0.socketInit(string handle)
See also simB0.publisherCreate simB0.publisherDestroy simB0.publisherPublish simB0.socketCleanup simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite simB0.subscriberCreate simB0.subscriberDestroy simB0.serviceClientCall simB0.serviceClientCreate simB0.serviceClientDestroy simB0.serviceServerCreate simB0.serviceServerDestroy simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite

simB0.socketPoll

Description Poll a socket (only needed for unmanaged sockets).
Lua synopsis bool result=simB0.socketPoll(string handle)
Lua parameters
handle (string): socket handle
Lua return values
result (bool): poll result
Python synopsis bool result=simB0.socketPoll(string handle)
See also simB0.publisherCreate simB0.publisherDestroy simB0.publisherPublish simB0.socketCleanup simB0.socketInit simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite simB0.subscriberCreate simB0.subscriberDestroy simB0.serviceClientCall simB0.serviceClientCreate simB0.serviceClientDestroy simB0.serviceServerCreate simB0.serviceServerDestroy simB0.socketInit simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite

simB0.socketRead

Description Read from a socket (only needed for unmanaged sockets).
Lua synopsis string payload=simB0.socketRead(string handle)
Lua parameters
handle (string): socket handle
Lua return values
payload (string): message payload
Python synopsis string payload=simB0.socketRead(string handle)
See also simB0.publisherCreate simB0.publisherDestroy simB0.publisherPublish simB0.socketCleanup simB0.socketInit simB0.socketPoll simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite simB0.subscriberCreate simB0.subscriberDestroy simB0.serviceClientCall simB0.serviceClientCreate simB0.serviceClientDestroy simB0.serviceServerCreate simB0.serviceServerDestroy simB0.socketInit simB0.socketPoll simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite

simB0.socketSetCompression

Description Set compression for the specified socket.
Lua synopsis simB0.socketSetCompression(string handle, string compressionAlgorithm, int compressionLevel=-1)
Lua parameters
handle (string): socket handle
compressionAlgorithm (string): compression algorithm to use. an empty string will disable compression.
compressionLevel (int, default: -1): compression level (-1 will use default level)
Lua return values -
Python synopsis simB0.socketSetCompression(string handle, string compressionAlgorithm, int compressionLevel=-1)
See also simB0.publisherCreate simB0.publisherDestroy simB0.publisherPublish simB0.socketCleanup simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSpinOnce simB0.socketWrite simB0.subscriberCreate simB0.subscriberDestroy simB0.serviceClientCall simB0.serviceClientCreate simB0.serviceClientDestroy simB0.serviceServerCreate simB0.serviceServerDestroy simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSpinOnce simB0.socketWrite

simB0.socketSetOption

Description Set a low-level socket option. Available options:
  • lingerPeriod
  • backlog
  • readTimeout
  • writeTimeout
  • immediate
  • conflate
  • readHWM
  • writeHWM
Lua synopsis simB0.socketSetOption(string handle, string option, int value)
Lua parameters
handle (string): socket handle
option (string): option key.
value (int): option value.
Lua return values -
Python synopsis simB0.socketSetOption(string handle, string option, int value)
See also

simB0.socketSpinOnce

Description Spin a socket (only needed for unmanaged sockets).
Lua synopsis simB0.socketSpinOnce(string handle)
Lua parameters
handle (string): socket handle
Lua return values -
Python synopsis simB0.socketSpinOnce(string handle)
See also simB0.publisherCreate simB0.publisherDestroy simB0.publisherPublish simB0.socketCleanup simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketWrite simB0.subscriberCreate simB0.subscriberDestroy simB0.serviceClientCall simB0.serviceClientCreate simB0.serviceClientDestroy simB0.serviceServerCreate simB0.serviceServerDestroy simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketWrite

simB0.socketWrite

Description Write to a socket (only needed for unmanaged sockets).
Lua synopsis simB0.socketWrite(string handle, string payload)
Lua parameters
handle (string): socket handle
payload (string): message payload
Lua return values -
Python synopsis simB0.socketWrite(string handle, string payload)
See also simB0.publisherCreate simB0.publisherDestroy simB0.publisherPublish simB0.socketCleanup simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.subscriberCreate simB0.subscriberDestroy simB0.serviceClientCall simB0.serviceClientCreate simB0.serviceClientDestroy simB0.serviceServerCreate simB0.serviceServerDestroy simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce

simB0.subscriberCreate

Description Create a new subscriber.
Lua synopsis string handle=simB0.subscriberCreate(string nodeHandle, string topic, string callback="", bool managed=true, bool notifyGraph=true)
Lua parameters
nodeHandle (string): node handle
topic (string): topic name
callback (string, default: ""): lua calback to call when a message is received
managed (bool, default: true): managed flag
notifyGraph (bool, default: true): notify graph flag
Lua return values
handle (string): a handle to the new subscriber
Python synopsis string handle=simB0.subscriberCreate(string nodeHandle, string topic, string callback="", bool managed=true, bool notifyGraph=true)
See also simB0.publisherCreate simB0.publisherDestroy simB0.publisherPublish simB0.socketCleanup simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite simB0.subscriberDestroy

simB0.subscriberDestroy

Description Destroy a subscriber.
Lua synopsis simB0.subscriberDestroy(string handle)
Lua parameters
handle (string): subscriber handle
Lua return values -
Python synopsis simB0.subscriberDestroy(string handle)
See also simB0.publisherCreate simB0.publisherDestroy simB0.publisherPublish simB0.socketCleanup simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite simB0.subscriberCreate



Script functions

Script functions are used to call some lua code from the plugin side (tipically used for event handlers).

topicCallback

Description Callback for a subscriber.
Lua synopsis simB0.topicCallback(string payload)
Lua parameters
payload (string): raw payload
Lua return values -
Python synopsis simB0.topicCallback(string payload)
See also

serviceCallback

Description Callback for a service server.
Lua synopsis string payload=simB0.serviceCallback(string payload)
Lua parameters
payload (string): raw request payload
Lua return values
payload (string): raw response payload
Python synopsis string payload=simB0.serviceCallback(string payload)
See also