PLCnext API Documentation 24.0.0.71
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Arp::Services::DataLogger::Services::IDataLoggerService2 Class Referenceabstract

The DataLogger provides an interface to log and store variables during firmware runtime. More...

#include <IDataLoggerService2.hpp>

Inheritance diagram for Arp::Services::DataLogger::Services::IDataLoggerService2:
Inheritance graph

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 > > &)>
 
- Public Types inherited from Arp::System::Rsc::Services::IRscService
typedef std::shared_ptr< IRscServicePtr
 

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...
 
- Public Member Functions inherited from Arp::System::Rsc::Services::IRscService
 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 Public Member Functions inherited from Arp::System::Rsc::Services::IRscService
static IRscServiceProxyFactory & GetProxyFactory (void)
 Returns a reference to service proxy factory to create a proxy instance of the service More...
 

Detailed Description

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.

Member Function Documentation

◆ ConfigureSession()

virtual ErrorCode Arp::Services::DataLogger::Services::IDataLoggerService2::ConfigureSession ( const RscString< 512 > &  sessionname,
const std::vector< SessionProperty > &  properties 
)
pure virtual

(Re)configures a session

Parameters
sessionnameName of session to be created or reconfigured
propertiesCollection of attributes forming the configuration for the session
Returns
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.

◆ CreateSession()

virtual ErrorCode Arp::Services::DataLogger::Services::IDataLoggerService2::CreateSession ( const RscString< 512 > &  sessionName,
boolean  persistent = false 
)
pure virtual

Tries to create a new session.

Parameters
sessionNameName of session to be created.
persistentIf set to true, the newly created session will not be removed when the RSC connection is closed.
Returns
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!

◆ GetLoggedVariables()

virtual ErrorCode Arp::Services::DataLogger::Services::IDataLoggerService2::GetLoggedVariables ( const RscString< 512 > &  sessionName,
GetLoggedVariablesInfosDelegate  infosDelegate 
)
pure virtual

Queries all infos about logged variables of a session.

Parameters
sessionNameName of session to query logged variables
infosIterator which can be used to list logged variables after successful call
Returns
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!

◆ GetRotatedFileNames()

virtual ErrorCode Arp::Services::DataLogger::Services::IDataLoggerService2::GetRotatedFileNames ( const RscString< 512 > &  sessionname,
GetRotatedFileNamesFilenamesDelegate  filenamesDelegate 
)
pure virtual

Returns names of all files that have been written by a session

Parameters
sessionnameName of session from which rotated files should be listed
filenamesIterator to list names of all rotated files on successful call.
Returns
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!

◆ GetSessionConfiguration()

virtual ErrorCode Arp::Services::DataLogger::Services::IDataLoggerService2::GetSessionConfiguration ( const RscString< 512 > &  sessionname,
std::vector< SessionProperty > &  properties,
boolean isPersistent 
)
pure virtual

Tries to query the current configuration of a session

Parameters
sessionnameName of session to be queried
propertiesCollection of attributes forming the sessions configuration after successfull invocation
isPersistentDetermines if the session will remain (true) when the connection to the server is closed or not
Returns
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!

◆ GetSessionNames()

virtual void Arp::Services::DataLogger::Services::IDataLoggerService2::GetSessionNames ( const RscString< 512 > &  variablename,
GetSessionNamesResultDelegate  resultDelegate 
)
pure virtual

Tries to retrieve names of sessions which log assigned variables

Parameters
variablenameName of variable to which corresponding sessions should be found
Returns
Enumeration of names of sessions which log the variable in question

◆ GetSessionState()

virtual ErrorCode Arp::Services::DataLogger::Services::IDataLoggerService2::GetSessionState ( const RscString< 512 > &  sessionName,
SessionState state 
)
pure virtual

Tries to query the state of a session.

Parameters
sessionNameName of session to query state of.
stateContainer for state of session, if session exists. The value after return from call is unspecified if the session does not exists.
Returns
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!

