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

Abstract base class for monitors handling. More...

#include <basemonitor.h>

Inheritance diagram for BaseMonitor:
Monitor

Public Member Functions

 BaseMonitor ()
 Class constructor.
 
virtual ~BaseMonitor ()
 Class desstructor.
 
virtual Globals::Results clear ()
 Clears the monitor, i.e. removes all the defined variables etc.
 
virtual Globals::Results add (const Variable &var)
 Adds a variable to the monitor definition.
 
virtual bool connected ()
 Get the flag to indicate if the monitor is connected to the device.
 
virtual uint32_t count ()
 Get the number of registered variables.
 
virtual bool coherentValues ()
 Get the flag setted to use coherent operations , i.e. don't split the command into multiple requests.
 
virtual void setCoherentValues (bool value)
 Set the flag setted to use coherent operations , i.e. don't split the command into multiple requests.
 
virtual Clientclient ()
 Get the owner setted Client object.
 
virtual void setClient (Client *value)
 Set the owner setted Client object.
 
virtual Connectionconnection ()
 Get the Connection object.
 
virtual void setConnection (Connection *value)
 Set the Connection object.
 

Protected Member Functions

void synchronizeCompleted (uint64_t senderId, RLibCpp::Bcc::Globals::Results re)
 Private handler for the Connection::synchronizeCompleted(uint64_t , Globals::Results); event.
 
void clearUserMonitors ()
 Clears the BaseMonitorStruct::UserMonitorItem
 
void clearDevices ()
 Clear the BaseMonitorStruct::DeviceItem
 
void addUserMonitor (BaseMonitorStruct::UserMonitorItem *item)
 Adds the item to the BaseMonitorStruct::UserMonitorItem list.
 
void addDevice (BaseMonitorStruct::DeviceItem *item)
 Adds the item to the BaseMonitorStruct::DeviceItem list.
 
virtual Globals::Results doPrepareRuntime (Client *client, bool coherentValues)
 Prepare the runtime device monitor definitions, i.e. splits the original user mnonitor into chuncks to fit the maximum BCC message data size and setup other the relevant properties.
 
Globals::Results doSetupReadData (BaseMonitorStruct::BaseData &data)
 Setups the BaseMonitorStruct::DeviceMonitorItem::readSrcValues() and BaseMonitorStruct::DeviceMonitorItem::readSrcValuesOffset(); of the BaseMonitorStruct::DeviceItem to the data values storage.
 
Globals::Results doParseReadData (BaseMonitorStruct::DeviceItem *deviceItem, ByteVector &rawData, uint32_t dataOff)
 Parses the rawData raw data buffer read from the devices and stores values into the deviceItem proper list (BaseMonitorStruct::DeviceMonitorItem::readSrcValues())
 
Globals::Results doParseReadData (BaseMonitorStruct::DeviceItem *deviceItem, const uint8_t *rawData, uint32_t rawDataSize, uint32_t dataOff)
 Parses the rawData raw data buffer read from the devices and stores values into the deviceItem proper list (BaseMonitorStruct::DeviceMonitorItem::readSrcValues())
 
Globals::Results doSetupWriteData (BaseMonitorStruct::BaseData &data)
 Setups the BaseMonitorStruct::DeviceMonitorItem::writeSrcValues() and BaseMonitorStruct::DeviceMonitorItem::writeSrcValuesOffset() of the BaseMonitorStruct::DeviceItem to the data values storage.
 
Globals::Results doParseWriteData (ByteVector &data, uint32_t dataOff, BaseMonitorStruct::DeviceItem *deviceItem)
 Parses the deviceItem proper list (BaseMonitorStruct::DeviceMonitorItem::readSrcValues()) and stores the data into the rawData raw data buffer to be written to the device.
 
Globals::Results doParseWriteData (uint8_t *rawData, uint32_t rawDataSize, uint32_t dataOff, BaseMonitorStruct::DeviceItem *deviceItem)
 Parses the deviceItem proper list (BaseMonitorStruct::DeviceMonitorItem::readSrcValues()) and stores the data into the rawData raw data buffer to be written to the device.
 
virtual Message::MsgCodes createMsgCode ()=0
 The message code used for read operations.
 
virtual ByteVector * createMsgDataPrefix ()=0
 The optional data to be prefixed in the read operations.
 
virtual Message::MsgCodes writeMsgCode ()=0
 The message code used for write operations.
 
virtual ByteVector * writeMsgDataPrefix ()=0
 The optional data to be prefixed in the write operations.
 
BaseMonitorStruct::DeviceItem::PtrVectordeviceItems ()
 Get the list of items to read, i.e. the list of BCC message sent to the device.
 
