PLCnext API Documentation 24.6.0.58
|
The DataLogger provides an interface to log and store variables during firmware runtime. More...
#include <IDataLoggerService2.hpp>
Public Types | |
using | Ptr = std::shared_ptr< IDataLoggerService2 > |
using | VariableInfo = Arp::Plc::Gds::Services::VariableInfo |
using | GetLoggedVariablesInfosDelegate = delegate< void(IRscReadEnumerator< VariableInfo > &)> |
using | GetRotatedFileNamesFilenamesDelegate = delegate< void(IRscReadEnumerator< RscString< 512 > > &)> |
using | GetSessionNamesResultDelegate = delegate< void(IRscReadEnumerator< RscString< 512 > > &)> |
using | ListSessionNamesResultDelegate = delegate< void(IRscReadEnumerator< RscString< 512 > > &)> |
using | ReadVariablesDataValuesDelegate = delegate< void(IRscReadEnumerator< RscVariant< 512 > > &)> |
using | ReadVariablesDataVariableNamesDelegate = delegate< void(IRscWriteEnumerator< RscString< 512 > > &)> |
using | SetTriggerConditionTriggerConditionDelegate = delegate< void(IRscWriteEnumerator< TriggerRpnItem > &)> |
using | SetVariablesResultDelegate = delegate< void(IRscReadEnumerator< ErrorCode > &)> |
using | SetVariablesVariableNamesDelegate = delegate< void(IRscWriteEnumerator< RscString< 512 > > &)> |
![]() | |
typedef std::shared_ptr< IRscService > | Ptr |
Public Member Functions | |
IDataLoggerService2 (void)=default | |
Constructs an IDataLoggerService2 instance. | |
virtual void | ListSessionNames (ListSessionNamesResultDelegate resultDelegate)=0 |
List all names of sessions inside the data logger component. More... | |
virtual ErrorCode | CreateSession (const RscString< 512 > &sessionName, boolean persistent=false)=0 |
Tries to create a new session. More... | |
virtual ErrorCode | RemoveSession (const RscString< 512 > &sessionName)=0 |
Tries to remove a session. More... | |
virtual ErrorCode | StartSession (const RscString< 512 > &sessionName)=0 |
Tries to start a logging session. More... | |
virtual ErrorCode | StopSession (const RscString< 512 > &sessionName)=0 |
Tries to stop a logging session. More... | |
virtual ErrorCode | ConfigureSession (const RscString< 512 > &sessionname, const std::vector< SessionProperty > &properties)=0 |
(Re)configures a session More... | |
virtual ErrorCode | GetSessionConfiguration (const RscString< 512 > &sessionname, std::vector< SessionProperty > &properties, boolean &isPersistent)=0 |
Tries to query the current configuration of a session More... | |
virtual ErrorCode | GetSessionState (const RscString< 512 > &sessionName, SessionState &state)=0 |
Tries to query the state of a session. More... | |
virtual void | SetVariables (const RscString< 512 > &sessionName, SetVariablesVariableNamesDelegate variableNamesDelegate, SetVariablesResultDelegate resultDelegate)=0 |
Tries to add a variable to a session. More... | |
virtual ErrorCode | GetLoggedVariables (const RscString< 512 > &sessionName, GetLoggedVariablesInfosDelegate infosDelegate)=0 |
Queries all infos about logged variables of a session. More... | |
virtual ErrorCode | ReadVariablesData (const RscString< 512 > &sessionName, DateTime startTime, DateTime endTime, ReadVariablesDataVariableNamesDelegate variableNamesDelegate, ReadVariablesDataValuesDelegate valuesDelegate)=0 |
Read the data from the given variable from the session with the session name. More... | |
virtual ErrorCode | GetRotatedFileNames (const RscString< 512 > &sessionname, GetRotatedFileNamesFilenamesDelegate filenamesDelegate)=0 |
Returns names of all files that have been written by a session More... | |
virtual void | GetSessionNames (const RscString< 512 > &variablename, GetSessionNamesResultDelegate resultDelegate)=0 |
Tries to retrieve names of sessions which log assigned variables More... | |
virtual ErrorCode | SetTriggerCondition (const RscString< 512 > &sessionName, const RscString< 512 > &taskName, uint16 preCycleCount, uint16 postCycleCount, SetTriggerConditionTriggerConditionDelegate triggerConditionDelegate)=0 |
Sets a trigger condition More... | |
![]() | |
IRscService (void)=default | |
Constructs an IRscService instance. | |
virtual | ~IRscService (void)=default |
Destructs this instance and frees all resouces. | |
Static Public Member Functions | |
static IRscServiceProxyFactory & | GetProxyFactory (void) |
![]() | |
static IRscServiceProxyFactory & | GetProxyFactory (void) |
Returns a reference to service proxy factory to create a proxy instance of the service More... | |
The DataLogger provides an interface to log and store variables during firmware runtime.
This service is defined in library Arp.Services.DataLogger.
Realtime Usage: This API call does not have to be deterministic in runtime behaviour, so an asynchronous execution should be considered.
|
pure virtual |
(Re)configures a session
sessionname | Name of session to be created or reconfigured |
properties | Collection of attributes forming the configuration for the session |
Error Code | Description |
---|---|
Arp.Services.DataLogger.Services.ErrorCode.None | Session successfully configured! |
Arp.Services.DataLogger.Services.ErrorCode.NoSuchSession | A session with specified name does not exist! |
Arp.Services.DataLogger.Services.ErrorCode.SessionRunning | The session is currently running and cannot be configured! |
Arp.Services.DataLogger.Services.ErrorCode.InvalidConfig | The provided configuration is invalid! See Output.log or notifications for more informations. |
|
pure virtual |
Tries to create a new session.
sessionName | Name of session to be created. |
persistent | If set to true , the newly created session will not be removed when the RSC connection is closed. |
Error Code | Description |
---|---|
Arp.Services.DataLogger.Services.ErrorCode.None | The session created successfully! |
Arp.Services.DataLogger.Services.ErrorCode.AlreadyExists | A session with the same name already exists! |
Arp.Services.DataLogger.Services.ErrorCode.OutOfMemory | Not enough memory to create a new session! |
|
pure virtual |
Queries all infos about logged variables of a session.
sessionName | Name of session to query logged variables |
infos | Iterator which can be used to list logged variables after successful call |
Error Code | Description |
---|---|
Arp.Services.DataLogger.Services.ErrorCode.None | Logged variables retrieved successfully! |
Arp.Services.DataLogger.Services.ErrorCode.NoSuchSession | A session with specified name does not exist! |
|
pure virtual |
Returns names of all files that have been written by a session
sessionname | Name of session from which rotated files should be listed |
filenames | Iterator to list names of all rotated files on successful call. |
Error Code | Description |
---|---|
Arp.Services.DataLogger.Services.ErrorCode.None | File names successfully retreived! |
Arp.Services.DataLogger.Services.ErrorCode.NoSuchSession | A session with specified name does not exist! |
Arp.Services.DataLogger.Services.ErrorCode.NoData | No sink configured yet or the sink cannot rotate files! |
|
pure virtual |
Tries to query the current configuration of a session
sessionname | Name of session to be queried |
properties | Collection of attributes forming the sessions configuration after successfull invocation |
isPersistent | Determines if the session will remain (true ) when the connection to the server is closed or not |
Error Code | Description |
---|---|
Arp.Services.DataLogger.Services.ErrorCode.None | Configuration successfully retrieved! |
Arp.Services.DataLogger.Services.ErrorCode.NoSuchSession | A session with specified name does not exist! |
|
pure virtual |
Tries to retrieve names of sessions which log assigned variables
variablename | Name of variable to which corresponding sessions should be found |
|
pure virtual |
Tries to query the state of a session.
sessionName | Name of session to query state of. |
state | Container for state of session, if session exists. The value after return from call is unspecified if the session does not exists. |
Error Code | Description |
---|---|
Arp.Services.DataLogger.Services.ErrorCode.None | State successfully retrieved! |
Arp.Services.DataLogger.Services.ErrorCode.NoSuchSession | A session with specified name does not exist! |
|
pure virtual |
List all names of sessions inside the data logger component.
|
pure virtual |
Read the data from the given variable from the session with the session name.
This service function returns the plain data values from the passed variable names including timestamps and data series consistent flags, which is called a record. In a record the values are in a static order and doesn't contain any type information. Each record starts with the timestamp followed by the values from the given variable by names and the consistent flag. The record ends with a record type describing the cycle the record belongs to.
Example:
The number of records depends on the given start and end time. Each values will be returned between the start and end time.
If the start time is zero, all available records until the end time will be returned.
If the end time is zero, all available records from the start time until the last available record is reached will be returned.
If the start and end time is zero, each available record will be returned.
If the start time is greater than the end time, the resulted values are returned in descending order.
sessionName | Name of session where variable should be read from. |
startTime | Start time to be read data. |
endTime | End time to be read data. |
variableNames | Name of variables to be read data. |
values | An enumerator which stores the read values. |
Error Code | Description |
---|---|
Arp.Services.DataLogger.Services.ErrorCode.None | Variable values from session successfully read! |
Arp.Services.DataLogger.Services.ErrorCode.NoSuchSession | A session with specified name does not exist! |
Arp.Services.DataLogger.Services.ErrorCode.NoData | The session has not logged any data yet! |
Arp.Services.DataLogger.Services.ErrorCode.NoSuchVariable | At least one of the specified variables is not logged by the session! In this case no data is read from the session! |
|
pure virtual |
Tries to remove a session.
sessionName | Name of session to be removed. |
Error Code | Description |
---|---|
Arp.Services.DataLogger.Services.ErrorCode.None | The session successfully removed! |
Arp.Services.DataLogger.Services.ErrorCode.NoSuchSession | A session with specified name does not exist! |
Arp.Services.DataLogger.Services.ErrorCode.Unspecified | Could not remove session due to internal error! See Output.log for more information. |
|
pure virtual |
Sets a trigger condition
Configuration of the trigger is done in RPN (Reverse Polish Notation). Each operand or operation is a single Arp.Services.DataLogger.Services.TriggerRpnItem. Only if the condition specified by the trigger is fullfilled values are logged and stored inside the sink.
The amount of cycles that should be stored before the condition was fullfilled can be configured using preCycleCount
whereas the amount of cycles that should be recorded afterwards can be configured using postCycleCount
. If postCycleCount
is set to 0 then the recording continues until IDataLoggerService::StopSession is called or the PLC project is stopped.
sessionName | Name of session to set trigger condition |
taskName | Name of task where trigger condition is evaluated |
preCycleCount | Amount of datasets recorded before the condition was triggered |
postCycleCount | Amount of dataset recorded ater the condition is triggered (0 means endless) |
triggerCondition | List of trigger items. All items are evaluated in order of their position inside the list. |
Error Code | Description |
---|---|
Arp.Services.DataLogger.Services.ErrorCode.None | Trigger condition successfully configured! |
Arp.Services.DataLogger.Services.ErrorCode.NoSuchSession | A session with specified name does not exist! |
Arp.Services.DataLogger.Services.ErrorCode.SessionRunning | The session is currently logging variable values! Stop session first. |
Arp.Services.DataLogger.Services.ErrorCode.NoSuchVariable | A referenced variable does not exist in the GDS! |
|
pure virtual |
Tries to add a variable to a session.
sessionName | Name of session where variable should be added. |
variableNames | Name of variable to be added to session. |
A array of error codes. The list/array will only contain a single value if the session is in an invalid state, e.g. already running or if the session is not existing.
Error Code | Description |
---|---|
Arp.Services.DataLogger.Services.ErrorCode.InvalidConfig | Maximal amount of variables(996) for the db sink is reached or the session is in an error state or not initialized yet! |
Arp.Services.DataLogger.Services.ErrorCode.SessionRunning | The session is currently logging variable values! Stop session first. |
Arp.Services.DataLogger.Services.ErrorCode.NoSuchSession | A session with specified name does not exist! |
In case the session is existing and can be configured, the returned array contains one entry for every assigned name in variableNames .
Error Code | Description |
---|---|
Arp.Services.DataLogger.Services.ErrorCode.None | Variable added to the session! |
Arp.Services.DataLogger.Services.ErrorCode.NoSuchVariable | The variable does not exists in the GDS! |
Arp.Services.DataLogger.Services.ErrorCode.NotSupported | The variable is of a not supported type, i.e. not of primitive or elementary type! |
|
pure virtual |
Tries to start a logging session.
sessionName | Name of session to be started. |
Error Code | Description |
---|---|
Arp.Services.DataLogger.Services.ErrorCode.None | The session started successfully! |
Arp.Services.DataLogger.Services.ErrorCode.NoSuchSession | A session with specified name does not exist! |
Arp.Services.DataLogger.Services.ErrorCode.Unspecified | Could not start session due to internal error! See Output.log for more information. |
|
pure virtual |
Tries to stop a logging session.
sessionName | Name of session to be stopped. |
Error Code | Description |
---|---|
Arp.Services.DataLogger.Services.ErrorCode.None | The session stopped successfully! |
Arp.Services.DataLogger.Services.ErrorCode.NoSuchSession | A session with specified name does not exist! |
Arp.Services.DataLogger.Services.ErrorCode.Unspecified | Could not stop session due to internal error! See Output.log for more information. |