cubing / cubing.js

🛠 A library for displaying and working with twisty puzzles. Also currently home to the code for Twizzle.
https://js.cubing.net/cubing/
GNU General Public License v3.0
253 stars 46 forks source link

Add support for Xiaomi "Smart Magic Cube" #16

Closed alastaira closed 4 years ago

alastaira commented 4 years ago

Hi, I've recently acquired a bluetooth cube described as a Xiaomi Smart Magic Cube. Product link is https://uk.banggood.com/Newest-Version-XIAOMI-Original-Bluetooth-Magic-Cube-Smart-Gateway-Linkage-3x3x3-Square-Magnetic-Cube-Puzzle-Science-Education-Toy-Gift-p-1586342.html - it seems to be a more recent version of the Giiker.

It works with an Android app called "Mi Smart Magic Cube" which can be downloaded from the manufacturer at http://app.xiaomi.com/download/918392 however, unfortunately it doesn't seem to be recognised by cubing (or "Supercube" or other third party apps) - I guess because the properties/protocol of the BLE service differ from other cubes.

I'd love to use the cubing API with it - in the absence of any documentation, I'm wondering how I can help add support for this type of cube?

lgarron commented 4 years ago

This cube actually uses the same protocol as the GiiKER cube, but unfortunately it doesn't advertise a device name.

The following should work:

This should allow you to identify the cube and connect.

Unfortunately, I don't know how to support anything more convenient, as Xiaomi seems to have made it hard to filter for this device in the prompt. :-/

alastaira commented 4 years ago

Ah, that's brilliant - thankyou so much! I was fooled by the fact it doesn't seem to advertise either a device name or the services available, so my scanner was failing to find it. But you're absolutely correct - if you manually force a connection to the correct MAC address it works great. :)