SynchroTime
Public Slots | Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
RTC Class Reference

The RTC class. More...

#include <rtc.h>

Inheritance diagram for RTC:
Inheritance graph
Collaboration diagram for RTC:
Collaboration graph

Public Slots

void informationRequestSlot ()
 RTC::informationRequestSlot. More...
 
void adjustmentRequestSlot ()
 RTC::adjustmentRequestSlot. More...
 
void calibrationRequestSlot ()
 RTC::calibrationRequestSlot. More...
 
void resetRequestSlot ()
 RTC::resetRequestSlot. More...
 
void setRegisterRequestSlot (const float newValue)
 RTC::setRegisterRequestSlot. More...
 
void statusRequestSlot ()
 RTC::versionRequestSlot. More...
 

Signals

void getRate (const float rate)
 Signal function for determining the access rate via the serial interface. More...
 
void getData (const QString &data)
 
void portError (const QString &error)
 

Public Member Functions

 RTC (const QString &portName, QObject *parent=0)
 RTC::RTC Constructor for test purposes. More...
 
 RTC (const Settings_t &portSettings, QObject *parent=0)
 RTC::RTC Default Constructor. More...
 
 ~RTC ()
 RTC::~RTC Default destructor. More...
 
bool isConnected () const
 RTC::isConnected. More...
 
bool isBusy () const
 RTC::isBusy. More...
 

Private Slots

void handleError (QSerialPort::SerialPortError error)
 RTC::handleError. More...
 

Private Member Functions

bool openSerialPort () const
 RTC::openSerialPort. More...
 
void connectToRTC ()
 RTC::connectToRTC. More...
 
const QByteArray sendRequest (Request request, quint8 size=0, const quint8 *const data=nullptr)
 RTC::sendRequest. More...
 
void informationRequest ()
 RTC::informationRequest. More...
 
void adjustmentRequest ()
 RTC::adjustmentRequest. More...
 
void calibrationRequest ()
 RTC::calibrationRequest. More...
 
void resetRequest ()
 RTC::resetRequest. More...
 
void setRegisterRequest (const float newValue)
 RTC::setRegisterRequest. More...
 
bool statusRequest ()
 RTC::statusRequest. More...
 

Private Attributes

QSerialPort * m_pSerialPort
 
bool m_isConnected
 
bool m_isBusy
 
QTimer * m_pTimerCheckConnection
 
float m_correctionFactor
 

Detailed Description

The RTC class.

The class is responsible for communication with the RTC device.

Constructor & Destructor Documentation

RTC::RTC ( const QString &  portName,
QObject *  parent = 0 
)
explicit

RTC::RTC Constructor for test purposes.

Parameters
portNameof the type const QString. Name of the port in the system.
parentof the type *QObject - pThread.
Note
There is no need to specify the parent. The parent will be a thread when we move our RTC object into it.

References connectToRTC(), handleError(), m_pSerialPort, m_pTimerCheckConnection, and statusRequestSlot().

Here is the call graph for this function:

RTC::RTC ( const Settings_t portSettings,
QObject *  parent = 0 
)
explicit

RTC::RTC Default Constructor.

Parameters
portSettingsof the type const Settings_t&. Reference to an parameters of the serial port.
parentof the type *QObject - pThread.
Note
There is no need to specify the parent. The parent will be a thread when we move our RTC object into it.

References Settings::baudRate, Settings::dataBits, Settings::flowControl, handleError(), m_isConnected, m_pSerialPort, m_pTimerCheckConnection, Settings::name, openSerialPort(), Settings::parity, Settings::requestRate, Settings::statusControlEnabled, statusRequestSlot(), and Settings::stopBits.

Here is the call graph for this function:

RTC::~RTC ( )

RTC::~RTC Default destructor.

References m_pSerialPort, and m_pTimerCheckConnection.

Member Function Documentation

void RTC::adjustmentRequest ( )
private

RTC::adjustmentRequest.

References ADJUST, ESC_RED, ESC_RESET, ESC_WHITE, ESC_YELLOW, getData(), sendRequest(), and STARTBYTE.

Referenced by adjustmentRequestSlot().

Here is the call graph for this function:

Here is the caller graph for this function:

void RTC::adjustmentRequestSlot ( )
slot

RTC::adjustmentRequestSlot.

References adjustmentRequest(), m_isBusy, and m_isConnected.

Referenced by MainWindow::connectRTC().

Here is the call graph for this function:

Here is the caller graph for this function:

void RTC::calibrationRequest ( )
private

RTC::calibrationRequest.

References CALIBR, ESC_RED, ESC_RESET, ESC_WHITE, ESC_YELLOW, getData(), sendRequest(), and STARTBYTE.

Referenced by calibrationRequestSlot().

Here is the call graph for this function:

Here is the caller graph for this function:

void RTC::calibrationRequestSlot ( )
slot

RTC::calibrationRequestSlot.

References calibrationRequest(), m_isBusy, and m_isConnected.

Referenced by MainWindow::connectRTC().

Here is the call graph for this function:

Here is the caller graph for this function:

void RTC::connectToRTC ( )
private

RTC::connectToRTC.

References m_isConnected, m_pSerialPort, statusRequest(), and WAIT_REBOOT.

Referenced by RTC().

Here is the call graph for this function:

Here is the caller graph for this function:

void RTC::getData ( const QString &  data)
signal
void RTC::getRate ( const float  rate)
signal

Signal function for determining the access rate via the serial interface.

Referenced by MainWindow::connectRTC(), and statusRequest().

Here is the caller graph for this function:

void RTC::handleError ( QSerialPort::SerialPortError  error)
privateslot

RTC::handleError.

Parameters
errorof the type enum QSerialPort::SerialPortError.

References m_pSerialPort, and portError().

Referenced by RTC().

Here is the caller graph for this function:

void RTC::informationRequest ( )
private

RTC::informationRequest.

References ESC_RED, ESC_RESET, ESC_WHITE, getData(), INFO, m_correctionFactor, sendRequest(), and STARTBYTE.

Referenced by informationRequestSlot().

Here is the call graph for this function:

Here is the caller graph for this function:

void RTC::informationRequestSlot ( )
slot

RTC::informationRequestSlot.

References informationRequest(), m_isBusy, and m_isConnected.

Referenced by MainWindow::connectRTC().

Here is the call graph for this function:

Here is the caller graph for this function:

bool RTC::isBusy ( ) const

RTC::isBusy.

Returns
True if the Serial Port is busy, otherwise false.

References m_isBusy.

bool RTC::isConnected ( ) const

RTC::isConnected.

Returns
True if the RTC device is connected, otherwise false.

References m_isConnected.

Referenced by MainWindow::connectRTC().

Here is the caller graph for this function:

bool RTC::openSerialPort ( ) const
private

RTC::openSerialPort.

Returns
True if the serial port is open, otherwise false.

References m_pSerialPort, and WAIT_REBOOT.

Referenced by RTC().

Here is the caller graph for this function:

void RTC::portError ( const QString &  error)
signal

Referenced by MainWindow::connectRTC(), handleError(), sendRequest(), and statusRequest().

Here is the caller graph for this function:

void RTC::resetRequest ( )
private

RTC::resetRequest.

References ESC_RED, ESC_RESET, ESC_WHITE, ESC_YELLOW, getData(), RESET, sendRequest(), and STARTBYTE.

Referenced by resetRequestSlot().

Here is the call graph for this function:

Here is the caller graph for this function:

void RTC::resetRequestSlot ( )
slot

RTC::resetRequestSlot.

References m_isBusy, m_isConnected, and resetRequest().

Referenced by MainWindow::connectRTC().

Here is the call graph for this function:

Here is the caller graph for this function:

const QByteArray RTC::sendRequest ( Request  request,
quint8  size = 0,
const quint8 *const  data = nullptr 
)
private

RTC::sendRequest.

Parameters
requestof the type enum Request.
sizeof the type quint8.
dataSent data of type byte array.
Returns
Data array of the type const QByteArray.

References m_isBusy, m_pSerialPort, portError(), STARTBYTE, and WAIT_TIME.

Referenced by adjustmentRequest(), calibrationRequest(), informationRequest(), resetRequest(), setRegisterRequest(), and statusRequest().

Here is the caller graph for this function:

void RTC::setRegisterRequest ( const float  newValue)
private

RTC::setRegisterRequest.

Parameters
newValueof the type const float. The new Value for Offset Register.

References ESC_RED, ESC_RESET, ESC_WHITE, ESC_YELLOW, getData(), sendRequest(), SETREG, and STARTBYTE.

Referenced by setRegisterRequestSlot().

Here is the call graph for this function:

Here is the caller graph for this function:

void RTC::setRegisterRequestSlot ( const float  newValue)
slot

RTC::setRegisterRequestSlot.

Parameters
newValueof the type const float.

References m_isBusy, m_isConnected, and setRegisterRequest().

Referenced by MainWindow::connectRTC().

Here is the call graph for this function:

Here is the caller graph for this function:

bool RTC::statusRequest ( )
private

RTC::statusRequest.

Returns
True if the RTC status was successful, otherwise false.

References ESC_RED, ESC_RESET, getData(), getRate(), m_pSerialPort, portError(), sendRequest(), STARTBYTE, STATUS, STATUS_DISCONNECTION, STATUS_ERROR, STATUS_INPUT_DATA_TOLONG, STATUS_INVALID_PARAMETER, STATUS_NOT_SUPPORTED, STATUS_SUCCESS, and STATUS_UNKNOWN_ERROR.

Referenced by connectToRTC(), and statusRequestSlot().

Here is the call graph for this function:

Here is the caller graph for this function:

void RTC::statusRequestSlot ( )
slot

RTC::versionRequestSlot.

References m_isBusy, m_isConnected, and statusRequest().

Referenced by RTC().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

float RTC::m_correctionFactor
private

Referenced by informationRequest().

bool RTC::m_isBusy
private
bool RTC::m_isConnected
private
QSerialPort* RTC::m_pSerialPort
private
QTimer* RTC::m_pTimerCheckConnection
private

Referenced by RTC(), and ~RTC().


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