From OpenSCADAWiki
Jump to: navigation, search

Software OpenSCADA interface to implement the protocol layer is presented by the objects and virtual functions of the calls from the OpenSCADA core:

  • TProtocol->TModule — The root module's object of the "Protocols" subsystem:
    • void itemListIn( vector<string> &ls, const string &curIt = "" ); — The list of sub-elements of the input protocol, if the protocol provides them. It is used when selecting an object in the configuration of input transport.
    • void outMess( XMLNode &io, TTransportOut &tro ); — The transfer of data by the objects of the OpenSCADA core in the in XML tree to the remote system via the tro transport and the current output protocol. Presentation of data in the in XML tree is non-standardized and specific to the logical structure of the protocol. This data are serialized (converted into a sequence of bytes according to the protocol) and are sent via the specified tro output transport by the messIO() function above.
    • TProtocolIn *in_open( const string &name ) — It is called when you open or create by this module the new name input transport protocol object.
  • TProtocolIn — Protocol's object of the input requests processing from the input transport object TTransportIn above. For each session of the input request the object of the associated input protocol is created, which remains alive until the completion of a full "request->answer" session. Address of the transport, which opened an instance of the protocol, is specified in the srcTr():
    • bool mess( const string &request, string &answer, const string &sender ); — Transfer of the request data sequence to the protocol's object for their parsing according to the protocol's implementation, with the specification of the requesting object's address in the sender. This protocol's function should process the request, generate the response in answer and return "false" in the case of the completeness of the request. If the request is not complete, it is necessary to return "true" to indicate the "expectation of the completion" for the transport, the first part of the request should be saved in the context of the protocol's object.