2011-03-15 15:27:42 +01:00
|
|
|
#ifndef _OWLPS_POSITIONING_OUTPUTSOCKET_HH_
|
|
|
|
#define _OWLPS_POSITIONING_OUTPUTSOCKET_HH_
|
|
|
|
#include "outputmedium.hh"
|
|
|
|
#include <string>
|
|
|
|
#include <stdint.h> // <cstdint> is not C++ 98 compliant
|
2011-04-01 16:24:25 +02:00
|
|
|
#include <iostream>
|
2011-03-15 15:27:42 +01:00
|
|
|
//#include <netinet/in.h>
|
|
|
|
//#include <unistd.h>
|
|
|
|
|
|
|
|
/// Send a result to socket
|
|
|
|
class OutputSocket: public OutputMedium
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
int socketDescriptor ;
|
2011-04-01 16:24:25 +02:00
|
|
|
std::string m_ip ;
|
2011-03-15 15:27:42 +01:00
|
|
|
unsigned short int serverPort ;
|
|
|
|
|
|
|
|
public:
|
2011-04-01 16:24:25 +02:00
|
|
|
OutputSocket(const std::string &remote_ip): m_ip(remote_ip) { init_socket(); }
|
|
|
|
~OutputSocket() ;
|
2011-03-15 15:27:42 +01:00
|
|
|
|
|
|
|
void write(const Result &result) ;
|
|
|
|
|
|
|
|
std::string float2string(float f) ;
|
|
|
|
std::string uint2string(uint64_t f) ;
|
|
|
|
std::string int2string(int f) ;
|
|
|
|
void init_socket() ;
|
2011-04-01 16:24:25 +02:00
|
|
|
void kill_socket() ;
|
2011-03-15 15:27:42 +01:00
|
|
|
void send_data(std::string msg) ;
|
2011-04-01 16:24:25 +02:00
|
|
|
void send_screen() ;
|
2011-03-15 15:27:42 +01:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _OWLPS_POSITIONING_OUTPUTSOCKET_HH_
|
|
|
|
|