izivkov / CasioGShockSmartSync

Apache License 2.0
115 stars 12 forks source link

Add support for fitness features of the CASIO GG-B100, the Mudmaster watch #79

Open izivkov opened 7 months ago

izivkov commented 7 months ago

We like to add support to the step counter and other fitness functions for the CASIO GG-B100, the Mudmaster watch. Eventually, we like to integrate it with Google fit. Let us discuss here.

izivkov commented 7 months ago

Here is what I have so far:

Here is a relevent buffer from BLE logs in Wireshark:

0000 a3 00 04 00 1b 14 00 00 00 b7 01 fe ff fe ff fe ................ 0010 ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ................ 0020 ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ................ 0030 ff fe ff fe ff fe ff 00 00 a7 00 fe ff fe ff fe ................ 0040 ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ................ 0050 ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ................ 0060 ff fe ff fe ff fe ff 49 20 00 00 6a 0f 00 00 fe .......I ..j.... 0070 ff ff ff fe ff ff ff fe ff ff ff fe ff ff ff fe ................ 0080 ff ff ff fe ff ff ff fe ff ff ff fe ff ff ff fe ................ 0090 ff ff ff fe ff ff ff fe ff ff ff fe ff ff ff fe ................ 00a0 ff ff ff fe ff ff ff .......

This python function converts some of the data to the step count of 8265 steps

byte_array = b'\x49\x20\x00\x00'
# Convert bytes to integer (assuming little-endian byte order)
integer_value = int.from_bytes(byte_array, byteorder='little')
print("Converted integer value:", integer_value)

Since I do not own this watch, I am looking for somebody with a similar watch and some technical skills to help me add this function to the app. Here is what I need:

  1. Send me Wireshark logs containing some geo-location data, step counter, and other sensor information from the watch, such as altitude, temperature, etc. Just a relevant section from the Wireshark logs is all I need; no need to manipulate it.

  2. I will create a Python function to read and parse the data, with your help to indicate which value is which. I can then incorporate this function into the existing Python project.

  3. I will add this functionality to the Android app as a separate screen, with your input. I think we should keep it simple, limited to one screen with the information coming from the watch, and delegate the analysis to another app like Google Fit or Strava(?).

Thank you.

tgvecchio commented 6 months ago

Hi, this is awesome! I will send you a data dump and some separate details about it as DM.

Thanks for this great work!

izivkov commented 6 months ago

@tgvecchio OK, I got confused, I should have seen the last name.

Let us continue to discuss here, it is easer to follow.

In the data above, we have a lot of ff fe. Do you know what these are? I thought they would hold the geo-location data. I thought the phone would periodically send location to the watch, and the watch would accumulate it and send it back later.

tgvecchio commented 6 months ago

Great!

The GG-B100 only supports these: Steps
Altitud (Redords the difference since logging started) Barometer (Records the difference and an additional curve graph since logging started) Temp (No records) Compass (No records) and about ten to fifteen altitude records.

The ff fe changed a few times between dumps and I never had my phone GPS activated (actually I did not granted location permission to the app). You might be right though.

I guess that these empty slots are for the accumulated data that the watch itself produces. I can wait one week until the next dump to see if these slots get written.

If you look at the lines 62 to 66 in this last dump, they all got populated.

izivkov commented 6 months ago

Supporting data files: 20240429_1217_btsnoop_hci_CASIODUMPS (1).log

20240429_1217_APPandWATCH_STATE (1).txt

izivkov commented 6 months ago

@tgvecchio Can you tell me what the current app displays? I see some of the steps values you send me for different days, but I think they also send the dates. So I get some vlaues like these:

Chunk: de0d0000 -> Integer: 3550 Chunk: 92060000 -> Integer: 1682 Chunk: 9f460000 -> Integer: 18079 Chunk: e31e0000 -> Integer: 7907 Chunk: 9a110000 -> Integer: 4506 Chunk: af070000 -> Integer: 1967

Some of these match your expected values. I will have to look into how they encode dates.

Any altitude or other information displayed on the app?

tgvecchio commented 6 months ago

Hi, that one is going to be difficult.

The watch can also use air pressure data (together with the step counter) to better calculate calories consumed (either in kcal or kJ).

Air presure fluctuate in normal values and kcal usually range between 1823 and 2300 (wich equals aprox 7600 to 9500 kJ). Neither of the values match.