Commit feb63b54 authored by Michael Tross's avatar Michael Tross

report new measurements values based on individual time stamps

parent d8ed08ab
......@@ -325,23 +325,21 @@ int main(int argc __attribute__((unused)), char **argv __attribute__((unused)))
}
}
// Test first element if there are new values
if (dev->announced && (dev->mod->values[0].last_reported >= dev->mod->values[0].last_query)) {
continue;
}
vdc_report(LOG_INFO, "Reporting new values from device %p: %s...\n", dev, dev->dsuidstring);
dsvdc_property_t* pushEnvelope;
dsvdc_property_t* propState;
dsvdc_property_t* prop;
time_t now = time (NULL);
dsvdc_property_new (&pushEnvelope);
dsvdc_property_new (&propState);
for (v = 0; v < dev->mod->values_num; v++) {
double val = dev->mod->values[v].value;
time_t now = time (NULL);
// Test each element if there are new values
if (dev->announced && (dev->mod->values[v].last_reported >= dev->mod->values[v].last_query)) {
continue;
}
if (dsvdc_property_new (&prop) != DSVDC_OK) {
continue;
......@@ -354,6 +352,12 @@ int main(int argc __attribute__((unused)), char **argv __attribute__((unused)))
snprintf (sensorIndex, 64, "%d", v);
dsvdc_property_add_property (propState, sensorIndex, &prop);
vdc_report(LOG_INFO, "Reporting value: device %s, index %d, type %s, value %.3f, age %d\n",
dev->dsuidstring, sensorIndex,
dev->mod->values[v].data_type,
dev->mod->values[v].value,
now - dev->mod->values[v].last_query);
dev->mod->values[v].last_reported = now;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment