added stuff for bluetooth

worked on resampling methods
This commit is contained in:
mail@toni-fetzer.de
2019-06-05 18:09:15 +02:00
parent cb61e0fe68
commit 8d37e94647
12 changed files with 472 additions and 320 deletions

View File

@@ -24,11 +24,20 @@ struct BeaconMeasurements {
/** remove entries older then 3000 ms*/
void removeOld(const Timestamp latestTS) {
auto lambda = [latestTS] (const BeaconMeasurement& e) {
Timestamp age = latestTS - e.getTimestamp();
return age > Timestamp::fromMS(1000*3);
};
entries.erase(std::remove_if(entries.begin(), entries.end(), lambda), entries.end());
std::vector<BeaconMeasurement>::iterator it;
for (it = entries.begin(); it != entries.end(); ++it){
if(latestTS - it->getTimestamp() > Timestamp::fromMS(1000*3)){
entries.erase(it);
}
}
}
void add(const BeaconMeasurement& entry){
entries.push_back(entry);
//remove entries that are to old (3000ms)
removeOld(entry.getTimestamp());
}
};