Repository navigation
suunto_nautic: skip another app's subscription notifications in the /Data stream - #15
Open
trustthegoose wants to merge 1 commit into
Open
trustthegoose wants to merge 1 commit into
trustthegoose wants to merge 1 commit into
Conversation
…Data stream The Suunto app on the same phone holds subscriptions whose pushed values arrive as 0x01 notifications with sequence number 0, like our stream chunks (one seen on handle F0 BF 06 with a 4-byte payload). The stream loop took them as chunks and failed the stream with "Unexpected chunk size". Skip notifications whose handle isn't the stream's, comparing without the slot byte (chunks carry slot F0, the GET reply slot 00).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 1 of deepsealabs/libdc-swift#78, split out as requested because it affects stock build 22.
Problem
When the Suunto app is connected on the same phone, it holds subscriptions of its own, and the watch pushes their values over the shared link as
0x01notifications with sequence number 0, the same opcode and sequence number as our/Datastream chunks.suunto_nautic_stream()takes every such packet as a chunk, so one of them fails the stream:Both were the same notification, on another handle (Nautic, DC Tester build 22 on an iPad with the Suunto app connected):
The watch also pushes that value to the app every 30 minutes, so the stray packet can turn up during any long download while the Suunto app is connected.
Fix
Skip a notification whose handle isn't the stream's. One wrinkle: compare the handle without its slot byte. Our stream's chunks carry the handle with slot
F0, while the GET reply that bound it has slot00(e.g. chunksF0 24 0Efor GET00 24 0E); a full three-byte compare rejects every chunk of our own stream. The other subscription differs in the remaining two bytes (BF 06vs24 0E).Testing
-Wall -Wextra), same as the base.