Robox Library for Cpp: BCC/31 module 1.0.0
RLibCpp BCC/31 protocol implementation
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Client Class Reference

Communication client declaration. More...

#include <client.h>

Inheritance diagram for Client:

Public Member Functions

Globals::Results abort ()
 Abort the current operation.
 
virtual Globals::Results pushIn (Message *msg)
 Emulate a message reception from the connected device.
 
virtual Globals::Results popIn (Message *msg)
 Receive a message from the connected device.
 
virtual Globals::Results pushOut (Message *msg)
 Send the message to the connected device.
 
virtual Globals::Results popOut (Message *msg)
 Remove the first message sent to the connected device but not yet started (still present in the client outgoing queue).
 
virtual Globals::Results flushMessages ()
 Flush messages in the client ingoing queue.
 
virtual Globals::Results command (Message *cmd, Message *asw, ClientStruct::OperationData *data)
 Execute a generic command sequence on the connected device.
 
Globals::Results replyBusy (Message *src)
 Reply with a BUSY message to the source message.
 
Globals::Results replyMsg (Message *src, Message::MsgCodes msgCode, void *data, uint8_t len=0)
 Reply with a generic message to the source message.
 
Globals::Results ping (ClientStruct::PingData &data)
 Execute a ping sequence on the connected device.
 
void fillSystemInfoData (Message &msg, ClientStruct::SystemInfoData &data)
 Fill the SysInfoData data structure from the content of the Message msg.
 
Globals::Results systemInfo (ClientStruct::SystemInfoData &data)
 Get the system information from the connected device.
 
Globals::Results downloadSequence (ClientStruct::DownloadSequenceData &data)
 Execute a generic download sequence on the connected device.
 
Globals::Results dataSaveSequence (ClientStruct::DataSaveSequenceData &data)
 Execute a generic data save sequence from on the connected device.
 
Globals::Results dataLoadSequence (ClientStruct::DataLoadSequenceData &data)
 Execute a generic data load sequence to the connected device.
 
Globals::Results flashDir (ClientStruct::FlashDirData &data)
 Get the content of the flash on the conencted device.
 
Globals::Results flashFileLoad (ClientStruct::FlashFileLoadData &data)
 Load a file to the flash of the connected device.
 
Globals::Results flashFileSave (ClientStruct::FlashFileSaveData &data)
 Save a file from the flash of the connected device.
 
Globals::Results flashFileDelete (ClientStruct::FlashFileDeleteData &data)
 Delete files from the flash of the connected device.
 
Globals::Results flashFileRename (ClientStruct::FlashFileRenameData &data)
 Rename a file in the flash of the connected device.
 
Globals::Results flashFileInfo (ClientStruct::FlashFileInfoData &data)
 Get information for a file in the flash of the connected device.
 
Globals::Results flashFormat (ClientStruct::FlashFormatData &data)
 Format a flash of the connecte device.
 
Globals::Results flashFolderCreate (ClientStruct::FlashFolderCreateData &data)
 Create a folder in the flash of the connected device.
 
Globals::Results flashFolderDelete (ClientStruct::FlashFolderDeleteData &data)
 Delete a folder in the flash of the connected device.
 
Globals::Results flashFolderInfo (ClientStruct::FlashFolderInfoData &data)
 Get information for a folder in the flash of the connected device.
 
Globals::Results flashDiskCreate (ClientStruct::FlashDiskCreateData &data)
 Create a flash in the physical storage of the connected device.
 
Globals::Results flashDiskDelete (ClientStruct::FlashDiskDeleteData &data)
 Delete a flash form the physical storage of the connected device.
 
Globals::Results flashDiskBackup (ClientStruct::FlashDiskBackpupData &data)
 Backup a flash content to the backup area of the connected device.
 
Globals::Results flashDiskRestore (ClientStruct::FlashDiskRestoreData &data)
 Restore a flash content from the backup area of the connected device.
 
Globals::Results flashSetAttributes (ClientStruct::FlashSetAttributesData &data)
 Sets attributes for flash's objects (files/folders)
 
Globals::Results readVariable (ClientStruct::ReadVariableData &data)
 Read variable values from the connected device.
 
Globals::Results writeVariable (ClientStruct::WriteVariableData &data)
 Write variable values to the connected device.
 
Globals::Results forceVariable (ClientStruct::ForceVariableData &data)
 Force variable values on the connected device.
 
Globals::Results releaseVariable (ClientStruct::ReleaseVariableData &data)
 Release variable values on the connected device.
 
Globals::Results releaseAllVariables (ClientStruct::ReleaseAllVariablesData &data)
 Release all variables value on the connected device.
 
Globals::Results alarmStackInfo (ClientStruct::AlarmStackInfoData &data)
 Get information about the alarm stack.
 
Globals::Results alarmStackGet (ClientStruct::AlarmStackGetData &data)
 Get a single item from the alarm stack.
 
Globals::Results alarmStackList (ClientStruct::AlarmStackListData &data)
 Get the list of alarms in the stack.
 
Globals::Results alarmStackClear (ClientStruct::AlarmStackClearData &data)
 Clear alarm at index from the stack.
 
Globals::Results alarmStackClearAll (ClientStruct::AlarmStackClearAllData &data)
 Clear all alarms from the stack.
 
Globals::Results alarmStackClearSpec (ClientStruct::AlarmStackClearSpecData &data)
 Clear specific alarm from the stack.
 
Globals::Results alarmHistoryInfo (ClientStruct::AlarmHistoryInfoData &data)
 Get information on alarm history.
 
Globals::Results alarmHistoryList (ClientStruct::AlarmHistoryListData &data)
 Get alarm history list.
 
Globals::Results alarmHistoryClear (ClientStruct::AlarmHistoryClearData &data)
 Clear alarm history.
 
Globals::Results canObjRead (ClientStruct::CanObjReadData &data)
 Read CANopen object value.
 
Globals::Results canObjWrite (ClientStruct::CanObjWriteData &data)
 Write CANopen object value.
 
Globals::Results canNmtRead (ClientStruct::CanNmtReadData &data)
 Read CANopen NMT status.
 
Globals::Results canNmtWrite (ClientStruct::CanNmtWriteData &data)
 Write CANopen NMT status.
 
Globals::Results canEmcyRead (ClientStruct::CanEmcyReadData &data)
 Read CANopen emergency.
 
Globals::Results canRbxChDiag (ClientStruct::CanRbxChDiagData &data)
 Read Robox diagnostic for CANopen's channel.
 
Globals::Results canRbxWsDiag (ClientStruct::CanRbxWsDiagData &data)
 Read Robox diagnostic for CANopen's workstation.
 
Globals::Results canRxPdoRead (ClientStruct::CanPdoReadData &data)
 Read Rx PDO data for CANopen's workstation.
 
Globals::Results canTxPdoRead (ClientStruct::CanPdoReadData &data)
 Read Tx PDO data for CANopen's workstation.
 
Globals::Results canC402Info (ClientStruct::CanC402InfoData &data)
 Read CAN402 information for CANopen's workstation.
 
Globals::Results reportInfo (ClientStruct::ReportInfoData &data)
 Read information for user report.
 
Globals::Results reportList (ClientStruct::ReportListData &data)
 Read list for user report.
 
Globals::Results reportClear (ClientStruct::ReportClearData &data)
 Clear user report.
 
Globals::Results reportSetMode (ClientStruct::ReportSetModeData &data)
 Set mode for user report.
 
Globals::Results sysReportInfo (ClientStruct::SysReportInfoData &data)
 Read information for system report.
 
Globals::Results sysReportList (ClientStruct::SysReportListData &data)
 Read list for system report.
 
Globals::Results sysReportClear (ClientStruct::SysReportClearData &data)
 Clear system report.
 
Globals::Results sysReportSetMode (ClientStruct::SysReportSetModeData &data)
 Set mode for system report.
 
Globals::Results fbReadLocalEntry (ClientStruct::FbEntryData &data)
 Read entry from fieldbus local interface.
 
Globals::Results fbWriteLocalEntry (ClientStruct::FbEntryData &data)
 Write to from fieldbus local interface.
 
Globals::Results fbReadLocalNmt (ClientStruct::FbReadNmtData &data)
 Read NMT from fieldbus local interface.
 
Globals::Results fbWriteLocalNmt (ClientStruct::FbWriteNmtData &data)
 Write NMT to fieldbus local interface.
 
Globals::Results fbReadCoeEntry (ClientStruct::FbEntryData &data)
 Read entry from fieldbus EtherCAT (CoE) interface.
 
Globals::Results fbWriteCoeEntry (ClientStruct::FbEntryData &data)
 Write to from fieldbus local interface.
 
Globals::Results fbReadEcatNmt (ClientStruct::FbReadEcatNmtData &data)
 Read NMT from fieldbus EtherCAT interface.
 
Globals::Results fbWriteEcatNmt (ClientStruct::FbWriteEcatNmtData &data)
 Write NMT from fieldbus EtherCAT interface.
 
Globals::Results fbReadCanEntry (ClientStruct::FbEntryData &data)
 Read entry from fieldbus CANopen interface.
 
