Communication Handler

The communication handler is a class that stores all the commands Ockle can handle from an external client. There is one instance of this class on the whole program and it is used to add new commands all over Ockle (both core and plugins).

A communication plugin (such as the SocketListner plugin) is then used to handle an incoming command.

A command consists of a command name and a data dict. A reply is either the same command with a dataDict holding the reply, or a command with the name “Unknown Command” if the communication Handler does not recognize the request.

The class that builds a message to be sent over a communication plugin is the Message class, located in CommunicationMessage module. It should not really be used directly since only the communication handler and a single function in The Communication Client.

Communication Handler Class

class common.CommunicationHandler.CommunicationHandler(mainDaemon)[source]

Handle communication massages from a listener plugin

AddCommandToList(command, function)[source]

Used by plugins to add an ability to handle a message in the CommunicationHandler

Parameters:
  • command – The command to be called
  • function – a callback to a function that receives a dict of the data to process
handleMessage(message)[source]

Receives a message class type, and returns the appropriate response

Parameters:message – The message class we received
Returns:A message class response
listCommands(dataDict)[source]

A command to list all available commands on the communication server

Parameters:dataDict – a dict of strings with the information passed to the handling method
Returns:the response from the handling method

Project Versions

Table Of Contents

Previous topic

Operation States (OpStates)

Next topic

Plugins

This Page