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

The class to handle BCC protocol oscilloscopes. More...

#include <oscilloscope.h>

Inheritance diagram for Oscilloscope:

Classes

class  PtrVector
 Class to handle with lists of Oscilloscope. More...
 

Public Types

typedef OscilloscopepOscilloscope
 

Public Member Functions

 Oscilloscope ()
 Class constructor.
 
virtual ~Oscilloscope ()
 Class destructor.
 
uint32_t changeId ()
 The id of the data read from the device.
 
Globals::Results clear ()
 Clears the oscilloscope items list.
 
Globals::Results add (const Variable &var)
 Adds a variable (i.e. a track) to the oscilloscope.
 
uint32_t activeEventFrequency ()
 The effective event notification frequency (Hz)
 
Globals::Results start ()
 Starts the oscilloscope.
 
Globals::Results stop ()
 Stops the oscilloscope.
 
Globals::Results read (OscilloscopeStruct::ReadData &data)
 Reads the samples cached from the device since last invocation of thie method.
 
uint64_t id () const
 This oscilloscpe identifier: this is the value specified in the signals' senderId parameter.
 
Connectionconnection () const
 Get the connection object to communicate to the device.
 
void setConnection (Connection *value)
 Set the connection object to communicate to the device.
 
Clientclient () const
 Get the owner setted Client object.
 
void setClient (Client *value)
 Set the owner setted Client object.
 
bool active () const
 Get the flag to indicate if the oscilloscope has been started into the device.
 
bool autoRestart () const
 Get the flag to restart the oscilloscope automatically when the device variable set has changed.
 
void setAutoRestart (bool value)
 Set the flag to restart the oscilloscope automatically when the device variable set has changed.
 
uint16_t dataFrequency () const
 Get the desired frequency of the data returned from the device (Hz)
 
void setDataFrequency (uint16_t value)
 Set the desired frequency of the data returned from the device (Hz)
 
uint16_t activeDataFrequency () const
 Get the effective data frequency returned from the device.
 
uint32_t eventFrequency () const
 Get the desired event frequency (Hz)
 
void setEventFrequency (uint32_t value)
 Set the desired event frequency (Hz)
 
uint32_t maxDataSamples () const
 Get the maximum number of samples cached.
 
void setMaxDataSamples (uint32_t value)
 Set the maximum number of samples cached.
 
uint32_t watchDog () const
 Get the oscilloscope watchdog time (msec)
 
void setWatchDog (uint32_t value)
 Set the oscilloscope watchdog time (msec)
 
bool dataOverflow () const
 Get the flag setted when the maxDataSamples() limit has been reached without read(OscilloscopeStruct::ReadData &) method invocation.
 
bool connected () const
 Get the flag to indicate if the oscilloscope is connected to the device.
 
size_t count () const
 Get the number of registered variables.
 

Public Attributes

Signal2< uint64_t, uint32_t > started
 Event fired when the oscilloscope is successfully started.
 
Signal1< uint64_t > stopped
 Event fired when the oscilloscope is successfully stopped.
 
Signal2< uint64_t, uint32_t > restarted
 Event fired when the oscilloscope is successfully restarted.
 
Signal2< uint64_t, uint32_t > dataChanged
 Event fired when the oscilloscope data has changed i.e. some new oscilloscope data has been received.
 
Signal2< uint64_t, RLibCpp::Bcc::OscilloscopeStruct::ErrorDataerror
 Event fired when an error occurs during oscilloscope operations.
 
Signal1< uint64_t > dataOverflowed
 Event fired when the number of cached samples exceeds maxDataSamples() . You have to invoke the read(OscilloscopeStruct::ReadData &) at proper rate to avoid that.
 
Signal1< uint64_t > dataNormalFlow
 Event fired once when the oscilloscope exit from the dataOverflow() condition to the normal data flow.
 

Protected Member Functions

Globals::Results doStop (bool wait, bool emitError=false)
 Stops the oscilloscope, i.e. destroys it on the device and stops the handling thread.
 
Message::MsgCodes createMsgCode ()
 Get the message code to create the oscilloscope.
 
ByteVector * createMsgDataPrefix ()
 Get a pointer to byte array containg data per for the create message.
 
Globals::Results doPrepareRuntime (Client *client)
 Prepare the runtime device oscilloscope definitions, i.e. setups the OscilloscopeStruct::DeviceItem::deviceOscilloscopeItemsList() from the user defined items() list.
 
void clearUserOscilloscopes ()
 Clears and deletes the user oscilloscopes' items() list.
 
void addUserOscilloscope (OscilloscopeStruct::UserOscilloscopeItem *item)
 Add a user oscilloscope to the items() list.
 
Globals::Results doParseReadData (OscilloscopeStruct::DeviceItem *deviceItem, const uint8_t *rawData, uint32_t rawDataSize, uint32_t rawDataOff, uint8_t numSamples)
 Parses the rawData raw data buffer read from the devices and stores values into the m_readDataCache storage.
 
Globals::Results doSetupReadData (OscilloscopeStruct::ReadData &data)
 Setups the OscilloscopeStruct::ReadData::samples() thats will hold the sampled data.
 
void doStopHandleThread (bool wait)
 Stops the m_handleThread
 
void doStartHandleThread ()
 Starts the m_handleThread
 
Globals::Results doDestroy (bool reportError)
 Destroys the oscilloscope on the device.
 
Globals::Results doSendDestroyMessage (OscilloscopeStruct::ErrorData &errorData)
 Sends the BCC oscilloscope destroy message.
 
Globals::Results doCreate (bool reportError)
 Creates the oscilloscope into the connected device.
 
Globals::Results doSendCreateMessage (OscilloscopeStruct::ErrorData &errorData)
 Sends the BCC oscilloscope create message.
 
Globals::Results doSendStartMessage (uint32_t watchDog, uint16_t dataFrequency, OscilloscopeStruct::ErrorData &errorData)
 Sends the BCC oscilloscope start message.
 
Globals::Results doSendStopMessage (OscilloscopeStruct::ErrorData &errorData)
 Sends the BCC oscilloscope stop message.
 
void doCheckForDataChangeEvent ()
 Helper method to check if dataChanged(long, uint32_t) event has to be fired.
 
void handleThread () override
 The handling thread methods.
 
void invoke (long tagData) override
 The method to be invoked for event dispatch.
 
void doInvokeEvent (const Event &event)
 The method that effectively invokes the event.
 
EventDispatcherThreadeventsThread ()
 The thread for event dispatching.
 
void synchronizeCompleted (uint64_t senderId, RLibCpp::Bcc::Globals::Results re)
 Private handler for the Connection::synchronizeCompleted(uint64_t , Globals::Results); event.
 
OscilloscopeStruct::UserOscilloscopeItem::PtrVectoritems ()
 Get the original user defined oscilloscope items' list (OscilloscopeStruct::UserOscilloscopeItem)
 
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.
 
void setDataOverflow (bool value)
 Set the flag setted when the maxDataSamples() limit has been reached without read(OscilloscopeStruct::ReadData &) method invocation.
 
uint32_t oscilloscopeId () const
 Get the oscilloscope identifier for the connected device.
 
void setOscilloscopeId (uint32_t value)
 Set the oscilloscope identifier for the connected device.
 
Tool::ThreadHelper::ScheduleTypes scheduleType () const
 Get the thread schedule type for oscilloscope.
 
void setScheduleType (Tool::ThreadHelper::ScheduleTypes value)
 Set the thread schedule type for oscilloscope.
 
bool releasing () const
 Get the releasing flag: when set the oscilloscope is about to be released from connection.
 
void setReleasing (bool value)
 Set the releasing flag: when set the oscilloscope is about to be released from connection.
 

Protected Attributes

OscilloscopeStruct::DeviceItem m_deviceItem
 The handler object for the BCC messages sent to the device.
 

Friends

class Connection
 
class Tool::ThreadHandler
 
class Tool::EventDispatcherThread
 

Detailed Description

The class to handle BCC protocol oscilloscopes.

Example of general usage of the oscilloscope class:

// ... setup the connection object using your logic here ....
Oscilloscope* oscilloscope;
uint32_t id_my_var0 = connection->addToVarsCache("MYTASK: MYVAR[0], 1");
return;
// Setup the oscilloscope properties as desired
oscilloscope->setAutoRestart(true);
oscilloscope->setDataFrequency(100);
oscilloscope->setEventFrequency(10);
// Setup the oscilloscope properties as desired
connect(oscilloscope, SIGNAL(dataChanged(long, uint32_t)), this, SLOT(onOscDataChanged(long, uint32_t)));
connect(oscilloscope, SIGNAL(restarted(long, uint32_t)), this, SLOT(onOscRestarted(long, uint32_t)));
connect(oscilloscope, SIGNAL(started(long, uint32_t)), this, SLOT(onOscStarted(long, uint32_t)));
connect(oscilloscope, SIGNAL(stopped(long)), this, SLOT(onOscStopped(long)));
connect(oscilloscope, SIGNAL(error(long, RLibQt::Bcc::OscilloscopeStruct::ErrorData)), this, SLOT(onOscError(long, RLibQt::Bcc::OscilloscopeStruct::ErrorData)));
connect(oscilloscope, SIGNAL(dataOverflowed(long)), this, SLOT(onOscDataOverflowed(long)));
// Add some variables
oscilloscope->add(Variable::fromVRR(10));
oscilloscope->add(Variable::fromCache(id_my_var0));
// Start the oscilloscope
if (oscilloscope->start() != Globals::resSuccess)
{
return;
}
// From now on , data will be received asynchronously through the Oscilloscope.DataChanged event
// do some work
// ...
// Stop the oscilloscope when done
oscilloscope->stop();
Communication client declaration.
Definition connection.h:48
uint32_t addToVarsCache(const String &name, const String &extraTag="")
Adds a variable to the cache.
virtual Globals::Results getOscilloscope(Oscilloscope *&oscilloscope)
Obtain a new (default configured) oscilloscope for the connection.
@ resSuccess
The operation completed successfully.
Definition globals.h:39
The class to handle BCC protocol oscilloscopes.
Definition oscilloscope.h:853
Signal1< uint64_t > stopped
Event fired when the oscilloscope is successfully stopped.
Definition oscilloscope.h:1220
Globals::Results add(const Variable &var)
Adds a variable (i.e. a track) to the oscilloscope.
Globals::Results stop()
Stops the oscilloscope.
Signal2< uint64_t, RLibCpp::Bcc::OscilloscopeStruct::ErrorData > error
Event fired when an error occurs during oscilloscope operations.
Definition oscilloscope.h:1244
Globals::Results start()
Starts the oscilloscope.
Signal2< uint64_t, uint32_t > restarted
Event fired when the oscilloscope is successfully restarted.
Definition oscilloscope.h:1230
Signal1< uint64_t > dataOverflowed
Event fired when the number of cached samples exceeds maxDataSamples() . You have to invoke the read(...
Definition oscilloscope.h:1255
void setEventFrequency(uint32_t value)
Set the desired event frequency (Hz)
void setAutoRestart(bool value)
Set the flag to restart the oscilloscope automatically when the device variable set has changed.
Signal2< uint64_t, uint32_t > started
Event fired when the oscilloscope is successfully started.
Definition oscilloscope.h:1214
Connection * connection() const
Get the connection object to communicate to the device.
Signal2< uint64_t, uint32_t > dataChanged
Event fired when the oscilloscope data has changed i.e. some new oscilloscope data has been received.
Definition oscilloscope.h:1237
void setDataFrequency(uint16_t value)
Set the desired frequency of the data returned from the device (Hz)
static Variable fromVRR(uint32_t index, uint32_t count=1)
Factory method to create and initialize a Message::varVRR variable.
static Variable fromCache(uint32_t cacheId)
Factory method to create and initialize a Message::varNamed variable.

And that's an example for the Oscilloscope.DataChanged event handler

void onOscDataChanged(long senderId, uint32_t changeId)
{
RLibQt::Bcc::OscilloscopeStruct::ReadData readData;
if( oscilloscope->read(readData)!= Globals::resSuccess)
{
return;
}
for (int sampleIdx = 0; sampleIdx < readData.samples().count(); sampleIdx++)
{
RLibQt::Bcc::OscilloscopeStruct::DataSample *sample = readData.samples()[sampleIdx];
QList<float> &values = sample->values();
for (int valIdx = 0; valIdx < values.count(); valIdx++)
{
// Do something with the data .....
}
}
}
Globals::Results read(OscilloscopeStruct::ReadData &data)
Reads the samples cached from the device since last invocation of thie method.
size_t count() const
Get the number of registered variables.
uint32_t changeId()
The id of the data read from the device.

The oscilloscope must be obtained from a valid connection. It is best practise to explictly release ( Connection::releaseOscilloscope(Oscilloscope *) ) the oscilloscope when done with it. Otherwise it will be released when the Connection object is destroyed.

All the methods of the oscilloscope class are blocking, that do not return until the operation is finished (with success or error).

For more usage examples, look at specific oscilloscope methods.

Member Typedef Documentation

◆ pOscilloscope

Constructor & Destructor Documentation

◆ Oscilloscope()

Class constructor.

◆ ~Oscilloscope()

virtual ~Oscilloscope ( )
virtual

Class destructor.

Member Function Documentation

◆ active()

bool active ( ) const

Get the flag to indicate if the oscilloscope has been started into the device.

Returns
The parameter value
Remarks
Use start() and stop() methods to activate and deactivate the oscilloscope

◆ activeDataFrequency()

uint16_t activeDataFrequency ( ) const

Get the effective data frequency returned from the device.

Returns
The parameter value

◆ activeEventFrequency()

uint32_t activeEventFrequency ( )

The effective event notification frequency (Hz)

It's the smallest value between the eventFrequency() assumed on start and the activeDataFrequency()

◆ add()

Globals::Results add ( const Variable & var)

Adds a variable (i.e. a track) to the oscilloscope.

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

Variable may be added only if the oscilloscope is not active(), otherwise an error will be returned

The maximum number of tracks per single oscilloscope is DataSample::MAX_TRACK

Array of variables are not accepted (i.e. the repea value must be one)

◆ addUserOscilloscope()

void addUserOscilloscope ( OscilloscopeStruct::UserOscilloscopeItem * item)
protected

Add a user oscilloscope to the items() list.

Parameters
itemThe item to add

The item is appended to the items() list and deleted on clearUserOscilloscopes() call

◆ autoRestart()

bool autoRestart ( ) const

Get the flag to restart the oscilloscope automatically when the device variable set has changed.

Returns
The parameter value
Remarks
This parameter may be changed at any time but it's assumed only upon the oscilloscope start() command

◆ changeId()

uint32_t changeId ( )

The id of the data read from the device.

This parameter may be useful if you are not using the dataChanged(long, uint32_t) event but pooling data with th read(OscilloscopeStruct::ReadData &) methods at your specific rate, to see if data has changed since last read.

This parameter is updated at any single data message received from the device.

◆ clear()

Globals::Results clear ( )

Clears the oscilloscope items list.

Returns
Return the operation result code.

Variable may be added only if the oscilloscope is not active(), otherwise an error will be returned

◆ clearUserOscilloscopes()

void clearUserOscilloscopes ( )
protected

Clears and deletes the user oscilloscopes' items() list.

◆ client()

Client * client ( ) const

Get the owner setted Client object.

Returns
The parameter value

◆ connected()

bool connected ( ) const

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

Returns
The parameter value

◆ connection()

Connection * connection ( ) const

Get the connection object to communicate to the device.

Returns
The parameter value

◆ count()

int32_t count ( ) const

Get the number of registered variables.

Returns
The parameter value

◆ createMsgCode()

Message::MsgCodes createMsgCode ( )
protected

Get the message code to create the oscilloscope.

Returns
The message code to create the oscilloscope

◆ createMsgDataPrefix()

ByteVector * createMsgDataPrefix ( )
protected

Get a pointer to byte array containg data per for the create message.

Returns
The pointer to byte array

◆ dataFrequency()

uint16_t dataFrequency ( ) const

Get the desired frequency of the data returned from the device (Hz)

Returns
The parameter value
Remarks
Valid value range is [1..100] Hz
The effective data frequency returned from the device will be decided by the device itself upon oscilloscope start() and will be stored into the activeDataFrequency() property
This parameter may be changed at any time but it's assumed only upon the oscilloscope start() command

◆ dataOverflow()

bool dataOverflow ( ) const

Get the flag setted when the maxDataSamples() limit has been reached without read(OscilloscopeStruct::ReadData &) method invocation.

On positive transition (false to true transition) a dataOverflowed event is fired.

Returns
The parameter value
See also
maxDataSamples()
dataOverflowed

◆ dirty()

bool dirty ( ) const
protected

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

Returns
The parameter value

◆ doCheckForDataChangeEvent()

void doCheckForDataChangeEvent ( )
protected

Helper method to check if dataChanged(long, uint32_t) event has to be fired.

◆ doCreate()

Globals::Results doCreate ( bool reportError)
protected

Creates the oscilloscope into the connected device.

Parameters
reportErrorIf setted, an error(long, RLibQt::Bcc::OscilloscopeStruct::ErrorData) event will be fired if any error occurs
Returns
Returns the operation result code

◆ doDestroy()

Globals::Results doDestroy ( bool reportError)
protected

Destroys the oscilloscope on the device.

Parameters
reportErrorIf setted, an error(long, RLibQt::Bcc::OscilloscopeStruct::ErrorData) event will be fired if any error occurs
Returns
Returns the operation result code

◆ doInvokeEvent()

void doInvokeEvent ( const Event & event)
protected

The method that effectively invokes the event.

◆ doParseReadData()

Globals::Results doParseReadData ( OscilloscopeStruct::DeviceItem * deviceItem,
const uint8_t * rawData,
uint32_t rawDataSize,
uint32_t rawDataOff,
uint8_t numSamples )
protected

Parses the rawData raw data buffer read from the devices and stores values into the m_readDataCache storage.

Parameters
deviceItemThe device containimg the list of DeviceOscilloscopeItem
rawDataThe raw data buffer read from the device
rawDataSizeThe raw data buffer size read from the device
rawDataOffThe starting offset related to rawData
numSamplesThe number of samples to retrive from rawData
Returns
Returns the operation result code

If the number of sample stored into the m_readDataCache storage exceeds maxDataSamples(), then the dataOverflow() property will be setted and the dataOverflowed(long) event fired.

◆ doPrepareRuntime()

Globals::Results doPrepareRuntime ( Client * client)
protected

Prepare the runtime device oscilloscope definitions, i.e. setups the OscilloscopeStruct::DeviceItem::deviceOscilloscopeItemsList() from the user defined items() list.

Parameters
clientThe Client to be used for comunicate to the device
Returns
Return the operation result code.

◆ doSendCreateMessage()

Globals::Results doSendCreateMessage ( OscilloscopeStruct::ErrorData & errorData)
protected

Sends the BCC oscilloscope create message.

Parameters
errorDataThe storage filled with error information if any error occurs during the command execution
Returns
Returns the operation result code

◆ doSendDestroyMessage()

Globals::Results doSendDestroyMessage ( OscilloscopeStruct::ErrorData & errorData)
protected

Sends the BCC oscilloscope destroy message.

Parameters
errorDataThe storage filled with error information if any error occurs during the command execution
Returns
Returns the operation result code

◆ doSendStartMessage()

Globals::Results doSendStartMessage ( uint32_t watchDog,
uint16_t dataFrequency,
OscilloscopeStruct::ErrorData & errorData )
protected

Sends the BCC oscilloscope start message.

Parameters
watchDogThe value for the WatchDog sent rate
dataFrequencyThe value for the desidered data frequency
errorDataThe storage filled with error information if any error occurs during the command execution
Returns
Returns the operation result code

◆ doSendStopMessage()

Globals::Results doSendStopMessage ( OscilloscopeStruct::ErrorData & errorData)
protected

Sends the BCC oscilloscope stop message.

Parameters
errorDataThe storage filled with error information if any error occurs during the command execution
Returns
Returns the operation result code

◆ doSetupReadData()

Globals::Results doSetupReadData ( OscilloscopeStruct::ReadData & data)
protected

Setups the OscilloscopeStruct::ReadData::samples() thats will hold the sampled data.

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

◆ doStartHandleThread()

void doStartHandleThread ( )
protected

Starts the m_handleThread

◆ doStop()

Globals::Results doStop ( bool wait,
bool emitError = false )
protected

Stops the oscilloscope, i.e. destroys it on the device and stops the handling thread.

Parameters
waitIf true, the method will not returns until the handling thread has exited
emitErrorSet this to emit an error signal when this method is invoked when the oscilloscope is not active()
Returns
Return the operation result code.

◆ doStopHandleThread()

void doStopHandleThread ( bool wait)
protected

Stops the m_handleThread

Parameters
waitIf set, the method returns only after the actual completion of the thread

◆ eventFrequency()

uint32_t eventFrequency ( ) const

Get the desired event frequency (Hz)

Returns
The parameter value
Remarks
This parameter may be changed at any time but it's assumed only upon the oscilloscope start() command

◆ eventsThread()

EventDispatcherThread * eventsThread ( )
protected

The thread for event dispatching.

◆ handleThread()

void handleThread ( )
overrideprotected

The handling thread methods.

This thread provides to all the common oscilloscope operations such as sending watch dog message, checking system information changes and performing autoRestart() (if enabled), retriving data and dispatching events to the user

◆ id()

uint64_t id ( ) const

This oscilloscpe identifier: this is the value specified in the signals' senderId parameter.

Returns

◆ invoke()

void invoke ( long tagData)
overrideprotected

The method to be invoked for event dispatch.

◆ items()

QList< OscilloscopeStruct::UserOscilloscopeItem * > & items ( )
protected

Get the original user defined oscilloscope items' list (OscilloscopeStruct::UserOscilloscopeItem)

Returns
The parameter value

◆ maxDataSamples()

uint32_t maxDataSamples ( ) const

Get the maximum number of samples cached.

The cached samples list is cleared at each read(OscilloscopeStruct::ReadData &) method invocation.
The number of samples retrived from the device exceeds this value, then the dataOverflow() property is set and a dataOverflowed event is fired. The successive data samples retrived will be discrded, until the next read(OscilloscopeStruct::ReadData &) method invocation.

Returns
The parameter value
Remarks
This parameter may be changed at any time but it's assumed only upon the oscilloscope start() command
See also
dataOverflow()
dataOverflowed

◆ oscilloscopeId()

uint32_t oscilloscopeId ( ) const
protected

Get the oscilloscope identifier for the connected device.

Returns
The parameter value
Remarks
This is the value returned from the device and my change at any oscilloscope creation, not to be confused with th id() which is specific of this object and never changes

◆ read()

Reads the samples cached from the device since last invocation of thie method.

Parameters
dataThe storage filled with the oscilloscope samples
Returns
Return the operation result code.

This methods clears the list of cached samples and the dataOverflow() flag if setted

Make sure to call this method at proper a rate so that the number of cached sampless doesn't exceed the maxDataSamples(), otherwise the dataOverflow() flag will be setted, a dataOverflowed(long) event fired and any other retrived sample discarded

◆ releasing()

bool releasing ( ) const
protected

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

Returns
The parameter value

◆ scheduleType()

Tool::ThreadHelper::ScheduleTypes scheduleType ( ) const
protected

Get the thread schedule type for oscilloscope.

Returns
The parameter value

◆ setAutoRestart()

void setAutoRestart ( bool value)

Set the flag to restart the oscilloscope automatically when the device variable set has changed.

Parameters
valueThe value to set
Remarks
This parameter may be changed at any time but it's assumed only upon the oscilloscope start() command

◆ setClient()

void setClient ( Client * value)

Set the owner setted Client object.

Parameters
valueThe value to set

◆ setConnection()

void setConnection ( Connection * value)

Set the connection object to communicate to the device.

Parameters
valueThe value to set

◆ setDataFrequency()

void setDataFrequency ( uint16_t value)

Set the desired frequency of the data returned from the device (Hz)

Parameters
valueThe value to set
Remarks
Valid value range is [1..100] Hz
The effective data frequency returned from the device will be decided by the device itself upon oscilloscope start() and will be stored into the activeDataFrequency() property
This parameter may be changed at any time but it's assumed only upon the oscilloscope start() command

◆ setDataOverflow()

void setDataOverflow ( bool value)
protected

Set the flag setted when the maxDataSamples() limit has been reached without read(OscilloscopeStruct::ReadData &) method invocation.

On positive transition (false to true transition) a dataOverflowed event is fired.

Parameters
valueThe value to set
See also
maxDataSamples()
dataOverflowed

◆ 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

◆ setEventFrequency()

void setEventFrequency ( uint32_t value)

Set the desired event frequency (Hz)

Parameters
valueThe value to set
Remarks
This parameter may be changed at any time but it's assumed only upon the oscilloscope start() command

◆ setMaxDataSamples()

void setMaxDataSamples ( uint32_t value)

Set the maximum number of samples cached.

The cached samples list is cleared at each read(OscilloscopeStruct::ReadData &) method invocation.
The number of samples retrived from the device exceeds this value, then the dataOverflow() property is set and a dataOverflowed event is fired. The successive data samples retrived will be discrded, until the next read(OscilloscopeStruct::ReadData &) method invocation.

Parameters
valueThe value to set
Remarks
This parameter may be changed at any time but it's assumed only upon the oscilloscope start() command
See also
dataOverflow()
dataOverflowed

◆ setOscilloscopeId()

void setOscilloscopeId ( uint32_t value)
protected

Set the oscilloscope identifier for the connected device.

Parameters
valueThe value to set
Remarks
This is the value returned from the device and my change at any oscilloscope creation, not to be confused with th id() which is specific of this object and never changes

◆ setReleasing()

void setReleasing ( bool value)
protected

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

Parameters
valueThe value to set

◆ setScheduleType()

void setScheduleType ( Tool::ThreadHelper::ScheduleTypes value)
protected

Set the thread schedule type for oscilloscope.

Parameters
valueThe value to set

◆ setWatchDog()

void setWatchDog ( uint32_t value)

Set the oscilloscope watchdog time (msec)

Parameters
valueThe value to set
Remarks
This parameter may be changed at any time but it's assumed only upon the oscilloscope start() command

◆ start()

Globals::Results start ( )

Starts the oscilloscope.

Returns
Return the operation result code.

If the oscilloscope is active() then it destroys the oscilloscope on the device, and then creates the new one with the actual properties

If any error occurs , an error(long, RLibQt::Bcc::OscilloscopeStruct::ErrorData) event will be fired

On successfull completition, the active() will be setted and the started() event fired

◆ stop()

Globals::Results stop ( )

Stops the oscilloscope.

Returns
Return the operation result code.

If the oscilloscope is not active() then an error codeis returned

If any error occurs , an error(long, RLibQt::Bcc::OscilloscopeStruct::ErrorData) event will be fired

On successfull completition, the active() will be resetted and the stopped() event fired

◆ 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

◆ watchDog()

uint32_t watchDog ( ) const

Get the oscilloscope watchdog time (msec)

Returns
The parameter value
Remarks
This parameter may be changed at any time but it's assumed only upon the oscilloscope start() command

Friends And Related Symbol Documentation

◆ Connection

friend class Connection
friend

◆ Tool::EventDispatcherThread

friend class Tool::EventDispatcherThread
friend

◆ Tool::ThreadHandler

friend class Tool::ThreadHandler
friend

Member Data Documentation

◆ dataChanged

Signal2<uint64_t, uint32_t> dataChanged

Event fired when the oscilloscope data has changed i.e. some new oscilloscope data has been received.

Parameters
senderIdThis oscilloscope identifier as return from id()
changeIdThe progressive Id of the data received from the connected device

◆ dataNormalFlow

Signal1<uint64_t> dataNormalFlow

Event fired once when the oscilloscope exit from the dataOverflow() condition to the normal data flow.

To exit the dataOverflow() condition you have to make a read(OscilloscopeStruct::ReadData &) or stop() and start() the oscilloscope

Parameters
senderIdThis oscilloscope identifier as return from id()
See also
read(OscilloscopeStruct::ReadData &), dataOverflow(), dataOverFlowed(long)


◆ dataOverflowed

Signal1<uint64_t> dataOverflowed

Event fired when the number of cached samples exceeds maxDataSamples() . You have to invoke the read(OscilloscopeStruct::ReadData &) at proper rate to avoid that.

Best practice is handling the dataChanged(long, uint32_t) event fired by the oscilloscope on new data sample and with activeEventFrequency()

Parameters
senderIdThis oscilloscope identifier as return from id()
See also
read(OscilloscopeStruct::ReadData &), dataChanged(long, uint32_t)


◆ error

Event fired when an error occurs during oscilloscope operations.

Parameters
senderIdThis oscilloscope identifier as return from id()
dataThe error data

◆ m_deviceItem

OscilloscopeStruct::DeviceItem m_deviceItem
protected

The handler object for the BCC messages sent to the device.

◆ restarted

Signal2<uint64_t, uint32_t> restarted

Event fired when the oscilloscope is successfully restarted.

The oscilloscope is restarted and this event fired only if the autoRestart() property is setted

Parameters
senderIdThis oscilloscope identifier as return from id()
activeDataFrequencyThe data frequency effectively assumed by the device

◆ started

Signal2<uint64_t, uint32_t> started

Event fired when the oscilloscope is successfully started.

Parameters
senderIdThis oscilloscope identifier as return from id()
activeDataFrequencyThe data frequency effectively assumed by the device

◆ stopped

Signal1<uint64_t> stopped

Event fired when the oscilloscope is successfully stopped.

Parameters
senderIdThis oscilloscope identifier as return from id()