Skip to content

Commit

Permalink
Use string length info for information packtet (fixes #14).
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigge committed May 14, 2012
1 parent f7dfe71 commit 7374eec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion garmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ def on_burst_data(self, data):

if self.state == Garmin.State.REQUESTID:
_logger.debug("%d, %d, %s", len(data), len(data[11:]), data[11:])
(strlen, unitid, name) = struct.unpack("<BI14s", data[11:-2])
(strlen, unitid) = struct.unpack("<11xBI", data[:16])
name = data[16:16 + strlen].tostring()
print "String length: ", strlen
print "Unit ID: ", unitid
print "Product name: ", name
Expand Down
5 changes: 3 additions & 2 deletions resources/protocol doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,12 @@ Watch -> Host burst: The clock answers with a burst message:

Row 1: Same as last/current broadcast

Row 2: Byte 0-2: Unknown, Byte 3: Probably name string length
Row 2: Byte 0-2: Unknown, Byte 3: Name string length (includes one null
char at the end of the string)
Byte 4-7: Garmin Unit ID - uint32, little-endian

Row 3-4: Name string: "Garmin Forerunner 610", remaining space is
zero padded.
zero padded to next even octet. Unknown character encoding.


Here we can either pair with device or send old pair info - can only pair if
Expand Down

0 comments on commit 7374eec

Please sign in to comment.