From OpenSCADAWiki
The procedure for creating a new module with inclusion in the source text tree based on a template is generally simpler than the procedure for an external module and includes the following steps:
- 1. Get the source tree of the OpenSCADA project for:
- the Work branch:
- svn co svn://oscada.org/trunk/OpenSCADA
- the stable release branch — NOT RECOMMENDED, as only patches are accepted for stable LTS releases and this instruction requires version 0.9 or higher:
- svn co svn://oscada.org/tags/openscada_0.9
- 2. Copy the template folder with the "NewMod" name of the new module, for example, for the "DB" subsystem:
- cd OpenSCADA/src/moduls/bd; cp -r =Tmpl= NewMod; cd NewMod; rm -f configure.ac
- for the "DAQ" subsystem the path is — "OpenSCADA/src/moduls/daq"
- for the "Archive-History" subsystem the path is — "OpenSCADA/src/moduls/arhiv"
- for the "Transport" subsystem the path is — "OpenSCADA/src/moduls/transport"
- for the "Transport protocol" subsystem the path is — "OpenSCADA/src/moduls/protocol"
- for the "UI" subsystem the path is — "OpenSCADA/src/moduls/ui"
- for the "Special" subsystem the path is — "OpenSCADA/src/moduls/special"
- cd OpenSCADA/src/moduls/bd; cp -r =Tmpl= NewMod; cd NewMod; rm -f configure.ac
- 3. Edit the "module.cpp" file for:
- also can do that automatically by: sed -i "s/Tmpl/NewMod/g" *.{cpp,h}
- changing the name of the builtin-inclusion functions of the module according to the name of the new module:
- "TModule::SAt bd_Tmpl_module( int n_mod )" —> "TModule::SAt bd_NewMod_module( int n_mod )"
- "TModule *bd_Tmpl_attach( const TModule::SAt &AtMod, const string &source )" —> "TModule *bd_NewMod_attach( const TModule::SAt &AtMod, const string &source )"
- information about the module in the "module.cpp" file, namely the section: