BlueZero Plugin API reference

BlueZero plugin

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.
See also

simB0.nodeCleanup

Description Cleanup a node.
Lua synopsis simB0.nodeCleanup(string handle)
Lua parameters
handle (string): node handle
Lua return values -
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
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 -
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
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 -
See also simB0.nodeCleanup simB0.nodeCreate simB0.nodeDestroy simB0.nodeInit simB0.nodeSpinOnce

simB0.nodeSpinOnce

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

simB0.pingResolver

Description Check if resolver node is reachable
Lua synopsis simB0.pingResolver()
Lua parameters -
Lua return values -
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
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 -
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 -
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
See also simB0.serviceClientCreate simB0.serviceClientDestroy simB0.serviceServerCreate simB0.serviceServerDestroy simB0.socketInit simB0.socketPoll simB0.socketRead simB0.socketSetCompression simB0.socketSpinOnce simB0.socketWrite

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
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 -
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
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 -
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 -
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 -
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
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
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 -
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 -
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 -
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 -
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.spin

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

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
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 -
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 -
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
See also