PLCnext API Documentation  20.6.0.30321
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Arp::Plc::Gds::Services::IDataAccessService Class Referenceabstract

Services for the direct data access. More...

#include <IDataAccessService.hpp>

Inheritance diagram for Arp::Plc::Gds::Services::IDataAccessService:
Inheritance graph

Public Types

typedef std::shared_ptr< IDataAccessServicePtr
 
typedef delegate< void(IRscWriteEnumerator< RscString< 512 >> &)> ReadPortNamesDelegate
 
typedef delegate< void(IRscReadEnumerator< ReadItem > &)> ReadResultDelegate
 
typedef delegate< void(IRscWriteEnumerator< WriteItem > &)> WriteDataDelegate
 
typedef delegate< void(IRscReadEnumerator< DataAccessError > &)> WriteResultDelegate
 
- Public Types inherited from Arp::System::Rsc::Services::IRscService
typedef std::shared_ptr< IRscServicePtr
 

Public Member Functions

 IDataAccessService (void)
 Constructs an IDataAccessService instance. More...
 
virtual ~IDataAccessService (void)
 Destructs this instance and frees all resouces. More...
 
virtual ReadItem ReadSingle (const RscString< 512 > &portName)=0
 Reads the value of the variable directly from the given variable name. More...
 
virtual void Read (ReadPortNamesDelegate portNamesDelegate, ReadResultDelegate resultDelegate)=0
 Reads the value of the variable directly from the given variable name. More...
 
virtual DataAccessError WriteSingle (const WriteItem &data)=0
 Writes the given value to the given variable name containing in the given Arp.Plc.Gds.Services.WriteItem. More...
 
virtual void Write (WriteDataDelegate dataDelegate, WriteResultDelegate resultDelegate)=0
 Writes the given value to the given variable name containing in the given Arp.Plc.Gds.Services.WriteItem. More...
 
- Public Member Functions inherited from Arp::System::Rsc::Services::IRscService
 IRscService (void)=default
 Constructs an IRscService instance. More...
 
virtual ~IRscService (void)=default
 Destructs this instance and frees all resouces. More...
 

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

Services for the direct data access.

The direct access functionality is a way for reading and writing values from and to variables. This is the fastest way, with a minimum of influence to the real time process, but it is not guaranteed that the data will be read/write in the same task cycle. For task consistent reading the subscription service Arp.Plc.Gds.Services.ISubscriptionService has to be used.

A client can read/write from/to different types of variables provided in Arp.Plc.DataType. Currently supported types are listed below:

TypeSupported variablesDescription
Arp.Plc.DataType.PrimitiveYES
Arp.Plc.DataType.DateTimeYes
Arp.Plc.DataType.String(YES)Please use Arp.Plc.DataType.StaticString or Arp.Plc.DataType.IecString.
Arp.Plc.DataType.EnumYES
Arp.Plc.DataType.StructYES
Arp.Plc.DataType.FunctionBlockYES
Arp.Plc.DataType.PointerYES
Arp.Plc.DataType.ArrayYES

To address a variable, the full variable name uri is necessary. Some valid examples are given below:

ComponentName-1/ProgramName-1.Variable_Name
ComponentName-1/Global_Variable_Name
ComponentName-1/ProgramName-1.Array_Variable_Name
ComponentName-1/ProgramName-1.Array_Variable_Name[index]
ComponentName-1/ProgramName-1.Array_Variable_Name[startIndex:endIndex]
ComponentName-1/ProgramName-1.Struct_Variable_Name.Element1.Leaf
ComponentName-1/ProgramName-1.Struct_Variable_Name.Element1.LeafArray
ComponentName-1/ProgramName-1.Struct_Variable_Name.Element1.LeafArray[index]

Constructor & Destructor Documentation

◆ IDataAccessService()

IDataAccessService::IDataAccessService ( void  )
inline

Constructs an IDataAccessService instance.

◆ ~IDataAccessService()

IDataAccessService::~IDataAccessService ( void  )
inlinevirtual

Destructs this instance and frees all resouces.

Member Function Documentation

◆ Read()

virtual void Arp::Plc::Gds::Services::IDataAccessService::Read ( ReadPortNamesDelegate  portNamesDelegate,
ReadResultDelegate  resultDelegate 
)
pure virtual

Reads the value of the variable directly from the given variable name.

Copies the value of the variable, given by the variable name, to the Arp.Plc.Gds.Services.ReadItem object, which will be returned. ReadSingle can only read one single variable, so if you want to read multiple variables simultaneously, an array or a range of an array, you have to use the Arp.Plc.Gds.Services.IDataAccessService.Read service instead. Be aware, this copy process isn't task consistent and the data could be corrupted.

Parameters
portNameFull variable name uri.
Returns
Returns Arp.Plc.Gds.Services.ReadItem.

◆ ReadSingle()

virtual ReadItem Arp::Plc::Gds::Services::IDataAccessService::ReadSingle ( const RscString< 512 > &  portName)
pure virtual

Reads the value of the variable directly from the given variable name.

Copies the value of the variable, given by the variable name, to the Arp.Plc.Gds.Services.ReadItem object, which will be returned. ReadSingle can only read one single variable, so if you want to read multiple variables simultaneously, an array or a range of an array, you have to use the Arp.Plc.Gds.Services.IDataAccessService.Read service instead. Be aware, this copy process isn't task consistent and the data could be corrupted.

Parameters
portNameFull variable name uri.
Returns
Returns Arp.Plc.Gds.Services.ReadItem.

◆ Write()

virtual void Arp::Plc::Gds::Services::IDataAccessService::Write ( WriteDataDelegate  dataDelegate,
WriteResultDelegate  resultDelegate 
)
pure virtual

Writes the given value to the given variable name containing in the given Arp.Plc.Gds.Services.WriteItem.

Writes the given value to the given variable containing in the given Arp.Plc.Gds.Services.WriteItem object. WriteSingle can only write one single value, so if you want to write to multiple variables simultaneously, to an array or to a range of an array, you have to use the Arp.Plc.Gds.Services.IDataAccessService.Write service instead. Be aware, this write process isn't task consistent and the data could be corrupted.

Parameters
dataVariable data which contains the variable name and the value to be written.
Returns
Returns Arp.Plc.Gds.Services.DataAccessError.None on success.

◆ WriteSingle()

virtual DataAccessError Arp::Plc::Gds::Services::IDataAccessService::WriteSingle ( const WriteItem data)
pure virtual

Writes the given value to the given variable name containing in the given Arp.Plc.Gds.Services.WriteItem.

Writes the given value to the given variable containing in the given Arp.Plc.Gds.Services.WriteItem object. WriteSingle can only write one single value, so if you want to write to multiple variables simultaneously, to an array or to a range of an array, you have to use the Arp.Plc.Gds.Services.IDataAccessService.Write service instead. Be aware, this write process isn't task consistent and the data could be corrupted.

Parameters
dataVariable data which contains the variable name and the value to be written.
Returns
Returns Arp.Plc.Gds.Services.DataAccessError.None on success.

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