libtase2  2.4.0
TASE.2/ICCP Protocol Source Code Library for C/C++
Loading...
Searching...
No Matches
tase2_common.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include "tase2_api_exports.h"
#include "tase2_endpoint.h"
#include "linked_list.h"

Go to the source code of this file.

Data Structures

struct  Tase2_Statistics
 Some stack statistics. More...
 
struct  Tase2_PointName
 

Macros

#define TASE2_COMMAND_TRIP   0
 
#define TASE2_COMMAND_CLOSE   1
 
#define TASE2_COMMAND_OPEN   0
 
#define TASE2_COMMAND_OFF   0
 
#define TASE2_COMMAND_ON   1
 
#define TASE2_COMMAND_LOWER   0
 
#define TASE2_COMMAND_RAISE   1
 
#define TASE2_SUPPORTED_FB_1   1
 
#define TASE2_SUPPORTED_FB_2   2
 
#define TASE2_SUPPORTED_FB_3   4
 
#define TASE2_SUPPORTED_FB_4   8
 
#define TASE2_SUPPORTED_FB_5   16
 
#define TASE2_DS_CONDITION_INTERVAL   1
 
#define TASE2_DS_CONDITION_INTEGRITY   2
 
#define TASE2_DS_CONDITION_CHANGE   4
 
#define TASE2_DS_CONDITION_OPERATOR_REQUESTED   8
 
#define TASE2_DS_CONDITION_EXTERNAL_EVENT   16
 
#define TASE2_DATA_FLAGS_UNUSED_0   1
 
#define TASE2_DATA_FLAGS_UNUSED_1   2
 
#define TASE2_DATA_FLAGS_VALIDITY_HI   4
 
#define TASE2_DATA_FLAGS_VALIDITY_LO   8
 
#define TASE2_DATA_FLAGS_CURRENT_SOURCE_HI   16
 
#define TASE2_DATA_FLAGS_CURRENT_SOURCE_LO   32
 
#define TASE2_DATA_FLAGS_NORMAL_VALUE   64
 
#define TASE2_DATA_FLAGS_TIME_STAMP_QUALITY   128
 
#define TASE2_DATA_STATE_HI   1
 
#define TASE2_DATA_STATE_LO   2
 
#define TASE2_DATA_STATE_VALIDITY_HI   4
 
#define TASE2_DATA_STATE_VALIDITY_LO   8
 
#define TASE2_DATA_STATE_CURRENT_SOURCE_HI   16
 
#define TASE2_DATA_STATE_CURRENT_SOURCE_LO   32
 
#define TASE2_DATA_STATE_NORMAL_VALUE   64
 
#define TASE2_DATA_STATE_TIME_STAMP_QUALITY   128
 
#define TASE2_DATA_STATE_BETWEEN   0
 
#define TASE2_DATA_STATE_TRIPPED   2
 
#define TASE2_DATA_STATE_OFF   2
 
#define TASE2_DATA_STATE_CLOSED   1
 
#define TASE2_DATA_STATE_ON   1
 
#define TASE2_DATA_STATE_INVALID   3
 
#define TASE2_DATA_FLAGS_VALIDITY_VALID   0
 
#define TASE2_DATA_FLAGS_VALIDITY_HELD   8
 
#define TASE2_DATA_FLAGS_VALIDITY_SUSPECT   4
 
#define TASE2_DATA_FLAGS_VALIDITY_NOTVALID   12
 
#define TASE2_DATA_FLAGS_CURRENT_SOURCE_TELEMETERED   0
 
#define TASE2_DATA_FLAGS_CURRENT_SOURCE_CALCULATED   32
 
#define TASE2_DATA_FLAGS_CURRENT_SOURCE_ENTERED   16
 
#define TASE2_DATA_FLAGS_CURRENT_SOURCE_ESTIMATED   48
 
#define TASE2_DATA_SUPPL_STATE_HI   1
 
#define TASE2_DATA_SUPPL_STATE_LO   2
 
#define TASE2_DATA_SUPPL_STATE_TAG_HI   4
 
#define TASE2_DATA_SUPPL_STATE_TAG_LO   8
 
