Reconstitution du dépôt, étape 0
Backup du 15-05-2009, restauré pour effacer les mauvais commits de Julien (mauvaise compréhension de SVN -> mauvaises utilisation). Du coup j'en profite pour préparer le terrain : un petit coup de astyle sur chaque fichier, pour que les diffs soient intéressants. DÉSORMAIS, ASTYLE DEVRA ÊTRE UTILISÉ AVANT CHAQUE COMMIT ! Pour ce faire : astyle --style=gnu *.cc *.hh git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@89 785a6c6c-259e-4ff1-8b91-dc31627914f0
This commit is contained in:
parent
f1791d816a
commit
4784fb00df
|
@ -24,22 +24,22 @@ AccessPoint::AccessPoint(const AccessPoint &ap)
|
|||
}
|
||||
|
||||
bool AccessPoint::operator==(const AccessPoint &ap)const
|
||||
{
|
||||
if(ap_addr == ap.ap_addr)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
{
|
||||
if (ap_addr == ap.ap_addr)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AccessPoint::operator!=(const AccessPoint &ap)const
|
||||
{
|
||||
if(ap_addr != ap.ap_addr)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
{
|
||||
if (ap_addr != ap.ap_addr)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
AccessPoint AccessPoint::operator=(const AccessPoint &ap)
|
||||
{
|
||||
if(this == &ap)
|
||||
if (this == &ap)
|
||||
return *this;
|
||||
ap_addr = ap.ap_addr;
|
||||
friis_index = ap.friis_index;
|
||||
|
@ -53,6 +53,6 @@ ostream &operator<<(ostream &os, const AccessPoint &ap)
|
|||
os << "Frequency: " << ap.freq << " Hz" << endl;
|
||||
os << "Antenna gain: " << ap.antenna_gain << "dBi" << endl;
|
||||
os << "Output power: " << ap.output_power << "dBm" << endl;
|
||||
|
||||
return os;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
|
|
@ -15,36 +15,76 @@ using std::string;
|
|||
#define AP_DEFAULT_OUTPUT_POWER 20 // Another good value, eq. to 100mW
|
||||
|
||||
class AccessPoint
|
||||
{
|
||||
protected:
|
||||
Point coordinates;
|
||||
string ap_addr;
|
||||
float friis_index;
|
||||
unsigned int freq;
|
||||
float antenna_gain;
|
||||
float output_power;
|
||||
|
||||
public:
|
||||
AccessPoint(const string &addr = AP_DEFAULT_ADDR, const float &fidx = AP_DEFAULT_FRIIS_INDEX, const Point &coords = Point(), const unsigned int &f = AP_DEFAULT_FREQ, const float &antg = AP_DEFAULT_ANTENNA_GAIN, const float &outp = AP_DEFAULT_OUTPUT_POWER);
|
||||
AccessPoint(const AccessPoint &ap);
|
||||
~AccessPoint() {};
|
||||
string getApAddr()const { return ap_addr; };
|
||||
float getFriisIndex()const { return friis_index; };
|
||||
Point getCoordinates()const { return coordinates; };
|
||||
float getAntennaGain()const { return antenna_gain; };
|
||||
unsigned int getFrequency()const { return freq; };
|
||||
float getOutputPower()const { return output_power; };
|
||||
void setApAddr(const string &addr) { ap_addr = addr; };
|
||||
void setFriisIndex(const float &fidx) { friis_index = fidx; };
|
||||
void setCoordinates(const Point &apc) { coordinates = apc; };
|
||||
void setCoordinates(const float &x, const float &y, const float &z) { Point apc(x, y, z); coordinates = apc; };
|
||||
void setFrequency(const unsigned int &f) { freq = f; };
|
||||
void setAntennaGain(const float &antg) { antenna_gain = antg; };
|
||||
void setOutputPower(const float &outp) {output_power = outp; };
|
||||
bool operator==(const AccessPoint &ap)const;
|
||||
bool operator!=(const AccessPoint &ap)const;
|
||||
AccessPoint operator=(const AccessPoint &ap);
|
||||
friend ostream &operator<<(ostream &os, const AccessPoint &ap);
|
||||
};
|
||||
{
|
||||
protected:
|
||||
Point coordinates;
|
||||
string ap_addr;
|
||||
float friis_index;
|
||||
unsigned int freq;
|
||||
float antenna_gain;
|
||||
float output_power;
|
||||
|
||||
public:
|
||||
AccessPoint(const string &addr = AP_DEFAULT_ADDR, const float &fidx = AP_DEFAULT_FRIIS_INDEX, const Point &coords = Point(), const unsigned int &f = AP_DEFAULT_FREQ, const float &antg = AP_DEFAULT_ANTENNA_GAIN, const float &outp = AP_DEFAULT_OUTPUT_POWER);
|
||||
AccessPoint(const AccessPoint &ap);
|
||||
~AccessPoint() {};
|
||||
string getApAddr()const
|
||||
{
|
||||
return ap_addr;
|
||||
};
|
||||
float getFriisIndex()const
|
||||
{
|
||||
return friis_index;
|
||||
};
|
||||
Point getCoordinates()const
|
||||
{
|
||||
return coordinates;
|
||||
};
|
||||
float getAntennaGain()const
|
||||
{
|
||||
return antenna_gain;
|
||||
};
|
||||
unsigned int getFrequency()const
|
||||
{
|
||||
return freq;
|
||||
};
|
||||
float getOutputPower()const
|
||||
{
|
||||
return output_power;
|
||||
};
|
||||
void setApAddr(const string &addr)
|
||||
{
|
||||
ap_addr = addr;
|
||||
};
|
||||
void setFriisIndex(const float &fidx)
|
||||
{
|
||||
friis_index = fidx;
|
||||
};
|
||||
void setCoordinates(const Point &apc)
|
||||
{
|
||||
coordinates = apc;
|
||||
};
|
||||
void setCoordinates(const float &x, const float &y, const float &z)
|
||||
{
|
||||
Point apc(x, y, z);
|
||||
coordinates = apc;
|
||||
};
|
||||
void setFrequency(const unsigned int &f)
|
||||
{
|
||||
freq = f;
|
||||
};
|
||||
void setAntennaGain(const float &antg)
|
||||
{
|
||||
antenna_gain = antg;
|
||||
};
|
||||
void setOutputPower(const float &outp)
|
||||
{
|
||||
output_power = outp;
|
||||
};
|
||||
bool operator==(const AccessPoint &ap)const;
|
||||
bool operator!=(const AccessPoint &ap)const;
|
||||
AccessPoint operator=(const AccessPoint &ap);
|
||||
friend ostream &operator<<(ostream &os, const AccessPoint &ap);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -70,34 +70,34 @@ Area::Area(const Area &a)
|
|||
|
||||
|
||||
bool Area::containsPoint(const Point &p)const
|
||||
{
|
||||
if((p.getX() >= x_min)
|
||||
&& (p.getX() <= x_max)
|
||||
&& (p.getY() >= y_min)
|
||||
&& (p.getY() <= y_max)
|
||||
&& (p.getZ() >= z_min)
|
||||
&& (p.getZ() <= z_max))
|
||||
return true;
|
||||
{
|
||||
if ((p.getX() >= x_min)
|
||||
&& (p.getX() <= x_max)
|
||||
&& (p.getY() >= y_min)
|
||||
&& (p.getY() <= y_max)
|
||||
&& (p.getZ() >= z_min)
|
||||
&& (p.getZ() <= z_max))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Area::operator==(const Area &a)const
|
||||
{
|
||||
if (area_name == a.area_name &&
|
||||
x_min == a.x_min &&
|
||||
x_max == a.x_max &&
|
||||
y_min == a.y_min &&
|
||||
y_max == a.y_max &&
|
||||
z_min == a.z_min &&
|
||||
z_max == a.z_max
|
||||
)
|
||||
return true ;
|
||||
{
|
||||
if (area_name == a.area_name &&
|
||||
x_min == a.x_min &&
|
||||
x_max == a.x_max &&
|
||||
y_min == a.y_min &&
|
||||
y_max == a.y_max &&
|
||||
z_min == a.z_min &&
|
||||
z_max == a.z_max
|
||||
)
|
||||
return true ;
|
||||
|
||||
return false ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -9,41 +9,83 @@ using namespace std;
|
|||
using std::string;
|
||||
|
||||
class Area
|
||||
{
|
||||
protected:
|
||||
string area_name;
|
||||
float x_min;
|
||||
float x_max;
|
||||
float y_min;
|
||||
float y_max;
|
||||
float z_min;
|
||||
float z_max;
|
||||
{
|
||||
protected:
|
||||
string area_name;
|
||||
float x_min;
|
||||
float x_max;
|
||||
float y_min;
|
||||
float y_max;
|
||||
float z_min;
|
||||
float z_max;
|
||||
|
||||
public:
|
||||
Area(const string &_name = "No name", const float &_x1 = 0, const float &_x2 = 0, const float &_y1 = 0, const float &_y2 = 0, const float &_z1 = 0, const float &_z2 = 0) ;
|
||||
Area(const Area &a) ;
|
||||
~Area() {};
|
||||
public:
|
||||
Area(const string &_name = "No name", const float &_x1 = 0, const float &_x2 = 0, const float &_y1 = 0, const float &_y2 = 0, const float &_z1 = 0, const float &_z2 = 0) ;
|
||||
Area(const Area &a) ;
|
||||
~Area() {};
|
||||
|
||||
bool containsPoint(const Point &p)const ;
|
||||
bool containsPoint(const Point &p)const ;
|
||||
|
||||
string getName()const { return area_name ; } ;
|
||||
float getXmin()const { return x_min; } ;
|
||||
float getXmax()const { return x_max; } ;
|
||||
float getYmin()const { return y_min; } ;
|
||||
float getYmax()const { return y_max; } ;
|
||||
float getZmin()const { return z_min; } ;
|
||||
float getZmax()const { return z_max; } ;
|
||||
string getName()const
|
||||
{
|
||||
return area_name ;
|
||||
} ;
|
||||
float getXmin()const
|
||||
{
|
||||
return x_min;
|
||||
} ;
|
||||
float getXmax()const
|
||||
{
|
||||
return x_max;
|
||||
} ;
|
||||
float getYmin()const
|
||||
{
|
||||
return y_min;
|
||||
} ;
|
||||
float getYmax()const
|
||||
{
|
||||
return y_max;
|
||||
} ;
|
||||
float getZmin()const
|
||||
{
|
||||
return z_min;
|
||||
} ;
|
||||
float getZmax()const
|
||||
{
|
||||
return z_max;
|
||||
} ;
|
||||
|
||||
void setName(const string &_name) { area_name = _name ; } ;
|
||||
void setXmin(const float &v) { x_min = v; } ;
|
||||
void setXmax(const float &v) { x_max = v; } ;
|
||||
void setYmin(const float &v) { y_min = v; } ;
|
||||
void setYmax(const float &v) { y_max = v; } ;
|
||||
void setZmin(const float &v) { z_min = v; } ;
|
||||
void setZmax(const float &v) { z_max = v; } ;
|
||||
void setName(const string &_name)
|
||||
{
|
||||
area_name = _name ;
|
||||
} ;
|
||||
void setXmin(const float &v)
|
||||
{
|
||||
x_min = v;
|
||||
} ;
|
||||
void setXmax(const float &v)
|
||||
{
|
||||
x_max = v;
|
||||
} ;
|
||||
void setYmin(const float &v)
|
||||
{
|
||||
y_min = v;
|
||||
} ;
|
||||
void setYmax(const float &v)
|
||||
{
|
||||
y_max = v;
|
||||
} ;
|
||||
void setZmin(const float &v)
|
||||
{
|
||||
z_min = v;
|
||||
} ;
|
||||
void setZmax(const float &v)
|
||||
{
|
||||
z_max = v;
|
||||
} ;
|
||||
|
||||
bool operator==(const Area &a)const ;
|
||||
friend ostream &operator<<(ostream &os, const Area &a) ;
|
||||
};
|
||||
bool operator==(const Area &a)const ;
|
||||
friend ostream &operator<<(ostream &os, const Area &a) ;
|
||||
};
|
||||
|
||||
#endif // _AREA_HH_
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
ClientInfo::ClientInfo(const string &ip, const int &port, const float &antg)
|
||||
{
|
||||
#ifdef DEBUG_T
|
||||
cout << "//--> ClientInfo::ClientInfo()" << endl ; fflush(stdout) ;
|
||||
cout << "//--> ClientInfo::ClientInfo()" << endl ;
|
||||
fflush(stdout) ;
|
||||
#endif // DEBUG_T
|
||||
|
||||
client_ip = ip;
|
||||
|
@ -17,7 +18,8 @@ ClientInfo::ClientInfo(const string &ip, const int &port, const float &antg)
|
|||
viterbi_V.resize(boost::extents[N-1][K]) ; // Allocation du tableau à la bonne taille (les cases sont initialisées à 0 automatiquement).
|
||||
|
||||
#ifdef DEBUG_T
|
||||
cout << "//<-- ClientInfo::ClientInfo()" << endl ; fflush(stdout) ;
|
||||
cout << "//<-- ClientInfo::ClientInfo()" << endl ;
|
||||
fflush(stdout) ;
|
||||
#endif // DEBUG_T
|
||||
}
|
||||
|
||||
|
@ -26,7 +28,8 @@ ClientInfo::ClientInfo(const string &ip, const int &port, const float &antg)
|
|||
ClientInfo::ClientInfo(const ClientInfo &c)
|
||||
{
|
||||
#ifdef DEBUG_T
|
||||
cout << "//--> ClientInfo::ClientInfo(ClientInfo)" << endl ; fflush(stdout) ;
|
||||
cout << "//--> ClientInfo::ClientInfo(ClientInfo)" << endl ;
|
||||
fflush(stdout) ;
|
||||
#endif // DEBUG_T
|
||||
|
||||
client_ip = c.client_ip ;
|
||||
|
@ -39,7 +42,8 @@ ClientInfo::ClientInfo(const ClientInfo &c)
|
|||
viterbi_V = c.viterbi_V ; // Copie du contenu de c.viterbi_V dans viterbi_V.
|
||||
|
||||
#ifdef DEBUG_T
|
||||
cout << "//<-- ClientInfo::ClientInfo(ClientInfo)" << endl ; fflush(stdout) ;
|
||||
cout << "//<-- ClientInfo::ClientInfo(ClientInfo)" << endl ;
|
||||
fflush(stdout) ;
|
||||
#endif // DEBUG_T
|
||||
}
|
||||
|
||||
|
@ -48,14 +52,16 @@ ClientInfo::ClientInfo(const ClientInfo &c)
|
|||
ClientInfo::~ClientInfo()
|
||||
{
|
||||
#ifdef DEBUG_T
|
||||
cout << "//--> ClientInfo::~ClientInfo()" << endl ; fflush(stdout) ;
|
||||
cout << "//--> ClientInfo::~ClientInfo()" << endl ;
|
||||
fflush(stdout) ;
|
||||
#endif // DEBUG_T
|
||||
|
||||
viterbi_Eprevious.clear();
|
||||
viterbi_Ecurrent.clear();
|
||||
|
||||
#ifdef DEBUG_T
|
||||
cout << "//<-- ClientInfo::~ClientInfo()" << endl ; fflush(stdout) ;
|
||||
cout << "//<-- ClientInfo::~ClientInfo()" << endl ;
|
||||
fflush(stdout) ;
|
||||
#endif // DEBUG_T
|
||||
}
|
||||
|
||||
|
@ -64,7 +70,8 @@ ClientInfo::~ClientInfo()
|
|||
ClientInfo ClientInfo::operator=(const ClientInfo &c)
|
||||
{
|
||||
#ifdef DEBUG_T
|
||||
cout << "//--> ClientInfo::operator=()" << endl ; fflush(stdout) ;
|
||||
cout << "//--> ClientInfo::operator=()" << endl ;
|
||||
fflush(stdout) ;
|
||||
#endif // DEBUG_T
|
||||
|
||||
if (this == &c)
|
||||
|
@ -80,7 +87,8 @@ ClientInfo ClientInfo::operator=(const ClientInfo &c)
|
|||
viterbi_V = c.viterbi_V ; // Copie du contenu de c.viterbi_V dans viterbi_V.
|
||||
|
||||
#ifdef DEBUG_T
|
||||
cout << "//<-- ClientInfo::operator=()" << endl ; fflush(stdout) ;
|
||||
cout << "//<-- ClientInfo::operator=()" << endl ;
|
||||
fflush(stdout) ;
|
||||
#endif // DEBUG_T
|
||||
|
||||
return *this ;
|
||||
|
@ -91,7 +99,8 @@ ClientInfo ClientInfo::operator=(const ClientInfo &c)
|
|||
bool ClientInfo::operator==(const ClientInfo &c)
|
||||
{
|
||||
#ifdef DEBUG_T
|
||||
cout << "//--> ClientInfo::operator==()" << endl ; fflush(stdout) ;
|
||||
cout << "//--> ClientInfo::operator==()" << endl ;
|
||||
fflush(stdout) ;
|
||||
#endif // DEBUG_T
|
||||
|
||||
if (this == &c)
|
||||
|
@ -115,26 +124,29 @@ bool ClientInfo::operator==(const ClientInfo &c)
|
|||
return true ;
|
||||
|
||||
#ifdef DEBUG_T
|
||||
cout << "//<-- ClientInfo::operator==()" << endl ; fflush(stdout) ;
|
||||
cout << "//<-- ClientInfo::operator==()" << endl ;
|
||||
fflush(stdout) ;
|
||||
#endif // DEBUG_T
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ClientInfo::print_viterbi_V() const
|
||||
{
|
||||
{
|
||||
#ifdef DEBUG_T
|
||||
cout << "//--> ClientInfo::print_viterbi_V()" << endl ; fflush(stdout) ;
|
||||
cout << "//--> ClientInfo::print_viterbi_V()" << endl ;
|
||||
fflush(stdout) ;
|
||||
#endif // DEBUG_T
|
||||
|
||||
for (float_index n=0 ; n < viterbi_V.shape()[0] ; n++)
|
||||
{
|
||||
for (float_index k=0 ; k < viterbi_V.shape()[1] ; k++)
|
||||
cout << "[" << viterbi_V[n][k] << "]" ;
|
||||
cout << endl ;
|
||||
}
|
||||
for (float_index n=0 ; n < viterbi_V.shape()[0] ; n++)
|
||||
{
|
||||
for (float_index k=0 ; k < viterbi_V.shape()[1] ; k++)
|
||||
cout << "[" << viterbi_V[n][k] << "]" ;
|
||||
cout << endl ;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_T
|
||||
cout << "//<-- ClientInfo::print_viterbi_V()" << endl ; fflush(stdout) ;
|
||||
cout << "//<-- ClientInfo::print_viterbi_V()" << endl ;
|
||||
fflush(stdout) ;
|
||||
#endif // DEBUG_T
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,36 +20,51 @@ using namespace std;
|
|||
#define VITERBI_K 8
|
||||
|
||||
class ClientInfo
|
||||
{
|
||||
public :
|
||||
typedef boost::multi_array<float, 2> float_array ; // On utilise boost::multi_array pour viterbi_V.
|
||||
typedef float_array::index float_index ;
|
||||
{
|
||||
public :
|
||||
typedef boost::multi_array<float, 2> float_array ; // On utilise boost::multi_array pour viterbi_V.
|
||||
typedef float_array::index float_index ;
|
||||
|
||||
protected:
|
||||
string client_ip;
|
||||
float antenna_gain;
|
||||
int client_listen_port;
|
||||
vector<Point> viterbi_Ecurrent; // Last vector
|
||||
vector<Point> viterbi_Eprevious; // Previous vector
|
||||
// float viterbi_distances[5];
|
||||
float_array viterbi_V ;
|
||||
unsigned int viterbi_iteration ; // Nombre d'ensembles d'historique qu'on a déjà passés
|
||||
protected:
|
||||
string client_ip;
|
||||
float antenna_gain;
|
||||
int client_listen_port;
|
||||
vector<Point> viterbi_Ecurrent; // Last vector
|
||||
vector<Point> viterbi_Eprevious; // Previous vector
|
||||
// float viterbi_distances[5];
|
||||
float_array viterbi_V ;
|
||||
unsigned int viterbi_iteration ; // Nombre d'ensembles d'historique qu'on a déjà passés
|
||||
|
||||
public:
|
||||
ClientInfo(const string &ip = CLIENT_DEFAULT_IP, const int &port = CLIENT_DEFAULT_PORT, const float &antg = CLIENT_DEFAULT_ANTENNA_GAIN);
|
||||
ClientInfo(const ClientInfo &c) ;
|
||||
~ClientInfo();
|
||||
public:
|
||||
ClientInfo(const string &ip = CLIENT_DEFAULT_IP, const int &port = CLIENT_DEFAULT_PORT, const float &antg = CLIENT_DEFAULT_ANTENNA_GAIN);
|
||||
ClientInfo(const ClientInfo &c) ;
|
||||
~ClientInfo();
|
||||
|
||||
ClientInfo operator=(const ClientInfo &c) ;
|
||||
bool operator==(const ClientInfo &c) ;
|
||||
ClientInfo operator=(const ClientInfo &c) ;
|
||||
bool operator==(const ClientInfo &c) ;
|
||||
|
||||
float getAntennaGain()const { return antenna_gain; };
|
||||
vector<Point>& getRef_viterbi_Ecurrent() { return viterbi_Ecurrent; } ;
|
||||
vector<Point>& getRef_viterbi_Eprevious() { return viterbi_Eprevious; } ;
|
||||
unsigned int& getRef_viterbi_iteration() { return viterbi_iteration ; } ;
|
||||
float_array& getRef_viterbi_V() { return viterbi_V; } ;
|
||||
float getAntennaGain()const
|
||||
{
|
||||
return antenna_gain;
|
||||
};
|
||||
vector<Point>& getRef_viterbi_Ecurrent()
|
||||
{
|
||||
return viterbi_Ecurrent;
|
||||
} ;
|
||||
vector<Point>& getRef_viterbi_Eprevious()
|
||||
{
|
||||
return viterbi_Eprevious;
|
||||
} ;
|
||||
unsigned int& getRef_viterbi_iteration()
|
||||
{
|
||||
return viterbi_iteration ;
|
||||
} ;
|
||||
float_array& getRef_viterbi_V()
|
||||
{
|
||||
return viterbi_V;
|
||||
} ;
|
||||
|
||||
void print_viterbi_V() const ;
|
||||
};
|
||||
void print_viterbi_V() const ;
|
||||
};
|
||||
|
||||
#endif // _CLIENTINFO_HH_
|
||||
|
|
|
@ -13,29 +13,29 @@ using namespace std;
|
|||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
ofstream output_file;
|
||||
string read_file;
|
||||
ofstream output_file;
|
||||
string read_file;
|
||||
|
||||
cout << "Called guinumo with args: ";
|
||||
for(int i = 1 ; i < argc ; i++)
|
||||
cout << argv[i] << " ";
|
||||
cout << endl;
|
||||
cout << "Called guinumo with args: ";
|
||||
for (int i = 1 ; i < argc ; i++)
|
||||
cout << argv[i] << " ";
|
||||
cout << endl;
|
||||
|
||||
if(argc != 5)
|
||||
cout << "Usage: guinumo AP_file Ref_Pt_file Test_file logfile" << endl;
|
||||
else
|
||||
{
|
||||
string apfile = argv[1];
|
||||
string refptfile = argv[2];
|
||||
Server server(apfile, refptfile) ;
|
||||
//server.createClient() ;
|
||||
//server.monitorClient(0, ALGO_CONTINU_FRBHM) ;
|
||||
string testfile = argv[3];
|
||||
string logfile = argv[4];
|
||||
server.radar_exp(logfile, testfile);
|
||||
if (argc != 5)
|
||||
cout << "Usage: guinumo AP_file Ref_Pt_file Test_file logfile" << endl;
|
||||
else
|
||||
{
|
||||
string apfile = argv[1];
|
||||
string refptfile = argv[2];
|
||||
Server server(apfile, refptfile) ;
|
||||
//server.createClient() ;
|
||||
//server.monitorClient(0, ALGO_CONTINU_FRBHM) ;
|
||||
string testfile = argv[3];
|
||||
string logfile = argv[4];
|
||||
server.radar_exp(logfile, testfile);
|
||||
|
||||
cout << argv[0] << " : fin." << endl ;
|
||||
fflush(stdout) ;
|
||||
}
|
||||
return 0;
|
||||
cout << argv[0] << " : fin." << endl ;
|
||||
fflush(stdout) ;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -3,31 +3,31 @@
|
|||
void Measurement::addSsValue(const int &ssv)
|
||||
{
|
||||
float ss_mwatts = pow(10, (float) ssv / 10.0) + (ss_list.size() * pow(10, average_ss / 10.0));
|
||||
|
||||
|
||||
ss_list.push_back(ssv);
|
||||
average_ss = 10 * log10(ss_mwatts / ss_list.size());
|
||||
}
|
||||
|
||||
float Measurement::getSsSquareDistance(const float &ss)const
|
||||
{
|
||||
return ((ss - average_ss) * (ss - average_ss));
|
||||
}
|
||||
{
|
||||
return ((ss - average_ss) * (ss - average_ss));
|
||||
}
|
||||
|
||||
ostream &operator<<(ostream &os, const Measurement &m)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
||||
os << m.mac_addr << "->";
|
||||
if (m.ss_list.size() == 0)
|
||||
os << "No values";
|
||||
else
|
||||
for (i = 0 ; i < m.ss_list.size() ; i++)
|
||||
{
|
||||
os << m.ss_list[i];
|
||||
if(i < m.ss_list.size() - 1)
|
||||
os << ";";
|
||||
os << m.ss_list[i];
|
||||
if (i < m.ss_list.size() - 1)
|
||||
os << ";";
|
||||
}
|
||||
os << " [AVG=" << m.average_ss << "]";
|
||||
|
||||
|
||||
return os;
|
||||
}
|
||||
|
|
|
@ -10,23 +10,47 @@ using namespace std;
|
|||
using std::string;
|
||||
|
||||
class Measurement
|
||||
{
|
||||
protected:
|
||||
string mac_addr;
|
||||
float average_ss;
|
||||
vector<int> ss_list;
|
||||
|
||||
public:
|
||||
Measurement(const string &ma = "ff:ff:ff:ff:ff:ff", const float &avg = 0, const vector<int> &ssl = vector<int>()) { mac_addr = ma; average_ss = avg, ss_list = ssl; };
|
||||
Measurement(const Measurement &m) { mac_addr = m.mac_addr; average_ss = m.average_ss; ss_list = m.ss_list; };
|
||||
~Measurement() { ss_list.clear(); };
|
||||
vector<int> getSsList()const { return ss_list; };
|
||||
float getAverage()const { return average_ss; };
|
||||
string getMacAddr()const { return mac_addr; };
|
||||
void addSsValue(const int &ssv);
|
||||
void setMacAddr(const string &ma) { mac_addr = ma; };
|
||||
float getSsSquareDistance(const float &ss)const;
|
||||
friend ostream &operator<<(ostream &os, const Measurement &m);
|
||||
};
|
||||
{
|
||||
protected:
|
||||
string mac_addr;
|
||||
float average_ss;
|
||||
vector<int> ss_list;
|
||||
|
||||
public:
|
||||
Measurement(const string &ma = "ff:ff:ff:ff:ff:ff", const float &avg = 0, const vector<int> &ssl = vector<int>())
|
||||
{
|
||||
mac_addr = ma;
|
||||
average_ss = avg, ss_list = ssl;
|
||||
};
|
||||
Measurement(const Measurement &m)
|
||||
{
|
||||
mac_addr = m.mac_addr;
|
||||
average_ss = m.average_ss;
|
||||
ss_list = m.ss_list;
|
||||
};
|
||||
~Measurement()
|
||||
{
|
||||
ss_list.clear();
|
||||
};
|
||||
vector<int> getSsList()const
|
||||
{
|
||||
return ss_list;
|
||||
};
|
||||
float getAverage()const
|
||||
{
|
||||
return average_ss;
|
||||
};
|
||||
string getMacAddr()const
|
||||
{
|
||||
return mac_addr;
|
||||
};
|
||||
void addSsValue(const int &ssv);
|
||||
void setMacAddr(const string &ma)
|
||||
{
|
||||
mac_addr = ma;
|
||||
};
|
||||
float getSsSquareDistance(const float &ss)const;
|
||||
friend ostream &operator<<(ostream &os, const Measurement &m);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
Point Point::operator=(const Point &p)
|
||||
{
|
||||
if(this == &p)
|
||||
if (this == &p)
|
||||
return *this;
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
|
@ -15,22 +15,22 @@ Point Point::operator=(const Point &p)
|
|||
|
||||
|
||||
bool Point::operator<(const Point &p) const
|
||||
{
|
||||
if (x < p.x)
|
||||
return true ;
|
||||
if (x > p.x)
|
||||
{
|
||||
if (x < p.x)
|
||||
return true ;
|
||||
if (x > p.x)
|
||||
return false ;
|
||||
|
||||
if (y < p.y)
|
||||
return true ;
|
||||
if (y > p.y)
|
||||
return false ;
|
||||
|
||||
if (z < p.z)
|
||||
return true ;
|
||||
|
||||
return false ;
|
||||
|
||||
if (y < p.y)
|
||||
return true ;
|
||||
if (y > p.y)
|
||||
return false ;
|
||||
|
||||
if (z < p.z)
|
||||
return true ;
|
||||
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,36 +7,96 @@
|
|||
using namespace std;
|
||||
|
||||
class Point
|
||||
{
|
||||
protected:
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
|
||||
public:
|
||||
Point(const float &_x = 0, const float &_y = 0, const float &_z = 0) { x = _x; y = _y; z = _z; } ;
|
||||
Point(const Point &p) { x = p.x; y = p.y; z = p.z; } ;
|
||||
Point(const float c[3]) { x = c[0] ; y = c[1] ; z = c[2] ; } ;
|
||||
~Point() {};
|
||||
float getX()const { return x; };
|
||||
float getY()const { return y; };
|
||||
float getZ()const { return z; };
|
||||
void setX(const float &_x) { x = _x; };
|
||||
void setY(const float &_y) { y = _y; };
|
||||
void setZ(const float &_z) { z = _z; };
|
||||
float squareDistance(const Point &p)const { return ((x-p.x)*(x-p.x))+((y-p.y)*(y-p.y))+((z-p.z)*(z-p.z)); };
|
||||
float squareDistance(const float &mx, const float &my, const float &mz)const { return ((x-mx)*(x-mx))+((y-my)*(y-my))+((z-mz)*(z-mz)); };
|
||||
float distance(const Point &p)const { return sqrt(((x-p.x)*(x-p.x))+((y-p.y)*(y-p.y))+((z-p.z)*(z-p.z))); };
|
||||
float distance(const float &mx, const float &my, const float &mz)const { return sqrt(((x-mx)*(x-mx))+((y-my)*(y-my))+((z-mz)*(z-mz))); };
|
||||
{
|
||||
protected:
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
|
||||
Point operator=(const Point &p) ;
|
||||
bool operator==(const Point &p) const {return ((x == p.x) && (y == p.y) && (z == p.z)) ;} ;
|
||||
bool operator!=(const Point &p) const {return !(*this == p) ;} ;
|
||||
bool operator<(const Point &p) const ;
|
||||
bool operator>(const Point &p) const {return (p < *this) ;} ;
|
||||
bool operator<=(const Point &p) const {return (*this < p || *this == p) ;} ;
|
||||
bool operator>=(const Point &p) const {return (p <= *this) ;} ;
|
||||
friend ostream &operator<<(ostream & os, const Point &p);
|
||||
};
|
||||
public:
|
||||
Point(const float &_x = 0, const float &_y = 0, const float &_z = 0)
|
||||
{
|
||||
x = _x;
|
||||
y = _y;
|
||||
z = _z;
|
||||
} ;
|
||||
Point(const Point &p)
|
||||
{
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
z = p.z;
|
||||
} ;
|
||||
Point(const float c[3])
|
||||
{
|
||||
x = c[0] ;
|
||||
y = c[1] ;
|
||||
z = c[2] ;
|
||||
} ;
|
||||
~Point() {};
|
||||
float getX()const
|
||||
{
|
||||
return x;
|
||||
};
|
||||
float getY()const
|
||||
{
|
||||
return y;
|
||||
};
|
||||
float getZ()const
|
||||
{
|
||||
return z;
|
||||
};
|
||||
void setX(const float &_x)
|
||||
{
|
||||
x = _x;
|
||||
};
|
||||
void setY(const float &_y)
|
||||
{
|
||||
y = _y;
|
||||
};
|
||||
void setZ(const float &_z)
|
||||
{
|
||||
z = _z;
|
||||
};
|
||||
float squareDistance(const Point &p)const
|
||||
{
|
||||
return ((x-p.x)*(x-p.x))+((y-p.y)*(y-p.y))+((z-p.z)*(z-p.z));
|
||||
};
|
||||
float squareDistance(const float &mx, const float &my, const float &mz)const
|
||||
{
|
||||
return ((x-mx)*(x-mx))+((y-my)*(y-my))+((z-mz)*(z-mz));
|
||||
};
|
||||
float distance(const Point &p)const
|
||||
{
|
||||
return sqrt(((x-p.x)*(x-p.x))+((y-p.y)*(y-p.y))+((z-p.z)*(z-p.z)));
|
||||
};
|
||||
float distance(const float &mx, const float &my, const float &mz)const
|
||||
{
|
||||
return sqrt(((x-mx)*(x-mx))+((y-my)*(y-my))+((z-mz)*(z-mz)));
|
||||
};
|
||||
|
||||
Point operator=(const Point &p) ;
|
||||
bool operator==(const Point &p) const
|
||||
{
|
||||
return ((x == p.x) && (y == p.y) && (z == p.z)) ;
|
||||
} ;
|
||||
bool operator!=(const Point &p) const
|
||||
{
|
||||
return !(*this == p) ;
|
||||
} ;
|
||||
bool operator<(const Point &p) const ;
|
||||
bool operator>(const Point &p) const
|
||||
{
|
||||
return (p < *this) ;
|
||||
} ;
|
||||
bool operator<=(const Point &p) const
|
||||
{
|
||||
return (*this < p || *this == p) ;
|
||||
} ;
|
||||
bool operator>=(const Point &p) const
|
||||
{
|
||||
return (p <= *this) ;
|
||||
} ;
|
||||
friend ostream &operator<<(ostream & os, const Point &p);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,147 +3,147 @@
|
|||
|
||||
|
||||
float ReferencePoint::getSsSquareDistance(const vector<Measurement> &m)const
|
||||
{
|
||||
unsigned int i, j;
|
||||
float ret = 0;
|
||||
bool found;
|
||||
vector<Measurement> ref_m = measurement_list;
|
||||
vector<Measurement> test_m = m;
|
||||
Measurement new_meas;
|
||||
{
|
||||
unsigned int i, j;
|
||||
float ret = 0;
|
||||
bool found;
|
||||
vector<Measurement> ref_m = measurement_list;
|
||||
vector<Measurement> test_m = m;
|
||||
Measurement new_meas;
|
||||
|
||||
new_meas.addSsValue(-95);
|
||||
new_meas.addSsValue(-95);
|
||||
|
||||
/* Complete measurement vector with unexisting ap (from ref point) */
|
||||
for(i = 0 ; i < ref_m.size() ; i++)
|
||||
{
|
||||
found = false;
|
||||
for(j = 0 ; j < test_m.size() && !found ; j++)
|
||||
if(test_m[j].getMacAddr() == ref_m[i].getMacAddr())
|
||||
found = true;
|
||||
if(!found)
|
||||
{
|
||||
new_meas.setMacAddr(measurement_list[i].getMacAddr());
|
||||
test_m.push_back(new_meas);
|
||||
}
|
||||
}
|
||||
/* Complete measurement vector with unexisting ap (from ref point) */
|
||||
for (i = 0 ; i < ref_m.size() ; i++)
|
||||
{
|
||||
found = false;
|
||||
for (j = 0 ; j < test_m.size() && !found ; j++)
|
||||
if (test_m[j].getMacAddr() == ref_m[i].getMacAddr())
|
||||
found = true;
|
||||
if (!found)
|
||||
{
|
||||
new_meas.setMacAddr(measurement_list[i].getMacAddr());
|
||||
test_m.push_back(new_meas);
|
||||
}
|
||||
}
|
||||
|
||||
/* Now, complete ref. point meas. */
|
||||
for(i = 0 ; i < test_m.size() ; i++)
|
||||
{
|
||||
found = false;
|
||||
for(j = 0 ; j < ref_m.size() && !found ; j++)
|
||||
if(test_m[i].getMacAddr() == ref_m[j].getMacAddr())
|
||||
found = true;
|
||||
if(!found)
|
||||
{
|
||||
new_meas.setMacAddr(test_m[i].getMacAddr());
|
||||
ref_m.push_back(new_meas);
|
||||
}
|
||||
}
|
||||
/* Now, complete ref. point meas. */
|
||||
for (i = 0 ; i < test_m.size() ; i++)
|
||||
{
|
||||
found = false;
|
||||
for (j = 0 ; j < ref_m.size() && !found ; j++)
|
||||
if (test_m[i].getMacAddr() == ref_m[j].getMacAddr())
|
||||
found = true;
|
||||
if (!found)
|
||||
{
|
||||
new_meas.setMacAddr(test_m[i].getMacAddr());
|
||||
ref_m.push_back(new_meas);
|
||||
}
|
||||
}
|
||||
|
||||
/* Now, compute SS distance */
|
||||
for (i = 0 ; i < test_m.size() ; i++)
|
||||
{
|
||||
j = 0;
|
||||
found = false;
|
||||
while((j < ref_m.size())&&(found == false))
|
||||
{
|
||||
if(ref_m[j].getMacAddr() == test_m[i].getMacAddr())
|
||||
{
|
||||
found = true;
|
||||
ret += ref_m[j].getSsSquareDistance(test_m[i].getAverage());
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
/* Now, compute SS distance */
|
||||
for (i = 0 ; i < test_m.size() ; i++)
|
||||
{
|
||||
j = 0;
|
||||
found = false;
|
||||
while ((j < ref_m.size())&&(found == false))
|
||||
{
|
||||
if (ref_m[j].getMacAddr() == test_m[i].getMacAddr())
|
||||
{
|
||||
found = true;
|
||||
ret += ref_m[j].getSsSquareDistance(test_m[i].getAverage());
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
ref_m.clear();
|
||||
test_m.clear();
|
||||
ref_m.clear();
|
||||
test_m.clear();
|
||||
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ReferencePoint::addMeasurement(const string &mac_a, const int &value)
|
||||
{
|
||||
unsigned int i;
|
||||
Measurement m;
|
||||
bool inserted = false;
|
||||
unsigned int i;
|
||||
Measurement m;
|
||||
bool inserted = false;
|
||||
|
||||
for (i = 0 ; i < measurement_list.size() ; i++)
|
||||
if(measurement_list[i].getMacAddr() == mac_a)
|
||||
{
|
||||
measurement_list[i].addSsValue(value);
|
||||
inserted = true;
|
||||
break;
|
||||
}
|
||||
if(inserted == false)
|
||||
{
|
||||
m.setMacAddr(mac_a);
|
||||
m.addSsValue(value);
|
||||
measurement_list.push_back(m);
|
||||
}
|
||||
for (i = 0 ; i < measurement_list.size() ; i++)
|
||||
if (measurement_list[i].getMacAddr() == mac_a)
|
||||
{
|
||||
measurement_list[i].addSsValue(value);
|
||||
inserted = true;
|
||||
break;
|
||||
}
|
||||
if (inserted == false)
|
||||
{
|
||||
m.setMacAddr(mac_a);
|
||||
m.addSsValue(value);
|
||||
measurement_list.push_back(m);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ReferencePoint::getPowerForAp(const string &ap_mac, float *p)const
|
||||
{
|
||||
unsigned int i;
|
||||
string str;
|
||||
string macLowerCase;
|
||||
{
|
||||
unsigned int i;
|
||||
string str;
|
||||
string macLowerCase;
|
||||
|
||||
str=ap_mac;
|
||||
str=ap_mac;
|
||||
|
||||
//Pour convertir les majuscules en miniscules
|
||||
const int length=str.length();
|
||||
for(int j=0; j < length; ++j)
|
||||
{
|
||||
str[j] = std::tolower(str[j]);
|
||||
}
|
||||
//Pour convertir les majuscules en miniscules
|
||||
const int length=str.length();
|
||||
for (int j=0; j < length; ++j)
|
||||
{
|
||||
str[j] = std::tolower(str[j]);
|
||||
}
|
||||
|
||||
for (i = 0 ; i < measurement_list.size() ; i++)
|
||||
if(measurement_list[i].getMacAddr() == str)
|
||||
{
|
||||
*p = measurement_list[i].getAverage();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
for (i = 0 ; i < measurement_list.size() ; i++)
|
||||
if (measurement_list[i].getMacAddr() == str)
|
||||
{
|
||||
*p = measurement_list[i].getAverage();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ReferencePoint ReferencePoint::operator=(const ReferencePoint &rp)
|
||||
{
|
||||
if(this == &rp)
|
||||
return *this;
|
||||
if (this == &rp)
|
||||
return *this;
|
||||
|
||||
coordinates = rp.coordinates;
|
||||
measurement_list = rp.measurement_list;
|
||||
return *this;
|
||||
coordinates = rp.coordinates;
|
||||
measurement_list = rp.measurement_list;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ostream &operator<<(ostream &os, ReferencePoint &rp)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int i;
|
||||
|
||||
os << rp.coordinates << endl;
|
||||
if(rp.measurement_list.size() == 0)
|
||||
os << "No measurements" << endl;
|
||||
else
|
||||
for (i = 0 ; i < rp.measurement_list.size() ; i++)
|
||||
os << rp.measurement_list[i] << endl;
|
||||
os << rp.coordinates << endl;
|
||||
if (rp.measurement_list.size() == 0)
|
||||
os << "No measurements" << endl;
|
||||
else
|
||||
for (i = 0 ; i < rp.measurement_list.size() ; i++)
|
||||
os << rp.measurement_list[i] << endl;
|
||||
|
||||
return os;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Opérateur de cast en Point */
|
||||
ReferencePoint::operator Point() const
|
||||
{
|
||||
return coordinates ;
|
||||
}
|
||||
{
|
||||
return coordinates ;
|
||||
}
|
||||
|
|
|
@ -9,27 +9,51 @@
|
|||
using namespace std;
|
||||
|
||||
class ReferencePoint
|
||||
{
|
||||
protected:
|
||||
Point coordinates;
|
||||
vector<Measurement> measurement_list;
|
||||
{
|
||||
protected:
|
||||
Point coordinates;
|
||||
vector<Measurement> measurement_list;
|
||||
|
||||
public:
|
||||
ReferencePoint(const float &x = 0, const float &y = 0, const float &z = 0) { coordinates.setX(x); coordinates.setY(y); coordinates.setZ(z); };
|
||||
ReferencePoint(const ReferencePoint &rp) { coordinates = rp.coordinates; measurement_list = rp.measurement_list; };
|
||||
ReferencePoint(const Point &c) { coordinates = c; };
|
||||
~ReferencePoint() { measurement_list.clear(); };
|
||||
public:
|
||||
ReferencePoint(const float &x = 0, const float &y = 0, const float &z = 0)
|
||||
{
|
||||
coordinates.setX(x);
|
||||
coordinates.setY(y);
|
||||
coordinates.setZ(z);
|
||||
};
|
||||
ReferencePoint(const ReferencePoint &rp)
|
||||
{
|
||||
coordinates = rp.coordinates;
|
||||
measurement_list = rp.measurement_list;
|
||||
};
|
||||
ReferencePoint(const Point &c)
|
||||
{
|
||||
coordinates = c;
|
||||
};
|
||||
~ReferencePoint()
|
||||
{
|
||||
measurement_list.clear();
|
||||
};
|
||||
|
||||
float getSsSquareDistance(const vector<Measurement> &m)const;
|
||||
Point getCoordinates()const { return coordinates; };
|
||||
void addMeasurement(const string &mac_a, const int &value);
|
||||
void setCoordinates(const Point &p) { coordinates = p; };
|
||||
vector<Measurement> getMeasurementList() const { return measurement_list; } ;
|
||||
bool getPowerForAp(const string &ap_mac, float *p) const ;
|
||||
float getSsSquareDistance(const vector<Measurement> &m)const;
|
||||
Point getCoordinates()const
|
||||
{
|
||||
return coordinates;
|
||||
};
|
||||
void addMeasurement(const string &mac_a, const int &value);
|
||||
void setCoordinates(const Point &p)
|
||||
{
|
||||
coordinates = p;
|
||||
};
|
||||
vector<Measurement> getMeasurementList() const
|
||||
{
|
||||
return measurement_list;
|
||||
} ;
|
||||
bool getPowerForAp(const string &ap_mac, float *p) const ;
|
||||
|
||||
ReferencePoint operator=(const ReferencePoint &rp);
|
||||
operator Point() const ;
|
||||
friend ostream &operator<<(ostream &os, ReferencePoint &rp);
|
||||
};
|
||||
ReferencePoint operator=(const ReferencePoint &rp);
|
||||
operator Point() const ;
|
||||
friend ostream &operator<<(ostream &os, ReferencePoint &rp);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -55,92 +55,95 @@ typedef enum { ALGO_VLI = 1, ALGO_BASIC_FRBHM, ALGO_CONTINU_FRBHM } ALGORITHM ;
|
|||
|
||||
|
||||
class Server
|
||||
{
|
||||
public :
|
||||
typedef boost::multi_array<float, 2> float_array ; // On utilise boost::multi_array pour les matrices de distances temporaires.
|
||||
typedef float_array::index float_index ;
|
||||
{
|
||||
public :
|
||||
typedef boost::multi_array<float, 2> float_array ; // On utilise boost::multi_array pour les matrices de distances temporaires.
|
||||
typedef float_array::index float_index ;
|
||||
|
||||
protected:
|
||||
vector<ClientInfo> client_list ; // Liste des clients connus.
|
||||
map<string, Area> area_list ; // Liste des zones homogènes (pièces).
|
||||
vector<ReferencePoint> reference_point_list ; // Liste des points de référence (calibration).
|
||||
vector<AccessPoint> access_point_list ; // Liste des AP connus.
|
||||
float **reference_point_matrix ; // Matrice des distances entre les points de référence.
|
||||
vector<Point> waypoint_list ; // Liste des points de passage entre les zones.
|
||||
float **waypoint_matrix ; // Matrice des distances entre les points de passage.
|
||||
struct sockaddr_in server_addr;
|
||||
int sockListen;
|
||||
int sockSend;
|
||||
protected:
|
||||
vector<ClientInfo> client_list ; // Liste des clients connus.
|
||||
map<string, Area> area_list ; // Liste des zones homogènes (pièces).
|
||||
vector<ReferencePoint> reference_point_list ; // Liste des points de référence (calibration).
|
||||
vector<AccessPoint> access_point_list ; // Liste des AP connus.
|
||||
float **reference_point_matrix ; // Matrice des distances entre les points de référence.
|
||||
vector<Point> waypoint_list ; // Liste des points de passage entre les zones.
|
||||
float **waypoint_matrix ; // Matrice des distances entre les points de passage.
|
||||
struct sockaddr_in server_addr;
|
||||
int sockListen;
|
||||
int sockSend;
|
||||
|
||||
public:
|
||||
Server(const string &ap_file = DEFAULT_AP_FILE, const string &ref_pt_file = DEFAULT_REF_POINT_FILE, const string &ip_addr = DEFAULT_IP, const int &listen_port = DEFAULT_LISTEN_PORT);
|
||||
~Server();
|
||||
public:
|
||||
Server(const string &ap_file = DEFAULT_AP_FILE, const string &ref_pt_file = DEFAULT_REF_POINT_FILE, const string &ip_addr = DEFAULT_IP, const int &listen_port = DEFAULT_LISTEN_PORT);
|
||||
~Server();
|
||||
|
||||
void send_to_client(const int &cl);
|
||||
int receive_data();
|
||||
void send_to_client(const int &cl);
|
||||
int receive_data();
|
||||
|
||||
ClientInfo& createClient() ;
|
||||
ClientInfo& createClient() ;
|
||||
|
||||
map<string, Area> inWhichAreas(const Point &p) ;
|
||||
bool inTheSameArea(const Point &p1, const Point &p2) ;
|
||||
vector<Point> areaConnection(const Area &z1, const Area &z2) ;
|
||||
vector<Point> areaConnection(const Area &z) ;
|
||||
float distanceTopology(const Point &p1, const Point &p2) ;
|
||||
map<string, Area> inWhichAreas(const Point &p) ;
|
||||
bool inTheSameArea(const Point &p1, const Point &p2) ;
|
||||
vector<Point> areaConnection(const Area &z1, const Area &z2) ;
|
||||
vector<Point> areaConnection(const Area &z) ;
|
||||
float distanceTopology(const Point &p1, const Point &p2) ;
|
||||
|
||||
bool pointExists(const float &x, const float &y, const float &z)const;
|
||||
bool pointExists(const Point &p)const;
|
||||
bool pointExists(const vector<ReferencePoint> &point_list, const float &x, const float &y, const float &z) const ;
|
||||
bool pointExists(const vector<ReferencePoint> &point_list, const Point &p) const ;
|
||||
bool pointExists(const float &x, const float &y, const float &z)const;
|
||||
bool pointExists(const Point &p)const;
|
||||
bool pointExists(const vector<ReferencePoint> &point_list, const float &x, const float &y, const float &z) const ;
|
||||
bool pointExists(const vector<ReferencePoint> &point_list, const Point &p) const ;
|
||||
|
||||
int pointIndex(const float &x, const float &y, const float &z) const;
|
||||
int pointIndex(const Point &p) const;
|
||||
int pointIndex(const vector<ReferencePoint> &point_list, const float &x, const float &y, const float &z) const ;
|
||||
int pointIndex(const vector<ReferencePoint> &point_list, const Point &p) const ;
|
||||
int pointIndex(const Point *tab, unsigned int &size, const Point &p) const ;
|
||||
int pointIndex(const vector<Point> &point_list, const Point &p) const ;
|
||||
int pointIndex(const float &x, const float &y, const float &z) const;
|
||||
int pointIndex(const Point &p) const;
|
||||
int pointIndex(const vector<ReferencePoint> &point_list, const float &x, const float &y, const float &z) const ;
|
||||
int pointIndex(const vector<ReferencePoint> &point_list, const Point &p) const ;
|
||||
int pointIndex(const Point *tab, unsigned int &size, const Point &p) const ;
|
||||
int pointIndex(const vector<Point> &point_list, const Point &p) const ;
|
||||
|
||||
bool apExists(const string &ap_addr)const;
|
||||
unsigned int apIndex(const string &ap_addr)const;
|
||||
bool apExists(const string &ap_addr)const;
|
||||
unsigned int apIndex(const string &ap_addr)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 ;
|
||||
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 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 fbcm_friis( const vector<Measurement> &m, const vector<float> friis_idx_list, const float &z)const;
|
||||
Point interlink(const vector<Measurement> &m, const int &client_idx)const;
|
||||
Point kPointsAverage(const vector<Point> &vp)const;
|
||||
Point fbcm(const vector<Measurement> &m, const int &client_idx)const;
|
||||
Point fbcm_friis( const vector<Measurement> &m, const vector<float> friis_idx_list, const float &z)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 makePointListFromFile(vector<ReferencePoint> &dest_point_list, const string &filename, const bool uniq_point) ;
|
||||
void makeApListFromFile(const string &filename);
|
||||
void makeTopologyFromFile(const string &filename) ;
|
||||
void makeWaypointListFromFile(const string &filename) ;
|
||||
void makeReferencePointDistances() ;
|
||||
void makeReferencePointListFromFile(const string &filename);
|
||||
void makePointListFromFile(vector<ReferencePoint> &dest_point_list, const string &filename) ;
|
||||
void makePointListFromFile(vector<ReferencePoint> &dest_point_list, const string &filename, const bool uniq_point) ;
|
||||
void makeApListFromFile(const string &filename);
|
||||
void makeTopologyFromFile(const string &filename) ;
|
||||
void makeWaypointListFromFile(const string &filename) ;
|
||||
void makeReferencePointDistances() ;
|
||||
|
||||
bool checkTopology() ;
|
||||
bool checkTopology() ;
|
||||
|
||||
void selectDistances(float_array *matrix, const vector<Point> &l1, const vector<Point> &l2) const ;
|
||||
void computeEuclideanDistances(float_array *matrix, const vector<Point> &l1, const vector<Point> &l2) const ;
|
||||
void computeTopologyDistances(float_array *matrix, const vector<Point> &l1, const vector<Point> &l2) ;
|
||||
void selectDistances(float_array *matrix, const vector<Point> &l1, const vector<Point> &l2) const ;
|
||||
void computeEuclideanDistances(float_array *matrix, const vector<Point> &l1, const vector<Point> &l2) const ;
|
||||
void computeTopologyDistances(float_array *matrix, const vector<Point> &l1, const vector<Point> &l2) ;
|
||||
|
||||
void printReferencePointList() ;
|
||||
void printPointList(vector<ReferencePoint> &point_list) ;
|
||||
void printAccessPointList() const ;
|
||||
void printReferencePointList() ;
|
||||
void printPointList(vector<ReferencePoint> &point_list) ;
|
||||
void printAccessPointList() const ;
|
||||
|
||||
void computeFriisFromRefList();
|
||||
vector<float> computeFriisFromRefList(const Point &p, const vector<Measurement> &m);
|
||||
void computeFriisFromRefList();
|
||||
vector<float> computeFriisFromRefList(const Point &p, const vector<Measurement> &m);
|
||||
|
||||
unsigned int getNbReferencePoints()const { return reference_point_list.size(); };
|
||||
unsigned int getNbReferencePoints()const
|
||||
{
|
||||
return reference_point_list.size();
|
||||
};
|
||||
|
||||
void monitorClient(const unsigned int &client_id, const ALGORITHM &algo) ;
|
||||
Point fastViterbiLike(const unsigned int &id_client, const float_array &distance_matrix) ;
|
||||
void monitorClient(const unsigned int &client_id, const ALGORITHM &algo) ;
|
||||
Point fastViterbiLike(const unsigned int &id_client, const float_array &distance_matrix) ;
|
||||
|
||||
/* For experimentation purpose only ! */
|
||||
void radar_exp(const string &outfile = DEFAULT_LOGFILE, const string &testfile = DEFAULT_REF_POINT_FILE_1M);
|
||||
};
|
||||
/* For experimentation purpose only ! */
|
||||
void radar_exp(const string &outfile = DEFAULT_LOGFILE, const string &testfile = DEFAULT_REF_POINT_FILE_1M);
|
||||
};
|
||||
|
||||
#endif // _SERVER_HH_
|
||||
|
|
Loading…
Reference in New Issue