65 lines
1.4 KiB
C++
Executable File
65 lines
1.4 KiB
C++
Executable File
#ifndef CSV_H
|
|
#define CSV_H
|
|
|
|
|
|
class CSV {
|
|
|
|
int row = 0;
|
|
const char sep = ';';
|
|
std::stringstream ss;
|
|
|
|
public:
|
|
|
|
void add(const OptStats& stats, const Floorplan::Ceilings& ceilings) {
|
|
|
|
ss << ++row << sep;
|
|
ss << stats.mac.asString() << sep;
|
|
ss << (stats.knownToMap() ? 1 : 0) << sep;
|
|
|
|
ss << stats.getEstErrorAvg() << sep;
|
|
ss << stats.getEstErrorMaxNeg().getError_db() << sep;
|
|
ss << stats.getEstErrorMaxPos().getError_db() << sep;
|
|
|
|
ss << stats.getEstPos().x << sep;
|
|
ss << stats.getEstPos().y << sep;
|
|
ss << stats.getEstPos().z << sep;
|
|
|
|
if (stats.knownToMap()) {
|
|
ss << stats.realPos.x << sep;
|
|
ss << stats.realPos.y << sep;
|
|
ss << stats.realPos.z << sep;
|
|
ss << stats.getRealEstDiff().length() << sep;
|
|
ss << ceilings.numCeilingsBetween(stats.realPos, stats.getEstPos()) << sep;
|
|
ss << stats.name << sep;
|
|
}
|
|
|
|
ss << "\n";
|
|
|
|
}
|
|
|
|
/** an AP that is known to the map, but unseen during fingerprinting [should not happen] */
|
|
void addUnseen(const MACAddress& mac) {
|
|
ss << ++row << sep;
|
|
ss << mac.asString() << sep;
|
|
ss << "AP_IN_MAP_BUT_UNSEEN_DURING_FINGERPRINTING" << sep;
|
|
ss << "\n";
|
|
}
|
|
|
|
/** ap is seen, but there are not enough fingerprints [should not happen] */
|
|
void addNotEnoughFingerprints(const OptStats& stats) {
|
|
ss << ++row << sep;
|
|
ss << stats.mac.asString() << sep;
|
|
ss << "NOT_ENOUGH_FINGERPRINTS" << sep;
|
|
}
|
|
|
|
void dump() {
|
|
std::cout << ss.str() << std::endl;
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
#endif // CSV_H
|