Petit Poucet
 
Loading...
Searching...
No Matches
ServerInterface.hh
Go to the documentation of this file.
1#pragma once
2#include <iostream>
3#include <fstream>
4#include <array>
5#include <sstream>
6#include <vector>
7#include <iomanip>
8
9#include <rtklib.h>
10
11#include "../Utils/Utils.hh"
12
17{
22 {
23 // Constructors
24 public:
27
28 // Methods
29 public:
36 void ReadConfigFile(std::string configFileName, std::string *casterName, std::string *serialPortName);
37
38 };
39
48
53 {
54 //Constructor
55 public:
58
59 // Properties
60 public:
61 int inactiveTimeout = 10000; // 10 000 ms
62 int intervalToReconnect = 10000; // 10 000 ms
63 int averagingTimeOfDataRate = 500; // 500 ms
64 int bufferSize = 32768; // 32768 bytes
65 int serverCycle = 10; // 10ms
66 int NMEARequestCycle = 0; // 0ms = no NMEA requests
67 int fileSwapMargin = 30; // 30s
68 int relayBackToOutputstream = 0; // 0 = no relay back
69
70 //Methods
71 public:
73 {
74 int* options = new int[8]{this->inactiveTimeout,
77 this->bufferSize,
78 this->serverCycle,
79 this->NMEARequestCycle,
80 this->fileSwapMargin,
81 this->relayBackToOutputstream};
82 return options; // Be careful, caller must delete this pointer
83 };
84 };
85
90 {
91 // Constructor
92 private:
93 PPServer(){}
94 public:
96
97 // Properties
98 private:
102 inline static strsvr_t RTKLIBStreamServer;
103
104 // Methods
105 private:
109 void ReadGNGGASolution(long double &longitude, long double &latitude, long double &altitude, int &signalToNoiseRatio, double &horizontalDilutionOfPrecision, std::string &fixQuality, int &timeStamp);
113 void ReadGNRMCSolution(long double &longitude, long double &latitude, long double &altitude, int &signalToNoiseRatio, double &horizontalDilutionOfPrecision, std::string &fixQuality, int &timeStamp);
114 public:
118 static PPServer SetupCorrectedReaderServer(std::string *casterName, std::string *serialPortName, PPServerOptions options);
119
127 static PPServer SetupCorrectionServer(std::string *casterName, std::string *serialPortName, PPServerOptions options);
128
135 static PPServer SetupReaderServer(std::string *serialPortName, PPServerOptions options);
136
140 void GetServerStatus(int *stat, int *log_stat, int *byte, int *bps, std::string *stringMessage);
141
142 void GetCurrentSolution(long double &longitude, long double &latitude, long double &altitude, int &signalToNoiseRatio, int &timeStamp, CoordinateSystem coordinateSystem, double &horizontalDilutionOfPrecision, std::string &fixQuality);
143
144 };
145}
This class stores the method for reading the configuration file.
Definition ServerInterface.hh:22
void ReadConfigFile(std::string configFileName, std::string *casterName, std::string *serialPortName)
Reads a configuration files and attibutes values to a caster name and a serial port name.
Definition ServerInterface.cc:5
ConfigurationSetup()
Definition ServerInterface.hh:25
This class stores the options for the PPServer when setup by PPServerInterface::SetupServer.
Definition ServerInterface.hh:53
int averagingTimeOfDataRate
Definition ServerInterface.hh:63
int inactiveTimeout
Definition ServerInterface.hh:61
int serverCycle
Definition ServerInterface.hh:65
int relayBackToOutputstream
Definition ServerInterface.hh:68
int fileSwapMargin
Definition ServerInterface.hh:67
int intervalToReconnect
Definition ServerInterface.hh:62
int bufferSize
Definition ServerInterface.hh:64
~PPServerOptions()
Definition ServerInterface.hh:57
int NMEARequestCycle
Definition ServerInterface.hh:66
int * ToIntegers()
Definition ServerInterface.hh:72
PPServerOptions()
Definition ServerInterface.hh:56
This class is the core of PetitPoucet and stores the server as private member as well as methods for ...
Definition ServerInterface.hh:90
static PPServer SetupCorrectionServer(std::string *casterName, std::string *serialPortName, PPServerOptions options)
Sets a server up to send correction data to an RTK reciever, and returns it as a Server object.
Definition ServerInterface.cc:114
void GetServerStatus(int *stat, int *log_stat, int *byte, int *bps, std::string *stringMessage)
Gets the status of the server and stores it in pointers given as parameters.
Definition ServerInterface.cc:210
static PPServer SetupReaderServer(std::string *serialPortName, PPServerOptions options)
Sets a server up to listen to an RTK reciever, and returns it as a Server object.
Definition ServerInterface.cc:163
void GetCurrentSolution(long double &longitude, long double &latitude, long double &altitude, int &signalToNoiseRatio, int &timeStamp, CoordinateSystem coordinateSystem, double &horizontalDilutionOfPrecision, std::string &fixQuality)
Definition ServerInterface.cc:217
static PPServer SetupCorrectedReaderServer(std::string *casterName, std::string *serialPortName, PPServerOptions options)
Sets a server up for correcting and reading corrected data.
~PPServer()
Definition ServerInterface.hh:95
Namespace for the server interface.
Definition ServerInterface.cc:4
CoordinateSystem
Enum for the different coordinate systems. Destined to be expanded.
Definition ServerInterface.hh:44
@ WGSDecimals
Definition ServerInterface.hh:46
@ WGSDegrees
Definition ServerInterface.hh:45