Add support for the new bailout event.

The new bailout event is reported to the application as a normal gas
change event.
This commit is contained in:
Jef Driesen 2013-06-18 22:17:38 +02:00
parent b1574848b2
commit bed4d19aca

View File

@ -596,13 +596,27 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call
} }
} }
// SetPoint Change if (version != 0x23) {
if ((events & 0x40) && (version != 0x23)) { // SetPoint Change
if (offset + 1 > size) if (events & 0x40) {
return DC_STATUS_DATAFORMAT; if (offset + 1 > size)
sample.setpoint = data[offset] / 100.0; return DC_STATUS_DATAFORMAT;
if (callback) callback (DC_SAMPLE_SETPOINT, sample, userdata); sample.setpoint = data[offset] / 100.0;
offset++; if (callback) callback (DC_SAMPLE_SETPOINT, sample, userdata);
offset++;
}
// Bailout Event
if (events & 0x80) {
if (offset + 2 > size)
return DC_STATUS_DATAFORMAT;
sample.event.type = SAMPLE_EVENT_GASCHANGE2;
sample.event.time = 0;
sample.event.flags = 0;
sample.event.value = data[offset] | (data[offset + 1] << 16);
if (callback) callback (DC_SAMPLE_EVENT, sample, userdata);
offset += 2;
}
} }
} }