Main Page | Features | Central Services | csv-Files | Types | Transfer | Access | API-C | API-.NET | API-Java | Examples | Downloads
page generated on 18.05.2024 - 04:45
Functions | Variables
System API Calls File Reference

TINE System API routines: More...

Functions

int _SystemCycle (int chkcmd)
 Required call for the TINE engine to function property. More...
 
void _SystemDelay (int msec)
 Blocks any activity inside a TINE task or equipment modules for the specified amount of time. More...
 
int _SystemFireEvent (char *eqm, char *prp)
 Schedules an event for the given property for immediate delivery to all attached clients. More...
 
int _SystemInit (int chkcmd)
 Required call for the TINE server engine to function property. More...
 
int _SystemReset (int level)
 Flushes all entry tables and returns all counters and semaphores to their initial state. More...
 
int _SystemScheduleProperty (char *eqm, char *prp)
 Schedules the given property for immediate delivery to all attached clients. More...
 
int _SystemSchedulePropertyEx (char *eqm, char *prp, int scope)
 Schedules the given property for immediate delivery to all attached clients according scope specified. More...
 
void _SystemStop (int exitOnFree)
 Free all system resources and optionally exit. More...
 
int clslog (char *context, char *tag, char *logger, int priority, int status, char *text,...)
 Sends a logging entry to the central logging server. More...
 
int datacmp (BYTE *d1, BYTE *d2, int siz, int fmt, double t)
 
int feclog (char *text,...)
 Puts entries into a server's FEC log file. More...
 
int feclogEx (int logLevel, char *text,...)
 Puts entries into a server's FEC log file and in error.log file if certain conditions match. More...
 
int GetBackgroundThreadPriority (void)
 Returns the priority of the registered background threads. More...
 
int GetBurstLimit (void)
 Gets the burst limit in number of packets which are allowed to be sent consecutively. More...
 
int GetCatchConsoleBreak (void)
 Returns the current setting for this feature. More...
 
int GetClientThreadPriority (void)
 Returns the priority of the client cycle thread as well as other associated client-side threads. More...
 
int GetContractAccessRate (int id)
 Returns the access rate (interval) associated with the given contract. More...
 
int GetContractId (const char *eqm)
 Returns the last contract identifier for the equipment module specified. More...
 
int GetCycleDelay (void)
 Gets the delay time in milliseconds following a 'burst' of ethernet packets (as defined by SetBurstLimit(). More...
 
int GetCycleMicroDelay (void)
 Gets the delay time in microseconds following a 'burst' of ethernet packets (as defined by SetBurstLimit(). More...
 
double GetDataTimeStamp (void)
 Returns the last established data timestamp. More...
 
struct timeval * GetDataTimeStampAsTimeval (void)
 Returns the last established data timestamp as a pointer to a struct timeval. More...
 
double GetDataTimeStampOffset (void)
 Returns a the current data timestamp offset as assigned by the TINE global time service. More...
 
char * GetDataTimeString (double ts, int useLongStringFormat)
 Returns the TINE data timestamp as a human-readable string. More...
 
char * GetDataTimeStringEx (double ts, int useLongStringFormat, char *tsstr)
 Returns the TINE data timestamp as a human-readable string. More...
 
int GetDieOnAddressInUse (void)
 Returns the current setting for this feature. More...
 
int GetDieOnFecIsAlias (void)
 Returns the current setting for this feature. More...
 
int GetDieOnSocketError (void)
 Returns the current setting for this feature. More...
 
char * GetFecHome (void)
 Gets the current setting for the fec home database repository. More...
 
int GetFeclogDepth (void)
 Returns the maximum size of the server's log file in lines. More...
 
char * GetFecLogPath (void)
 Gets the current setting for the fec log repository. More...
 
int GetFormatSizeInBytesFromDataType (DTYPE *d)
 Gives the size of bytes according to the DTYPE fields. More...
 
int GetLastContractId (void)
 Returns the last contract identifier. More...
 
int GetLastContractTableId (void)
 Returns the last contract table identifier. More...
 
int GetPutCommandsInFeclog (void)
 Returns the current setting for putCommandsInFeclog (which determines whether all in-coming WRITE access calls are automatically included in the server's log file) More...
 
int GetServerIdleState (char *eqm)
 Gets the server's idle state. More...
 
int GetServerThreadPriority (void)
 Returns the priority of the server cycle thread as well as other associated server-side threads. More...
 
int GetServerWaiting (void)
 Gets the server's waiting state. More...
 
int GetStreamTransportRetryLimit (void)
 Returns the stream transport retry limit. More...
 
char * GetSystemErrorString (short cc, char *errstr)
 Gets the system error code in plain text. More...
 
int GetSystemLogging (void)
 Returns the current system logging setting (TRUE or FALSE) More...
 
int GetSystemRequireAcknowledgments (void)
 Gets the require acknowledgments flag to the value given. More...
 
int GetSystemSchedulePropertyLazy (void)
 Gets the 'lazy' flag for scheduling properties. More...
 
int GetSystemUseDataProtection (void)
 Gets the data protection flag to the value given. More...
 
char * GetSystemUserName (void)
 Gets the current value for the application user. More...
 
double GetTimeStampFromString (char *timestr)
 Returns a TINE timestamp converted from the string argument given. More...
 
int GetUseGlobalSynchronization (void)
 Returns whether data timestamps are to be externally synchronized. More...
 
int GetUseMultiThreadedBackgroundTasks (void)
 Returns whether equipment module background tasks are to run in separate threads (boolean). More...
 
int GetUseMultiThreadedEquipmentFunctions (void)
 Returns whether an equipment module equipment function can run in a separate threads (boolean). More...
 
int GetUseMultiThreadedStockFunctions (void)
 Returns whether stock propery calls can run in a separate threads (boolean). More...
 
UINT32 GetWorkAreaSize (void)
 Gets the server-side work area size which is coupled to the maximum transport size for supported by a single-threaded server. More...
 
int IsServerRunning (void)
 Returns TRUE (non zero) if the server kernel is fully initialized and ready. More...
 
int LockEquipmentModules (void)
 Locks all equipment modules. More...
 
double MakeDataTimeStamp (void)
 Returns a data timestamp according to the current system time. More...
 
int MakeSystemDataStamp (void)
 Returns the current valid global system data stamp. More...
 
int microsleep (int usecs)
 sleep for given number of micro-seconds More...
 
double PutDataTimeStamp (double toffset, time_t tsec, int tmsec)
 Returns a data timestamp according to the input parameters given. More...
 
double PutDataTimeStampU (double toffset, time_t tsec, int tusec)
 Returns a data timestamp according to the input parameters given. More...
 
int ResetMultiChannelProperty (char *eqm, char *prp)
 sends (schedules) a 'reset_mca_property' signal to any listening client More...
 
int SetBackgroundThreadPriority (int priority)
 Determines the priority of any registered background threads. More...
 
int SetBurstLimit (int npackets)
 Sets the burst limit in number of packets which are allowed to be set consecutively. More...
 
void SetCatchConsoleBreak (int value)
 Determines whether an application will catch an interrupt or break signal (such as control-C) and issue a graceful exit or not. More...
 
int SetClientThreadPriority (int priority)
 Determines the priority of the client cycle thread as well as other associated client-side threads. More...
 
int SetCycleDelay (int msecs)
 Sets the delay time in milliseconds following a 'burst' of ethernet packets (as defined by SetBurstLimit(). More...
 
int SetCycleMicroDelay (int usecs)
 Sets the delay time in microseconds following a 'burst' of ethernet packets (as defined by SetBurstLimit(). More...
 
void SetDataTimeStamp (double ts)
 Sets the intrinsic data timestamp to the value given. More...
 
void SetDieAnotherDay (int value)
 Revokes an 'exit' due to a 'die on' condition. More...
 
void SetDieFunction (DIEFCNP fcn)
 Sets a dispatch routine to call if and when the FEC process dies due to e.g. 'address in use'. More...
 
void SetDieOnAddressInUse (int value)
 Determines whether a server will exit() if an 'address in use' message is delivered by the ENS upon registration. More...
 
void SetDieOnFecIsAlias (int value)
 Determines whether a server will exit() if a 'FEC has an alias' message is delivered by the ENS upon registration. More...
 
void SetDieOnSocketError (int value)
 Determines whether a server will exit() if there are continuous socket errors on important server sockets. More...
 
int SetFecHome (char *fecHomePath)
 Sets the current fec home database repository. More...
 
void SetFeclogDepth (int value)
 Determines the approximate size of the server's log file in lines. More...
 
int SetFecLogPath (char *path)
 Sets the fec log repository. More...
 
int SetKernelPriority (int priority)
 Determines the priority of TINE kernel threads. More...
 
void SetPostSystemInitFunction (SYSTSKP fcn)
 Sets a user-specific initialization routine to be executed following server initialization.
More...
 
void SetPreSystemInitFunction (SYSTSKP fcn)
 Sets a user-specific initialization routine to be executed prior to server initialization.
More...
 
void SetPutCommandsInFeclog (int value)
 Determines whether all in-coming WRITE access calls are automatically included in the server's log file. More...
 
void SetServerIdleState (char *eqm, int value)
 Sets the server's idle state to the value given. More...
 
int SetServerThreadPriority (int priority)
 Determines the priority of the server cycle thread as well as other associated server-side threads. More...
 
void SetServerWaiting (int value)
 Sets the server's waiting state to the value given. More...
 
void SetStreamTransportRetryLimit (int value)
 Sets the stream transport retry limit. More...
 
void SetSystemCleanupFunction (SYSTSKP fcn)
 Sets a user-specific cleanup routine to be executed as a final step during a normal cleanup phase (e.g. typing 'quit' or 'exit' at the command prompt. More...
 
void SetSystemDataStamp (int value)
 Sets the global system data stamp with which to tag outbound data sets. More...
 
void SetSystemLogging (int value)
 Sets system logging (output to fec.log) to TRUE or FALSE. More...
 
void SetSystemRequireAcknowledgments (int value)
 Sets the require acknowledgments flag to the value given. More...
 
void SetSystemSchedulePropertyLazy (int value)
 Sets the 'lazy' flag for scheduling properties. More...
 
void SetSystemUseDataProtection (int value)
 Sets the data protection flag to the value given. More...
 
int SetSystemUserName (char *usr)
 Sets the current value for the application user. More...
 
void SetUseGlobalSynchronization (int value)
 Determines whether data timestamps are to be externally synchronized. More...
 
void SetUseMultiThreadedBackgroundTasks (int value)
 Determines whether equipment module background tasks are to run in separate threads (boolean). More...
 
void SetUseMultiThreadedEquipmentFunctions (int value)
 Determines whether an equipment module equipment function can run in a separate threads (boolean). More...
 
void SetUseMultiThreadedStockFunctions (int value)
 Determines whether stock propery calls can run in a separate threads (boolean). More...
 
UINT32 SetWorkAreaSize (UINT32 size)
 Sets the server-side work area size which is coupled to the maximum transport size for supported by a single-threaded server. More...
 
int srvlog (char *filename, char *tag, char *text,...)
 Puts entries into a named log file. More...
 
BYTE * SystemVersion (void)
 Returns the system version as a 4-byte array containg the major and minor version numbers as the first two bytes and the current revision in the next two bytes. More...
 
int UnlockEquipmentModules (void)
 Unlocks all equipment modules. More...
 

Variables

int FeclogDepth = FECLOG_DEPTH
 Determines the approximate size of the server's log file in lines. More...
 
int gErrorLogLevel = TINE_LOGLEVEL_WARN
 Determines which messages are written to error.log file. More...
 
int gStartupDebug = 1
 Determines whether server initialization messages are displayed or not. More...
 
int nofeclog = FALSE
 Determines whether a server is to keep a log file on the local disk. More...
 
int putCommandsInFeclog = INCLUDE_IN_LOGFILE
 Determines whether all in-coming WRITE access calls are automatically included in the server's log file. More...
 
int useGlobalSynchronization = GLOBAL_SYNCHRONIZATION
 Determines whether data timestamps are to be externally synchronized. More...
 

Detailed Description

TINE System API routines:

The API routines offered here generally refer to the TINE engine and have relevance for both client-side and server-side programming. Some routines such as _SystemCycle() are required. Others such as _SystemInit() are required for server operation. Many routines are optional and offer ways of setting and getting system timestamps for instance or making entries into the server's log file.

Function Documentation

◆ _SystemCycle()

int _SystemCycle ( int  chkcmd)

Required call for the TINE engine to function property.

Should be called within an infinite loop. Prior to the start of this loop, all other device server registration should occur.
Clients with asynchronous links must see to it that _SystemCycle() is called regularly (unless SystemDelay(-1) is used to block the main process).

Parameters
chkcmdis used to signal the presence of a local command interpreter. Developers wishing to bypass the built-in command interpreter in favor of another should pass FALSE for this argument
Note
SystemCycle does will in general NOT monopolize the CPU as for most Operating systems, blocking sockets are used and the TINE Engine will itself block on select() for a duration not greater than the SystemPollingRate. A noteable exception is DOS, where non-blocking sockets are used and the TINE engine becomes a defacto operating system.
Returns
0 under normal circumstances. A non-zero return values indicates an immediate need to re-enter (i.e. following a complete cycle, there are still incomplete data transfer pending).
Note
SystemCycle is macro #defined as _SystemCycle(). If additional 'cycle' procedures need to be incorporated, one can re-#define the SystemCycle() macro.
See also
_SystemInit(), _SystemDelay(),

Alias: SystemCycle

Example:

#include "tine.h"
#include "bpmeqm.h"
void PreSystemInit(void);
void PostSystemInit(void);
int main(int argc, char *argv[])
{
int cc;
/* TODO: modify command line input to suit your own needs. */
/* Here: the debug level is set according to initial input */
switch (argc)
{
case 2:
tineDebug = atoi(argv[1]);
break;
default:
tineDebug = 0;
}
/* To deviate from default settings, initialize */
/* any system variables in PreSystemInit() */
PreSystemInit();
/* initialize RPC server: */
if ((cc=SystemInit(TRUE)) != 0)
{
printf(erlst[cc]);
exit(1);
}
/* Make all other registrations in PostSystemInit() */
PostSystemInit();
for(;;)
{
SystemCycle(TRUE);
}
return 0;
}

◆ _SystemDelay()

void _SystemDelay ( int  msec)

Blocks any activity inside a TINE task or equipment modules for the specified amount of time.

The TINE engine will continue to run and process data which is not related to 1) the equipment module being blocked if _SystemDelay() is called inside an equipment module or 2) the background task if _SystemDelay() is called inside a backgroung task.

Parameters
msecis the amount of time in milliseonds to suspend the calling routine.
Note
The TINE engine is designed to run single-threaded. You are free to use threads and you can specify multi-threaded backgound tasks if you want the TINE engine itself to explicitly use threads. In such cases, calls to 'sleep()' would have their intended effect. Under single-threaded conditions (i.e. DOS, VMS, or you're avoided threads because they complicate things) you should not use 'sleep()' since you will block then entire TINE engine. Use _SystemDelay() instead if you want to wait at a specific spot in your code until some action has finished.
SystemDelay is macro #defined as _SystemDelay(). If additional 'delay' procedures need to be incorporated, one can re-#define the SystemDelay() macro.
See also
_SystemCycle(), _SystemInit(),

Alias: SystemDelay

Example

...
WriteMyIOChannel(1,val); // write something to channel 1
SystemDelay(50); // give the hardware a bit of time
ReadMyIOChannel(1,&val); // read it back
...

◆ _SystemFireEvent()

int _SystemFireEvent ( char *  eqm,
char *  prp 
)

Schedules an event for the given property for immediate delivery to all attached clients.

Clients can attach to a particular property and reqest event notification only by applying the CM_EVENT polling mode. When a server schedules the property by calling either this routine of _SystemScheduleProperty() then the property handler is called and the attached clients receive the property's data (if any) and an event notification. This call is fully equivalent to _SystemScheduleProperty().

Parameters
eqmis the local equipment module name (maximum 6 characters in length) For example: "BPMEQM".
prpis (comma separated) list of properties which are to be scheduled.
Returns
0 upon success or a TINE error code.
See also
_SystemScheduleProperty()

Alias: SystemFireEvent()

Example:

...
char errstr[256];
// schedule property 'STATUS'
if ((rc = SystemScheduleProperty("EQM1","STATUS")) != 0)
{
printf(“SystemScheduleProperty Failed: %s\n”,GetLastLinkError(rc,errstr));
}
// schedule property 'Trace' to the local history system.
if ((rc = SystemSchedulePropertyEx("EQM1","Trace",CA_HIST)) != 0)
{
printf(“SystemScheduleProperty Failed: %s\n”,GetLastLinkError(rc,errstr));
}
// schedule property 'Values' if remote contract specifies 'Device1'
if ((rc = SystemScheduleProperty("EQM1","Values<Device1>")) != 0)
{
printf(“SystemScheduleProperty Failed: %s\n”,GetLastLinkError(rc,errstr));
}
...

References _SystemSchedulePropertyEx().

◆ _SystemInit()

int _SystemInit ( int  chkcmd)

Required call for the TINE server engine to function property.

Should be called prior to the start of the main TINE server engine. Any deviations from default system parameters should be made before any call to _SystemInit(). This might include server settings which fix the size of the local connection table entries, the maximum date transport size, etc. Note that _SystemInit() will begin be allocating space for its connection tables, so modifying these values away from their defaults will have no effect after _SystemInit() has been called. Also, if the FEC Name is given by calling RegisterFecInformation() or RegisterFecNameEx(), then this should also preceed a call to _SystemInit().

Parameters
chkcmdis used only for UNIX servers and if TRUE will determine if the server is running in the foreground and if so, will check the stdin for console commands at the keyboard.
Note
_SystemInit() does not and should not be called if you are writing a 'client-only' application. _SystemInit() will attempt to register various server settings which play no role, and will attempt to initiaze server sockets which could lead to confusing situations on the local computer. _SystemInit() does not initialize any client-side functioniality.
Returns
0 if successful, otherwise a TINE completion code which can be interpreted by a call to GetLastLinkError().
Note
SystemInit is macro #defined as _SystemInit(). If additional 'init' procedures need to be incorporated, one can re-#define the SystemInit() macro.
See also
_SystemCycle(), _SystemDelay(),

Alias: SystemInit

Example:

#include "tine.h"
#include "bpmeqm.h"
void PreSystemInit(void);
void PostSystemInit(void);
int main(int argc, char *argv[])
{
int cc;
/* TODO: modify command line input to suit your own needs. */
/* Here: the debug level is set according to initial input */
switch (argc)
{
case 2:
tineDebug = atoi(argv[1]);
break;
default:
tineDebug = 0;
}
/* To deviate from default settings, initialize */
/* any system variables in PreSystemInit() */
PreSystemInit();
/* initialize RPC server: */
if ((cc=SystemInit(TRUE)) != 0)
{
printf(erlst[cc]);
exit(1);
}
/* Make all other registrations in PostSystemInit() */
PostSystemInit();
for(;;)
{
SystemCycle(TRUE);
}
return 0;
}

◆ _SystemReset()

int _SystemReset ( int  level)

Flushes all entry tables and returns all counters and semaphores to their initial state.

Useful under some circumstances, for instance following program suspension or interrupt due to CNTL-C, etc.

Parameters
levelis reserved for future use.
Returns
0 if successful, otherwise a TINE completion code which can be interpreted by a call to GetLastLinkError().
Note
SystemReset is macro #defined as _SystemReset(). If additional 'reset' procedures need to be incorporated, one can re-#define the SystemReset() macro.
See also
_SystemInit(), _SystemCycle(),

Alias: SystemReset

Example:

if ((cc=SystemReset(0)) != 0) printf("Could not reset system : %s\n", cc2str(cc));

◆ _SystemScheduleProperty()

int _SystemScheduleProperty ( char *  eqm,
char *  prp 
)

Schedules the given property for immediate delivery to all attached clients.

When clients are attached to a particular property, they have specified a polling rate, which defines the maximum latency for receiving updates at the client side. This is usually fine. However, if a server knows that important data have changed and which properties depend on these data, it can signal the scheduler to call the given properties immediately and send the data to all attached callers, regardless of their registered polling rates. In this way, a server can signal an event to its attached clients.

Parameters
eqmis the local equipment module name (maximum 6 characters in length) For example: "BPMEQM".
prpis (comma separated) list of properties which are to be scheduled. If the supplied property should only be scheduled if the associated contracts call the property with a specific device then the device can also be supplied in the property string as in "property<device>". Note: the device specification applies only to 'remote' contracts (not to local history or alarm system contracts).
Returns
0 upon success or a TINE error code.

Alias: SystemScheduleProperty()

Example:

...
char errstr[256];
// schedule property 'STATUS'
if ((rc = SystemScheduleProperty("EQM1","STATUS")) != 0)
{
printf(“SystemScheduleProperty Failed: %s\n”,GetLastLinkError(rc,errstr));
}
// schedule property 'Trace' to the local history system.
if ((rc = SystemSchedulePropertyEx("EQM1","Trace",CA_HIST)) != 0)
{
printf(“SystemScheduleProperty Failed: %s\n”,GetLastLinkError(rc,errstr));
}
// schedule property 'Values' if remote contract specifies 'Device1'
if ((rc = SystemScheduleProperty("EQM1","Values<Device1>")) != 0)
{
printf(“SystemScheduleProperty Failed: %s\n”,GetLastLinkError(rc,errstr));
}
...

References _SystemSchedulePropertyEx().

◆ _SystemSchedulePropertyEx()

int _SystemSchedulePropertyEx ( char *  eqm,
char *  prp,
int  scope 
)

Schedules the given property for immediate delivery to all attached clients according scope specified.

When clients are attached to a particular property, they have specified a polling rate, which defines the maximum latency for receiving updates at the client side. This is usually fine. However, if a server knows that important data have changed and which properties depend on these data, it can signal the scheduler to call the given properties immediately and send the data to all attached callers, regardless of their registered polling rates. In this way, a server can signal an event to its attached clients. In this extended call, the caller can specify the 'scope' of the call : CA_NETWORK (all listening clients), CA_HIST (the local history subsystem) or CA_ALARM (the local alarm server).

Parameters
eqmis the local equipment module name (maximum 6 characters in length) For example: "BPMEQM".
prpis (comma separated) list of properties which are to be scheduled. If the supplied property should only be scheduled if the associated contracts call the property with a specific device then the device can also be supplied in the property string as in "property<device>".
scopeis any of CA_NETWORK, CA_HIST, or CA_ALARM ORed together. Note: a call to _SystemScheduleProperty() is equivalent to supplying all bits.
Returns
0 upon success or a TINE error code.

Alias: SystemSchedulePropertyEx()

Example:

...
char errstr[256];
// schedule property 'STATUS'
if ((rc = SystemScheduleProperty("EQM1","STATUS")) != 0)
{
printf(“SystemScheduleProperty Failed: %s\n”,GetLastLinkError(rc,errstr));
}
// schedule property 'Trace' to the local history system.
if ((rc = SystemSchedulePropertyEx("EQM1","Trace",CA_HIST)) != 0)
{
printf(“SystemScheduleProperty Failed: %s\n”,GetLastLinkError(rc,errstr));
}
// schedule property 'Values' if remote contract specifies 'Device1'
if ((rc = SystemScheduleProperty("EQM1","Values<Device1>")) != 0)
{
printf(“SystemScheduleProperty Failed: %s\n”,GetLastLinkError(rc,errstr));
}
...

Referenced by _SystemFireEvent(), and _SystemScheduleProperty().

◆ _SystemStop()

void _SystemStop ( int  exitOnFree)

Free all system resources and optionally exit.

Calling this routine will close down all client-side connections, call any registered equipment module exit routines, stop all registered background tasks, free up all system memory, close all system sockets and pipes, and call exit(0) if the 'exitOnFree' parameter is TRUE.

Parameters
exitOnFreeif TRUE will call exit(0) after freeing resources. Otherwise the process will remain active (for an additional startup sequence, for example).
Note
SystemStop is macro #defined as _SystemStop(). If additional 'stop' procedures need to be incorporated, one can re-#define the SystemStop() macro.

◆ clslog()

int clslog ( char *  context,
char *  tag,
char *  logger,
int  priority,
int  status,
char *  text,
  ... 
)

Sends a logging entry to the central logging server.

An application (be it client or server) can send an entry to the central logger at any time. As this will require WRITE access, the entry will only be accepted if the caller has WRITE privileges.

Parameters
contextis the logging context. If NULL or empty, the currently defined TINE context will be used. Logging entries can be browsed or sorted according to context.
tagis a brief logging tag. Logging entries can be browsed or sorted according to logging tag.
loggeris the user submitting the logging entry. This is typically the user name, but can be a fec name, or application name, for example. Logging entries can be browsed or sorted according the logger.
priorityis the logging entry priority. This should be one of CLOG_PRIORITY_NONE, CLOG_PRIORITY_USEFUL, CLOG_PRIORITY_IMPORTANT, or CLOG_PRIORITY_URGENT.
statusis the logging status. This should be one of CLOG_STATUS_NONE, CLOG_STATUS_INFO, CLOG_STATUS_WARN, or CLOG_STATUS_ERR.
textis the logging entry. Variable argument ellipses (i.e. printf-style) is allowed.
Returns
0 upon success, otherwise a TINE error code.
See also
feclog()

◆ datacmp()

int datacmp ( BYTE *  d1,
BYTE *  d2,
int  siz,
int  fmt,
double  t 
)

\intern compares array d1[siz] against d2[siz] with given format and absolute tolerance

◆ feclog()

int feclog ( char *  text,
  ... 
)

Puts entries into a server's FEC log file.

Servers by default maintain a log file (fec.log) which contains system information at startup and shutdown time, as well as WRITE access command calls, as well as other notifications.
The server can all place its own text in the server's log file by using this routine. All entries will be pre-pended with a time stamp and the FEC NAME of the server providing the log entry. A new-line character will be appended if the supplied string does not already end in a new line.

Parameters
textis the text string (up to 200 characters) to be logged.
Returns
0 if successful, otherwise a TINE error code.
See also
GetCompletionStatus()
gFeclogPath
vfeclog()
SetFeclogDepth()
srvlog()

References argument_list_error.

Referenced by SetAlarmCollapseWindow(), SetAllowNetworkAddressResolution(), SetClientListCapacity(), SetContractListCapacity(), SetFeclogDepth(), SetLinkWatchdogPollingInterval(), SetPacketMTU(), SetPropertySubscriptionRenewalLength(), and SetSystemCycleDeadband().

◆ feclogEx()

int feclogEx ( int  loglevel,
char *  text,
  ... 
)

Puts entries into a server's FEC log file and in error.log file if certain conditions match.

Servers by default maintain a log file (fec.log) which contains system information at startup and shutdown time, as well as WRITE access command calls, as well as other notifications.
The server can all place its own text in the server's log file by using this routine. All entries will be pre-pended with a time stamp and the FEC NAME of the server providing the log entry. A new-line character will be appended if the supplied string does not already end in a new line. In this extended call an int constant parameter indicates if entry should also be logged to error.log This is done, if and only if loglevel parameter is greater than global gErrorLogLevel. Loglevel constants are defined in errors.h: TINE_LOGLEVEL_INFO ..._WARN ..._ERROR ..._FATAL (FATAL is largest value).

Parameters
textis the text string (up to 200 characters) to be logged.
loglevelindicates if text should be written to error.log file
Returns
0 if successful, otherwise a TINE error code.
See also
GetCompletionStatus()
gFeclogPath
vfeclog()
SetFeclogDepth()
srvlog()

Referenced by SystemGetStartupCommand().

◆ GetBackgroundThreadPriority()

int GetBackgroundThreadPriority ( void  )

Returns the priority of the registered background threads.

Returns
the background thread priority.
See also
SetBackgroundThreadPriority().

◆ GetBurstLimit()

int GetBurstLimit ( void  )

Gets the burst limit in number of packets which are allowed to be sent consecutively.

For UDP transport (the default) TINE does not make use of flow control in any systematic way, other than adjusting this parameter setting at the server side. This parameter works together with the cycle delay and determines how many UDP packets (datagrams) are allowed to be sent consecutively within the transport loop before a brake is applies (cycle delay). If all clients and servers are on the same speed ethernet, this value can be adjusted to a much larger value. However, a fast server sending to a slow client (a remote client via a DSL link for instance) might send more datagrams in a burst than can be received. The default value should compensate for this effect.

Returns
The current setting for the burst limit.
See also
SetBurstLimit(), SetCycleDelay().

◆ GetCatchConsoleBreak()

int GetCatchConsoleBreak ( void  )

Returns the current setting for this feature.

If TRUE an application will catch an interrupt or break signal (such as control-C) and issue a graceful exit.

Returns
the current setting for this feature
See also
SetCatchConsoleBreak()

◆ GetClientThreadPriority()

int GetClientThreadPriority ( void  )

Returns the priority of the client cycle thread as well as other associated client-side threads.

Returns
the client thread priority.
See also
SetClientThreadPriority().

◆ GetContractAccessRate()

int GetContractAccessRate ( int  id)

Returns the access rate (interval) associated with the given contract.

A server can retieve the access rate of the specified contract. If a negative number is passed, then the most recently invoked contract is assumed. This routine is most usefull however when used within a server's equipment module.

Parameters
idis the contract table indentifier whose access rate is desired
Note
A contract table identifier is a dynamic thing, to the extent that if a contract comes and goes (is not persistent) it can have a different ID when it comes again.
Returns
a valid contract ID or -1 if the contract table is empty.

◆ GetContractId()

int GetContractId ( const char *  eqm)

Returns the last contract identifier for the equipment module specified.

A server can retieve the current contract identifier when the equipment module dispatch routine is being called. If this routine is called outside of the dispatch routine, the value returned will only represent the contract ID valid when the equipment module was last called.

Parameters
eqmis the local equipment module name (maximum 6 characters in length) For example: "BPMEQM".
Note
A contract table identifier is a dynamic thing, to the extent that if a contract comes and goes (is not persistent) it can have a different ID when it comes again.
Returns
a valid contract ID or -1 if there is an error (parameter is invalid).

◆ GetCycleDelay()

int GetCycleDelay ( void  )

Gets the delay time in milliseconds following a 'burst' of ethernet packets (as defined by SetBurstLimit().

For UDP transport (the default) TINE does not make use of flow control in any systematic way, other than adjusting this parameter setting at the server side. This parameter works together with the burst limit and determines how long to delay further datagram transmission when the burst limit has been reached. If all clients and servers are on the same speed ethernet, this value can be adjusted to 0. However, a fast server sending to a slow client (a remote client via a DSL link for instance) might send more datagrams in a burst than can be received. The default value should compensate for this effect.

Returns
The current setting for the cycle delay.
See also
SetBurstLimit(), SetCycleDelay().

◆ GetCycleMicroDelay()

int GetCycleMicroDelay ( void  )

Gets the delay time in microseconds following a 'burst' of ethernet packets (as defined by SetBurstLimit().

For UDP transport (the default) TINE does not make use of flow control in any systematic way, other than adjusting this parameter setting at the server side. This parameter works together with the burst limit and determines how long to delay further datagram transmission when the burst limit has been reached. If all clients and servers are on the same speed ethernet, this value can left at its default value 0. However, when fine adjustments in flow control are necessary, a delay in the micro second region following each 'burst' of packets can be applied, where the delay in microseconds is given by this setting.

Returns
The current setting for the cycle micro delay.
See also
SetBurstLimit(), SetCycleDelay().

◆ GetDataTimeStamp()

double GetDataTimeStamp ( void  )

Returns the last established data timestamp.

A call to getDataTimeStamp() immediately following a call to ExecLink() or within a callback routine will yield the data timestamp of the call.

Note
This call is not thread-safe. Synchronous data acquisition on two different threads could conceivably interfer with the value returned from this routine. A thread-safe way of obtaining the data timestamp associated with a call is to use the .dTimestamp field of the DTYPE object for synchronous calls such as ExecLink() or ExecLinkEx() or to use getCurrentDataTimeStampFromCallbackId() or getCurrentDataTimeStamp() (which take a link identifier as input parameter) for asynchronous links.
Returns
The data timestamp currently in place.
See also
MakeDataTimeStamp
GetDataTimeStampAsTimeval, GetCurrentDataTimeStamp, GetCurrentDataTimeStampFromCallbackId
GetSystemDataStamp

◆ GetDataTimeStampAsTimeval()

struct timeval* GetDataTimeStampAsTimeval ( void  )

Returns the last established data timestamp as a pointer to a struct timeval.

A call to getDataTimeStampAsTimeval() immediately following a call to ExecLink() or within a callback routine will yield the data timestamp of the call.

Note
This call is not thread-safe. See the discussion in getDataTimeStamp() for details.
Returns
A pointer to a struct timeval containing the data timestamp currently in place.
See also
MakeDataTimeStamp
GetDataTimeStamp, GetCurrentDataTimeStamp, GetCurrentDataTimeStampFromCallbackId

◆ GetDataTimeStampOffset()

double GetDataTimeStampOffset ( void  )

Returns a the current data timestamp offset as assigned by the TINE global time service.

Returns
the current data timestamp offset
See also
SetDataTimeStamp, PutDataTimeStamp, GetDataTimeStamp

◆ GetDataTimeString()

char* GetDataTimeString ( double  ts,
int  useLongStringFormat 
)

Returns the TINE data timestamp as a human-readable string.

A call to getDataTimeStamp() returns an 8-byte double containing the current TINE system timestamp. This will be the UTC timestamp appended with milliseconds after the decimal (if available). This timestamp can be converted to a human readable string with this call. The format will depend on the value of the second parameter. If useLongStringFormat is non-zero, the a date of the form:

"Mon Jan 10 12:08:43.355 CET 2005"

will be returned. If useLongStringFormat is zero, then the date string will be of the form (dd.mm.yy hh:mm:ss.msec TZ):

"10.01.05 12:08:43.355 CET"

Parameters
tsis the TINE Data Timestamp for which the string conversion is to be applied.
useLongStringFormatis a flag which if non-zero returns a longer representation of the timestamp.
Note
This call is not thread-safe. See the discussion in getDataTimeStamp() for details.
Returns
A pointer to a string containing the timestamp representation.
See also
MakeDataTimeStamp
GetDataTimeStamp, GetCurrentDataTimeStamp, GetCurrentDataTimeStampFromCallbackId
ctime()
localtime()
findDaylight()

References GetDataTimeStringEx().

◆ GetDataTimeStringEx()

char* GetDataTimeStringEx ( double  ts,
int  useLongStringFormat,
char *  tsstr 
)

Returns the TINE data timestamp as a human-readable string.

A call to getDataTimeStamp() returns an 8-byte double containing the current TINE system timestamp. This will be the UTC timestamp appended with milliseconds after the decimal (if available). This timestamp can be converted to a human readable string with this call. The format will depend on the value of the second parameter. If useLongStringFormat is non-zero, the a date of the form:

"Mon Jan 10 12:08:43.355 CET 2005"

will be returned. If useLongStringFormat is zero, then the date string will be of the form (dd.mm.yy hh:mm:ss.msec TZ):

"10.01.05 12:08:43.355 CET"

Parameters
tsis the TINE Data Timestamp for which the string conversion is to be applied.
useLongStringFormatis a flag which if non-zero returns a longer representation of the timestamp.
tsstris a buffer to contain the time string (should be at least 64 characters). this same buffer will be returned by the call as a matter of convenience.
Note
This call is thread-safe.
Returns
A pointer to a string containing the timestamp representation.
See also
MakeDataTimeStamp
GetDataTimeStamp, GetCurrentDataTimeStamp, GetCurrentDataTimeStampFromCallbackId
ctime()
localtime()
findDaylight()

Referenced by GetDataTimeString().

◆ GetDieOnAddressInUse()

int GetDieOnAddressInUse ( void  )

Returns the current setting for this feature.

If TRUE a server will exit() if an 'address in use' message is delivered by the ENS upon registration.

Returns
the current setting for this feature
See also
SetDieOnAddressInUse()

◆ GetDieOnFecIsAlias()

int GetDieOnFecIsAlias ( void  )

Returns the current setting for this feature.

If TRUE a server will exit() if a 'FEC has an alias' message is delivered by the ENS upon registration.

Returns
the current setting for this feature
See also
SetDieOnFecIsAlias()

◆ GetDieOnSocketError()

int GetDieOnSocketError ( void  )

Returns the current setting for this feature.

If TRUE a server will exit() if there are continuous socket errors on important server sockets.

Returns
the current setting for this feature
See also
SetDieOnSocketError()

◆ GetFecHome()

char* GetFecHome ( void  )

Gets the current setting for the fec home database repository.

Returns
A string pointing to the current setting for the fec home database repository

◆ GetFeclogDepth()

int GetFeclogDepth ( void  )

Returns the maximum size of the server's log file in lines.

The server's log file, if located on the local disk, is a file called 'fec.log'. When it's length surpasses the FecLogDepth, this file is rotated to 'fec.bak' and a new 'fec.log' file is started. A call for the server's log file will always be able to scan both the 'fec.bak' file and 'fec.log', and will thus always be able to scan at least FeclogDepth entries.

The value of the log depth also determines the depth of any named log file (see srvlog()).

Returns
the current setting.

References FeclogDepth.

◆ GetFecLogPath()

char* GetFecLogPath ( void  )

Gets the current setting for the fec log repository.

Returns
A string pointing to the current setting for the fec log repository

◆ GetFormatSizeInBytesFromDataType()

int GetFormatSizeInBytesFromDataType ( DTYPE d)

Gives the size of bytes according to the DTYPE fields.

Parameters
dis a pointer to the DTYPE object whose size in bytes is desired
Returns
Size of bytes of the DTYPE object given.

References DTYPE::dArrayLength, DTYPE::dFormat, and DTYPE::dTag.

◆ GetLastContractId()

int GetLastContractId ( void  )

Returns the last contract identifier.

A server can retieve the last contract identifier at any time.

Note
A contract table identifier is a dynamic thing, to the extent that if a contract comes and goes (is not persistent) it can have a different ID when it comes again.
Returns
a valid contract ID or -1 if the contract table is empty.

◆ GetLastContractTableId()

int GetLastContractTableId ( void  )

Returns the last contract table identifier.

A server can retieve the last contract table identifier at any time. This routine is most usefull however when used within a server's equipment module.

Note
A contract table identifier is a dynamic thing, to the extent that if a contract comes and goes (is not persistent) it can have a different ID when it comes again.
Returns
a valid contract ID or -1 if the contract table is empty.

◆ GetPutCommandsInFeclog()

int GetPutCommandsInFeclog ( void  )

Returns the current setting for putCommandsInFeclog (which determines whether all in-coming WRITE access calls are automatically included in the server's log file)

Returns
the current setting for putCommandsInFeclog
See also
SetPutCommandsInFeclog

References putCommandsInFeclog.

◆ GetServerIdleState()

int GetServerIdleState ( char *  eqm)

Gets the server's idle state.

A Server can be set in an idle state where no background activity occurs and the server's equipment function is temporarily disabled. This call returns the current idle state of the equipment module specified.

Parameters
eqmis the local equipment module name (maximum 6 characters in length) For example: "BPMEQM".
Returns
the value of the idle state.
See also
SetServerIdleState()

◆ GetServerThreadPriority()

int GetServerThreadPriority ( void  )

Returns the priority of the server cycle thread as well as other associated server-side threads.

Returns
the server thread priority.
See also
SetServerThreadPriority().

◆ GetServerWaiting()

int GetServerWaiting ( void  )

Gets the server's waiting state.

A Server can be set in a wait state prior to initialization by passing a non-zero value as argument. In this state, the server will respond to all contract requests with the status code 'not_initialized'. This is useful, if the server needs to undergo a long initialization precedure before allowing clients access. The call retrieves the current wait state (0 = not waiting, non-zero = waiting). The server's wait state is, of course, FALSE (not waiting) by default.

Returns
the value of the wait state.
See also
SetServerWaiting()

◆ GetStreamTransportRetryLimit()

int GetStreamTransportRetryLimit ( void  )

Returns the stream transport retry limit.

When a server attempts to deliver data via a stream (TCP) connection to a client it attempts to find available TCP send buffers to deliver the data. This generally is successful upon the initial attempt but can fail due to network or buffering congestion. In such cases a delay of a clock tick and a retry will then succeed. The number of times these retries are allowed to happen are influenced by this parameter setting. The default value of '2' is generally correct, but under some conditions (one sluggish client) can impede transfer to other clients and in such cases it might be advisible to set this value to a lower value or even to '0' so as not to make all attached clients suffer.

Returns
the current setting for the stream transport retry limit (default = 2).
See also
SetStreamTransportRetryLimit().

◆ GetSystemErrorString()

char* GetSystemErrorString ( short  cc,
char *  errstr 
)

Gets the system error code in plain text.

This routine only returns the corresponding string for TINE system error codes. User defined error codes should use the routine GetLastLinkError().

Parameters
ccis the completion code or status code for which the internal system error string is desired.
errstris a string buffer capable of handling up to 32 characters.
Returns
a pointer to the string buffer 'errstr' given (unless NULL).
See also
GetLastLinkError()

◆ GetSystemLogging()

int GetSystemLogging ( void  )

Returns the current system logging setting (TRUE or FALSE)

See also
SetSystemLogging().

References nofeclog.

◆ GetSystemRequireAcknowledgments()

int GetSystemRequireAcknowledgments ( void  )

Gets the require acknowledgments flag to the value given.

A server normally requires an acknowledgment from clients being sent changed data if the client link is a data-change style monitor. Under some circumstances this extra acknowledgment network traffic might be unnecessary or undesireable. The current setting can be acquired with this function call.

Returns
the current setting for the require acknowledgments flag.
See also
SetSystemRequireAcknowledgments()

References gRequireAcknowledgments.

◆ GetSystemSchedulePropertyLazy()

int GetSystemSchedulePropertyLazy ( void  )

Gets the 'lazy' flag for scheduling properties.

When a property is scheduled, the delivery can either occur immedidately (default) and thereby invoke the TINE scheduler within the call to SystemScheduleProperty() or occur within the next normal delivery cycle (lazy), which could add a latency of up to a clock tick to the delivery. This call reads the 'lazy flag'.

Returns
the current setting of the schedule property 'lazy' flag.
See also
_SystemScheduleProperty(), _SystemSchedulePropertyEx(), SetSystemSchedulePropertyLazy()

◆ GetSystemUseDataProtection()

int GetSystemUseDataProtection ( void  )

Gets the data protection flag to the value given.

Multi-threaded servers using background tasks can ensure the thread safety of any data sets used in both an equipment module's background thread and dispatch function handler by explicit coding. As an alternative, calling this routine at initialization time with a non-zero value will automatically generate a data protection mutex which will prevent concurrent exectution of a module's background task and dispatch handler.

Returns
the current setting;

◆ GetSystemUserName()

char* GetSystemUserName ( void  )

Gets the current value for the application user.

Returns
A string pointing to the current value of the application user, typically the logged in user or, if the application is a FEC, the FEC name.

◆ GetTimeStampFromString()

double GetTimeStampFromString ( char *  ts)

Returns a TINE timestamp converted from the string argument given.

A call to getDataTimeStampAsTimeval() immediately following a call to ExecLink() or within a callback routine will yield the data timestamp of the call.

Parameters
tsis the string representation of a timestamp. 'NOW' returns the current system clock as a TINE timestamp. A UTC value passed as a string (with or without milliseconds) is converted to a double value and returned. Otherwise a string of the form 'mm.dd.yy hh:mm:ss.msec' is assumed.
Returns
A TINE timestamp (0 if the argument passed is NULL or a zero-length string).

◆ GetUseGlobalSynchronization()

int GetUseGlobalSynchronization ( void  )

Returns whether data timestamps are to be externally synchronized.

Returns
TRUE or FALSE
See also
SetUseGlobalSynchronization()

References useGlobalSynchronization.

◆ GetUseMultiThreadedBackgroundTasks()

int GetUseMultiThreadedBackgroundTasks ( void  )

Returns whether equipment module background tasks are to run in separate threads (boolean).

If set to TRUE, the server's background task will run in its own thread, where a multi-threaded build of the library is in use. Note that this could result in data concurrency issues if the background task is acquiring data which is to be used by an equipment module's equipment function.

Returns
the current setting of this feature.
See also
SetAllowBackgroundTaskReentrancy(), SetUseMultiThreadedBackgroundTasks().

◆ GetUseMultiThreadedEquipmentFunctions()

int GetUseMultiThreadedEquipmentFunctions ( void  )

Returns whether an equipment module equipment function can run in a separate threads (boolean).

If set to TRUE, the an equipment function will handle designated properties in a separate thread, where a multi-threaded build of the library is in use.
Ordinarily an equipment function should be regarded as an interrupt service routine which should return 'promptly' after being called. All properties will be directed to the equipment function using the same thread as the server cycle, unless otherwise specified. On the other hand if a property is specifically registered to run the equipment module in a separate thread (because the action is known to require significant time to complete) then it will run in its own thread if this setting has been enabled. This will result in other calls to the equipment function receiving an 'operation busy' completion while the equipment function is handling the time-consuming call. Otherwise, concurrent calls will simply time out at the client side. To configure a property to be called in a separate thread one can either call SetCallPropertyInSeparateThread() following the property registration of supply an "MT" switch in the properties 'access' string which registering via file (either exports.csv or fec.xml).

Returns
the current setting of this feature.
See also
SetUseMultiThreadedEquipmentFunctions(), SetUseMultiThreadedStockFunctions(), SetCallPropertyInSeparateThread().

◆ GetUseMultiThreadedStockFunctions()

int GetUseMultiThreadedStockFunctions ( void  )

Returns whether stock propery calls can run in a separate threads (boolean).

If set to TRUE, certain stock property calls will be handled in a separate thread, where a multi-threaded build of the library is in use.
Ordinarily stock property calls return 'promptly' after being called, and make use of the same thread as the server cycle, unless otherwise specified. On the other hand certain stock properties which make heavy use of the local disk might require considerable time to complete, noteably calls to the local history subsystem or file retrieval calls. A calls to such property will run in its own thread if this setting has been enabled. This will result in other calls to the same stock property receiving an 'operation busy' completion while the system is handling the time-consuming call. Otherwise, concurrent calls will simply time out at the client side.

Returns
the current setting of this feature.
See also
SetUseMultiThreadedStockFunctions().

◆ GetWorkAreaSize()

UINT32 GetWorkAreaSize ( void  )

Gets the server-side work area size which is coupled to the maximum transport size for supported by a single-threaded server.

Server-side equipment function calls are double buffered, one buffer being a dynamic allocation of the caller's requested data size, the other buffer being in the case of single threaded servers, a temporary use of the server's work area. In order to allow transfer of 'large' data sets, this size needs to be adjusted accordingly prior to server initialization. Note that multi-threaded servers will dynamically allocate both buffers on a call by call basis.

Returns
The current setting for the server's work area.

References MaxSystemTransportSize.

◆ IsServerRunning()

int IsServerRunning ( void  )

Returns TRUE (non zero) if the server kernel is fully initialized and ready.

Returns
0 if not running

References SystemRunning.

◆ LockEquipmentModules()

int LockEquipmentModules ( void  )

Locks all equipment modules.

Applying this call seizes a system mutex which will not allow the scheduler to cycle thru the equipment module dispatch routines. Consider setting the IDLE state of the module in lieu of locking and unlocking.

Returns
0 if successful, otherwise a TINE completion code
See also
UnlockEquipmentModules().

◆ MakeDataTimeStamp()

double MakeDataTimeStamp ( void  )

Returns a data timestamp according to the current system time.

Returns
A tine data timestamp.
See also
SetDataTimeStamp, PutDataTimeStamp, GetDataTimeStamp, MakeSystemDataStamp()

Referenced by sendNetGlobal().

◆ MakeSystemDataStamp()

int MakeSystemDataStamp ( void  )

Returns the current valid global system data stamp.

A server can set a global data stamp value (e.g. cycle id or run number, etc.) which will accompany all data transactions.

Parameters
valueis the integer value to use as the system data stamp.
Returns
void
See also
MakeDataTimeStamp()

◆ microsleep()

int microsleep ( int  usecs)

sleep for given number of micro-seconds

If the input is less than 4 micro-seconds the delay is a 'hard-spin' where the OS system clock is examined in a loop without yielding the time slice. If the input is greater than 4 but less than 50 micro-seconds the delay is a 'soft-spin' where the OS system clock is examined in a loop but yielding the thread's time slice at each pass through the loop. If the input is greater than 50 micro-seconds the delay invokes a nanosleep or equivalent which yields the thread until the delay time expires. Unless a real-time clock is used (e.g. VxWorks) the granularity of this latter technique is never better than 50 micro-seconds (often more like a clock tick).

Parameters
usecsthe desired number of micro-seconds to sleep
Returns
the number of micro seconds slept

◆ PutDataTimeStamp()

double PutDataTimeStamp ( double  toffset,
time_t  tsec,
int  tmsec 
)

Returns a data timestamp according to the input parameters given.

This call is has the same purpose as makeDataTimeStamp(), but can assign a TINE data timestamp according to the input seconds, milliseconds and system time offset. This call is used only under special circumstances.

Parameters
toffsetis the systematic time offset to be applied.
tsecis the data timestamp in seconds
tmsecis the millisecond part of the data timestamp
Returns
A tine data timestamp.
See also
SetDataTimeStamp, MakeDataTimeStamp, GetDataTimeStamp

◆ PutDataTimeStampU()

double PutDataTimeStampU ( double  toffset,
time_t  tsec,
int  tusec 
)

Returns a data timestamp according to the input parameters given.

This call is has the same purpose as makeDataTimeStamp(), but can assign a TINE data timestamp according to the input seconds, microseconds and system time offset. This call is used only under special circumstances.

Parameters
toffsetis the systematic time offset to be applied.
tsecis the data timestamp in seconds
tusecis the microsecond part of the data timestamp
Returns
A tine data timestamp.
See also
SetDataTimeStamp, MakeDataTimeStamp, GetDataTimeStamp

◆ ResetMultiChannelProperty()

int ResetMultiChannelProperty ( char *  eqm,
char *  prp 
)

sends (schedules) a 'reset_mca_property' signal to any listening client

A server with registered multi-channel array properties can inform any attached clients that the mutli-channel array configuration has changed (e.g. array elements have been added, removed, or otherwise edited) by using this call. Any listening clients with multi-channel array links will then return to the original client startup conditions and 're-learn' the new array indexing now in place.

Parameters
eqmis the local equipment module name (maximum 6 characters in length) For example: "BPMEQM".
prpis (comma separated) list of properties which are to be reset at the client side.
Note
This routine will call _SystemSchedulePropertyEx() to assure immediate notification at the client side.
Returns
0 upon success, otherwise a TINE return code.
See also
SetEnforceMcaAcquisition

References argument_list_error.

◆ SetBackgroundThreadPriority()

int SetBackgroundThreadPriority ( int  priority)

Determines the priority of any registered background threads.

The priority passed should be regarded as an offset to the 'normal' thread priorty for the operating system in use. That is, the TINE definition STD_THREAD_PRIORITY will be 'correct' for the target operating system (where a multi-threaded build of the library is in use). It is up to the developer to take the appropriate steps to ensure that this call in fact works as planned. For instance, using real-time priorities on Windows will require a call to the Windows function SetPriorityClass() using REALTIME_PRIORITY_CLASS prior to server initialization (otherwise the resulting thread priorities will not be as desired). Using any non-standard priorities on Unix will likely require running the application as root! VxWorks will take the initial task priority as a reference for the 'standard thread priority'.

Parameters
priorityis the desired thread priority (default STD_THREAD_PRIORITY).
Returns
the assigned background thread priority.
See also
GetBackgroundThreadPriority().

◆ SetBurstLimit()

int SetBurstLimit ( int  npackets)

Sets the burst limit in number of packets which are allowed to be set consecutively.

For UDP transport (the default) TINE does not make use of flow control in any systematic way, other than adjusting this parameter setting at the server side. This parameter works together with the cycle delay and determines how many UDP packets (datagrams) are allowed to be sent consecutively within the transport loop before a brake is applies (cycle delay). If all clients and servers are on the same speed ethernet, this value can be adjusted to a much larger value. However, a fast server sending to a slow client (a remote client via a DSL link for instance) might send more datagrams in a burst than can be received. The default value should compensate for this effect.

Parameters
npacketsis the number of packet allowed to be set consecutively for a given call (default: 1000).
Returns
The current setting for the burst limit.
See also
SetCycleDelay(), GetBurstLimit().

◆ SetCatchConsoleBreak()

void SetCatchConsoleBreak ( int  value)

Determines whether an application will catch an interrupt or break signal (such as control-C) and issue a graceful exit or not.

Parameters
valueis the desired setting (default = TRUE)
See also
GetCatchConsoleBreak()

◆ SetClientThreadPriority()

int SetClientThreadPriority ( int  priority)

Determines the priority of the client cycle thread as well as other associated client-side threads.

The priority passed should be regarded as an offset to the 'normal' thread priorty for the operating system in use. That is, the TINE definition STD_THREAD_PRIORITY will be 'correct' for the target operating system (where a multi-threaded build of the library is in use). It is up to the developer to take the appropriate steps to ensure that this call in fact works as planned. For instance, using real-time priorities on Windows will require a call to the Windows function SetPriorityClass() using REALTIME_PRIORITY_CLASS prior to server initialization (otherwise the resulting thread priorities will not be as desired). Using any non-standard priorities on Unix will likely require running the application as root! VxWorks will take the initial task priority as a reference for the 'standard thread priority'.

Parameters
priorityis the desired thread priority (default STD_THREAD_PRIORITY).
Returns
the assigned client thread priority.
See also
GetClientThreadPriority().

◆ SetCycleDelay()

int SetCycleDelay ( int  msecs)

Sets the delay time in milliseconds following a 'burst' of ethernet packets (as defined by SetBurstLimit().

For UDP transport (the default) TINE does not make use of flow control in any systematic way, other than adjusting this parameter setting at the server side. This parameter works together with the burst limit and determines how long to delay further datagram transmission when the burst limit has been reached. If all clients and servers are on the same speed ethernet, this value can be adjusted to 0. However, a fast server sending to a slow client (a remote client via a DSL link for instance) might send more datagrams in a burst than can be received. The default value should compensate for this effect.

Parameters
msecis the time in milliseconds to delay before sending further ethernet packets. (default: 20 msec).
Returns
The current setting for the cycle delay.
See also
SetBurstLimit().

◆ SetCycleMicroDelay()

int SetCycleMicroDelay ( int  usecs)

Sets the delay time in microseconds following a 'burst' of ethernet packets (as defined by SetBurstLimit().

For UDP transport (the default) TINE does not make use of flow control in any systematic way, other than adjusting this parameter setting at the server side. This parameter works together with the burst limit and determines how long to delay further datagram transmission when the burst limit has been reached. If all clients and servers are on the same speed ethernet, this value can be left at its default value 0. However, when fine adjustments in flow control are necessary, a delay in the micro second region following each 'burst' of packets can be applied, where the delay in microseconds is given by this setting.

Parameters
usecis the time in microseconds to delay before sending further ethernet packets. (default: 0 usec => use cycle delay in milliseconds).
Returns
The current setting for the cycle micro delay.
See also
SetCycleDelay(), SetBurstLimit().

◆ SetDataTimeStamp()

void SetDataTimeStamp ( double  ts)

Sets the intrinsic data timestamp to the value given.

This call is typically used inside an equipment function to set the data timestamp associated with the request being made. For instance, when the data are taken from the hardware IO loop, a call to makeDataTimeStamp() is made to get the current system timestamp. Then when a request for data is made the caller can know the precise time of data acquisition. If this routine is not called, then the current system time will be used to stamp the data.

Parameters
tsis the timestamp to be associated with the next data set.
See also
PutDataTimeStamp, MakeDataTimeStamp

◆ SetDieAnotherDay()

void SetDieAnotherDay ( int  value)

Revokes an 'exit' due to a 'die on' condition.

Parameters
valueis the desired setting.
Note
: the default (FALSE) is restablished following a call to SetDieAnotherDay

◆ SetDieFunction()

void SetDieFunction ( DIEFCNP  fcn)

Sets a dispatch routine to call if and when the FEC process dies due to e.g. 'address in use'.

◆ SetDieOnAddressInUse()

void SetDieOnAddressInUse ( int  value)

Determines whether a server will exit() if an 'address in use' message is delivered by the ENS upon registration.

Parameters
valueis the desired setting (default = TRUE)
See also
GetDieOnAddressInUse()

◆ SetDieOnFecIsAlias()

void SetDieOnFecIsAlias ( int  value)

Determines whether a server will exit() if a 'FEC has an alias' message is delivered by the ENS upon registration.

Parameters
valueis the desired setting (default = FALSE)
See also
GetDieOnFecIsAlias()

◆ SetDieOnSocketError()

void SetDieOnSocketError ( int  value)

Determines whether a server will exit() if there are continuous socket errors on important server sockets.

Parameters
valueis the desired setting (default = TRUE)
See also
GetDieOnSocketError()

◆ SetFecHome()

int SetFecHome ( char *  fecHomePath)

Sets the current fec home database repository.

Returns
A string pointing to the current setting for the fec home database repository
Note
If the server has already been initialized, this function will return an error.
Returns
0 upon success or a TINE error code.

◆ SetFeclogDepth()

void SetFeclogDepth ( int  value)

Determines the approximate size of the server's log file in lines.

The server's log file, if located on the local disk, is a file called 'fec.log'. When it's length surpasses the FecLogDepth, this file is rotated to 'fec.bak' and a new 'fec.log' file is started. A call for the server's log file will always be able to scan both the 'fec.bak' file and 'fec.log', and will thus always be able to scan at least FeclogDepth entries. The log file depth is controlled via this API call.

Parameters
valueis the desired log depth in lines of fec.log. Default: 100. Minimum: 100.

References feclog(), and FeclogDepth.

◆ SetFecLogPath()

int SetFecLogPath ( char *  path)

Sets the fec log repository.

Parameters
pathis the desired path for the fec.log file
Returns
0 upon success or 'string_too_long'

◆ SetKernelPriority()

int SetKernelPriority ( int  priority)

Determines the priority of TINE kernel threads.

Use this routine to set the priority of all TINE kernel threads (server-side, client-side, background tasks) to the desired value. This is primarily a convenience routine and is equivalent to calling SetServerThreadPriority(), SetClientThreadPriority() and SetBackgroundThreadPriority() individually.

Parameters
priorityis the desired thread priority (default STD_THREAD_PRIORITY).
Returns
the assigned thread priority.
See also
SetServerThreadPriority(), SetClientThreadPriority(), SetBackgroundThreadPriority()

References not_accepted.

◆ SetPostSystemInitFunction()

void SetPostSystemInitFunction ( SYSTSKP  fcn)

Sets a user-specific initialization routine to be executed following server initialization.

Parameters
fcnis the function to be called following system initialization. (prototype void fcn(void)). Typically one places registration calls such as RegisterEquipmentModule(), etc. in such a routine.
See also
SetPreSystemInitFunction()

◆ SetPreSystemInitFunction()

void SetPreSystemInitFunction ( SYSTSKP  fcn)

Sets a user-specific initialization routine to be executed prior to server initialization.

Parameters
fcnis the function to be called prior to system initialization. (prototype void fcn(void)). Typically one places parameter settings which differ from the default values in such a routine, so that they have an effect on the server initialization. Likewise, calls such as RegisterFecInformation() should be made in such a routine.
See also
SetPostSystemInitFunction()

◆ SetPutCommandsInFeclog()

void SetPutCommandsInFeclog ( int  value)

Determines whether all in-coming WRITE access calls are automatically included in the server's log file.

Parameters
valueis the desired setting (default = TRUE).
Note
This is an exported routine which simply sets the global variable putCommandsInFeclog
See also
GetPutCommandsInFeclog

References putCommandsInFeclog.

◆ SetServerIdleState()

void SetServerIdleState ( char *  eqm,
int  value 
)

Sets the server's idle state to the value given.

A Server can be set in an idle state where no background activity occurs and the server's equipment function is temporarily disabled. Calls to the equipment function will receive the status code 'server_idle' if this is the case.

Parameters
eqmis the local equipment module name (maximum 6 characters in length) For example: "BPMEQM".
valueis the value of the idle state. Any non-zero sets the idle state to TRUE. A zero value sets the idle state to FALSE.
Note
This call targets a specific equipment module and hence only applies to the specified server module.
See also
GetServerIdleState()

◆ SetServerThreadPriority()

int SetServerThreadPriority ( int  priority)

Determines the priority of the server cycle thread as well as other associated server-side threads.

The priority passed should be regarded as an offset to the 'normal' thread priorty for the operating system in use. That is, the TINE definition STD_THREAD_PRIORITY will be 'correct' for the target operating system (where a multi-threaded build of the library is in use). It is up to the developer to take the appropriate steps to ensure that this call in fact works as planned. For instance, using real-time priorities on Windows will require a call to the Windows function SetPriorityClass() using REALTIME_PRIORITY_CLASS prior to server initialization (otherwise the resulting thread priorities will not be as desired). Using any non-standard priorities on Unix will likely require running the application as root! VxWorks will take the initial task priority as a reference for the 'standard thread priority'.

Parameters
priorityis the desired thread priority (default STD_THREAD_PRIORITY).
Returns
the assigned server thread priority.
See also
GetServerThreadPriority().

◆ SetServerWaiting()

void SetServerWaiting ( int  value)

Sets the server's waiting state to the value given.

A Server can be set in a wait state prior to initialization by passing a non-zero value as argument. In this state, the server will respond to all contract requests with the status code 'not_initialized'. This is useful, if the server needs to undergo a long initialization precedure before allowing clients access. Setting the wait state to TRUE before stating the server's cycle() and then later to FALSE when all properties and equipment modules are ready is a safe way to prevent premature access. The server's wait state is, of course, FALSE (not waiting) by default.

Parameters
valueis the value of the wait state.
Note
This call does not target a specific equipment module and hence applies to all registered equipment modules on the FEC.
See also
GetServerWaiting()

◆ SetStreamTransportRetryLimit()

void SetStreamTransportRetryLimit ( int  value)

Sets the stream transport retry limit.

When a server attempts to deliver data via a stream (TCP) connection to a client it attempts to find available TCP send buffers to deliver the data. This generally is successful upon the initial attempt but can fail due to network or buffering congestion. In such cases a delay of a clock tick and a retry will then succeed. The number of times these retries are allowed to happen are influenced by this parameter setting. The default value of '2' is generally correct, but under some conditions (one sluggish client) can impede transfer to other clients and in such cases it might be advisible to set this value to a lower value or even to '0' so as not to make all attached clients suffer. This value setting can be established by making use of this call.

See also
GetStreamTransportRetryLimit().

◆ SetSystemCleanupFunction()

void SetSystemCleanupFunction ( SYSTSKP  fcn)

Sets a user-specific cleanup routine to be executed as a final step during a normal cleanup phase (e.g. typing 'quit' or 'exit' at the command prompt.

Parameters
fcnis the cleanup function to be called (prototype void fcn(void)).

◆ SetSystemDataStamp()

void SetSystemDataStamp ( int  value)

Sets the global system data stamp with which to tag outbound data sets.

A server can set a global data stamp value (e.g. cycle id or run number, etc.) which will accompany all data transactions.

Parameters
valueis the integer value to use as the system data stamp.
Returns
void
See also
SetDataTimeStamp

◆ SetSystemLogging()

void SetSystemLogging ( int  value)

Sets system logging (output to fec.log) to TRUE or FALSE.

Parameters
valueshould be TRUE (non zero) if logging is desired (DEFAULT) or FALSE if not.

References nofeclog.

◆ SetSystemRequireAcknowledgments()

void SetSystemRequireAcknowledgments ( int  value)

Sets the require acknowledgments flag to the value given.

A server normally requires an acknowledgment from clients being sent changed data if the client link is a data-change style monitor. Under some circumstances this extra acknowledgment network traffic might be unnecessary or undesireable and can be disabled with the function call.

Parameters
valueis the desired setting (default = TRUE).
See also
GetSystemRequireAcknowledgments()

References gRequireAcknowledgments.

◆ SetSystemSchedulePropertyLazy()

void SetSystemSchedulePropertyLazy ( int  value)

Sets the 'lazy' flag for scheduling properties.

When a property is scheduled, the delivery can either occur immedidately (default) and thereby invoke the TINE scheduler within the call to SystemScheduleProperty() or occur within the next normal delivery cycle (lazy), which could add a latency of up to a clock tick to the delivery. This call sets the 'lazy' flag deteriming this behavior.

Parameters
valuewill be interpreted in a boolean manner. If TRUE (non-zero) then calls to SystemScheduleProperty() will mark the associated properties for scheduling, which will duly occur during the next call to the scheduler (usually within a clock tick) by the TINE kernel. If FALSE (default) then scheduled properties will immediately invoke the TINE scheduler.
See also
_SystemScheduleProperty(), _SystemSchedulePropertyEx(), GetSystemSchedulePropertyLazy()

◆ SetSystemUseDataProtection()

void SetSystemUseDataProtection ( int  value)

Sets the data protection flag to the value given.

Multi-threaded servers using background tasks can ensure the thread safety of any data sets used in both an equipment module's background thread and dispatch function handler by explicit coding. As an alternative, calling this routine at initialization time with a non-zero value will automatically generate a data protection mutex which will prevent concurrent exectution of a module's background task and dispatch handler.

Parameters
valueis the desired setting (default = FALSE).

◆ SetSystemUserName()

int SetSystemUserName ( char *  usr)

Sets the current value for the application user.

Parameters
usrThe desired appliation's user name.
Returns
0 if successful, otherwise a TINE return code.

References argument_list_error.

◆ SetUseGlobalSynchronization()

void SetUseGlobalSynchronization ( int  value)

Determines whether data timestamps are to be externally synchronized.

Parameters
valueIf set to TRUE, data timestamps will be synchronized to an externally supplied timestamp. This requires a TINE Time Server to be in operation and sending timestamps at regular intervals either as multicast or as broadcast (default TRUE);
See also
GetUseGlobalSynchronization()

◆ SetUseMultiThreadedBackgroundTasks()

void SetUseMultiThreadedBackgroundTasks ( int  value)

Determines whether equipment module background tasks are to run in separate threads (boolean).

If set to TRUE, the server's background task will run in its own thread, where a multi-threaded build of the library is in use. Note that this could result in data concurrency issues if the background task is acquiring data which is to be used by an equipment module's equipment function.

Parameters
valueshould be non-zero (TRUE) to turn this feature on or FALSE to turn it off. TRUE is the default.
See also
SetAllowBackgroundTaskReentrancy(), GetUseMultiThreadedBackgroundTasks().

◆ SetUseMultiThreadedEquipmentFunctions()

void SetUseMultiThreadedEquipmentFunctions ( int  value)

Determines whether an equipment module equipment function can run in a separate threads (boolean).

If set to TRUE, the an equipment function will handle designated properties in a separate thread, where a multi-threaded build of the library is in use.
Ordinarily an equipment function should be regarded as an interrupt service routine which should return 'promptly' after being called. All properties will be directed to the equipment function using the same thread as the server cycle, unless otherwise specified. On the other hand if a property is specifically registered to run the equipment module in a separate thread (because the action is known to require significant time to complete) then it will run in its own thread if this setting has been enabled. This will result in other calls to the equipment function receiving an 'operation busy' completion while the equipment function is handling the time-consuming call. Otherwise, concurrent calls will simply time out at the client side. To configure a property to be called in a separate thread one can either call SetCallPropertyInSeparateThread() following the property registration of supply an "MT" switch in the properties 'access' string which registering via file (either exports.csv or fec.xml).

Parameters
valueshould be non-zero (TRUE) to turn this feature on or FALSE to turn it off.
FALSE is the default.
See also
GetUseMultiThreadedEquipmentFunctions(), SetUseMultiThreadedStockFunctions(), SetCallPropertyInSeparateThread().

◆ SetUseMultiThreadedStockFunctions()

void SetUseMultiThreadedStockFunctions ( int  value)

Determines whether stock propery calls can run in a separate threads (boolean).

If set to TRUE, certain stock property calls will be handled in a separate thread, where a multi-threaded build of the library is in use.
Ordinarily stock property calls return 'promptly' after being called, and make use of the same thread as the server cycle, unless otherwise specified. On the other hand certain stock properties which make heavy use of the local disk might require considerable time to complete, noteably calls to the local history subsystem or file retrieval calls. A calls to such property will run in its own thread if this setting has been enabled. This will result in other calls to the same stock property receiving an 'operation busy' completion while the system is handling the time-consuming call. Otherwise, concurrent calls will simply time out at the client side.

Parameters
valueshould be non-zero (TRUE) to turn this feature on or FALSE to turn it off.
TRUE is the default.
See also
GetUseMultiThreadedStockFunctions().

◆ SetWorkAreaSize()

UINT32 SetWorkAreaSize ( UINT32  size)

Sets the server-side work area size which is coupled to the maximum transport size for supported by a single-threaded server.

Server-side equipment function calls are double buffered, one buffer being a dynamic allocation of the caller's requested data size, the other buffer being in the case of single threaded servers, a temporary use of the server's work area. In order to allow transfer of 'large' data sets, this size needs to be adjusted accordingly prior to server initialization. Note that multi-threaded servers will dynamically allocate both buffers on a call by call basis.

Parameters
sizeis the size in bytes to be reserved for the server's work area and hence the maximum allowed transport size for any property supported by the server. (default: 64 KBytes on most operating systems).
Returns
The current setting for the server's work area.

◆ srvlog()

int srvlog ( char *  filename,
char *  tag,
char *  text,
  ... 
)

Puts entries into a named log file.

Servers can write log entries to any log file of their choosing by making use of this call. All entries will be pre-pended with a time stamp and the given tag and appended with a new-line character.

Parameters
filenameis the desired file name. If this name does not specify a full path then the FEC_HOME location determines the location of the log file. Likewise, if the filename does not specify an extension, the extension ".log" will be automatically appended.
tagis an optional tag to be applied to each log entry, following the timestamp. This can be used to specify the routine or process supplying the log information, for example. If not specified, the tag "Logger" will be used.
textis the text string (up to 200 characters) to be logged.
Returns
0 if successful, otherwise a TINE error code.
See also
feclog()
GetCompletionStatus()
gFeclogPath
vfeclog()
SetFeclogDepth()

◆ SystemVersion()

BYTE* SystemVersion ( void  )

Returns the system version as a 4-byte array containg the major and minor version numbers as the first two bytes and the current revision in the next two bytes.

Returns
The tine version in use.

Example:

BYTE *ver = SystemVersion();
//...
printf("Current version is %d.%02d.%04d\n",ver[0],ver[1],ver[2]*256 + ver[3]);
//...

Referenced by GetSystemVersionString().

◆ UnlockEquipmentModules()

int UnlockEquipmentModules ( void  )

Unlocks all equipment modules.

If the equipment modules were locked by applying a call to LockEquipmentModules() then this call frees the lock state, allowing equipment module dispatch routines and background tasks to continue. Consider setting the IDLE state of the module in lieu of locking and unlocking.

Returns
0 if successful, otherwise a TINE completion code
See also
LockEquipmentModules().

Variable Documentation

◆ FeclogDepth

int FeclogDepth = FECLOG_DEPTH

Determines the approximate size of the server's log file in lines.

The server's log file, if located on the local disk, is a file called 'fec.log'. When it's length surpasses the FecLogDepth, this file is moved to 'fec.bak' and a new 'fec.log' file is started. A call for the server's log file will always be able to scan both the 'fec.bak' file and 'fec.log', and will thus always be able to scan at least FeclogDepth entries.

Default: 100

Referenced by GetFeclogDepth(), and SetFeclogDepth().

◆ gErrorLogLevel

int gErrorLogLevel = TINE_LOGLEVEL_WARN

Determines which messages are written to error.log file.

by default it is set to TINE_LOGLEVEL_WARN, so WARN, ERROR and FATAL are written to error.log

See also
feclogEx()

◆ gStartupDebug

int gStartupDebug = 1

Determines whether server initialization messages are displayed or not.

A running server is quiet regarding information displayed on the standard output. An initializing server is however by default not quiet, and will echo various steps of the initialization process on the screen, including whether of not optional configuration files are found or not, etc. This information can be surpressed by setting gStartupDebug to FALSE prior to calling SystemInit().

Note
Critical errors will be displayed on the screen in all circumstances.
Macro definition StartupDebug to provide compatibility with pre-refactoring usage

Default: TRUE

◆ nofeclog

int nofeclog = FALSE

Determines whether a server is to keep a log file on the local disk.

The location of the log file is determined by the FECDB environment variable or, if not set, the current working directory is used. If set to TRUE, then no log file will be maintained on the local disk. A log file will nonetheless be maintained in a local ring-buffer, with the caveat that all entries will disappear upon server restart. To eliminate the log file entirely, 'nofeclog' should be set to TRUE and 'FeclogDepth' should be set to 0.

Default: FALSE for most operating systems. Exceptions: VxWorks, NIOS.

Referenced by GetSystemLogging(), and SetSystemLogging().

◆ putCommandsInFeclog

int putCommandsInFeclog = INCLUDE_IN_LOGFILE

Determines whether all in-coming WRITE access calls are automatically included in the server's log file.

Default: TRUE

Referenced by GetPutCommandsInFeclog(), and SetPutCommandsInFeclog().

◆ useGlobalSynchronization

int useGlobalSynchronization = GLOBAL_SYNCHRONIZATION

Determines whether data timestamps are to be externally synchronized.

If set to TRUE, data timestamps will be synchronized to an externally supplied timestamp. This requires a TINE Time Server to be in operation and sending timestamps at regular intervals either as multicast or as broadcast.

Default: TRUE

Referenced by GetUseGlobalSynchronization().

GetLastLinkError
char * GetLastLinkError(short cc, char *errstr)
The error string associated with the input error number.
Definition: client.c:9974
SystemVersion
BYTE * SystemVersion(void)
Returns the system version as a 4-byte array containg the major and minor version numbers as the firs...
Definition: System API Calls:6320

Impressum   |   Imprint   |   Datenschutzerklaerung   |   Data Privacy Policy   |   Declaration of Accessibility   |   Erklaerung zur Barrierefreiheit
Generated for TINE API by  doxygen 1.5.8