◆ ListSessionNames()

virtual void Arp::Services::DataLogger::Services::IDataLoggerService2::ListSessionNames ( ListSessionNamesResultDelegate  resultDelegate)
pure virtual

List all names of sessions inside the data logger component.

Returns
Array of session names.

◆ ReadVariablesData()

virtual ErrorCode Arp::Services::DataLogger::Services::IDataLoggerService2::ReadVariablesData ( const RscString< 512 > &  sessionName,
DateTime  startTime,
DateTime  endTime,
ReadVariablesDataVariableNamesDelegate  variableNamesDelegate,
ReadVariablesDataValuesDelegate  valuesDelegate 
)
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:

Read variables from task A: a1, a2
from task B: b1
Results in:
object[]
timestamp task A, a1, a2, b1, consistent flag, record type
timestamp task B, a1, a2, b1, consistent flag, record type

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.

Parameters
sessionNameName of session where variable should be read from.
startTimeStart time to be read data.
endTimeEnd time to be read data.
variableNamesName of variables to be read data.
valuesAn enumerator which stores the read values.
Returns
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!

◆ RemoveSession()

virtual ErrorCode Arp::Services::DataLogger::Services::IDataLoggerService2::RemoveSession ( const RscString< 512 > &  sessionName)
pure virtual

Tries to remove a session.

Parameters
sessionNameName of session to be removed.
Returns
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.

◆ SetTriggerCondition()

virtual ErrorCode Arp::Services::DataLogger::Services::IDataLoggerService2::SetTriggerCondition ( const RscString< 512 > &  sessionName,
const RscString< 512 > &  taskName,
uint16  preCycleCount,
uint16  postCycleCount,
SetTriggerConditionTriggerConditionDelegate  triggerConditionDelegate 
)
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.

Parameters
sessionNameName of session to set trigger condition
taskNameName of task where trigger condition is evaluated
preCycleCountAmount of datasets recorded before the condition was triggered
postCycleCountAmount of dataset recorded ater the condition is triggered (0 means endless)
triggerConditionList of trigger items. All items are evaluated in order of their position inside the list.
Returns
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!
The trigger condition contains invalid data! See Notifications for more information.

◆ SetVariables()

virtual void Arp::Services::DataLogger::Services::IDataLoggerService2::SetVariables ( const RscString< 512 > &  sessionName,
SetVariablesVariableNamesDelegate  variableNamesDelegate,
SetVariablesResultDelegate  resultDelegate 
)
pure virtual

Tries to add a variable to a session.

Parameters
sessionNameName of session where variable should be added.
variableNamesName of variable to be added to session.
Returns

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 CodeDescription
Arp.Services.DataLogger.Services.ErrorCode.InvalidConfigMaximal 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.SessionRunningThe session is currently logging variable values! Stop session first.
Arp.Services.DataLogger.Services.ErrorCode.NoSuchSessionA 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 CodeDescription
Arp.Services.DataLogger.Services.ErrorCode.NoneVariable added to the session!
Arp.Services.DataLogger.Services.ErrorCode.NoSuchVariableThe variable does not exists in the GDS!
Arp.Services.DataLogger.Services.ErrorCode.NotSupportedThe variable is of a not supported type, i.e. not of primitive or elementary type!

◆ StartSession()

virtual ErrorCode Arp::Services::DataLogger::Services::IDataLoggerService2::StartSession ( const RscString< 512 > &  sessionName)
pure virtual

Tries to start a logging session.

Parameters
sessionNameName of session to be started.
Returns
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.

◆ StopSession()

virtual ErrorCode Arp::Services::DataLogger::Services::IDataLoggerService2::StopSession ( const RscString< 512 > &  sessionName)
pure virtual

Tries to stop a logging session.

Parameters
sessionNameName of session to be stopped.
Returns
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.

The documentation for this class was generated from the following file: