Comments (8)
How to "blacklisting CCCD UUID before call is made",I'am an Android developer using flutter.
from flutter_blue.
Hello people!
I have the same problem!! I can't to write descriptor and i don't know what i do...
I'am using the flutter_blue 0.7.2
My code:
targetCharacteristic = service.characteristics
.where((element) => element.uuid.toString() == GLUCOSE_CHARACTERISTIC)
.first;
if (targetCharacteristic != null) {
print("notify GLUCOSE_CHARACTERISTIC");
targetCharacteristic.setNotifyValue(true);
BluetoothDescriptor descriptor = targetCharacteristic.descriptors[0];
if (descriptor != null) {
List<int> elements = [1, 1];
var data = new Uint16List.fromList(elements);
await descriptor.write(data);
}
targetCharacteristic = null;
}
Message error:
D/BluetoothGatt(24483): setCharacteristicNotification() - uuid: 00002a18-0000-1000-8000-00805f9b34fb enable: true
E/flutter (24483): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: PlatformException(RuntimeException, Protocol message contained an invalid tag (zero)., com.google.protobuf.InvalidProtocolBufferException: Protocol message contained an invalid tag (zero).
E/flutter (24483): at com.google.protobuf.CodedInputStream.readTag(CodedInputStream.java:148)
from flutter_blue.
@pauldemarco Hi,
What if we need to write to a descriptor in order to get heart rate from MiBand3? I am using flutter too, and I need to write to a descriptor. What should I do?
from flutter_blue.
@aytunch This issue just refers to the CCC descriptor. Writing to other (writable) descriptors should work fine. Let me know if you run into issues.
from flutter_blue.
@pauldemarco Ah ok, I will see if it CCC descriptor first then. Thanks for the quick response, take care
from flutter_blue.
@pauldemarco I am still having issues, the moment I try to write to the descriptor, app crashes instantly. It should not be CCC but I could not be sure. Is there a way to ask the characteristic/descriptors of their traits (allow-read/write/notify)? I am trying to get Real Time Heart Rate from my MiBand3. My code and the result is this:
void _startMonitoringHeartRate() async {
if (hrmctrlCharacteristic != null && hrmdataDescriptor != null) {
print("NOT NULLLLLL");
await hrmctrlCharacteristic.write(
hex.decode("15" + COMMAND_SET_HR_MANUAL + COMMAND_STOP),
withoutResponse: true);
print("1111");
await hrmctrlCharacteristic.write(
hex.decode("15" + COMMAND_SET__HR_CONTINUOUS + COMMAND_STOP),
withoutResponse: true);
print("2222");
print("descriptorUUID:${hrmdataDescriptor.uuid.toString()}");
print("characterUUID:${hrmdataDescriptor.characteristicUuid.toString()}");
print("serviceUUID:${hrmdataDescriptor.serviceUuid.toString()}");
await hrmdataDescriptor.write(hex.decode("0100"));
print("3333");
await hrmctrlCharacteristic.write(
hex.decode("15" + COMMAND_SET__HR_CONTINUOUS + COMMAND_START),
withoutResponse: true); //TODO: change to true!!!!
print("4444");
Timer.periodic(Duration(seconds: 12), _sendPing(hrmctrlCharacteristic));
print("5555");
} else {
print("NULLLLLL");
}
}
Output:
flutter: Start Getting Continous Heart Data...
flutter: NOT NULLLLLL
flutter: 1111
flutter: 2222
flutter: descriptorUUID:00002902-0000-1000-8000-00805f9b34fb
flutter: characterUUID:00002a37-0000-1000-8000-00805f9b34fb
flutter: serviceUUID:0000180d-0000-1000-8000-00805f9b34fb
Lost connection to device.
Exited (sigterm)
One last thing: What is the _bool inside character.write(_data, withoutResponse:_bool) for? Is there a chance the problem might be caused of using wrong withoutResponse for the previous character.write's? And there is no withoutResponse
inside of descriptor.write. What is the reason there?
Btw I am following Andrey Nikishaev's medium article: How I hacked my Xiaomi MiBand 2 fitness tracker — a step-by-step Linux guide and the pseudo code is below. So I think the descriptor should be writable:
To turn off the current hear monitor measurement.
Send a request to HMC \x15\x02\x00 for one-shot measurements.
Send a request to HMC \x15\x01\x00 for continous measurements.
Enabling Gyroscope and Heart raw data by sending a command to SENS \x01\x03\x19
Enabling notification for HRM by writing a request to DES \x01\x00
Start continuous heart measurements by sending a request to HMC \x15\x01\x01
Sending command to SENS \x02 (don’t know why this is need)
Then while getting notifications, every 12 seconds we need to send a ping with the value \x16 to the HCM
from flutter_blue.
How to "blacklisting CCCD UUID before call is made",I'am an Android developer using flutter
I hava got the same issue ,do you deal it ? @coderLM @pauldemarco
from flutter_blue.
Hello people!
Has anyone here managed to solve the bluetooth communication problem with the miband?
I was able to decipher the authentication process with the bracelet, but I'm having trouble implementing it in flutter. Can you help me?
The steps are as follows:
1- Create a key with 16bytes. Example: {0x30, 0x31, ..., 0x46, 0x45}
2 - Enable notifications on the miband by sending TRUE to service UUID 0x0009
3 - Send {0x01, 0x08, KEY} to UUID 0x0009.
4 - Check if the first three bytes of the return were {0x10, 0x01, 0x01} which means success in receiving.
5 - Send another request now with an extra bit in the first element and without a key {0x02, 0x08}
6 - Check the return again if equal to {0x10, 0x02, 0x01} means success.
7 - Take the last 16bytes of the response from step 6 and encrypt it using AES / ECB / NoPadding using the key created in step one. Store in a RESPONSE_KEY variable.
8- Send another request with the encrypted response created above. Example: {0x03, 0x08, RESPONSE_KEY}, similar to what is done in step 3.
9- Check the return, if equal to {0x10, 0x03, 0x01} the data has probably already been sent.
Font: https://leojrfs.github.io/writing/miband2-part1-auth/
from flutter_blue.
Related Issues (20)
- Can't to Scan and Connect in FlutterBlue library.
- How to diconnect the connected device when app is quit HOT 2
- Is this a active project? HOT 5
- doesn't display names of bluetooth list IOS IPHONE DEVICE HOT 1
- Filter devices in flutter_blue HOT 1
- Can't find my device
- null check operator HOT 1
- Can not connect a device with Android HOT 3
- when Auto Connect Enable Communication with ble not working
- Multiple characteristics sharing the same UUID not working?
- Unable to connect automatically HOT 2
- descriptor is missing JT-2890 HOT 1
- Ios scan find only 1 device
- minSdkVersion 16 cannot be smaller than version 19 declared in library [:flutter_blue] HOT 2
- in ios device run _flutterBlue.connectedDevices cannot get connectedDevices [ getConnectedDevices periphs size: 0] but andriod device is OK HOT 1
- There is a problem compiling the library with Flutter 3.7.12 with Gradle 8 HOT 4
- Flutter_blue_plus scan not working when the device screen is off
- Initiating ble channel upon collision detection to trigger alarm HOT 1
- Race condition between Connect timeout and a successful connection leaving active connection stranded HOT 2
- MissingPluginException on device.connect() HOT 2
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 flutter_blue.