Adding options for returning statistics and points.

This commit is contained in:
stephb9959
2022-03-27 11:13:01 -07:00
parent 8afe603488
commit 05dfcc9699

View File

@@ -70,14 +70,19 @@ namespace OpenWifi {
if(Values.empty())
return;
double sum = 0.0;
uint32_t num_values = 0;
for(const auto &value:Values) {
for(const auto &radio:value.radio_data) {
num_values++;
sum += (radio.*T);
P.min = std::min((double)P.min, (double)(radio.*T));
P.max = std::max((double)P.max, (double)(radio.*T));
}
}
P.avg = sum / (double) Values.size();
if(num_values)
P.avg = sum / (double) num_values;
else
P.avg = 0.0;
}
void RESTAPI_board_timepoint_handler::DoGet() {