From OpenSCADAWiki
Jump to: navigation, search

For the purpose of general module's management the TModule class provides a number of virtual functions that can be defined in the root object of the module with implementation the necessary reaction on the OpenSCADA core commands to the module:

  • void load_( TConfig *cfg );, void load_( ); — loading the module from the "cfg" storage context and in general, is called at the stage of loading the module configuration from the storage.
  • void save_( ); — saving the module, is called at the stage of saving the configuration of the module to the storage, usually at the initiative of the user.
  • void modStart( ); — module starting, is called at the stage of starting tasks of the module's background functions, if these are provided by the module.
  • void modStop( ); — stopping the module, is called at the stage of stopping the tasks of performing the background functions of the module, if these are provided by the module.
  • void modInfo( vector<string> &list ); — a request for a list of information properties of the module, which is provided with a standard set of properties "Module", "Name", "Type", "Source", "Version", "Author", "Description", "License", and which can be extended by own-specific properties.
  • string modInfo( const string &name ); — a request for the information element name at which there performed also the requests processing of own-specific properties of the module.
  • void preEnable( int flag );, void postEnable( int flag ); — connecting the module to the dynamic tree of objects, is called before and after the actual activation of the module, respectively.
  • void preDisable( int flag );, void postDisable( int flag ); — excluding the module from the dynamic tree of objects before freeing the object, is called before and after the actual exclusion of the module, respectively.
  • void perSYSCall( unsigned int cnt ); — a call from the system-service thread-task with the periodicity 10 seconds and a second counter "cnt", can be used to perform periodic-rare service procedures.