On Fri, Aug 9, 2019 at 7:14 PM Michael Werle <
mwe...@gmail.com> wrote:
>
> Bluetooth captures (can be loaded into wireshark) as well as typed up some analysis on the actual dive computer protocol (readme.txt for list of files and what's in each):
>
>
https://drive.google.com/open?id=1iyNLJY3bhjbdftDta5XT2EtmEbg6DgOB
>
> I can easily create new Bluetooth captures, should also get some more dives on it in the next couple of weeks.
>
> If the writeup isn't sufficient, please point at an example of a "good writeup".
Looks useful already.
The first packet actually looks like a setup packet. Your writeup says
#202e0c190730223004
# - request / command
20 - packet type : ?
2e - ?
0c - packet payload length in characters (12)
190730223004 - packet payload data : ?
19 - matches number of dives below; coincidence?
but I think the 19 is actually "19" as the _year_ 2019: that looks
like the date and time of the connection: 19/07/30 at 22:30:04.
Do you think that 10:30pm sounds like a likely time for you to have
done that dump? That's *kind* of what the dump data itself says, I see
a packet timestamp that claims
Jul 30, 2019 15:30:05.134311000 PDT
(so off by a second, and showing your 10:30pm PDT with what looks like
a -0700 timezone correction - I think that may be a wireshark problem,
where it applies the timezone correction to something that was already
a local time).
Your first dump ("hci_log_A") has a similar pattern: Wireshark says
Jul 16, 2019 02:02:47.853062000 PDT
but I doubt you did it at 2:02AM, and it's likely 9:02AM local time.
Which matches the first setup packet in the dump:
#204C0C190716090247
which would be 19/07/16 at 09:02:47.
So the "20" seems to be the command, and I agree that the "0c" might
be the length of the remaining data.
I'm not sure what that middle byte there is ("4C" in the first dump,
"2E" in the second one). It seems largely random. It does look like
the pattern is "command/response byte", "random byte", "data length
byte" all encoded as HEX numbers in the ASCII stream of data.
I wonder if the "random byte" is some kind of parity or CRC byte.
It's a very odd format. It's all ASCII, with some of it seemingly
being real ASCII data (like that date and time), and other parts being
hex-encoded bytes.
With that #/$ for command/response marker, and newlines at the end.
And almost always, the BLE packetization matches the ASCII line
exactly (so one line per packet). But I see one case of the line being
split, so that the first packet only contains the "$", and the next
packet contains the ASCII line of data (and newline). I suspect that's
because the Nordic Semiconductor BLE serial logic simply has a small
buffer and a timeout, and what happened once was that the writing side
of the dive computer started with the "$" byte and then had a small
delay before the rest of the line made it to the BLE serial converter
logic, and so that sent it out as two packets.
So it _looks_ packetized, but you actually have to treat it as an
ASCII stream with newlines.
Some of the HEX encoding is also confused about the case of the hex
characters too (ie "a-f" vs "A-F").
Anyway, I think I can make sense of most of this, and I can parse the
insanity. It's a quite odd format, but the actual amount of data there
seems to be pretty limited and simple.
Famous last words.
Linus