Globals::Results fbWriteCanEntry (ClientStruct::FbEntryData &data)
 Write to from fieldbus CANopen interface.
 
Globals::Results fbReadCanNmt (ClientStruct::FbReadNmtData &data)
 Read NMT from fieldbus CANopen interface.
 
Globals::Results fbWriteCanNmt (ClientStruct::FbWriteNmtData &data)
 Write NMT to fieldbus CANopen interface.
 
Globals::Results fbReadIf (ClientStruct::FbReadIfData &data)
 Read fieldbus interface.
 
Globals::Results fbWriteIf (ClientStruct::FbWriteIfData &data)
 Write fieldbus interface.
 
Globals::Results fbLoadFirmware (ClientStruct::FbLoadFirmwareData &data)
 load firmware file for fieldbus
 
int txNumBlock (ClientStruct::OperationData *data=nullptr)
 Query the data interlocking value (trasmission)
 
virtual bool connected ()
 The client connection state.
 
virtual bool reconnecting ()
 The client reconnection state.
 
uint64_t id () const
 Get the object identifier.
 
Connectionconnection () const
 Get the Connection object.
 
void setConnection (Connection *value)
 Set the Connection object.
 
virtual uint8_t targetId ()
 Get the client target identifier.
 
virtual void setTargetId (uint8_t value)
 Set the client target identifier.
 
virtual uint8_t targetCh ()
 Get the client target channel.
 
virtual void setTargetCh (uint8_t value)
 Set the client target channel.
 
virtual uint8_t sourceId ()
 Get the client source identifier.
 
virtual void setSourceId (uint8_t value)
 Set the client source identifier.
 
virtual uint8_t sourceCh ()
 Get the client source channel.
 
virtual void setSourceCh (uint8_t value)
 Set the client source channel.
 
int maxCmdTimeout () const
 Get the maximum generic command timeout [ms].
 
void setMaxCmdTimeout (int value)
 Set the maximum generic command timeout [ms].
 
int maxWaitTimeout () const
 Get the maximum generic wait timeout [ms].
 
void setMaxWaitTimeout (int value)
 Set the maximum generic wait timeout [ms].
 

Protected Member Functions

 Client ()
 Class constructor.
 
virtual ~Client ()
 Class destructor.
 
virtual bool doGetIBInfo (int &ibTx, int &ibRx, ClientStruct::OperationData &data)
 Query informations for the data interlocking.
 
uint8_t nextCommandPid ()
 Get the next command Pid.
 
Globals::Results checkSafeVarAvailability (ClientStruct::SafeModes safeMode, bool &useSafeVar)
 Helper method to check if we can use safe variable operations.
 
Globals::Results doQueryDeviceInfo ()
 Retrieves informations from connected device.
 
Globals::Results doReadStdVar (ClientStruct::ReadVariableData &data)
 Helper to read a standard variable.
 
Globals::Results doReadStringVar (ClientStruct::ReadVariableData &data)
 Helper to read a string variable.
 
Globals::Results doReadChVar (ClientStruct::ReadVariableData &data)
 Helper to read a channel variable.
 
Globals::Results doReadAxisVar (ClientStruct::ReadVariableData &data)
 Helper to read an axis variable.
 
Globals::Results doReadBitVar (ClientStruct::ReadVariableData &data)
 Helper to read an bit variable.
 
Globals::Results doReadCachedVar (ClientStruct::ReadVariableData &data)
 Helper to read the values of a cached variable.
 
Globals::Results doReadNamedVar (ClientStruct::ReadVariableData &data)
 Helper to read variable values from the connected device by specified data.Var.Name.
 
Globals::Results doGetDataFromReadVar (Message &asw, const RVar::Base &var, const RVar::Index &index, Variable::Data::Vector &values)
 Helper to parse data stored into the asw message and fills the values list.
 
bool canForceOrReleaseVariable (Protocol::VarTypes type)
 Helper to check if the specified variable type can be forced or released.
 
Globals::Results doWriteVariable (ClientStruct::BaseWriteVariableData &data, bool force, bool coherentValues)
 Helper method to write or force a variable.
 
Globals::Results doWriteStdVar (ClientStruct::BaseWriteVariableData &data, bool force, bool coherentValues)
 Helper to write or force a standard variable.
 
Globals::Results doSetDataToWriteVar (Message &msg, bool useSafeVar, RVar::Dict::VarData &varData, Variable::Data::Vector &values, int &valOffset)
 Helper to fill the msg with values from values
 
Globals::Results doWriteStringVar (ClientStruct::BaseWriteVariableData &data, bool force, bool coherentValues)
 Helper to write or force a string variable.
 
Globals::Results doWriteChVar (ClientStruct::BaseWriteVariableData &data, bool force, bool coherentValues)
 Helper to write or force a channel variable.
 
Globals::Results doWriteAxisVar (ClientStruct::BaseWriteVariableData &data, bool force, bool coherentValues)
 Helper to write or force an axis variable.
 
Globals::Results doWriteBitVar (ClientStruct::BaseWriteVariableData &data, bool force, bool coherentValues)
 Helper to write a bit variable.
 
Globals::Results doWriteNamedVar (ClientStruct::BaseWriteVariableData &data, bool force, bool coherentValues)
 Helper to write or force variable values to the connected device by specified data.Var.Name.
 
Globals::Results doWriteCachedVar (ClientStruct::BaseWriteVariableData &data, bool force, bool coherentValues)
 Helper to write or force the values to a cached variable.
 
Globals::Results doReleaseStdVar (ClientStruct::ReleaseVariableData &data)
 Helper to release a standard variable.
 
Globals::Results doReleaseVarByName (ClientStruct::ReleaseVariableData &data)
 Helper to release a variable from the connected device specified by data.Name.
 
Globals::Results doReleaseCachedVar (ClientStruct::ReleaseVariableData &data)
 Helper to release a cached variable.
 
Globals::Results doReleaseChVar (ClientStruct::ReleaseVariableData &data)
 Helper to release a channel variable.
 
Globals::Results doReleaseAxisVar (ClientStruct::ReleaseVariableData &data)
 Helper to release an axis variable.
 
Globals::Results doReleaseBitVar (ClientStruct::ReleaseVariableData &data)
 Helper to release an bit variable.
 
Globals::Results doCanPdoRead (ClientStruct::CanPdoReadData &data, bool isTx)
 Read Tx/Rx PDO data for CANopen's workstation.
 
Globals::Results doFbReadEntry (ClientStruct::FbEntryData &data, Message::MsgCodes msgCode)
 Helper for reading fieldbus entry.
 
Globals::Results doFbWriteEntry (ClientStruct::FbEntryData &data, Message::MsgCodes msgCode)
 Helper for writing fieldbus entry.
 
Globals::Results doFbReadNmt (ClientStruct::FbReadNmtData &data, Message::MsgCodes msgCode)
 Helper for reading fieldbus Nmt.
 
Globals::Results doFbWriteNmt (ClientStruct::FbWriteNmtData &data, Message::MsgCodes msgCode)
 Helper for writing fieldbus Nmt.
 
Globals::Results doFlashFileLoad (ClientStruct::FlashFileLoadData &data)
 Load a file to the flash of the connected device.
 
bool abortRequest () const
 Get the flag to abort operation.
 
void setAbortRequest (bool value)
 Set the flag to abort operation.
 
LocalClientLinklocalLink () const
 Get the LocalClientLink object.
 
void setLocalLink (LocalClientLink *value)
 Set the LocalClientLink object.
 
MessageQueue * outQueue () const
 Get the outgoing message queue.
 
void setOutQueue (MessageQueue *value)
 Set the outgoing message queue.
 

Protected Attributes

std::recursive_timed_mutex m_pidLock
 Object to lock the m_commandPid when generating the next pid value
 
uint8_t m_commandPid
 Command protocol Id.
 

Friends

class Connection
 
class TcpIpConnection
 
class Monitor
 
class Oscilloscope
 
class LocalClientLink
 

Detailed Description

Communication client declaration.

Constructor & Destructor Documentation

◆ Client()

Client ( )
protected

Class constructor.

◆ ~Client()

virtual ~Client ( )
protectedvirtual

Class destructor.

Member Function Documentation

◆ abort()

Globals::Results abort ( )

Abort the current operation.

Returns
Returns Globals::resSuccess if some operation is in progress and the abort request was successfull setted, or Globals::resNoOperationRunning if no operation is in progress

This method is non blocking and returns immediatly without waiting for the effective operation abort.

◆ abortRequest()

bool abortRequest ( ) const
protected

Get the flag to abort operation.

Returns
The parameter value

◆ alarmHistoryClear()

Clear alarm history.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.AlarmHistoryClearData

◆ alarmHistoryInfo()

Get information on alarm history.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.AlarmHistoryInfoData

◆ alarmHistoryList()

Get alarm history list.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.AlarmHistoryListData

◆ alarmStackClear()

Clear alarm at index from the stack.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.AlarmStackClearData

◆ alarmStackClearAll()

Clear all alarms from the stack.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.AlarmStackClearAllData