#define TASE2_DATA_SUPPL_STATE_EXPECTED_HI   16
 
#define TASE2_DATA_SUPPL_STATE_EXPECTED_LO   32
 
#define TASE2_SINGLE_FLAGS_ELAPSED_TIME_VALIDITY   1
 
#define TASE2_SINGLE_FLAGS_BLOCKED   2
 
#define TASE2_SINGLE_FLAGS_SUBSTITUTED   4
 
#define TASE2_SINGLE_FLAGS_TOPICAL   8
 
#define TASE2_SINGLE_FLAGS_EVENT_VALIDITY   16
 
#define TASE2_SINGLE_FLAGS_UNUSED   32
 
#define TASE2_SINGLE_FLAGS_EVENT_STATE_HI   64
 
#define TASE2_SINGLE_FLAGS_EVENT_STATE_LO   128
 
#define TASE2_EVENT_FLAGS_GENERAL   1
 
#define TASE2_EVENT_FLAGS_PHASE_1   2
 
#define TASE2_EVENT_FLAGS_PHASE_2   4
 
#define TASE2_EVENT_FLAGS_PHASE_3   8
 
#define TASE2_EVENT_FLAGS_EARTH   16
 
#define TASE2_EVENT_FLAGS_REVERSE   32
 
#define TASE2_PACKED_FLAGS_ELAPSED_TIME_VALIDITY   1
 
#define TASE2_PACKED_FLAGS_BLOCKED   2
 
#define TASE2_PACKED_FLAGS_SUBSTITUTED   4
 
#define TASE2_PACKED_FLAGS_TOPICAL   8
 
#define TASE2_PACKED_FLAGS_EVENT_VALIDITY   16
 

Typedefs

typedef void(* Tase2_Log_Function) (int logLevel, const char *message)
 User provided log message handler (optional)
 
typedef void(* Tase2_Log_FunctionEx) (Tase2_LogLevel logLevel, Tase2_LogSource source, Tase2_Endpoint endpoint, Tase2_Endpoint_Connection peer, const char *message)
 
typedef struct sTase2_PointValue * Tase2_PointValue
 A TASE.2 point value with type information.
 
typedef uint8_t Tase2_DataFlags
 
typedef uint8_t Tase2_DataState
 
typedef uint8_t Tase2_DataStateSupplemental
 
typedef uint8_t Tase2_SingleEventFlags
 
typedef uint8_t Tase2_EventFlags
 
typedef uint8_t Tase2_PackedEventFlags
 

Enumerations

enum  Tase2_LogLevel {
  TASE2_LOG_DEBUG = 1 , TASE2_LOG_INFO = 2 , TASE2_LOG_WARNING = 3 , TASE2_LOG_ERROR = 4 ,
  TASE2_LOG_NONE = 5
}
 Specify the log level for the library internal logging. More...
 
enum  Tase2_LogSource {
  TASE2_LOG_SOURCE_ICCP = 1 , TASE2_LOG_SOURCE_MMS = 2 , TASE2_LOG_SOURCE_TCP = 3 , TASE2_LOG_SOURCE_TLS = 4 ,
  TASE2_LOG_SOURCE_ISO_LAYERS = 5
}
 
enum  Tase2_IndicationPointType { TASE2_IND_POINT_TYPE_REAL = 0 , TASE2_IND_POINT_TYPE_STATE , TASE2_IND_POINT_TYPE_DISCRETE , TASE2_IND_POINT_TYPE_STATE_SUPPLEMENTAL }
 
enum  Tase2_QualityClass { TASE2_NO_QUALITY = 0 , TASE2_QUALITY }
 
enum  Tase2_TimeStampClass { TASE2_NO_TIMESTAMP = 0 , TASE2_TIMESTAMP , TASE2_TIMESTAMP_EXTENDED }
 
