Closed sebws closed 5 days ago
Hi @sebws,
Thanks for the information. I have renamed the files so that they better match the original WeiHeng WH-C06 instead of the MAT Muscle Meter. Was the ScaleWatcher.java
extracted from their APK? Maybe you could help me establish a connection with the WH-C06/Crane Scale in Typescript?
export const WHC06: Device = {
filters: [],
services: [],
}
The Kilterboard, for example, also works with an Advertising service:
filters: [
{
services: ["4488b571-7806-4df6-bcff-a2897e4953ff"], // Aurora Climbing Advertising service
},
],
Could you have a look at Google Chrome's Bluetooth Internals chrome://bluetooth-internals/#devices
to see what information it gives you? I'm looking forward to your reply and potentially a pull request.
Stevie
hey Stevie, I'll have a look and try set up a PR. to your comment, ScaleWatcher.java came from contacting WeiHeng and asking for it 😄. also, it is not like the Kilterboard unfortunately. It is not a service, instead the data is part of the manufacturer data sent out in the advertising packets.
Hey again, the functionality required to make it work is currently only implemented in Chrome Android and Mac, so I'm feeling a little put off by the effort. When trying it on my Mac, the implementation was not very reliable. Also, since the data is taken from the scale in a totally different (and annoying) way, I'm not sure it is worth the effort of trying to refactor to handle the special case. Sorry to disappoint!
However, I can try and explain a bit better.
To get the data from the scale, we need to watch its advertisement packets. Within those packets is the manufacturer data, which contains the info we are after. See ScaleWatcher.java, but essentially we just need to take some of the bits and convert to an int.
I wonder if you saw my (disappointing) update @Stevie-Ray
Hi @sebws, I completely understand the disappointment. The current browser support for the Bluetooth API is indeed limited, and unfortunately, Apple has cited privacy concerns as the reason for not implementing it in their browsers. However, there is some hope on the horizon with potential non-WebKit-based browsers for iOS, as discussed here.
I've just ordered the WH-C06 and plan to explore its compatibility as well. Interestingly, I know of a climbing company in Poland that's interested in a customized WH-C06, similar to MAT, to pair with their grip tools. They're curious if it can be integrated with the HangTime app for Android, so I'll be looking into that too.
Once I receive the device, I'll dive into ScaleWatcher.java to see if I can get it up and running. Thanks again for your input, it's much appreciated! 👍
Hi @sebws, I completely understand the disappointment. The current browser support for the Bluetooth API is indeed limited, and unfortunately, Apple has cited privacy concerns as the reason for not implementing it in their browsers. However, there is some hope on the horizon with potential non-WebKit-based browsers for iOS, as discussed here.
I've just ordered the WH-C06 and plan to explore its compatibility as well. Interestingly, I know of a climbing company in Poland that's interested in a customized WH-C06, similar to MAT, to pair with their grip tools. They're curious if it can be integrated with the HangTime app for Android, so I'll be looking into that too.
Once I receive the device, I'll dive into ScaleWatcher.java to see if I can get it up and running. Thanks again for your input, it's much appreciated! 👍
Happy to help in the future if any required but you seem more than capable 😄
I would only say to any companies that they could probably do better than a WH-C06 if they are after a scale with a professional and high quality experience.
Hi @sebws ,
Today I received the WH-C06 and added device.watchAdvertisements()
to v0.3.5 of the project, which is a experimental Chrome feature that has to be enabled by setting 'Experimental Web Platform features' using chrome://flags#enable-experimental-web-platform-features
.
With this feature we are able to add an event listener device.addEventListener("advertisementreceived", (event) => {})
and convert the received data just like in the ScaleWatcher.java file.
const weight = (data.getUint8(WEIGHT_OFFSET) << 8) | data.getUint8(WEIGHT_OFFSET + 1)
const stable = (data.getUint8(STABLE_OFFSET) & 0xf0) >> 4
const unit = data.getUint8(STABLE_OFFSET) & 0x0f
The amount of data that we receive is very limited, a better way would be to create a watcher like chrome://bluetooth-internals/#devices/
did, the Manufacturer Data is constantly updated but i don't know how they did it.
You can give it a try at: Example
That’s sweet @Stevie-Ray I’ll give it a look. In terms of data speed this is the same issue I have in Swift. I think partly the device just doesn’t send info super often, and partly the Apple implementation doesn’t let you read the advertisement data that often.
If you think their implementation is faster you can check their source. I just looked on my phone so struggled to find anything special
After further investigation, it appears that the limited data issue is specific to macOS (or desktop platforms, not sure). You can find more details here: Chromium issue #365108877.
I’m closing this issue as the feature is now working on Android with a feature flag enabled.
Hey there, as far as I can tell the MAT Muscle Meter is just a reskinned WeiHeng WH-C06. See this file for a manufacturer provided implementation of communication. https://github.com/sebws/Crane/blob/4cfdd1eb2afd250641afbfeac0fba36aab6fcf75/ScaleWatcher.java
Unfortunately they don’t use BT services / characteristics, and instead send data through the advertisement data. Forgive me if I’ve messed up the terminology there I’m not well versed in BT tech.