From OpenSCADAWiki
Jump to: navigation, search

Public methods:

  • TSYS( int argi, char **argb, char **env ); — The initialisation constructor.
  • bool isRunning( ); — Sign of the station running state — executing the main threaded module or waiting the stop signal.
  • bool isFinalKill( ); — Sign "The final killing of". It is used for forced disconnection of blocked objects on the the final stage of shutdown.
  • int stopSignal( ); — The return code in the case of system shutdown. Can be used as a sign of "System shutdown" of the various subsystems.
  • void unload( ); — Unload subsystems.
  • int start( ); — Start of the system. The function is finished only with the finishing of the system. The return code is returned.
  • void stop( int sig = SIGUSR1 ); — Stop program by the signal sig, by default it is SIGUSR1 and SIGUSR2 reserved for projects manager.
  • string id( ) const; — station ID.
  • string name( ) const; — Localized name of the station.
  • void setName( const string &vl ); — Setting the localized name of the station.
  • string ico( string *tp = NULL, bool retPath = false ); — Obtaining file data or path, for retPath, of the station common icon with placing the file type to tp.
  • string user( ) const; — The system user on behalf of which the system is running.
  • string host( ); — Host name for the station run.
  • void list( vector<string> &list ) const; — A list of registered subsystems in the system.
  • bool present( const string &name ) const; — Check the availability of the subsystem.
  • void add( TSubSYS *sub ); — Add/registration of the subsystem.
  • void del( const string &name ); — Removing the subsystem.
  • AutoHD<TSubSYS> at( const string &name ) const; — Connection to the specified subsystem.
  • AutoHD<TUIS> ui( ); — Direct access to the subsystem "User interfaces".
  • AutoHD<TArchiveS> archive( ); — Direct access to the subsystem "Archives".
  • AutoHD<TBDS> db( ); — Direct access to the subsystem "Databases".
  • AutoHD<TControllerS> daq( ); — Direct access to the subsystem "Data acquisition".
  • AutoHD<TProtocolS> protocol( ); — Direct access to the subsystem "Protocols".
  • AutoHD<TTransportS> transport( ); — Direct access to the subsystem "Transports".
  • AutoHD<TSpecialS> special( ); — Direct access to the subsystem "Special".
  • AutoHD<TModSchedul> modSchedul( ); — Direct access to the subsystem "Module".
  • AutoHD<TSesurity> sesurity( ); — Direct access to the subsystem "Security".
  • string workDir( ); — Working directory of the station.
  • string modDir( ); — Directories with the modules of OpenSCADA, separated by ';', they can include a files' template into the end (/my/modules/path/lib*.so).
  • string icoDir( ); — Directory of the icons of OpenSCADA.
  • string docDir( ); — Directory of the documents of OpenSCADA.
  • void setWorkDir( const string &wdir, bool init = false ); — Setting the working directory of the station.
  • void setModDir( const string &mdir, bool init = false ); — Specifying the directories of the modules of OpenSCADA.
  • void setIcoDir( const string &idir ); — Specifying of the directory of icons of OpenSCADA.
  • void setDocDir( const string &idir ); — Specifying of the directory of documents of OpenSCADA.
  • string cfgFile( ); — Name of configuration file of the system.
  • XMLNode &cfgRoot( ); — Parsed structure of the configuration file.
  • XMLNode *cfgNode( const string &path, bool create = false ); — Node of configuration getting by it path path. Elements of the path creation by it miss create.
  • void modifCfg( bool chkPossibleWR = false ); — Configuration mark to modification or write possibility chkPossibleWR, for next saving to file.
  • ResRW &cfgRes( ); — Lock of the access to the config file tree.
  • string workDB( ); — The full name of the working database.
  • string mainCPUs( ); — Used processors list.
  • bool clockRT( ); — The Real-time clock selection for the tasks planning, else used the monotonic one (by defaults).
  • int taskInvPhs( ); — Number of the tasks invoking phases.
  • bool saveAtExit( ); — Sign - "Save configuration on exit".
  • int savePeriod( ); — Frequency of the automatically saving the station in the database (seconds).
  • bool modifCalc( ); — Set modification for the calculated objects.
  • void setSelDB( const string &vl ); — Installation of the selected database for the specified boot.
  • void setMainCPUs( const string &vl ); — Setting of used processors list.
  • void setClockRT( bool vl ); — Setting of the Real-time clock selection for the tasks planning.
  • void setTaskInvPhs( int vl ); — Setting number of the tasks invoking phases.
  • void setSaveAtExit( bool vl ); — Setting of the sign - "Save configuration on exit".
  • void setSavePeriod( int vl ); — Set the frequency of the automatically saving of the station to the database (seconds).
  • void setModifCalc( bool vl ); — Set of setting the modification for the calculated objects.
  • string selDB( ); — Chosen DB. Used for selective loading from the specified database in the subsystem "DB".
  • void setWorkDB( const string &wdb ); — Setting of the full name of the working database.
  • bool chkSelDB( const string &wDB ); — The function of checking for compliance of the specified database wDB with the selected "selDB()".
  • XMLNode *cfgCtx( bool last = false ); — The global configuration context of the interstation copying or the last setting link, for the access lock used cfgLoadSaveM().
  • void setCfgCtx( XMLNode *vl, bool last = false ); — Set the global configuration context of the interstation copying or the last setting link, for the access lock used cfgLoadSaveM(). At any operation with the global configuration context the last setting link is cleared.
  • ResMtx &cfgLoadSaveM( ); — Lock of the loading and saving configuration.
  • static void sighandler( int signal ); — Function of the default handler of the signals of the system as a whole.
  • float sysClk( ); void setSysClk( float vl ); — System clock-frequency in MHz and its setting from outside for information on the root page.
  • void taskCreate( const string &path, int priority, void *(*start_routine)(void *), void *arg, int wtm = 5, pthread_attr_t *pAttr = NULL, bool *startSt = NULL ); — Create task (thread) with id path, priority (-1...99), task's function start_routine and it argument arg, and also wait for user's code start by flag startSt.
  • void taskDestroy( const string &path, bool *endrunCntr = NULL, int wtm = 5, bool noSignal = false ); — Destroy task with id path, start control flag startCntr. Use noSignal for exclude signal SIGALRM send to the task.
  • void taskSendSIGALRM( const string &path ); — Sending the termination signal "ALARM" to a task with id path.
  • double taskUtilizTm( const string &path, bool max = false ); — Utilization of CPU time, in seconds, for task path or it's maximum max.
  • static bool taskEndRun( ); — Check for the task endrun by signal SIGUSR1.
  • static const STask& taskDescr( ); — Get reference to the task's descriptor.
  • static int sysSleep( float tm ); — System sleep in seconds up to nanoseconds (1e-9).
  • time_t sysTm( ); time_t sysTmJmp( bool *hasJump = NULL, time_t last = 0 ); — System time fast access from updating cell and with a function of detection time jumps hasJump from last used time.
  • static int64_t curTime( clockid_t clc = CLOCK_REALTIME ); — The clock clc time in microseconds from the beginning of the era (01.01.1970).
  • static uint64_t curTimeN( clockid_t clc = CLOCK_REALTIME ); — The clock clc time in nanoseconds from the beginning of the era (01.01.1970).
  • string prjUserDir( ); — Directory of the user projects.
  • bool prjCustMode( ); — Custom mode of projects.
  • void setPrjCustMode( bool vl ); — Set for custom mode of projects.
  • string prjNm( ); — Project name of the configuration.
  • void setPrjNm( const string &vl ); — Set project name of the configuration.
  • bool prjSwitch( const string &prj, bool toCreate = false ); — Switch to project prj.
  • int prjLockUpdPer( ); — Get project lock updating period, zero for the lock disable.
  • bool prjLock( const char *cmd ); — Project lock process for the command cmd ("hold", "free", "update").
  • static void taskSleep( int64_t per, const string &cron = "", int64_t *lag = NULL ); — The function of the flow sleep by the grid of absolute time with the period per in the nanosecond or for the scheduled time cron. If set lag then to it will return different value from real and planed wake up time (lost cycles).
  • static time_t cron( const string &vl, time_t base=0 ); — Planning the execution time on the format of the standard Cron vl beginning at the basic time base or at the current time if the base is not specified.
  • static bool eventWait( bool &m_mess_r_stat, bool exempl, const string &loc, time_t time=0 ); — Function of the event waiting exempl for the variable m_mess_r_stat within a specified time interval time for the source loc.
  • bool cntrEmpty( ); — Debug counters checking to empty.
  • double cntrGet( const string &id ); — Debug counter id getting.
  • void cntrSet( const string &id, double vl ); — Debug counter id setting to value vl.
  • void cntrIter( const string &id, double vl ); — Debug counter id iteration to value vl.
  • bool rdEnable( ); — Redundancy enabled, at least one redundancy station presented.
  • bool rdActive( ); — Redundancy active, at least one active station presented.
  • void rdStList( vector<string> &ls ); — List of ls stations into the redundancy.
  • SStat rdSt( const string &id ); — Get copy of state structure of the redundancy station id.
  • map<string, SStat> rdSts( ); — Get copy of list of state structures of redundancy stations.
  • int rdStLevel( ); — Current station level into the redundancy system.
  • void setRdStLevel( int vl ); — Set current station level into the redundancy system.
  • float rdTaskPer( ); — Period of execution of the redundancy processing task.
  • void setRdTaskPer( float vl ); — Set period of execution of the redundancy processing task.
  • int rdRestConnTm( ); — Time of the retry attempts to reconnect to the backup station after its loss in seconds.
  • void setRdRestConnTm( int vl ); — Set time of the retry attempts to reconnect to the backup station after its loss in seconds.
  • string rdStRequest( XMLNode &req, const string &st = "" ); — Common request req to pointed redundancy station st.
  • static string int2str( int val, IntView view=Dec ); — Transformation of a signed integer to the string of the type of view view.
  • static string uint2str( unsigned val, IntView view=Dec ); — Transformation of unsigned integer to the string type of view view.
  • static string ll2str( long long val, IntView view=Dec ); — Transformation of a long integer (64bit) to the string type of view view.
  • static string real2str( double val, int prec=15, char tp='g'); — Real transformation with an accuracy prec signs and type tp to the string.
  • static double realRound( double val, int dig=0, bool toint=false ); — Rounding the real number to the specified digit dig after the decimal point with the possibility of transformation to integer after rounding toint.
  • static string atime2str( time_t tm, const string &format = "", bool gmt = false, const string &user_lang = "" ); — Astronomic UNIX time tm conversion to string in the format of the POSIX-function "strftime()" or "gmtime()" for gmt, also can be localised for the user and language user_lang or from the messages translation context.
  • static string time2str( double tm ); — Convert time interval, in seconds, to string like "1hour 23min 10sec".
  • static string cpct2str( double cnt ); — Traffic counter cnt (bytes) convert to string like "12.5KiB".
  • static double str2real( const string &val ); — String transformation to the real.
  • static time_t str2atime( const string &val, const string &format = "", bool gmt = false ) — String time val conversion to an astronomic UNIX time, in the format of the POSIX-function "strptime()", and by the function "mktime()" or "timegm()", for gmt.
  • static string addr2str( void *addr ); — Convert addresses into string.
  • static void *str2addr( const string &str ); — Convert string into the address.
  • static string strTrim( const string &val, const string &cfg = " \n\t\r" ); — Deletes from the original string val pointed into cfg (mostly empty) characters at the beginning and end of it.
  • static string strSepParse( const string &path, int level, char sep, int *off = NULL ); — Parsing of the string path into the components separated by the dividing symbol sep, beginning with the offset off and controlling the offset of the element end in itself.
  • static string {strParse,strParseEnd}( const string &str, int level, const string &sep, int *off = NULL, bool mergeSepSymb = false ); — Parse function's "strSepParse()" expanded version which allow using multi-symbols separators and one symbol merging. strParseEnd does the same but from the end.
  • static string strLine( const string &str, int level, int *off = NULL ); — Parsing text lines for different ways to the end of a line (CR, LF and CR/LF).
  • static string pathLev( const string &path, int level, bool decode = true, int *offCmtbl = NULL, int *off = NULL ); — Obtaining of the element/token level of the path with the ability of their decode, starting with the offset off (stopping on the next token begin) or offCmtbl (stopping on next symbol of the current token end — for compatibility).
  • static string pathLevEnd( const string &path, int level, bool decode = true, int *off = NULL ); — Obtaining of the element/token level of the path from the end with the ability of their decode, starting with the offset off (stopping on the next token end).
  • static string path2sepstr( const string &path, char sep = '.' ); — Transformation the path into string with the separator sep of the elements.
  • static string sepstr2path( const string &str, char sep = '.' ); — Transformation of the string with the separator sep of the elements into the path.
  • static string strEncode( const string &in, Code tp, const string &opt = "" ); — Encoding of the string by the specified rule tp and the option opt (symbols by "Custom").
  • static string strDecode( const string &in, Code tp = Custom, const string &opt = "" ); — Decoding of the string in by the specified rule tp and the option opt (separator or "<text>" for "Bin").
  • static string strMess( const char *fmt, ... ); — Formation of the string by the template fmt and arguments. It is implemented on the basis of "printf".
  • static string strLabEnum( const string &base, bool onlyDec = true ); — Individual string labels from base forming by increment at end. Supported numbering into decimal, hexadecimal (prefix "0x") or octal (prefix "0") notation and onlyDec for simple enumerating one digit, found the first from the string end.
  • string strCompr( const string &in, int lev=-1); — Compression of the string in with the compression level lev.
  • string strUncompr( const string &in ); — Decompression of the string in.
  • static inline uint16_t getUnalign16( const void *p ); static inline uint32_t getUnalign32( const void *p ); static inline uint64_t getUnalign64( const void *p ); — Unaligned read for unsigned
  • static inline int getUnalignInt( const void *p ); — Unaligned read for integer from buffer by offset.
  • static inline float getUnalignFloat( const void *p ); — Unaligned read by real "float" from buffer by offset.
  • static inline double getUnalignDbl( const void *p ); — Unaligned read by real "double" from buffer by offset.
  • static uint16_t i16_LE( uint16_t in ); static uint32_t i32_LE( uint32_t in ); static uint64_t i64_LE( uint64_t in ); — Byte order conversion for integer in from Little-Endian (LE) to internal represent.
  • static uint16_t i16_BE( uint16_t in ); static uint32_t i32_BE( uint32_t in ); static uint64_t i64_BE( uint64_t in ); —Byte order conversion for integer in from Big-Endian (BE) to internal represent.
  • static float floatLE( float in ); static double doubleLE( double in ); — Real number in conversion from internal to format IEEE754 Little-Endian (LE).
  • static float floatLErev( float in ); static double doubleLErev( double in ); — Real number in conversion from format IEEE754 Little-Endian (LE) to internal.
  • static float floatBE( float in ); static double doubleBE( double in ); — Real number in conversion from internal to format IEEE754 Big-Endian (BE).
  • static float floatBErev( float in ); static double doubleBErev( double in ); — Real number in conversion from format IEEE754 Big-Endian (BE) to internal.
  • string optDescr( ); — Full localized help on the options of the command line and parameters of the configuration file.
  • string getCmdOpt( int &curPos, string *argVal = NULL ); static string getCmdOpt_( int &curPos, string *argVal, int argc, char **argv ); — Command line parameters parsing by cursor scanning curPos. Return argument name and it's possible value into argVal. Implement formats for short keys: "-v", "-v val", "-abcv", "-abcv val"; and long keys: "--var", "--var=val", "--var val".
  • bool cmdOptPresent( const string &opt ); — Check the command-line option opt for presence.
  • string cmdOpt( const string &opt, const string &setVl = "" ); — Get command-line option opt. Set it at setVl if pointing.
  • int permCrtFiles( bool exec = false ); — get permission for files created OpenSCADA in form 0777 (RWXRWXRWX), where exec is not mask the bit 01.
  • ResMtx *commonLock( const string &nm ); — creates and gets a lock for the name nm — for non multithread system functions, typically.
  • static void ctrListFS( XMLNode *nd, const string &fsBase, const string &fileExt = "" ); — Browsing list for file system's items from base fsBase, for the files with extensions fileExt in list "png;jpeg;gif;".