SynchroTime
helper.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Home Office
3 // Nürnberg, Germany
4 // E-Mail: sergej1@email.ua
5 //
6 // Copyright (C) 2020 free Project SynchroTime. All rights reserved.
7 //------------------------------------------------------------------------------
8 // Project SynchroTime: Command-line client for adjust the exact time and
9 // calibrating the RTC DS3231 module via the serial interface (UART).
10 //------------------------------------------------------------------------------
11 #ifndef HELPER_H
12 #define HELPER_H
13 
14 //------------------------------------------------------------------------------
15 // Includes
16 //------------------------------------------------------------------------------
17 #include "session.h"
18 #include <QCommandLineParser>
19 
20 //------------------------------------------------------------------------------
21 // Preprocessor
22 //------------------------------------------------------------------------------
23 
24 //------------------------------------------------------------------------------
25 // Enums
26 //------------------------------------------------------------------------------
27 
28 //------------------------------------------------------------------------------
29 // Types
30 //------------------------------------------------------------------------------
31 // Interval for a time-out in milliseconds
32 #define TIME_WAIT 10U
33 // optins for the Command line parser
34 #ifndef GUI_APP
35 #define DISCOVERY "d"
36 #endif
37 #define PORT "p"
38 #define INFO "i"
39 #define ADJUST "a"
40 #define CALIBR "c"
41 #define RESET "r"
42 #define SETREG "s"
43 // number of expected bytes
44 #define RECEIVED_BYTES 1U
45 #define RECEIVED_BYTES_INFO 15U
46 #define RECEIVED_BYTES_CALIBR 7U
47 
48 //------------------------------------------------------------------------------
49 // Function Prototypes
50 //------------------------------------------------------------------------------
51 void setCommandLineParser( QCommandLineParser &parser );
52 int handleInformationRequest( Session *const session );
53 int handleAdjustmentRequest( Session *const session );
54 int handleCalibrationRequest( Session *const session );
55 int handleResetRequest( Session *const session );
56 int handleSetRegisterRequest( Session * const session, const float value );
57 
58 #endif // HELPER_H
int handleCalibrationRequest(Session *const session)
Request for the Calibration of the device.
Definition: helper.cpp:323
int handleResetRequest(Session *const session)
Request for the Reset of the device.
Definition: helper.cpp:120
Definition: session.h:39
void setCommandLineParser(QCommandLineParser &parser)
Set Command Line Parser&#39;s parameters and optins.
Definition: helper.cpp:51
int handleSetRegisterRequest(Session *const session, const float value)
Request to update the register value.
Definition: helper.cpp:401
int handleAdjustmentRequest(Session *const session)
Request for the Adjustment of the device.
Definition: helper.cpp:257
int handleInformationRequest(Session *const session)
Request for the Information of the device.
Definition: helper.cpp:171