enum  Tase2_ClientError {
  TASE2_CLIENT_ERROR_OK = 0 , TASE2_CLIENT_ERROR_FAILED , TASE2_CLIENT_ERROR_TIMEOUT , TASE2_CLIENT_ERROR_ACCESS_DENIED ,
  TASE2_CLIENT_ERROR_TEMPORARILY_UNAVAILABLE , TASE2_CLIENT_ERROR_INVALID_ARGUMENT , TASE2_CLIENT_ERROR_INVALID_RETURN_VALUE , TASE2_CLIENT_ERROR_OTHER ,
  TASE2_CLIENT_ERROR_OBJECT_NOT_EXISTING , TASE2_CLIENT_ERROR_OBJECT_EXISTS
}
 Client side error code. More...
 
enum  Tase2_TagValue { TASE2_TAG_NO_TAG = 0 , TASE2_TAG_OPEN_AND_CLOSE_INHIBIT = 1 , TASE2_TAG_CLOSE_ONLY_INHIBIT = 2 , TASE2_TAG_INVALID = 3 }
 
enum  Tase2_ReportReason {
  TASE2_REPORT_REASON_INTERVAL_TIMEOUT = 1 , TASE2_REPORT_REASON_INTEGRITY_TIMEOUT = 2 , TASE2_REPORT_REASON_OBJECT_CHANGE = 4 , TASE2_REPORT_REASON_OPERATOR_REQUESTED = 8 ,
  TASE2_REPORT_REASON_OTHER_EXTERNAL_EVENT = 16
}
 
enum  Tase2_PointValueType {
  TASE2_VALUE_TYPE_STATE = 0 , TASE2_VALUE_TYPE_STATE_SUPPLEMENTAL , TASE2_VALUE_TYPE_DISCRETE , TASE2_VALUE_TYPE_REAL ,
  TASE2_VALUE_TYPE_SINGLE_EVENT , TASE2_VALUE_TYPE_PACKED_EVENT , TASE2_VALUE_TYPE_ERROR = 99 , TASE2_VALUE_TYPE_UNKNOWN = 100 ,
  TASE2_VALUE_TYPE_STATE_OR_STATE_SUPPLEMENTAL = 101 , TASE2_VALUE_TYPE_STATE_OR_DISCRETE = 102
}
 
enum  Tase2_PointValueError { TASE2_POINT_VALUE_ERROR_OK = 0 , TASE2_POINT_VALUE_ERROR_WRONG_TYPE = 1 }
 

Functions

TASE2_API void Tase2_Library_setLogLevel (Tase2_LogLevel level)
 Set the library log level.
 
TASE2_API void Tase2_Library_setLogFunction (Tase2_Log_Function logFunction)
 Set a user provided log message handler.
 
TASE2_API void Tase2_Library_setLogFunctionEx (Tase2_Log_FunctionEx logFunction)
 
TASE2_API const char * Tase2_Library_getVersionString ()
 Get the version string of the library (e.g. "1.2.3")
 
TASE2_API int Tase2_Library_getMajorVersion ()
 Get the major version of the library.
 
TASE2_API int Tase2_Library_getMinorVersion ()
 Get the minor version of the library.
 
TASE2_API int Tase2_Library_getPatchVersion ()
 Get the patch version of the library.
 
TASE2_API Tase2_PointValueType Tase2_PointValue_getType (Tase2_PointValue self)
 Get the (estimated) type of the point value.
 
TASE2_API Tase2_ClientError Tase2_PointValue_getError (Tase2_PointValue self)
 Get the error code (when point value type is TASE2_VALUE_TYPE_ERROR)
 
TASE2_API void Tase2_PointValue_setType (Tase2_PointValue self, Tase2_PointValueType type)
 Set the type of a point value.
 
TASE2_API void Tase2_PointValue_destroy (Tase2_PointValue self)
 Release all resource related to the point value instance.
 
TASE2_API Tase2_PointValue Tase2_PointValue_getCopy (Tase2_PointValue self)
 Create a copy (clone) of the PointValue instances.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createReal (float value)
 Create a new PointValue instance of type "real".
 
TASE2_API Tase2_PointValue Tase2_PointValue_createDiscrete (int32_t value)
 Create a new PointValue instance of type "discrete".
 
TASE2_API Tase2_PointValue Tase2_PointValue_createState (Tase2_DataState value)
 Create a new PointValue instance of type "state".
 
