95 lines
1.9 KiB
C++
95 lines
1.9 KiB
C++
//
|
|
// RTCM Daemon
|
|
// Neal Probert
|
|
//
|
|
|
|
/* prevent multiple inclusions */
|
|
#ifndef __RtcmDaemon__
|
|
#define __RtcmDaemon__
|
|
|
|
/* includes *****************************************************************/
|
|
|
|
#include "TcpDaemon.h"
|
|
#include "UdpClient.h"
|
|
#include "UdpCaster.h"
|
|
#include "GpsDevice.h"
|
|
#include "RtcmDevice.h"
|
|
#include "DgpsClient.h"
|
|
#include "NtripClient.h"
|
|
#include "Logging.h"
|
|
|
|
/* defines ******************************************************************/
|
|
|
|
/* software details */
|
|
#define RTCMD_NAME "rtcmd"
|
|
#define RTCMD_VERSION "0.1"
|
|
|
|
/* default service and port */
|
|
#define RTCMD_SERVICE "rtcm-sc104"
|
|
#define RTCMD_PORT "2101"
|
|
|
|
/* macros *******************************************************************/
|
|
|
|
/* structs & typedefs *******************************************************/
|
|
|
|
/* c class definitions ******************************************************/
|
|
|
|
//
|
|
// Uses the Peak Systems CAN Linux driver and Nissan CAN data
|
|
//
|
|
class RtcmDaemon : public TcpDaemon, public Logging {
|
|
// public data
|
|
public:
|
|
DgpsClient Dgps;
|
|
NtripClient Ntrip;
|
|
RtcmDevice Rtcm;
|
|
|
|
// private data
|
|
private:
|
|
char Uri[1024];
|
|
|
|
// FDs
|
|
int DgpsIn;
|
|
int SerialIn;
|
|
int DgramIn;
|
|
int NtripIn;
|
|
|
|
// UDP broadcast
|
|
UdpCaster Bcast;
|
|
|
|
int nClients;
|
|
|
|
// static data
|
|
|
|
// public methods
|
|
public:
|
|
// constructors
|
|
RtcmDaemon();
|
|
|
|
// destructor
|
|
virtual ~RtcmDaemon();
|
|
|
|
// virtual functions
|
|
int ServerTimeout(void);
|
|
int ServerSocket(void);
|
|
int ClientIn( int sock, const char *buf, int n );
|
|
void ClientCast( const char *buf, int n );
|
|
int ClientUp( int sock );
|
|
void ClientDown( int sock );
|
|
|
|
// public methods
|
|
int RtcmOpen( const char *uri ); // serial device
|
|
|
|
int RtcmConnect( const char *uri );
|
|
void RtcmDisconnect( void );
|
|
void RtcmReconnect( void );
|
|
int RtcmBroadcast( const char *host = NULL, const char *port = RTCMD_SERVICE );
|
|
|
|
// static methods
|
|
|
|
// private methods
|
|
private:
|
|
};
|
|
|
|
#endif
|