The last event that happened or null if nothing has happened since the last call to this function.
A list of all of the reports that could be parsed out of the currently received data. If no reports could be parsed, returns an empty list.
Individual reports have a fixed size format of 20 bytes with a fixed, known structure.
List reports have a variable size with a fixed size header that contains the size of the total report.
This function will also update the reportParser object's current report progress status so that people who care can be informed about progress receiving this report.
NB We need to keep track of the time when we first start receiving information from a report because that the time the report was sent. So we keep an internal state variable _receivedTime that we set to the current time when we start receiving a report and to null when we're done processing a report.
Try to parse a single report from the report ring buffer. We get one single byte to figure out the type and then, optionally read the header and finally read the entire report.
A list of all of the reports that could be parsed out of the currently received data. If no reports could be parsed, returns an empty list.
Update our internal status information so that we can inform the user about progress receiving long reports. We only send events when a report is not received in a single shot. So if we are just dumped a complete report in a single pushData() call, then no progress will be reported.
Generated using TypeDoc
object
iotile.device.object:ReportParser
A stream based report parser that knows how to construct IOTileReport objects from data streamed from an IOTile Device. The ReportParser has only 2 public methods (and several getters). You can call pushData to send additional data received from an IOTileDevice to the ReportParser.
The ReportParser will automatically try to see how many reports it can build using all of the data it currently has and return a list of those reports to you.
If any error occurs during parsing, the ReportParser enters a broken state and will not process any further data until you call the reset() function.
ReportParser is built on top of a fixed size RingBuffer that it uses for efficiently handling report data.
See {@link Utilities.type:RingBuffer Utilities.RingBuffer}