TASE2_API Tase2_PointValue Tase2_PointValue_createStateSupplemental (Tase2_DataStateSupplemental value)
 Create a new PointValue instance of type "state-supplemental".
 
TASE2_API Tase2_PointValue Tase2_PointValue_createRealQ (float value, Tase2_DataFlags flags)
 Create a new point value instance of Type RealQ.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createDiscreteQ (int32_t value, Tase2_DataFlags flags)
 Create a new point value instance of Type DiscreteQ.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createStateQ (Tase2_DataState value, Tase2_DataFlags flags)
 Create a new PointValue instance of type StateQ.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createStateSupplementalQ (Tase2_DataStateSupplemental value, Tase2_DataFlags flags)
 Create a new PointValue instance of type StateSupplementalQ.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createRealQTimeTag (float value, Tase2_DataFlags flags, int32_t timeTag)
 Create a new point value instance of Type RealQTimeTag.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createStateQTimeTag (Tase2_DataFlags valueAndFlags, int32_t timeTag)
 Create a new point value instance of Type StateQTimeTag.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createDiscreteQTimeTag (int32_t value, Tase2_DataFlags flags, int32_t timeTag)
 Create a new point value instance of Type DiscreteQTimeTag.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createStateSupplementalQTimeTag (Tase2_DataStateSupplemental value, Tase2_DataFlags flags, int32_t timeTag)
 Create a new PointValue instance of type StateSupplementalQTimeTag.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createRealExtended (float value, Tase2_DataFlags flags, int32_t timeTag, uint16_t cov)
 Create a new point value instance of Type RealExtended.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createStateExtended (Tase2_DataFlags valueAndFlags, int32_t timeTag, uint16_t cov)
 Create a new point value instance of Type StateExtended.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createDiscreteExtended (int32_t value, Tase2_DataFlags flags, int32_t timeTag, uint16_t cov)
 Create a new point value instance of Type DiscreteExtended.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createStateSupplementalExtended (Tase2_DataStateSupplemental value, Tase2_DataFlags flags, int32_t timeTag, uint16_t cov)
 Create a new PointValue instance of type StateSupplementalExtended.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createRealQTimeTagExtended (float value, Tase2_DataFlags flags, uint64_t timeTagExtended)
 Create a new point value instance of Type RealQTimeTagExtended.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createStateQTimeTagExtended (Tase2_DataFlags valueAndFlags, uint64_t timeTagExtended)
 Create a new point value instance of Type StateQTimeTagExtended.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createDiscreteQTimeTagExtended (int32_t value, Tase2_DataFlags flags, uint64_t timeTagExtended)
 Create a new point value instance of Type DiscreteQTimeTagExtended.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createStateSupplementalQTimeTagExtended (Tase2_DataStateSupplemental value, Tase2_DataFlags flags, uint64_t timeTagExtended)
 Create a new PointValue instance of type StateSupplementalQTimeTagExtended.
 
TASE2_API float Tase2_PointValue_getValueReal (Tase2_PointValue self)
 Get the real value.
 
TASE2_API float Tase2_PointValue_getValueRealEx (Tase2_PointValue self, Tase2_PointValueError *err)
 Get the real value.
 
TASE2_API void Tase2_PointValue_setValueReal (Tase2_PointValue self, float value)
 Set the real value.
 
TASE2_API Tase2_PointValueError Tase2_PointValue_setValueRealEx (Tase2_PointValue self, float value)
 Set the real value.
 
TASE2_API int32_t Tase2_PointValue_getValueDiscrete (Tase2_PointValue self)
 Get the value of an indication point of type DISCRETE.
 
TASE2_API int32_t Tase2_PointValue_getValueDiscreteEx (Tase2_PointValue self, Tase2_PointValueError *err)
 Get the value of an indication point of type DISCRETE.
 
TASE2_API void Tase2_PointValue_setValueDiscrete (Tase2_PointValue self, int32_t value)
 Set the value of an indication point of type DISCRETE.
 
