Comments (15)
@betomaluje I did it! =)
It turns out that sending 0x4
via the 2A06
characteristic is correct -- however, the service was wrong -- instead of using the default (Profile.UUID_SERVICE_MILI
which is FEE0
), I was able to find the characteristic within the 1802
service.
Sample code to reproduce success:
UUID vibrationService = UUID.fromString(String.format(BASE_UUID, "1802"));
UUID vibrationCharacteristic = UUID.fromString(String.format(BASE_UUID, "2A06"));
byte[] vibrationCommand = {0x4};
BluetoothGattCharacteristic chara = gatt.getService(vibrationService).getCharacteristic(vibrationCharacteristic);
chara.setValue(vibrationCommand);
gatt.writeCharacteristic(chara);
Would you like me to submit a pull request updating the library with the new firmware's vibrate codes? Also, do we need to offer backward compatibility for old firmware versions?
from mi-band.
Also, I just tried the following and none of them worked:
MiBand.sendAction(MiBandWrapper.ACTION_VIBRATE_WITH_LED);
MiBand.sendAction(MiBandWrapper.ACTION_VIBRATE_UNTIL_CALL_STOP);
MiBand.sendAction(MiBandWrapper.ACTION_VIBRATE_WITHOUT_LED);
MiBand.sendAction(MiBandWrapper.ACTION_VIBRATE_CUSTOM);
from mi-band.
This may help:
lwis/miband-notifier#33
from mi-band.
I sniffed the Bluetooth with the band and sent the same commands using the nRF Master Control Panel app and using the same commands worked like a charm.
Try using the latest version of the library and use the miBand.startVibration(VibrationMode.VIBRATION_WITHOUT_LED);
command to test it.
Let me know if the problem persists.
from mi-band.
@betomaluje tried it, unfortunately, no vibration -- is it possible that the Mi Fit app updated my band's firmware recently (and your firmware hasn't been updated yet because you don't have that app installed)?
from mi-band.
I have tweaked version of Mi Fit installed. My firmware version is 1.0.10.11 . Is this the same as yours?
from mi-band.
@betomaluje nope, I've got the official Mi Fit app (and my firmware version is 1.0.11.6 - probably the newest one available).
By the way, thanks a lot for helping with this!
from mi-band.
@betomaluje after some excruciatingly-painful smali debugging of Mi Band Notify v2 (the only custom Mi Band app that supports vibration in the new firmware), I was able to extract the new characteristic: 2A06
and the new vibrate (without light) command: 0x4
.
However, the 2A06
characteristic isn't available in the mAvailableCharacteristics
so getCharacteristic()
in BluetoothGattCharacteristic.java
fails. Any idea how to fix that?
from mi-band.
@eladnava thank you for your research! Unfortunately I wasn't able to send this commands to the band. I tried reading the characteristic inside BTConnectionManager
and using a few BT apps such as nRF Master Control Panel but none of them could found the 2A06
characteristic. I tried sending them an nothing happened. I used several combinations changing the Profile
and the Protocol
clases but nothing happened.
2A06
is used inside the Profile
as the UUID_CHAR_ALERT_LEVEL
. Also tried changing the Write command on the startVibration
method inside MiBand
to this one but no results.
There must be something that I'm doing wrong. You can play with those values and let me know if anything works. I'm also going to research why this isn't working.
Hope this helps you someway.
from mi-band.
@betomaluje did you update your band's firmware to 1.0.11.6?
I did go ahead and change the values for the VIBRATE_WITHOUT_LED (0x4
via 2A06
characteristic), but then I discovered that this characteristic is not available for the Mi Band device.
I'll try to use the nRF App to sniff out the Mi Band Notify v2, just in case.
from mi-band.
@eladnava yes I did. Sorry I forgot to mention that. Let me know if anything helped you.
For the sniffing part I was following this tutorial. But I don't have the hardware. Also I found this guide for doing the same thing but using an Android phone but I haven't had the time to give it a try. In theory, you can listen to each command sent back and forth between the band an the official app, save the log to the SD card and then analyse the data using Wireshark. If you found the exact command then we can replicate it on the app.
Hope this helps!
from mi-band.
@betomaluje thanks!
Just to make sure, are the available Bluetooth characteristics provided by the Mi Band? Because the 2A06
characteristic isn't listed for some reason. Or are they determined by the app?
from mi-band.
@eladnava I really don't remember where did I found those characteristics but where the default characteristics for bluetooth devices. The Xiaomi guys haven't provided the characteristics they use so at this point I was just trying things.
I can't find the 2A06
characteristic but my guess is that using the Wireshark approach may help.
Let me know if you find something.
EDIT: I've found where the list of characteristics are!! In this link you can find the complete list!
from mi-band.
@eladnava You're the man! that's awesome! Please submit that pull request. The compatibility would be great. There must be a way of seeing the current firmware and if it's the newest, use your method. I would investigate if there's a way of getting the firmware (there must be a way, the Mi Fit app does it).
Great work!
from mi-band.
@betomaluje I see that you already implemented it yourself. =)
Closed via a8a3220.
from mi-band.
Related Issues (16)
- Why not differ "TYPE_ACTIVITY" into walk and run? HOT 1
- Sync error : OncharacteristicWrite fail
- Mi Band 2 HOT 2
- Create plugin for cordova? HOT 1
- mi band 2 support?
- MI Band 2 Support
- Connected but Write Action returns false in all cases
- Q: Mi Band Sync Activity Data Protocol
- Method miBand.startListeningSync(actionCallback) do not work. HOT 2
- Invalid parameters UserInfo.create(UserInfo.java:74) HOT 4
- Rename resources to avoid conflict HOT 1
- Support for heart rate monitor of Mi Band Pulse? HOT 2
- Sync fail: data null HOT 2
- Cannot connect HOT 10
- Custom vibration doesnt' work - Protocol problem? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mi-band.