It seems like I didn't actually redeploy the app to my phone when
testing my previous change, so I was actually testing the old code
(which works with my particular device name). After rebuilding for
sure with the new code, I didn't get the indexOf offsets correct.
This fixes the bug introduced by the previous change.
This change fixes several things:
1. Update the logic for 3 state related functions for MultiBLEDevice
so they now take into account all sub devices.
2. Fix several race condidtions in the initialization logic. This
fixes one lens permenantly not being connected.
3. Add a callback when one of the devicess diconnects to put the
both sides of the lens into WAITING_FOR_RECONNECT state.
4. Decrease the heartbeat sleep to 8 seconds. Since Android Deep sleep
can add upwards to 20 seconds to the sleep time, this means most
heartbeats will be sent every 28 seconds.
5. Fixed a bug in the per-side state when the device was disconnected
without the SideManager object being destroyed which lead to the
full initialization process not being followed on reconnection.
https://developer.android.com/guide/topics/resources/string-resource#FormattingAndStyling
Escape single quotes (') and double quote (").
Unescaped characters are removed by the Android tool chain.
A string contained completely in quotes
<string>"a b c"</string>
triggers special white space preserving handling (a b c) instead of the normal white space collapse (a b c).
Some glasses have shown up that have the format G1_X_L instead of the
previously expecte G1_XX_L. Update the regex so it can support any
number of digits in that position.
Previously, each side of the glasses had it's own sequence number, after
longer periods of time, these numbers would go out of sync and the
glasses would crash because the values are expected to be the same. Now
there is a single sequence number, and packets that are sent to both
lenses will now share the same sequence number. The heartbeat runner is
also moved to the shared space so that the time outs of the BLE
connections do not get skewed.