TASE2_API Tase2_PointValueError Tase2_PointValue_setValueDiscreteEx (Tase2_PointValue self, int32_t value)
 Set the value of an indication point of type DISCRETE.
 
TASE2_API Tase2_DataState Tase2_PointValue_getValueState (Tase2_PointValue self)
 Get the value of an indication point of type STATE.
 
TASE2_API Tase2_DataState Tase2_PointValue_getValueStateEx (Tase2_PointValue self, Tase2_PointValueError *err)
 Get the value of an indication point of type STATE.
 
TASE2_API void Tase2_PointValue_setValueState (Tase2_PointValue self, Tase2_DataState value)
 Set the value of an indication point of type STATE.
 
TASE2_API Tase2_PointValueError Tase2_PointValue_setValueStateEx (Tase2_PointValue self, Tase2_DataState value)
 Set the value of an indication point of type STATE.
 
TASE2_API Tase2_DataStateSupplemental Tase2_PointValue_getValueStateSupplemental (Tase2_PointValue self)
 Get the value of an indication point of type STATE_SUPPLEMENTAL.
 
TASE2_API Tase2_DataStateSupplemental Tase2_PointValue_getValueStateSupplementalEx (Tase2_PointValue self, Tase2_PointValueError *err)
 Get the value of an indication point of type STATE_SUPPLEMENTAL.
 
TASE2_API void Tase2_PointValue_setValueStateSupplemental (Tase2_PointValue self, Tase2_DataStateSupplemental value)
 Set the value of an indication point of type STATE_SUPPLEMENTAL.
 
TASE2_API Tase2_PointValueError Tase2_PointValue_setValueStateSupplementalEx (Tase2_PointValue self, Tase2_DataStateSupplemental value)
 Set the value of an indication point of type STATE_SUPPLEMENTAL.
 
TASE2_API bool Tase2_PointValue_hasTimeStamp (Tase2_PointValue self)
 Try to determine if the value has a timestamp.
 
TASE2_API Tase2_TimeStampClass Tase2_PointValue_getTimeStampClass (Tase2_PointValue self)
 Get the timestamp class of the value.
 
TASE2_API uint64_t Tase2_PointValue_getTimeStamp (Tase2_PointValue self)
 Get the time stamp of the last data point change or update.
 
TASE2_API uint64_t Tase2_PointValue_getTimeStampEx (Tase2_PointValue self, Tase2_PointValueError *err)
 Get the time stamp of the last data point change or update.
 
TASE2_API void Tase2_PointValue_setTimeStamp (Tase2_PointValue self, uint64_t timestamp)
 Set the time stamp of the last data point change or update.
 
TASE2_API Tase2_PointValueError Tase2_PointValue_setTimeStampEx (Tase2_PointValue self, uint64_t timestamp)
 Set the time stamp of the last data point change or update.
 
TASE2_API Tase2_DataFlags Tase2_PointValue_getFlags (Tase2_PointValue self)
 Get the quality flags of a data point.
 
TASE2_API Tase2_DataFlags Tase2_PointValue_getFlagsEx (Tase2_PointValue self, Tase2_PointValueError *err)
 Get the quality flags of a data point.
 
TASE2_API void Tase2_PointValue_setFlags (Tase2_PointValue self, Tase2_DataFlags flags)
 Set the quality flags of a data point.
 
TASE2_API Tase2_PointValueError Tase2_PointValue_setFlagsEx (Tase2_PointValue self, Tase2_DataFlags flags)
 Set the quality flags of a data point.
 
TASE2_API uint16_t Tase2_PointValue_getCOV (Tase2_PointValue self)
 Get the COV (counter of value changes) of a data point.
 
TASE2_API uint16_t Tase2_PointValue_getCOVEx (Tase2_PointValue self, Tase2_PointValueError *err)
 Get the COV (counter of value changes) of a data point.
 
TASE2_API void Tase2_PointValue_setCOV (Tase2_PointValue self, uint16_t cov)
 Set the COV (counter of value changes) of a data point.
 
TASE2_API Tase2_PointValueError Tase2_PointValue_setCOVEx (Tase2_PointValue self, uint16_t cov)
 Set the COV (counter of value changes) of a data point.
 
