btnexus-node-python.btNodeV3 module

Blackout Nexus node. Base class for all personality core parts

class btNodeV3.Node(token=None, axonURL=None, debug=None)[source]

Bases: object

Blackout Nexus node

cleanUp()[source]

Implement this to handle the things, which should be done when you disconnect the node.

connect(ping_interval=60)[source]

Runs this node and listen forever This is a blocking call

linkModule(module, group, topic)[source]

EXPERIMENTAL Link a python object to the messaging service This makes every method of the object accessable as callbacks over the btNexus

Parameters
  • module (Object) – the module to be linked

  • group (String) – The group the callbacks should subscribe to

  • topic (String) – The topic on callbacks should subscribe to

onConnected()[source]

Is called when this node was connected This needs to be overloaded to subscribe to messages.

onDisconnected()[source]

This will be executed after a the Node is disconnected from the btNexus If not implemented the Node tries to reconnect

onError(error)[source]

Handling of Errors. If not overloaded it just forwards the error to the nexusConnector which just prints and publishes it if possible

publish(group, topic, funcName, params)[source]

publishes a Message with the payload(funcName and params) to a topic.

Parameters
  • group (String) – Name of the group

  • topic (String) – Name of the topic

  • funcName (String) – Name of the function.

  • params (List or keywordDict) – The parameters for the callback

publishDebug(debug)[source]

Publish a Debug message on the btNexus if debug is active

Parameters

debug (String) – A Message to send to the debug topic

publishError(error)[source]

Publish a Error message on the btNexus

Parameters

error (String) – A Message to send to the error topic

publishWarning(warning)[source]

Publish a Warning message on the btNexus

Parameters

warning (String) – A Message to send to the warning topic

run()[source]

DEPRECATED: Will be replaced with connect(). Is here for backwards compatibility.

setUp()[source]

Implement this to handle the things, which should be done before the connection to nexus is established.

subscribe(group, topic, callback, funcName=None)[source]

Subscribe to a group & topic with a callback

Parameters
  • group (String) – Name of the group

  • topic (String) – Name of the topic

  • callback (function pointer) – function pointer to the callback

  • funcName (String) – Name of the function. If not set this is the name of the function in the implementation(needed if you want to link a function to a different name)

write(error)[source]

This forwards errors to the publishError function to make them visible in the btNexus

Parameters

error (String) – A Message to send to the error topic