owlps/owlps-positioning/src/outputsocket.hh

37 lines
838 B
C++
Raw Normal View History

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
#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 ;
std::string m_ip ;
2011-03-15 15:27:42 +01:00
unsigned short int serverPort ;
public:
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() ;
void kill_socket() ;
2011-03-15 15:27:42 +01:00
void send_data(std::string msg) ;
void send_screen() ;
2011-03-15 15:27:42 +01:00
} ;
#endif // _OWLPS_POSITIONING_OUTPUTSOCKET_HH_