TASE2_API Tase2_PointValue Tase2_PointValue_createSingleProtectionEvent (Tase2_SingleEventFlags eventFlags, int32_t operatingTime, uint64_t eventTime)
 Create a new point value instance of type single event (TASE2_VALUE_TYPE_SINGLE_EVENT)
 
TASE2_API Tase2_PointValue Tase2_PointValue_createPackedProtectionEvent (Tase2_EventFlags packedEvent, Tase2_PackedEventFlags packedEventFlags, int32_t operatingTime, uint64_t eventTime)
 Create a new point value instance of type packed event (TASE2_VALUE_TYPE_PACKED_EVENT)
 
TASE2_API Tase2_SingleEventFlags Tase2_PointValue_getSingleEventFlags (Tase2_PointValue self)
 Get the single event flags value.
 
TASE2_API Tase2_SingleEventFlags Tase2_PointValue_getSingleEventFlagsEx (Tase2_PointValue self, Tase2_PointValueError *err)
 Get the single event flags value.
 
TASE2_API void Tase2_PointValue_setSingleEventFlags (Tase2_PointValue self, Tase2_SingleEventFlags eventFlags)
 Set the single event flags value.
 
TASE2_API Tase2_PointValueError Tase2_PointValue_setSingleEventFlagsEx (Tase2_PointValue self, Tase2_SingleEventFlags eventFlags)
 Set the single event flags value.
 
TASE2_API Tase2_EventFlags Tase2_PointValue_getPackedEvent (Tase2_PointValue self)
 Get the packed event flags values.
 
TASE2_API Tase2_EventFlags Tase2_PointValue_getPackedEventEx (Tase2_PointValue self, Tase2_PointValueError *err)
 Get the packed event values.
 
TASE2_API void Tase2_PointValue_setPackedEvent (Tase2_PointValue self, Tase2_EventFlags packedEvent)
 Set the packed event values.
 
Tase2_PointValueError Tase2_PointValue_setPackedEventEx (Tase2_PointValue self, Tase2_EventFlags packedEvent)
 Set the packed event values.
 
TASE2_API Tase2_PackedEventFlags Tase2_PointValue_getPackedEventFlags (Tase2_PointValue self)
 Get the packed event flags value.
 
TASE2_API Tase2_PackedEventFlags Tase2_PointValue_getPackedEventFlagsEx (Tase2_PointValue self, Tase2_PointValueError *err)
 Get the packed event flags value.
 
TASE2_API void Tase2_PointValue_setPackedEventFlags (Tase2_PointValue self, Tase2_PackedEventFlags flags)
 Set the packed event flags.
 
TASE2_API Tase2_PointValueError Tase2_PointValue_setPackedEventFlagsEx (Tase2_PointValue self, Tase2_PackedEventFlags flags)
 Set the packed event flags.
 
TASE2_API int32_t Tase2_PointValue_getOperatingTime (Tase2_PointValue self)
 Get the operation or event duration.
 
TASE2_API int32_t Tase2_PointValue_getOperatingTimeEx (Tase2_PointValue self, Tase2_PointValueError *err)
 Get the operation or event duration.
 
TASE2_API void Tase2_PointValue_setOperatingTime (Tase2_PointValue self, int32_t operatingTime)
 Set the operation or event duration.
 
TASE2_API Tase2_PointValueError Tase2_PointValue_setOperatingTimeEx (Tase2_PointValue self, int32_t operatingTime)
 Set the operation or event duration.
 
TASE2_API uint64_t Tase2_PointValue_getEventTime (Tase2_PointValue self)
 Get the event/operation start time.
 
TASE2_API uint64_t Tase2_PointValue_getEventTimeEx (Tase2_PointValue self, Tase2_PointValueError *err)
 Get the event/operation start time.
 
TASE2_API void Tase2_PointValue_setEventTime (Tase2_PointValue self, uint64_t eventTime)
 Set the event/operation start time.
 
TASE2_API Tase2_PointValueError Tase2_PointValue_setEventTimeEx (Tase2_PointValue self, uint64_t eventTime)
 Set the event/operation start time.