Open stefanoterna opened 7 years ago
BackendBrokerClientXmpp
and BackendBrokerClientMqtt
(with pass
methods)Polyglot
BackendBrokerClientXmpp
porting the current commander
module
init
and send_command
are module methods, they must become instance (class) methodsmain
:
commanded.init
with the instantiation of the Polyglot
class, passing in the correct config dict as defined previouslycommander.send_command
is referred, substitute with the polyglot.send_command
methodbrokerclientname='BackendBrokerClientXmpp'
since the BackendBrokerClientMqtt is not yet implementedBackendBrokerClientMqtt
brokerclientname='BackendBrokerClientMqtt'
in main
Architecture
Iottly BackendBrokerClients
Each client is basically a wrapper for the specific third party client (sleekxmpp or paho)
Currently we implement:
BackendBrokerClientXmpp
BackendBrokerClientMqtt
Each broker client is implemented as a
class
with the same interface:__init__(params)
: a constructor taking the necessary parameters to let the inner third party client to connect to the brokersend_command(cmd)
: a method to send commands over the protocolEach BackendBrokerClient
Iottly Polyglot
The
Polyglot
class abstracts the interaction with each BackendBrokerClient:Polyglot structure
Globals
A dictionary of currently loaded BackendBrokerClients
Constructor
__init__(backendbrokerclientconf: dict)
Accepts a dict of parameters, grouped in a sub-dict for each of the required BackendBrokerClients:The constructor performs the following actions:
Methods
send_command(cmd, brokerclientname)
: a method responsible for routing the request to send a command to the proper BackendBrokerClient instance, looking it up in the dictionary by means of thebrokerclientname
parameterMain
The
Main
module must interact with each BackendBrokerClient solely viaPolyglot
. It knows: