SynchroTime
Macros | Functions
helper.h File Reference
#include "session.h"
#include <QCommandLineParser>
Include dependency graph for helper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TIME_WAIT   10U
 
#define DISCOVERY   "d"
 
#define PORT   "p"
 
#define INFO   "i"
 
#define ADJUST   "a"
 
#define CALIBR   "c"
 
#define RESET   "r"
 
#define SETREG   "s"
 
#define RECEIVED_BYTES   1U
 
#define RECEIVED_BYTES_INFO   15U
 
#define RECEIVED_BYTES_CALIBR   7U
 

Functions

void setCommandLineParser (QCommandLineParser &parser)
 Set Command Line Parser's parameters and optins. More...
 
int handleInformationRequest (Session *const session)
 Request for the Information of the device. More...
 
int handleAdjustmentRequest (Session *const session)
 Request for the Adjustment of the device. More...
 
int handleCalibrationRequest (Session *const session)
 Request for the Calibration of the device. More...
 
int handleResetRequest (Session *const session)
 Request for the Reset of the device. More...
 
int handleSetRegisterRequest (Session *const session, const float value)
 Request to update the register value. More...
 

Macro Definition Documentation

#define ADJUST   "a"

Referenced by setCommandLineParser().

#define CALIBR   "c"

Referenced by setCommandLineParser().

#define DISCOVERY   "d"

Referenced by setCommandLineParser().

#define INFO   "i"

Referenced by setCommandLineParser().

#define PORT   "p"

Referenced by setCommandLineParser().

#define RECEIVED_BYTES   1U
#define RECEIVED_BYTES_CALIBR   7U
#define RECEIVED_BYTES_INFO   15U
#define RESET   "r"

Referenced by setCommandLineParser().

#define SETREG   "s"

Referenced by setCommandLineParser().

#define TIME_WAIT   10U

Function Documentation

int handleAdjustmentRequest ( Session *const  session)

Request for the Adjustment of the device.

The function creates a connection to the device and sends a request for Adjustment using the Adjustment protocol of the form: {@a|time|ms}, 2+4+2 bytes long.

Parameters
[in]sessionPointer to the current session.
Return values
0if no error occurs,
1terminate with an error.

References Interface::closeSocket(), Session::getInterface(), Interface::getReceivedData(), Interface::openSocket(), Interface::readTheData(), RECEIVED_BYTES, standardOutput(), TIME_WAIT, and Interface::writeTheData().

Here is the call graph for this function:

int handleCalibrationRequest ( Session *const  session)

Request for the Calibration of the device.

The function creates a connection to the device and sends a request for Calibration using the Calibration protocol of the form: {@c|time|ms}, 2+4+2 bytes long.

Parameters
[in]sessionPointer to the current session.
Return values
0if no error occurs,
1terminate with an error.

References Interface::closeSocket(), Session::getInterface(), Interface::getReceivedData(), Interface::openSocket(), Interface::readTheData(), RECEIVED_BYTES_CALIBR, standardOutput(), TIME_WAIT, and Interface::writeTheData().

Here is the call graph for this function:

int handleInformationRequest ( Session *const  session)

Request for the Information of the device.

The function creates a connection to the device and sends a request for Information using the Information protocol of the form: {@i|time|ms}, 2+4+2 bytes long.

Parameters
[in]sessionPointer to the current session.
Return values
0if no error occurs,
1terminate with an error.

References Interface::closeSocket(), Session::getInterface(), Interface::getReceivedData(), Interface::openSocket(), Interface::readTheData(), RECEIVED_BYTES_INFO, standardOutput(), TIME_WAIT, and Interface::writeTheData().

Here is the call graph for this function:

int handleResetRequest ( Session *const  session)

Request for the Reset of the device.

The function creates a connection to the device and sends a request for Reset using the Reset protocol of the form: {@r}, 2 bytes long.

Parameters
[in]sessionPointer to the current session.
Return values
0
1

References Interface::closeSocket(), Session::getInterface(), Interface::getReceivedData(), Interface::openSocket(), Interface::readTheData(), RECEIVED_BYTES, standardOutput(), TIME_WAIT, and Interface::writeTheData().

Here is the call graph for this function:

int handleSetRegisterRequest ( Session *const  session,
const float  value 
)

Request to update the register value.

The function creates a connection to the device and sends a request for SetRegister using the SetRegister protocol of the form: {@s|value}, 2+4 bytes long.

Parameters
[in]sessionPointer to the current session.
[in]value
Return values
0if no error occurs,
1terminate with an error.

References Interface::closeSocket(), Session::getInterface(), Interface::getReceivedData(), Interface::openSocket(), Interface::readTheData(), RECEIVED_BYTES, standardOutput(), TIME_WAIT, and Interface::writeTheData().

Here is the call graph for this function:

void setCommandLineParser ( QCommandLineParser &  parser)

Set Command Line Parser's parameters and optins.

Todo:
Parameters
[in,out]parserof the type QCommandLineParser

References ADJUST, CALIBR, DISCOVERY, INFO, PORT, RESET, and SETREG.