◆ alarmStackClearSpec()

Clear specific alarm from the stack.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.AlarmStackClearSpecData

◆ alarmStackGet()

Get a single item from the alarm stack.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.AlarmStackGetData

◆ alarmStackInfo()

Get information about the alarm stack.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.AlarmStackInfoData

◆ alarmStackList()

Get the list of alarms in the stack.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.AlarmStackListData

◆ canC402Info()

Read CAN402 information for CANopen's workstation.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.CanC402InfoData

◆ canEmcyRead()

Read CANopen emergency.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.CanEmcyReadData

◆ canForceOrReleaseVariable()

bool canForceOrReleaseVariable ( Protocol::VarTypes type)
protected

Helper to check if the specified variable type can be forced or released.

Parameters
typeType of the variable to check
Returns
True if the specified type can be forced/released

◆ canNmtRead()

Read CANopen NMT status.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.CanNmtReadData

◆ canNmtWrite()

Write CANopen NMT status.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.CanNmtWriteData

◆ canObjRead()

Read CANopen object value.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.CanObjReadData

◆ canObjWrite()

Write CANopen object value.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.CanObjWriteData

◆ canRbxChDiag()

Read Robox diagnostic for CANopen's channel.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.CanRbxChDiagData

◆ canRbxWsDiag()

Read Robox diagnostic for CANopen's workstation.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.CanRbxWsDiagData

◆ canRxPdoRead()

Read Rx PDO data for CANopen's workstation.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.CanPdoReadData

◆ canTxPdoRead()

Read Tx PDO data for CANopen's workstation.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.CanPdoReadData

◆ checkSafeVarAvailability()

Globals::Results checkSafeVarAvailability ( ClientStruct::SafeModes safeMode,
bool & useSafeVar )
protected

Helper method to check if we can use safe variable operations.

Parameters
safeModeThe requested ClientStruct::SafeModes: if setted to ClientStruct::safeModeIfSupported the remote device firmware version will be checked
useSafeVarFlag to indicate if safe operation can be performed
Returns
Return the operation result code.

◆ command()

virtual Globals::Results command ( Message * cmd,
Message * asw,
ClientStruct::OperationData * data )
virtual

Execute a generic command sequence on the connected device.

Parameters
cmdThe command message.
aswThe answer message if the command was successfull executed, otherwise null
dataThe operation data.
Returns
Return the operation result code.

This method sends the command message and waits for the corresponding reply message, no later than a certain maximum time( maxCmdTimeout() property).

In case of success the answer message contains copy of the confirmation message; in case of failure the answer message contain the corresponding BCC error message.

When a Nack response message is received, the return result code is setted to resRemoteError and the operation data fields ClientStruct::ErrorData::nackErrCode(), ClientStruct::ErrorData::nackErrExtra() are updated

When a Abort response message is received or the operation is locally aborted, the return result code is setted to Globals::resAborted and the operation data fields ClientStruct::ErrorData::nackErrCode(), ClientStruct::ErrorData::nackErrExtra() are updated

Example of getting current data and time from the connected device:

// Create the command message
// NOTE: for more information about the GetDateTime message, look at BCC/31 Communication Protocol documentation.
Client* client;
// ... setup the client object using your logic here ....
Message cmd;
Message asw;
// Execute the command
if (client->command(&cmd, &asw, &data) == Globals::resSuccess)
{
cout <<
"Data " <<
StringHelper::fromU8(asw.getU8(3)) << "/" << // U8 offset 3 (day)
StringHelper::fromU8(asw.getU8(4)) << "/" << // U8 offset 4 (month)
StringHelper::fromU8(asw.getU16(5)) << // U16 offset 5 (year)
"Ora " <<
StringHelper::fromU8(asw.getU8(0)) << ":" << // U8 offset 0 (hour)
StringHelper::fromU8(asw.getU8(1)) << ":" << // U8 offset 1 (minute)
StringHelper::fromU8(asw.getU8(2)) << endl; // U8 offset 2 (second)
}
else
{
cout << "Unable to get the date and time:" << endl;
}
Communication client declaration.
Definition client.h:4639
virtual Globals::Results command(Message *cmd, Message *asw, ClientStruct::OperationData *data)
Execute a generic command sequence on the connected device.
The base operation data for all client operations.
Definition client.h:234
@ resSuccess
The operation completed successfully.
Definition globals.h:39
Message declaration for the BCC protocol.
Definition message.h:43
bool getU16(uint32_t offset, uint16_t &value)
Read an U16 value from the data buffer at the specified offset.
void setMsg(uint16_t msg)
Set the message code.
bool getU8(uint32_t offset, uint8_t &value)
Read an U8 value from the data buffer at the specified offset.
@ msgCodesGetDateTime
Get current date and time.
Definition message.h:780

Example of setting current date and time to the connected device.

// Create the command message with date '15/08/2013', time '09:35:50'.
// NOTE: for more information about the SetDateTime message, look at BCC/31 Communication Protocol documentation.
Client* client;
// ... setup the client object using your logic here ....
Message cmd;
Message asw;
cmd.setU8(3, 15); // U8 offset 3 (day)
cmd.setU8(4, 8); // U8 offset 4 (month)
cmd.setU16(5, 2013); // U16 offset 5 (year)
cmd.setU8(0, 9); // U8 offset 0 (hour)
cmd.setU8(1, 35); // U8 offset 1 (minute)
cmd.setU8(2, 50); // U8 offset 2 (second)
// Execute the command
if (client->command(&cmd, &asw, &data) == Globals::resSuccess)
{
cout << "Date and time set successfully" << endl;
}
else
{
cout << "Unable to set the date and time: " << endl;
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Message::ErrCodes nackErrCode() const
Get the received NACK error code : if the value equals Message::errCodesNoError then no NACK message ...
uint16_t nackErrExtra() const
Get the optional error extra data of the last NACK message received from the remote device.
bool setU8(uint32_t offset, uint8_t value)
Write an U8 value into the data buffer at the specified offset.
bool setU16(uint32_t offset, uint16_t value)
Write an U16 value into the data buffer at the specified offset.
@ errCodesNoError
No errors.
Definition message.h:353
@ msgCodesSetDateTime
Set current date and time.
Definition message.h:782

Example of decoding a NACK error message:

// Create a bad command message
Client* client;
// ... setup the client object using your logic here ....
Message cmd;
Message asw;
cmd.setMsg((Message::MsgCodes)0xffff); // Invalid message code
// Execute the bad command
if (client->command(&cmd, &asw, &data) == Globals::resRemoteError && data.nackErrCode() != Message::errCodesNoError)
{
cout << "Obtained error code = " << data.nackErrCode() << " extra = " << data.nackErrExtra() << endl;
}
@ resRemoteError
operation ended due to a error on the connected device
Definition globals.h:161
MsgCodes
The BCC protocol message codes.
Definition message.h:649
See also
ClientStruct::OperationData

◆ connected()

virtual bool connected ( )
virtual

The client connection state.

This value reflect the connected state of the underlying connection system.

◆ connection()

Connection * connection ( ) const

Get the Connection object.

Returns
The parameter value

◆ dataLoadSequence()

Execute a generic data load sequence to the connected device.

Parameters
dataReference to the operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

Example of manually loading of a ladder diagram task into memory:

Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
uint16_t process_id = 27; // Assign your own process ID
uint32_t flags = 0; // Assign your own flags
data.cmd().setDataLength(22);
ByteVector buffer;
FileHelper::read("saved_task.lad", buffer);
data.setRawData(buffer);
data.cmd().setU32(0, (uint32_t)data.rawData().size());
data.cmd().setU16(16, process_id);
data.cmd().setU32(18, flags);
cout << "Task successfully loaded" << endl;
else
{
cout << "Unable to load the task:" << endl;
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results dataLoadSequence(ClientStruct::DataLoadSequenceData &data)
Execute a generic data load sequence to the connected device.
The data for the dataLoadSequence method.
Definition client.h:655
void setRawData(const ByteVector &value)
Set the saved raw data. [IN].
ByteVector & rawData()
Get the saved raw data. [IN].
Message & cmd()
Get the command message. [IN].
bool setU32(uint32_t offset, uint32_t value)
Write an U32 value into the data buffer at the specified offset.
void setDataLength(uint8_t len)
Set the data buffer length.
@ msgCodesLadTaskSave
Save ladder task from device.
Definition message.h:906

◆ dataSaveSequence()

Execute a generic data save sequence from on the connected device.

Parameters
dataReference to the operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

Example of manually saving of a ladder diagram task from memory:

Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
uint16_t process_id = 27; // Assign your own process ID
uint32_t flags = 0; // Assign your own flags
data.cmd().setDataLength(22);
data.cmd().setU16(16, process_id);
data.cmd().setU32(18, flags);
{
cout << "Task successfully saved" << endl;
FileHelper::write("saved_task.lad", data.rawData(), 0, data.rawData().size(), true);
}
else
{
cout << "Unable to save the task:" << endl;
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results dataSaveSequence(ClientStruct::DataSaveSequenceData &data)
Execute a generic data save sequence from on the connected device.
The data for the dataSaveSequence method.
Definition client.h:641
ByteVector & rawData()
Get the saved raw data . [OUT].
Message & cmd()
Get the command message. [IN].

◆ doCanPdoRead()

Globals::Results doCanPdoRead ( ClientStruct::CanPdoReadData & data,
bool isTx )
protected

Read Tx/Rx PDO data for CANopen's workstation.

Parameters
dataThe operation data.
isTxSetted to read Tx PDO
Returns
Return the operation result code.

◆ doFbReadEntry()

Globals::Results doFbReadEntry ( ClientStruct::FbEntryData & data,
Message::MsgCodes msgCode )
protected

Helper for reading fieldbus entry.

Parameters
dataThe operation data.
msgCodeThe message code to handle
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbEntryData

◆ doFbReadNmt()

Globals::Results doFbReadNmt ( ClientStruct::FbReadNmtData & data,
Message::MsgCodes msgCode )
protected

Helper for reading fieldbus Nmt.

Parameters
dataThe operation data.
msgCodeThe message code to handle
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbReadNmtData

◆ doFbWriteEntry()

Globals::Results doFbWriteEntry ( ClientStruct::FbEntryData & data,
Message::MsgCodes msgCode )
protected

Helper for writing fieldbus entry.

Parameters
dataThe operation data.
msgCodeThe message code to handle
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbEntryData

◆ doFbWriteNmt()

Globals::Results doFbWriteNmt ( ClientStruct::FbWriteNmtData & data,
Message::MsgCodes msgCode )
protected

Helper for writing fieldbus Nmt.

Parameters
dataThe operation data.
msgCodeThe message code to handle
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbWriteNmtData

◆ doFlashFileLoad()

Globals::Results doFlashFileLoad ( ClientStruct::FlashFileLoadData & data)
protected

Load a file to the flash of the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

See documentation for Client::flashFileLoad(ClientStruct::FlashFileLoadData &)

◆ doGetDataFromReadVar()

Globals::Results doGetDataFromReadVar ( Message & asw,
const RVar::Base & var,
const RVar::Index & index,
Variable::Data::Vector & values )
protected

Helper to parse data stored into the asw message and fills the values list.

Parameters
aswThe message to read the data from
varThe variable read (Base )
indexThe index of the variable (Index)
valuesStorage for the data retrived from the message
Returns
Return the operation result code.

◆ doGetIBInfo()

virtual bool doGetIBInfo ( int & ibTx,
int & ibRx,
ClientStruct::OperationData & data )
protectedvirtual

Query informations for the data interlocking.

Parameters
ibTxReference to interlocking for trasmission
ibRxReference to interlocking for reception
dataThe operation data
Returns
The logical operation result.

◆ doQueryDeviceInfo()

Globals::Results doQueryDeviceInfo ( )
protected

Retrieves informations from connected device.

Returns
Returns Globals::resSuccess if the operation was successfully completed

This method wraps the Connection::queryDeviceInfo(Client *, bool, bool &) method call.

The values of m_devInfoValid field will be synched to the value of the Connection::devInfoValid() parameter

◆ doReadAxisVar()

Globals::Results doReadAxisVar ( ClientStruct::ReadVariableData & data)
protected

Helper to read an axis variable.

Parameters
dataThe operation data.
Returns
Return the operation result code.

◆ doReadBitVar()

Globals::Results doReadBitVar ( ClientStruct::ReadVariableData & data)
protected

Helper to read an bit variable.

Parameters
dataThe operation data.
Returns
Return the operation result code.

◆ doReadCachedVar()

Globals::Results doReadCachedVar ( ClientStruct::ReadVariableData & data)
protected

Helper to read the values of a cached variable.

Parameters
dataThe operation data with the chaced Id of the variable to read
Returns
Returns the operation result code

The variable must be previously cached with the method Connection.AddToVarsCache(string, string)

◆ doReadChVar()

Globals::Results doReadChVar ( ClientStruct::ReadVariableData & data)
protected

Helper to read a channel variable.

Parameters
dataThe operation data.
Returns
Return the operation result code.

◆ doReadNamedVar()

Globals::Results doReadNamedVar ( ClientStruct::ReadVariableData & data)
protected

Helper to read variable values from the connected device by specified data.Var.Name.

Parameters
dataThe operation data with the name of the variable to be read.
Returns
Return the operation result code.

◆ doReadStdVar()

Globals::Results doReadStdVar ( ClientStruct::ReadVariableData & data)
protected

Helper to read a standard variable.

Parameters
dataThe operation data.
Returns
Return the operation result code.

◆ doReadStringVar()

Globals::Results doReadStringVar ( ClientStruct::ReadVariableData & data)
protected

Helper to read a string variable.

Parameters
dataThe operation data.
Returns
Return the operation result code.

◆ doReleaseAxisVar()

Globals::Results doReleaseAxisVar ( ClientStruct::ReleaseVariableData & data)
protected

Helper to release an axis variable.

Parameters
dataThe operation data.
Returns
Return the operation result code.

◆ doReleaseBitVar()

Globals::Results doReleaseBitVar ( ClientStruct::ReleaseVariableData & data)
protected

Helper to release an bit variable.

Parameters
dataThe operation data.
Returns
Return the operation result code.

◆ doReleaseCachedVar()

Globals::Results doReleaseCachedVar ( ClientStruct::ReleaseVariableData & data)
protected

Helper to release a cached variable.

Parameters
dataThe operation data with the Id of the cached variable to release
Returns
Returns the operation result code

The variable must be previously cached with the method Connection.AddToVarsCache(string, string)

◆ doReleaseChVar()

Globals::Results doReleaseChVar ( ClientStruct::ReleaseVariableData & data)
protected

Helper to release a channel variable.

Parameters
dataThe operation data.
Returns
Return the operation result code.

◆ doReleaseStdVar()

Globals::Results doReleaseStdVar ( ClientStruct::ReleaseVariableData & data)
protected

Helper to release a standard variable.

Parameters
dataThe operation data.
Returns
Return the operation result code.

◆ doReleaseVarByName()

Globals::Results doReleaseVarByName ( ClientStruct::ReleaseVariableData & data)
protected

Helper to release a variable from the connected device specified by data.Name.

Parameters
dataThe operation data.
Returns
Return the operation result code.

◆ doSetDataToWriteVar()

Globals::Results doSetDataToWriteVar ( Message & msg,
bool useSafeVar,
RVar::Dict::VarData & varData,
Variable::Data::Vector & values,
int & valOffset )
protected

Helper to fill the msg with values from values

Parameters
msgThe message to fill (Message)
useSafeVarFlag to use safe variable commands
varDataThe Dict.VarData containing the variable data definition
valuesThe list of values to store into msg
valOffsetThe starting offset into values array of values
Returns
Returns the operation result code

◆ downloadSequence()

Execute a generic download sequence on the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

Example of manually getting a complete user report from the connected device:

// Prepare and execute the report information request
Client* client;
// ... setup the client object using your logic here ....
Message cmd;
Message asw;
// Execute the command
if (client->command(&cmd, &asw, &data) == Globals::resSuccess)
{
// Cache report information's
uint32_t oldId = 0;
uint32_t newId = 0;
uint32_t countId = 0;
asw.getU32(0, oldId);
asw.getU32(4, newId);
asw.getU32(8, countId);
// Prepare and execute the report download request
dsData.cmd().setDataLength(12);
dsData.cmd().setU32(0, oldId);
dsData.cmd().setU32(4, newId);
dsData.cmd().setU32(8, countId);
if (client->downloadSequence(dsData) == Globals::resSuccess)
{
// Print the obatined report content
String buffer;
for (int msgIdx = 0; msgIdx < dsData.list().size(); msgIdx++)
{
dsData.list()[msgIdx].getStringUTF8(14, buffer);
cout << buffer << endl;
}
}
else
{
cout << "Unable to get the report:" << endl;
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
}
else
{
cout << "Unable to get the report info:" << endl;
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results downloadSequence(ClientStruct::DownloadSequenceData &data)
Execute a generic download sequence on the connected device.
The data for the downloadSequence method.
Definition client.h:627
Message::Vector & list()
Get the list of received messages. [OUT].
Message & cmd()
Get the command message. [IN].
bool getU32(uint32_t offset, uint32_t &value)
Read an U32 value from the data buffer at the specified offset.
@ msgCodesReportInfo
Query report information.
Definition message.h:868
@ msgCodesReportList
Get report.
Definition message.h:870

◆ doWriteAxisVar()

Globals::Results doWriteAxisVar ( ClientStruct::BaseWriteVariableData & data,
bool force,
bool coherentValues )
protected

Helper to write or force an axis variable.

Parameters
dataThe operation data.
forceFlag to force the variable instead of write.
coherentValuesFlag to ensure coherent values operations
Returns
Return the operation result code.

◆ doWriteBitVar()

Globals::Results doWriteBitVar ( ClientStruct::BaseWriteVariableData & data,
bool force,
bool coherentValues )
protected

Helper to write a bit variable.

Parameters
dataThe operation data.
forceFlag to force the variable instead of write.
coherentValuesFlag to ensure coherent values operations
Returns
Return the operation result code.

◆ doWriteCachedVar()

Globals::Results doWriteCachedVar ( ClientStruct::BaseWriteVariableData & data,
bool force,
bool coherentValues )
protected

Helper to write or force the values to a cached variable.

Parameters
dataThe operation data with the Id of the cached variable to write
forceFlag to force the variable instead of write.
coherentValuesFlag to ensure coherent values operations
Returns
Returns the operation result code

The variable must be previously cached with the method Connection.AddToVarsCache(string, string)

◆ doWriteChVar()

Globals::Results doWriteChVar ( ClientStruct::BaseWriteVariableData & data,
bool force,
bool coherentValues )
protected

Helper to write or force a channel variable.

Parameters
dataThe operation data.
forceFlag to force the variable instead of write.
coherentValuesFlag to ensure coherent values operations
Returns
Return the operation result code.

◆ doWriteNamedVar()

Globals::Results doWriteNamedVar ( ClientStruct::BaseWriteVariableData & data,
bool force,
bool coherentValues )
protected

Helper to write or force variable values to the connected device by specified data.Var.Name.

Parameters
dataThe operation data.
forceFlag to force the variable instead of write.
coherentValuesFlag to ensure coherent values operations
Returns
Return the operation result code.

◆ doWriteStdVar()

Globals::Results doWriteStdVar ( ClientStruct::BaseWriteVariableData & data,
bool force,
bool coherentValues )
protected

Helper to write or force a standard variable.

Parameters
dataThe operation data.
forceFlag to force the variable instead of write.
coherentValuesFlag to ensure coherent values operations
Returns
Return the operation result code.

◆ doWriteStringVar()

Globals::Results doWriteStringVar ( ClientStruct::BaseWriteVariableData & data,
bool force,
bool coherentValues )
protected

Helper to write or force a string variable.

Parameters
dataThe operation data.
forceFlag to force the variable instead of write.
coherentValuesFlag to ensure coherent values operations
Returns
Return the operation result code.

◆ doWriteVariable()

Globals::Results doWriteVariable ( ClientStruct::BaseWriteVariableData & data,
bool force,
bool coherentValues )
protected

Helper method to write or force a variable.

Parameters
dataThe operation data
forceFlag setted to force the variable, resetted to write the variable
coherentValuesFlag setted to use coherent operations , i.e. don't split the command into multiple requests
Returns
Return the operation result code.

◆ fbLoadFirmware()

load firmware file for fieldbus

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbLoadFirmwareData

◆ fbReadCanEntry()

Globals::Results fbReadCanEntry ( ClientStruct::FbEntryData & data)

Read entry from fieldbus CANopen interface.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbEntryData

◆ fbReadCanNmt()

Read NMT from fieldbus CANopen interface.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbNmtData, Client.FbReadNmtData

and

◆ fbReadCoeEntry()

Globals::Results fbReadCoeEntry ( ClientStruct::FbEntryData & data)

Read entry from fieldbus EtherCAT (CoE) interface.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbEntryData

◆ fbReadEcatNmt()

Read NMT from fieldbus EtherCAT interface.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbReadEcatNmtData

◆ fbReadIf()

Read fieldbus interface.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbReadIfData

◆ fbReadLocalEntry()

Globals::Results fbReadLocalEntry ( ClientStruct::FbEntryData & data)

Read entry from fieldbus local interface.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbEntryData

◆ fbReadLocalNmt()

Read NMT from fieldbus local interface.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbNmtData, Client.FbReadNmtData

and

◆ fbWriteCanEntry()

Globals::Results fbWriteCanEntry ( ClientStruct::FbEntryData & data)

Write to from fieldbus CANopen interface.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbEntryData

◆ fbWriteCanNmt()

Write NMT to fieldbus CANopen interface.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbNmtData, Client.FbWriteNmtData

and

◆ fbWriteCoeEntry()

Globals::Results fbWriteCoeEntry ( ClientStruct::FbEntryData & data)

Write to from fieldbus local interface.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbEntryData

◆ fbWriteEcatNmt()

Write NMT from fieldbus EtherCAT interface.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbWriteEcatNmtData

◆ fbWriteIf()

Write fieldbus interface.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbWriteIfData

◆ fbWriteLocalEntry()

Globals::Results fbWriteLocalEntry ( ClientStruct::FbEntryData & data)

Write to from fieldbus local interface.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbEntryData

◆ fbWriteLocalNmt()

Write NMT to fieldbus local interface.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.FbNmtData, Client.FbWriteNmtData

and

◆ fillSystemInfoData()

void fillSystemInfoData ( Message & msg,
ClientStruct::SystemInfoData & data )

Fill the SysInfoData data structure from the content of the Message msg.

Parameters
msgThe source message from which retrive the data
dataThe object to fill

◆ flashDir()

Get the content of the flash on the conencted device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

Example of enumeration of flash files:

// Prepare and execute the request to enumarate the files
// contained in the /fa path, using absolute paths.
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
data.setPath("/fa/*");
if (client->flashDir(data) == Globals::resSuccess)
{
// Print all obained flash files
for (int itemIdx = 0; itemIdx < data.items().size(); itemIdx++)
{
cout << "File " << data.items()[itemIdx].name() << " , dimensione " << data.items()[itemIdx].size() << endl;
}
}
else
{
cout << "Unable to get the flash content:" << endl;
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results flashDir(ClientStruct::FlashDirData &data)
Get the content of the flash on the conencted device.
The data for the FlashDir method.
Definition client.h:863
FlashItem::Vector & items()
Get the result list of flash items. [OUT].
void setFlags(Flagss value)
Set the operation flags. [IN].
void setPath(String value)
Set the source path, with optionally jolly characters. [IN].
Flagss
The available operation flags.
Definition client.h:875
@ fAbsPath
List items with absolute path.
Definition client.h:878
@ fListFiles
List files.
Definition client.h:884
size_t size() const
Get the number of elements in the container.
@ attrTypeElFile
The item is a file.
Definition client.h:826
@ attrTypeElType
The item type mask.
Definition client.h:824
See also
ClientStruct::FlashDirData

◆ flashDiskBackup()

Backup a flash content to the backup area of the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

For more detailed information about managing flashes look at the RTE Firmware Documentation.


◆ flashDiskCreate()

Create a flash in the physical storage of the connected device.

Parameters
dataReference to the operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

For more detailed information about managing flashes look at the RTE Firmware Documentation.


◆ flashDiskDelete()

Delete a flash form the physical storage of the connected device.

Parameters
dataReference to the operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

For more detailed information about managing flashes look at the RTE Firmware Documentation.


◆ flashDiskRestore()

Restore a flash content from the backup area of the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

WARNING: all previous data in the flash will be overwritten with files restored from the backup area!

This method make use of the state and progress events.

For more detailed information about managing flashes look at the RTE Firmware Documentation.


◆ flashFileDelete()

Delete files from the flash of the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

Example of deleting files from the flash:

// Prepare and execute request for deleting al .DAT files
// in the flash folder /fb.
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
data.setFileMask("/fb/*.dat");
if (client->flashFileDelete(data) == Globals::resSuccess)
{
cout << "Successfully delete {" << data.count() << "} file(s)" << endl;
}
else
{
cout << "Unable to delete the files:" << endl;
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results flashFileDelete(ClientStruct::FlashFileDeleteData &data)
Delete files from the flash of the connected device.
The data for the flashFileDelete method.
Definition client.h:1021
void setFileMask(String value)
Set the file to be delete, with optionally jolly characters. [IN].
int32_t count() const
Get the number of deleted objects. [OUT].
See also
ClientStruct::FlashFileDeleteData

◆ flashFileInfo()

Get information for a file in the flash of the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

Example of getting information of a file in the flash:

// Prepare and execute request for getting information for file /fa/mydata.dat
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
data.setSource / ("/fa/mydata.dat");
if (client->flashFileInfo(data) == Globals::resSuccess)
{
cout << "File " << data.info().name() << ", last modification " << data.info().dateTime() << endl;
}
else
{
cout << "Unable to get file info :" << endl;
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results flashFileInfo(ClientStruct::FlashFileInfoData &data)
Get information for a file in the flash of the connected device.
The data for the flashFileInfo method.
Definition client.h:1087
void setFlags(Flagss value)
Set the operation flags. [IN].
void setSource(String value)
Set the source file name. [IN].
FlashItem & info()
Get the obtained source file information. [OUT].
Flagss
The available operation flags.
Definition client.h:1098
@ fAbsPath
List items with absolute path.
Definition client.h:1101
@ fDateTimeModify
Get date and time of last file modification.
Definition client.h:1107
String name() const
Get the element name.
time_t dateTime() const
Get the element date and time.
See also
ClientStruct::FlashFileInfoData

◆ flashFileLoad()

Load a file to the flash of the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

The files are also loaded into the ramdisk with this same command, only need to specify the path corresponding to the desired ramdisk.

Example of loading a file to the flash.

// Prepare and execute the request to load the local
// file C:\MyFile.dat to the target flash in path /fa
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
data.setSource("C:\\MyFile.dat");
data.setTarget("/fa/myfile.dat");
if (client->flashFileLoad(data) == Globals::resSuccess)
{
cout << "File successfully loaded" << endl;
}
else
{
cout << "Unable to load the file:") << endl;
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results flashFileLoad(ClientStruct::FlashFileLoadData &data)
Load a file to the flash of the connected device.
The data for the flashFileLoad method.
Definition client.h:915
void setFlags(Flagss value)
Set the operation flags. [IN].
void setSource(String value)
Set the source file name. [IN].
void setTarget(String value)
Set the target file name. [IN].
@ fOverwrite
Overwrite target file.
Definition client.h:930
See also
ClientStruct::FlashFileLoadData

◆ flashFileRename()

Rename a file in the flash of the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

Example of renaming of a file in the flash:

// Prepare and execute request for renaming the file /fa/mydata.dat
// to /fa/mydata-old.dat
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
data.setSource("/fa / mydata.dat");
data.setTarget("/fa / mydata - old.dat");
if (client->flashFileRename(data) == Globals::resSuccess)
{
cout << "File successfully renamed" << endl;
}
else
{
cout << "Unable to rename the file:" << endl;
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results flashFileRename(ClientStruct::FlashFileRenameData &data)
Rename a file in the flash of the connected device.
The data for the flashFileRename method.
Definition client.h:1054
void setFlags(Flagss value)
Set the operation flags. [IN].
void setSource(String value)
Set the source file name. [IN].
void setTarget(String value)
Set the target file name. [IN].
@ fOverwrite
Overwrite target file.
Definition client.h:1068
See also
Client.FlashFileRenameData

◆ flashFileSave()

Save a file from the flash of the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

The files are also saved from the ramdisk with this same command, only need to specify the path corresponding to the desired ramdisk.

Example of saving a file from the flash.

// Prepare and execute the request to save the flash
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
data.setSource("/fa/myfile.dat");
data.setTarget("C:\\MyFile.dat");
if (client->flashFileSave(data) == Globals::resSuccess)
{
cout << "File successfully saved" << endl;
}
else
{
cout << "Unable to save the file:" << endl;
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results flashFileSave(ClientStruct::FlashFileSaveData &data)
Save a file from the flash of the connected device.
The data for the flashFileSave method.
Definition client.h:986
void setFlags(Flagss value)
Set the operation flags. [IN].
void setSource(String value)
Set the source file name. [IN].
void setTarget(String value)
Set the target file name. [IN].
@ fOverwrite
Overwrite target file.
Definition client.h:1000
See also
ClientStruct::flashFileSaveData

◆ flashFolderCreate()

Create a folder in the flash of the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

Example of creating a folder in the flash:

// Prepare and execute request for creating the folder /data/recipes/active
// in the flash, creating non existing path levels.
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
data.setPath("/data/recipes/active");
{
cout << "Folder sucessfully created" << endl;
}
else
{
cout << "Unable to create the folder:" << endl;
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results flashFolderCreate(ClientStruct::FlashFolderCreateData &data)
Create a folder in the flash of the connected device.
The data for the flashFolderCreate method.
Definition client.h:1152
void setFlags(Flagss value)
Set the operation flags. [IN].
void setPath(String value)
Set the target folder path. [IN].
Flagss
The available operation flags.
Definition client.h:1175
@ fSkipExisting
Skip existing path levels.
Definition client.h:1179
@ fRecursive
Create all path levels.
Definition client.h:1177
See also
ClientStruct::FlashFolderCreateData


◆ flashFolderDelete()

Delete a folder in the flash of the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

// Prepare and execute request for removing the folder /data/recipes/ in the flash,
// removing all the content recursively (all contained folder and files)
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
data.setPath("/data/recipes");
{
cout << "Folder sucessfully deleted" << endl;
}
else
{
cout << "Unable to delete the folder:" << endl;
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results flashFolderDelete(ClientStruct::FlashFolderDeleteData &data)
Delete a folder in the flash of the connected device.
The data for the flashFolderDelete method.
Definition client.h:1197
void setFlags(Flagss value)
Set the operation flags. [IN].
void setPath(String value)
Set the target folder path. [IN].
Flagss
The available operation flags.
Definition client.h:1209
@ fDeleteContent
Remove the entire content of all path levels.
Definition client.h:1214
@ fRecursive
Delete all path levels recursively.
Definition client.h:1212
See also
ClientStruct::FlashFolderDeleteData

◆ flashFolderInfo()

Get information for a folder in the flash of the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

Example of getting information of a folder in the flash:

// Prepare and execute request for getting information for file /data/recipes
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
data.setPath("/data/recipes");
if (client->flashFolderInfo(data) == Globals::resSuccess)
{
cout << "Folder " << data.info().name() << ", last access ") << data.info().dateTime() << endl;
}
else
{
cout << "Unable to get folder info:" << endl;
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results flashFolderInfo(ClientStruct::FlashFolderInfoData &data)
Get information for a folder in the flash of the connected device.
The data for the flashFolderInfo method.
Definition client.h:1231
void setFlags(Flagss value)
Set the operation flags. [IN].
FlashItem & info()
Get the obtained folder infomation. [OUT].
void setPath(String value)
Set the target folder path. [IN].
@ fDateTimeAccess
Get date and time of file creation.
Definition client.h:1253
See also
ClientStruct::FlashFolderInfoData

◆ flashFormat()

Format a flash of the connecte device.

Parameters
dataReference to the operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

For more detailed information about managing flashes look at the RTE Firmware Documentation.


See also
ClientStruct::FlashFormatData

◆ flashSetAttributes()

Sets attributes for flash's objects (files/folders)

Parameters
dataThe operation data.
Returns
Return the operation result code.

◆ flushMessages()

virtual Globals::Results flushMessages ( )
virtual

Flush messages in the client ingoing queue.

Returns
Return the operation result code.

◆ forceVariable()

Force variable values on the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

Example of forcing a bit of a physical 16bit output word.

// Prepare and execute the request to atomically force to 'on'
// the bit 5 of the physical 16bit output at index 1
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
varData.setBoolean(true);
data.values().pushBack(varData);
if (client->forceVariable(data) == Globals::resSuccess)
{
cout << "Variable successully forced" << endl;
}
else
{
cout << "Unable to force the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results forceVariable(ClientStruct::ForceVariableData &data)
Force variable values on the connected device.
The data for the forceVariable method.
Definition client.h:4570
Class to handle variable data values.
Definition variable.h:52
void setBoolean(bool value)
Sets the value to the specified one and type to Types::dtBool.
static Variable fromBitPhyOW16(uint32_t index, uint32_t bit)
Factory method to create and initialize a Message::varBitPhyOW16 variable.

Example of forcing a logical 16bit input word.

// Prepare and execute the request to force to value
// 0x8F0A the logical 16bit word ad index 1.
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
varData.setU16(0x8f0a);
data.values().pushBack(varData);
if (client->forceVariable(data) == Globals::resSuccess)
{
cout << "Variable successully forced" << endl;
}
else
{
cout << "Unable to force the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
void setU16(uint16_t value)
Sets the value to the specified one and type to Types::dtU16.
static Variable fromLogIW16(uint32_t index, uint32_t count=1)
Factory method to create and initialize a Message::varLogIW16 variable.

Example of forcing a bit of a physical 16bit output word.

// Prepare and execute the request to atomically force to 'on'
// the bit 5 of the physical 16bit output at index 1
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
varData.setBoolean(true);
data.values().pushBack(varData);
if (client->forceVariable(data) == Globals::resSuccess)
{
cout << "Variable successully forced" << endl;
}
else
{
cout << "Unable to force the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}

Example of forcing a logical 16bit input word specified by name.

// Prepare and execute the request to atomically force to 'on'
// the bit 5 of the physical 16bit input at index 100
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
varData.setU16(1);
data.values().pushBack(varData);
if (client->forceVariable(data) == Globals::resSuccess)
{
cout << "Variable successully forced" << endl;
}
else
{
cout << "Unable to force the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
static Variable fromName(const String &name)
Factory method to create and initialize a Message::varNamed variable.

Example of forcing a logical 16bit input word specified by name and stored into the cache:

// Prepare and execute the request to atomically force to 'on'
// the bit 5 of the physical 16bit input at index 100
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// ... setup the connection object using your logic here ....
uint32_t cacheId = connection->addToVarsCache("inp_w 100.5");
if (cacheId != 0)
{
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
Variable::Data varData;
varData.setU16(1);
data.values().pushBack(varData);
if (client->forceVariable(data) == Globals::resSuccess)
{
cout << "Variable successully forced" << endl;
}
else
{
cout << "Unable to force the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
}
Connection * connection() const
Get the Connection object.
Communication client declaration.
Definition connection.h:48
uint32_t addToVarsCache(const String &name, const String &extraTag="")
Adds a variable to the cache.
static Variable fromCache(uint32_t cacheId)
Factory method to create and initialize a Message::varNamed variable.

This method make use of the state and progress events.

For more information about parameter and axis parameter indexes, look at R3 Programming Language documentation, chapter Prefined Variables.

The Count and AxCount attributes are not present in the ForceVariableData class because they are automatically calculated based on the content of the Values list.

The above examples show the usage of the raccomended method to initialize a Variable object , i.e. using the factory helper function for the specific data type, but you can allocate the object by your own and set the getSingle specific parameters required for the variable data type.

See also
ClientStruct.ForceVariableData, Message::VarTypes

◆ id()

uint64_t id ( ) const

Get the object identifier.

Returns
The object identifier

◆ localLink()

LocalClientLink * localLink ( ) const
protected

Get the LocalClientLink object.

Returns
The parameter value

◆ maxCmdTimeout()

int32_t maxCmdTimeout ( ) const

Get the maximum generic command timeout [ms].

Returns
The parameter value

◆ maxWaitTimeout()

int32_t maxWaitTimeout ( ) const

Get the maximum generic wait timeout [ms].

Returns
The parameter value

◆ nextCommandPid()

uint8_t nextCommandPid ( )
protected

Get the next command Pid.

Returns
The next command Pid

◆ outQueue()

MessageQueue * outQueue ( ) const
protected

Get the outgoing message queue.

Returns
The parameter value

◆ ping()

Execute a ping sequence on the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

Example of testing communication timing with the connected device:

// Prepare and execute the request
Client* client;
// ... setup the client object using your logic here ....
if (client->ping(data) == Globals::resSuccess)
{
cout << "Ping with time of " << data.time() << "ms" << endl;
}
else
{
cout << "Unable to ping:" << endl;
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results ping(ClientStruct::PingData &data)
Execute a ping sequence on the connected device.
The data for the Ping method.
Definition client.h:288
uint32_t time() const
Get the time difference between transmission and reception [ms]. [OUT].

◆ popIn()

virtual Globals::Results popIn ( Message * msg)
virtual

Receive a message from the connected device.

Parameters
msgThe removed message, if successfully.
Returns
Return the operation result code.

◆ popOut()

virtual Globals::Results popOut ( Message * msg)
virtual

Remove the first message sent to the connected device but not yet started (still present in the client outgoing queue).

Parameters
msgThe removed message, if successfully.
Returns
Return the operation result code.

◆ pushIn()

virtual Globals::Results pushIn ( Message * msg)
virtual

Emulate a message reception from the connected device.

Parameters
msgThe desired message.
Returns
Return the operation result code

◆ pushOut()

virtual Globals::Results pushOut ( Message * msg)
virtual

Send the message to the connected device.

Parameters
msgThe desired message.
Returns
Return the operation result code.

◆ readVariable()

Read variable values from the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

Example of reading volatile integer 32bit registers:

// Prepare and execute the request for reading 16 consecutive
// volatile integer 32bit registers from index 1
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
if (client->readVariable(data) == Globals::resSuccess)
{
// Print the obtained values
for (size_t valIdx = 0; valIdx < data.values().size(); valIdx++)
{
cout << data.values()[valIdx].getU32() << " ";
}
cout << "\n";
}
else
{
cout << "Unable to read the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results readVariable(ClientStruct::ReadVariableData &data)
Read variable values from the connected device.
The data for the readVariable method.
Definition client.h:4411
static Variable fromVR32(uint32_t index, uint32_t count=1)
Factory method to create and initialize a Message::varVR32 variable.
// Prepare and execute the request for reading 300 consecutive
// volatile integer 32bit registers from index 1
// Note that 300 exceeds the maximum BCC protocol specification
// so the operation will be performed only in non coherent values operation
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Setting the flag CoherentValues to true will produce an error: the default value is false
// data.CoherentValues = true;
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
if (client->readVariable(data) == Globals::resSuccess)
{
// Print the obtained values
for (size_t valIdx = 0; valIdx < data.values().size(); valIdx++)
{
cout << data.values()[valIdx].getU32() << " ";
}
cout << "\n";
}
else
{
cout << "Unable to read the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}

Example of reading a non volatile string register:

// Prepare and execute the request for reading
// a volatile string register at index 1
Client* client; // Initialize your own client
// ... Setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
if (client->readVariable(data) == Globals::resSuccess)
{
// Print the obtained values
for (size_t valIdx = 0; valIdx < data.values().size(); valIdx++)
{
cout << data.values()[valIdx].getString() << " ";
}
cout << "\n";
}
else
{
cout << "Unable to read the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
static Variable fromNvSR(uint32_t index, uint32_t size=128)
Factory method to create and initialize a Message::varNvSR variable.

Example of reading a real axis parameter:

// Prepare and execute the request for reading
// the current position (CP) for axes from 5 to 8
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
if (client->readVariable(data) == Globals::resSuccess)
{
// Print the obtained values
for (size_t valIdx = 0; valIdx < data.values().size(); valIdx++)
{
cout << data.values()[valIdx].getDouble() << " ";
}
cout << "\n";
}
else
{
cout << "Unable to read the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
static Variable fromAxisR(uint32_t index, uint32_t axIndex, uint32_t axCount=1)
Factory method to create and initialize a Message::varAxisR variable.

Example of reading volatile integer 32bit registers specified by name:

// Prepare and execute the request for reading 50 consecutive
// volatile integer 32bit registers from index 100
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Setting the flag coherentValues() to true will produce an error: the default value is false
// data.setCoherentValues(true);
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
if (client->readVariable(data) == Globals::resSuccess)
{
// Print the obtained values
for (size_t valIdx = 0; valIdx < data.values().size(); valIdx++)
{
cout << data.values()[valIdx].getU32() << " ";
}
cout << "\n";
}
else
{
cout << "Unable to read the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}

Example of reading volatile integer 32bit registers specified by name and stored into the cache:

// Prepare and execute the request for caching and reading 50 consecutive
// volatile integer 32bit registers from index 100
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// ... setup the connection object using your logic here ....
uint32_t cacheId = connection->addToVarsCache("R 100 ,50");
if (cacheId != 0) {
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
if (client->readVariable(data) == Globals::resSuccess)
{
// Print the obtained values
for (size_t valIdx = 0; valIdx < data.values().size(); valIdx++)
{
cout << data.values()[valIdx].getU32() << " ";
}
cout << "\n";
}
else
{
cout << "Unable to read the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
}

This method make use of the state and progress events.

Although there is the possibility to read specific bits of a variable it is advisable, for performance reasons, reading the variable in full (for example if you need a bit from integer register, its better to read the whole register value and then test the desired bit).

For more information about parameter and axis parameter indexes, look at R3 Programming Language documentation, chapter Prefined Variables.

The ClientStruct.ReadVariableData.coherentValues() defaults to false so you can perform operations returning a number of data above the BCC protocol specification. The method will provide to send multile commands to acomplish the BCC protocol data size, so the data consistency is not guaranteed

The above examples show the usage of the raccomended method to initialize a Variable object , i.e. using the factory helper function for the specific data type, but you can allocate the object by your own and set the getSingle specific parameters required for the variable data type.

See also
Variable, ClientStruct.ReadVariableData, Message::VarTypes

◆ reconnecting()

virtual bool reconnecting ( )
virtual

The client reconnection state.

Returns
The client reconnection state.

Value of true indicate the there is a reconnection action in progress.

◆ releaseAllVariables()

Release all variables value on the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

WARNING: this method will release all the forced variables on the connected device, including those set by other subjects / connections, for which there could be unwanted side effects.

◆ releaseVariable()

Release variable values on the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

Example of releasing a bit of a physical 16bit output word.

// Prepare and execute the request to release
// the bit 5 of the physical 16bit output at index 1
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
if (client->releaseVariable(data) == Globals::resSuccess)
cout << "Variable successully released" << endl;
else
{
cout << "Unable to release the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results releaseVariable(ClientStruct::ReleaseVariableData &data)
Release variable values on the connected device.
The data for the releaseVariable method.
Definition client.h:4589

Example of releasing a logical 16bit input word.

// Prepare and execute the request to release
// the logical 16bit input word ad index 1.
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
if (client->releaseVariable(data) == Globals::resSuccess)
cout << "Variable successully released" << endl;
else
{
cout << "Unable to release the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}

Example of releasing a logical 16bit input word specified by name.

// Prepare and execute the request to release
// the bit 5 of the physical 16bit input at index 1
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
if (client->releaseVariable(data) == Globals::resSuccess)
cout << "Variable successully released" << endl;
else
{
cout << "Unable to release the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}

Example of releasing a logical 16bit input word specified by name and stored into the cache.

// Prepare and execute the request to release
// the bit 5 of the physical 16bit input at index 1
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// ... setup the connection object using your logic here ....
uint32_t cacheId = connection->addToVarsCache("inp_w 100.5");
if (cacheId != 0)
{
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
if (client->releaseVariable(data) == Globals::resSuccess)
cout << "Variable successully released" << endl;
else
{
cout << "Unable to release the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
}

This method make use of the state and progress events.

For more information about parameter and axis parameter indexes, look at R3 Programming Language documentation, chapter Prefined Variables.

The above examples show the usage of the raccomended method to initialize a Variable object , i.e. using the factory helper function for the specific data type, but you can allocate the object by your own and set the getSingle specific parameters required for the variable data type.

See also
ClientStruct.ReleaseVariableData, Message::VarTypes

◆ replyBusy()

Globals::Results replyBusy ( Message * src)

Reply with a BUSY message to the source message.

Parameters
srcThe source message.
Returns
Return the operation result code.

The reply message will be sent immediately to the connected device.

See also
Message

◆ replyMsg()

Globals::Results replyMsg ( Message * src,
Message::MsgCodes msgCode,
void * data,
uint8_t len = 0 )

Reply with a generic message to the source message.

Parameters
srcThe source message.
msgCodeThe message code.
dataThe message data (null=no data)
lenThe message data len (0=no data)
Returns
Return the operation result code.

The reply message will be sent immediately to the connected device.

See also
Message

◆ reportClear()

Clear user report.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.ReportClearData

◆ reportInfo()

Read information for user report.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.ReportInfoData

◆ reportList()

Read list for user report.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.ReportListData

◆ reportSetMode()

Set mode for user report.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.ReportSetModeData

◆ setAbortRequest()

void setAbortRequest ( bool value)
protected

Set the flag to abort operation.

Parameters
valueThe value to set

◆ setConnection()

void setConnection ( Connection * value)

Set the Connection object.

Parameters
valueThe value to set

◆ setLocalLink()

void setLocalLink ( LocalClientLink * value)
protected

Set the LocalClientLink object.

Parameters
valueThe value to set

◆ setMaxCmdTimeout()

void setMaxCmdTimeout ( int value)

Set the maximum generic command timeout [ms].

Parameters
valueThe value to set

◆ setMaxWaitTimeout()

void setMaxWaitTimeout ( int value)

Set the maximum generic wait timeout [ms].

Parameters
valueThe value to set

◆ setOutQueue()

void setOutQueue ( MessageQueue * value)
protected

Set the outgoing message queue.

Parameters
valueThe value to set

◆ setSourceCh()

void setSourceCh ( uint8_t value)
virtual

Set the client source channel.

Parameters
valueThe value to set

◆ setSourceId()

void setSourceId ( uint8_t value)
virtual

Set the client source identifier.

Parameters
valueThe value to set

◆ setTargetCh()

void setTargetCh ( uint8_t value)
virtual

Set the client target channel.

Parameters
valueThe value to set

◆ setTargetId()

void setTargetId ( uint8_t value)
virtual

Set the client target identifier.

Parameters
valueThe value to set

◆ sourceCh()

uint8_t sourceCh ( )
virtual

Get the client source channel.

Returns
The parameter value

◆ sourceId()

uint8_t sourceId ( )
virtual

Get the client source identifier.

Returns
The parameter value

◆ sysReportClear()

Clear system report.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.SysReportClearData

◆ sysReportInfo()

Read information for system report.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.SysReportInfoData

◆ sysReportList()

Read list for system report.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.SysReportListData

◆ sysReportSetMode()

Set mode for system report.

Parameters
dataThe operation data.
Returns
Return the operation result code.

This method make use of the state and progress events.

See also
Client.SysReportSetModeData

◆ systemInfo()

Get the system information from the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

◆ targetCh()

uint8_t targetCh ( )
virtual

Get the client target channel.

Returns
The parameter value

◆ targetId()

uint8_t targetId ( )
virtual

Get the client target identifier.

Returns
The parameter value

◆ txNumBlock()

int txNumBlock ( ClientStruct::OperationData * data = nullptr)

Query the data interlocking value (trasmission)

Parameters
dataThe operation data (opz)
Returns
Returns the data interlocking value

◆ writeVariable()

Write variable values to the connected device.

Parameters
dataThe operation data.
Returns
Return the operation result code.

Example of writing volatile real registers:

// Prepare and execute the request for writing
// 8 consecutive register starting from index 1
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
for (int i = 0; i < 8; i++)
{
varData.setDouble(i);
data.values().pushBack(varData);
}
if (client->writeVariable(data) == Globals::resSuccess)
cout << "Variable successully written" << endl;
else
{
cout << "Unable to write the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
Globals::Results writeVariable(ClientStruct::WriteVariableData &data)
Write variable values to the connected device.
The data for the writeVariable method.
Definition client.h:4544
void setDouble(double value)
Sets the value to the specified one and type to Types::dtDouble.
static Variable fromVRR(uint32_t index, uint32_t count=1)
Factory method to create and initialize a Message::varVRR variable.

Example of writing a volatile string register:

// Prepare and execute the request for writing
// the volatile string register at index 1
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
varData.setString("My tring to write");
data.values().pushBack(varData);
if (client->writeVariable(data) == Globals::resSuccess)
cout << "Variable successully written" << endl;
else
{
cout << "Unable to write the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
void setString(const String &value)
Sets the value to the specified one and type to Types::dtString.
static Variable fromVSR(uint32_t index, uint32_t size=128)
Factory method to create and initialize a Message::varVSR variable.

Example of writing a real parameter:

// Prepare and execute the request for writing
// the feed rate parameter with value of 0.75.
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
ClientStruct::WriteVariableData data(Variable::fromParamR(8)); // 8 = index of the FR real parameter
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
varData.setDouble(0.75);
data.values().pushBack(varData);
if (client->writeVariable(data) == Globals::resSuccess)
cout << "Variable successully written" << endl;
else
{
cout << "Unable to write the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
static Variable fromParamR(uint32_t index, uint32_t count=1)
Factory method to create and initialize a Message::varParamR variable.

Example of writing volatile real registers with non coherent values:

// Prepare and execute the request for writing
// 300 consecutive register starting from index 1
// Note that 300 exceeds the maximum BCC protocol specification
// so the operation will be performed only in non coherent values operation
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Setting the flag coherentValues() to true will produce an error: the default value is false
// data.setCoherentValues(true);
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
for (int i = 0; i < 300; i++)
{
varData.setDouble(i);
data.values().pushBack(varData);
}
if (client->writeVariable(data) == Globals::resSuccess)
cout << "Variable successully written" << endl;
else
{
cout << "Unable to write the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}

Example of writing volatile real registers specified by name:

// Prepare and execute the request for writing
// 50 consecutive register starting from index 1
// Note that 50 exceeds the maximum BCC protocol specification
// so the operation will be performed only in non coherent values operation
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// Setup the variable object using a proper helper function
// Setting the flag coherentValues() to true will produce an error: the default value is false
// data.setCoherentValues(true);
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
for (int i = 0; i < 50; i++)
{
varData.setDouble(i);
data.values().pushBack(varData);
}
if (client->writeVariable(data) == Globals::resSuccess)
cout << "Variable successully written" << endl;
else
{
cout << "Unable to write the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}

Example of writing volatile integer 32bit registers specified by name and stored into the cache:

// Prepare and execute the request for caching and writing 50 consecutive
// volatile integer 32bit registers from index 100
Client* client; // Initialize your own client
// ... setup the client object using your logic here ....
// ... setup the connection object using your logic here ....
uint32_t cacheId = connection->addToVarsCache("R 100 ,50");
if (cacheId != 0)
{
// Setup the variable object using a proper helper function
// Choose a proper safe mode : defaults is ClientStruct::safeModeIfSupported;
//data.setSafe(ClientStruct::safeModeIfSupported);
Variable::Data varData;
for (int i = 0; i < 50; i++)
{
varData.setDouble(i);
data.values().pushBack(varData);
}
if (client->writeVariable(data) == Globals::resSuccess)
cout << "Variable successully written" << endl;
else
{
cout << "Unable to write the variable:" << endl;
if (data.nackErrCode() != Message::errCodesNoError)
cout << "NackErrCode = " << data.nackErrCode() << " NackErrExtra = " << data.nackErrExtra() << endl;
}
}

This method make use of the state and progress events.

For more information about parameter and axis parameter indexes, look at R3 Programming Language documentation, chapter Prefined Variables.

The Count and AxCount attributes are not present in the ClientStruct.WriteVariableData class because they are automatically calculated based on the content of the Values list.

The ClientStruct.WriteVariableData.coherentValues() defaults to false so you can perform write operations on a number of data above the BCC protocol specification. The method will provide to send multile commands to acomplish the BCC protocol data size, so the data consistency is not guaranteed

The above examples show the usage of the raccomended method to initialize a Variable object , i.e. using the factory helper function for the specific data type, but you can allocate the object by your own and set the getSingle specific parameters required for the variable data type.

See also
ClientStruct.WriteVariableData, Message::VarTypes

Friends And Related Symbol Documentation

◆ Connection

friend class Connection
friend

◆ LocalClientLink

friend class LocalClientLink
friend

◆ Monitor

friend class Monitor
friend

◆ Oscilloscope

friend class Oscilloscope
friend

◆ TcpIpConnection

friend class TcpIpConnection
friend

Member Data Documentation

◆ m_commandPid

uint8_t m_commandPid
protected

Command protocol Id.

◆ m_pidLock

std::recursive_timed_mutex m_pidLock
protected

Object to lock the m_commandPid when generating the next pid value