BaseMonitorStruct::UserMonitorItem::PtrVectoritems ()
 Get the original user defined monitor items' list

See also
BaseMonitorStruct::UserMonitorItem

 
bool dirty () const
 Get the dirty flag: when set, the internal data structures needs to be updated/recreated.
 
void setDirty (bool value)
 Set the dirty flag: when set, the internal data structures needs to be updated/recreated.
 
bool releasing () const
 Get the releasing flag: when set the monitor is about to be released from connection.
 
void setReleasing (bool value)
 Set the releasing flag: when set the monitor is about to be released from connection.
 

Static Protected Attributes

static const int MaxItemsPerMonitor = 25
 The number of maximun variable definition for each device monitor.
 

Friends

class Connection
 

Detailed Description

Abstract base class for monitors handling.

This class is not intended to be used directly from your code.

For internal use only.

This class provides the common functionality for monitors.

You cannot derive from this class.

Constructor & Destructor Documentation

◆ BaseMonitor()

Class constructor.

◆ ~BaseMonitor()

virtual ~BaseMonitor ( )
virtual

Class desstructor.

Member Function Documentation

◆ add()

virtual Globals::Results add ( const Variable & var)
virtual

Adds a variable to the monitor definition.

Parameters
varThe variable to add
Returns
Return the operation result code.

Reimplemented in Monitor.

◆ addDevice()

void addDevice ( BaseMonitorStruct::DeviceItem * item)
protected

Adds the item to the BaseMonitorStruct::DeviceItem list.

Parameters
itemThe BaseMonitorStruct::DeviceItem to add

◆ addUserMonitor()

void addUserMonitor ( BaseMonitorStruct::UserMonitorItem * item)
protected

Adds the item to the BaseMonitorStruct::UserMonitorItem list.

Parameters
itemThe BaseMonitorStruct::UserMonitorItem to add

◆ clear()

virtual Globals::Results clear ( )
virtual

Clears the monitor, i.e. removes all the defined variables etc.

Returns
Return the operation result code.

Reimplemented in Monitor.

◆ clearDevices()

void clearDevices ( )
protected

◆ clearUserMonitors()

void clearUserMonitors ( )
protected

◆ client()

Client * client ( )
virtual

Get the owner setted Client object.

Returns
The parameter value

◆ coherentValues()

bool coherentValues ( )
virtual

Get the flag setted to use coherent operations , i.e. don't split the command into multiple requests.

Returns
The parameter value

◆ connected()

bool connected ( )
virtual

Get the flag to indicate if the monitor is connected to the device.

Returns
The parameter value

◆ connection()

Connection * connection ( )
virtual

Get the Connection object.

Returns
The parameter value

◆ count()

uint32_t count ( )
virtual

Get the number of registered variables.

Returns
The parameter value

◆ createMsgCode()

virtual Message::MsgCodes createMsgCode ( )
protectedpure virtual

The message code used for read operations.

Implemented in Monitor.

◆ createMsgDataPrefix()

virtual ByteVector * createMsgDataPrefix ( )
protectedpure virtual

The optional data to be prefixed in the read operations.

Implemented in Monitor.

◆ deviceItems()

BaseMonitorStruct::DeviceItem::PtrVector & deviceItems ( )
protected

Get the list of items to read, i.e. the list of BCC message sent to the device.

Returns
The parameter value
Remarks
The list will contains multiple items when not using coherentValues() and the number of requested user items execeeds the maximun BCC message data size

◆ dirty()

bool dirty ( ) const
protected

Get the dirty flag: when set, the internal data structures needs to be updated/recreated.

Returns
The parameter value

◆ doParseReadData() [1/2]

Globals::Results doParseReadData ( BaseMonitorStruct::DeviceItem * deviceItem,
ByteVector & rawData,
uint32_t dataOff )
protected

Parses the rawData raw data buffer read from the devices and stores values into the deviceItem proper list (BaseMonitorStruct::DeviceMonitorItem::readSrcValues())

Parameters
deviceItemThe device item into which store the read data
rawDataThe raw data buffer read from the device
dataOffThe starting offset related to rawData
Returns
Returns the operation result code

◆ doParseReadData() [2/2]

Globals::Results doParseReadData ( BaseMonitorStruct::DeviceItem * deviceItem,
const uint8_t * rawData,
uint32_t rawDataSize,
uint32_t dataOff )
protected

Parses the rawData raw data buffer read from the devices and stores values into the deviceItem proper list (BaseMonitorStruct::DeviceMonitorItem::readSrcValues())

Parameters
deviceItemThe device item into which store the read data
rawDataThe raw data buffer read from the device
rawDataSizeThe raw data buffer size read from the device
dataOffThe starting offset related to rawData
Returns
Returns the operation result code

