#ifndef _SERVER_HH_ #define _SERVER_HH_ #include #include #include #include #include #include #include #include #include #include #include #include #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" #define DEFAULT_REF_POINT_FILE "csv/complete-scan.csv" #define DEFAULT_AP_FILE "cfg/accesspoints.cfg" #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 1024 #define DEFAULT_Z 3 #define DEFAULT_VITERBI_K 5 class Server { protected: vector client_list; vector reference_point_list; vector access_point_list; struct sockaddr_in server_addr; int sockListen; int sockSend; public: //Server(string ip_addr = DEFAULT_IP, int listen_port = DEFAULT_LISTEN_PORT, int send_port); Server(string ip_addr = DEFAULT_IP, int listen_port = DEFAULT_LISTEN_PORT); ~Server(); void send_to_client(int cl); int receive_data(); bool pointExists(float x, float y, float z)const; unsigned int pointIndex(float x, float y, float z)const; bool pointExists(Point p)const; bool apExists(string ap_addr)const; unsigned int apIndex(string ap_addr)const; unsigned int pointIndex(Point p)const; vector getkClosestInSs(vector m, unsigned int k, bool ignore_point, Point point_ignored)const; Point getkWeightedInSs(vector m, unsigned int k, bool ignore_point, Point point_ignored)const; Point kPointsAverage(vector vp)const; Point fbcm(vector m, int client_idx)const; Point interlink(vector m, int client_idx)const; void makeReferencePointListFromFile(string filename); void makeApListFromFile(string filename); void printReferencePointList(); void printAccessPointList(); void computeFriisFromRefList(); unsigned int getNbReferencePoints()const { return reference_point_list.size(); }; /* For experimentation purpose only ! */ void radar_exp(); /* For compilation purpose :-) */ // Point viterbiLike(float**, short unsigned int, short unsigned int, std::vector >, std::vector >) ; }; #endif