hcilab / MyoStream

A reusable tool for Processing allowing the streaming of EMG data directly from the Myo armband through Bluetooth Low Energy
4 stars 2 forks source link

Timeout during readPacketOrTimeout() results in indeterminate state. #5

Open aarontabor opened 7 years ago

aarontabor commented 7 years ago

Currently, the readPacketOrTimeout() discards the partially read packet when it aborts due to a timeout. This leaves the communication channel in an essentially broken state, since a packet has essentially been discarded and there is no easy/reliable way to tell where the next packet begins.

Proposed solution

Instead of discarding the partially read packet, buffer it in an instance variable so that the read can be resumed in a subsequent call.