btnexus-node-python.btNode module¶
Blackout Nexus node. Base class for all personality core parts
-
class
btNode.
Node
(token=None, axonURL=None, debug=None, logger=None)[source]¶ Bases:
object
Blackout Nexus node
-
NEXUSINFO
= 21¶
-
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 - here Threads can be closed or other variables can be reset.
-
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
-
setUp
()[source]¶ Implement this to handle the things, which should be done before the connection to nexus is established. This will also be called for reconnects.
-
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)
-