◆ doParseWriteData() [1/2]

Globals::Results doParseWriteData ( ByteVector & data,
uint32_t dataOff,
BaseMonitorStruct::DeviceItem * deviceItem )
protected

Parses the deviceItem proper list (BaseMonitorStruct::DeviceMonitorItem::readSrcValues()) and stores the data into the rawData raw data buffer to be written to the device.

Parameters
dataThe raw data buffer to be written to the device
dataOffThe starting offset related to data
deviceItemThe device item from which retrive the data to be written
Returns
Returns the operation result code

◆ doParseWriteData() [2/2]

Globals::Results doParseWriteData ( uint8_t * rawData,
uint32_t rawDataSize,
uint32_t dataOff,
BaseMonitorStruct::DeviceItem * deviceItem )
protected

Parses the deviceItem proper list (BaseMonitorStruct::DeviceMonitorItem::readSrcValues()) and stores the data into the rawData raw data buffer to be written to the device.

Parameters
rawDataThe raw data buffer to be written to the device
rawDataSizeThe raw data buffer size to be written to the device
dataOffThe starting offset related to data
deviceItemThe device item from which retrive the data to be written
Returns
Returns the operation result code

◆ doPrepareRuntime()

virtual Globals::Results doPrepareRuntime ( Client * client,
bool coherentValues )
protectedvirtual

Prepare the runtime device monitor definitions, i.e. splits the original user mnonitor into chuncks to fit the maximum BCC message data size and setup other the relevant properties.

Parameters
clientThe Bcc.Client to be used for comunicate to the device
coherentValuesFlag to use coeherent values
Returns
Returns the operation result code

Reimplemented in Monitor.

◆ doSetupReadData()

Globals::Results doSetupReadData ( BaseMonitorStruct::BaseData & data)
protected

Setups the BaseMonitorStruct::DeviceMonitorItem::readSrcValues() and BaseMonitorStruct::DeviceMonitorItem::readSrcValuesOffset(); of the BaseMonitorStruct::DeviceItem to the data values storage.

Parameters
dataThe object to which save the values read from the device
Returns
Returns the operation result code

◆ doSetupWriteData()

Globals::Results doSetupWriteData ( BaseMonitorStruct::BaseData & data)
protected

Setups the BaseMonitorStruct::DeviceMonitorItem::writeSrcValues() and BaseMonitorStruct::DeviceMonitorItem::writeSrcValuesOffset() of the BaseMonitorStruct::DeviceItem to the data values storage.

Parameters
dataThe object from which retrive the values to be written to the device
Returns
Returns the operation result code

◆ items()

Get the original user defined monitor items' list

See also
BaseMonitorStruct::UserMonitorItem

Returns
The parameter value

◆ releasing()

bool releasing ( ) const
protected

Get the releasing flag: when set the monitor is about to be released from connection.

Returns
The parameter value

◆ setClient()

void setClient ( Client * value)
virtual

Set the owner setted Client object.

Parameters
valueThe value to set

Reimplemented in Monitor.

◆ setCoherentValues()

void setCoherentValues ( bool value)
virtual

Set the flag setted to use coherent operations , i.e. don't split the command into multiple requests.

Parameters
valueThe value to set

Reimplemented in Monitor.

◆ setConnection()

void setConnection ( Connection * value)
virtual

Set the Connection object.

Parameters
valueThe value to set

Reimplemented in Monitor.

◆ setDirty()

void setDirty ( bool value)
protected

Set the dirty flag: when set, the internal data structures needs to be updated/recreated.

Parameters
valueThe value to set

◆ setReleasing()

void setReleasing ( bool value)
protected

Set the releasing flag: when set the monitor is about to be released from connection.

Parameters
valueThe value to set

◆ synchronizeCompleted()

void synchronizeCompleted ( uint64_t senderId,
RLibCpp::Bcc::Globals::Results re )
protected

Private handler for the Connection::synchronizeCompleted(uint64_t , Globals::Results); event.

Parameters
senderIdThe event sender indentifier
reThe opration result code

◆ writeMsgCode()

virtual Message::MsgCodes writeMsgCode ( )
protectedpure virtual

The message code used for write operations.

Implemented in Monitor.

◆ writeMsgDataPrefix()

virtual ByteVector * writeMsgDataPrefix ( )
protectedpure virtual

The optional data to be prefixed in the write operations.

Implemented in Monitor.

Friends And Related Symbol Documentation

◆ Connection

friend class Connection
friend

Member Data Documentation

◆ MaxItemsPerMonitor

const int MaxItemsPerMonitor = 25
staticprotected

The number of maximun variable definition for each device monitor.