SynchroTime
Functions
helper.cpp File Reference
#include <QCommandLineOption>
#include <QLoggingCategory>
#include <QDebug>
#include <QDateTime>
#include <QElapsedTimer>
#include "helper.h"
Include dependency graph for helper.cpp:

Functions

static QT_USE_NAMESPACE QTextStream standardOutput (stdout)
 
void setCommandLineParser (QCommandLineParser &parser)
 Set Command Line Parser's parameters and optins. More...
 
int handleResetRequest (Session *const session)
 Request for the Reset of the device. 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 handleSetRegisterRequest (Session *const session, const float value)
 Request to update the register value. More...
 

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.

static QT_USE_NAMESPACE QTextStream standardOutput ( stdout  )
static