86 lines
3.2 KiB
C++
86 lines
3.2 KiB
C++
#ifndef _SERVER_HH_
|
|
#define _SERVER_HH_
|
|
|
|
#include <iostream>
|
|
#include <vector>
|
|
#include <string>
|
|
#include <fstream>
|
|
#include <sstream>
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
#include <arpa/inet.h>
|
|
#include <string.h>
|
|
#include <math.h>
|
|
#include <stdio.h>
|
|
#include "clientinfo.hh"
|
|
#include "referencepoint.hh"
|
|
#include "accesspoint.hh"
|
|
#include "point.hh"
|
|
#include "measurement.hh"
|
|
|
|
using namespace std;
|
|
using std::string;
|
|
|
|
#define DEFAULT_LOGFILE "log/radar_exp.csv" // Fichier de sortie
|
|
#define DEFAULT_REF_POINT_FILE "csv/agreg/toutes.csv" // Fichier des points de référence
|
|
#define DEFAULT_AP_FILE "cfg/minipc.cfg" // Fichier de configuration des AP
|
|
#define DEFAULT_TRACKING_FILE "csv/agreg/divagation.csv" // Fichier de prérégrination
|
|
#define DEFAULT_IP "127.0.0.1"
|
|
#define DEFAULT_LISTEN_PORT 7777
|
|
#define LIGHT_SPEED 300000000
|
|
#define MINMAX_STEP 0.5
|
|
#define MINMAX_X_START -1
|
|
#define MINMAX_Y_START -1
|
|
#define MINMAX_X_STOP 15
|
|
#define MINMAX_Y_STOP 45
|
|
#define BUFFER_LENGTH 5000
|
|
//#define DEFAULT_Z 3 // Décommenter pour utiliser des fichiers d'entrée avec des coordonnées dans un seul plan (X, Y).
|
|
//#define FRED_CSV_FORMAT // Décommenter pour utiliser les fichiers CSV au « format Fred » (plusieurs lignes par mesure, avec un AP par ligne).
|
|
|
|
|
|
class Server
|
|
{
|
|
protected:
|
|
vector<ClientInfo> client_list;
|
|
vector<ReferencePoint> reference_point_list;
|
|
vector<AccessPoint> access_point_list;
|
|
struct sockaddr_in server_addr;
|
|
int sockListen;
|
|
int sockSend;
|
|
|
|
public:
|
|
Server(const string &ip_addr = DEFAULT_IP, const int &listen_port = DEFAULT_LISTEN_PORT);
|
|
~Server();
|
|
void send_to_client(const int &cl);
|
|
int receive_data();
|
|
bool pointExists(const float &x, const float &y, const float &z)const;
|
|
unsigned int pointIndex(const float &x, const float &y, const float &z)const;
|
|
bool pointExists(const Point &p)const;
|
|
bool apExists(const string &ap_addr)const;
|
|
unsigned int apIndex(const string &ap_addr)const;
|
|
unsigned int pointIndex(const Point &p)const;
|
|
vector<Point> getkClosestInSs(const vector<Measurement> &m, const unsigned int &k)const ;
|
|
vector<Point> getkClosestInSs(const vector<Measurement> &m, const unsigned int &k, const Point *point_ignored)const ;
|
|
Point getkWeightedInSs(const vector<Measurement> &m, const unsigned int &k)const ;
|
|
Point getkWeightedInSs(const vector<Measurement> &m, const unsigned int &k, const Point *point_ignored)const ;
|
|
Point kPointsAverage(const vector<Point> &vp)const;
|
|
Point fbcm(const vector<Measurement> &m, const int &client_idx)const;
|
|
Point interlink(const vector<Measurement> &m, const int &client_idx)const;
|
|
void makeReferencePointListFromFile(const string &filename);
|
|
void makePointListFromFile(vector<ReferencePoint> &dest_point_list, const string &filename) ;
|
|
void makeApListFromFile(const string &filename);
|
|
void printReferencePointList();
|
|
void printPointList(vector<ReferencePoint> &point_list) ;
|
|
void printAccessPointList();
|
|
void computeFriisFromRefList();
|
|
unsigned int getNbReferencePoints()const { return reference_point_list.size(); };
|
|
|
|
/* For experimentation purpose only ! */
|
|
void radar_exp();
|
|
|
|
void fastViterbiLike(const unsigned short &N, const unsigned short &K, const unsigned int &id_client) ;
|
|
};
|
|
|
|
#endif
|