2

I'm really new to this but I already know (by searching other projects through the Internet) that the MiBands have an authentication process.

The thing is I have tried to write without and with response to the only service UUID I got through the connection and it's always saying the band has not that UUID Service.

I am using React-Native-BLE-PLX library.

As it can be seen in the image I use the device's Service UUID since I cannot get any other service but it always says that it does not exist.

DEBUG

search(){
    this.manager = new BleManager();

    this.manager.startDeviceScan(null, null, (error, device) => {
        if (error) {           
            console.log(error.message);
            return;
        }

        if (device.name == 'Mi Band 3') {
          this.manager.stopDeviceScan();
          this.device = device;

          this.connect();
        }
    });
}

connect() {
  console.log("CONNECTING...");

  this.device.connect()
  .then(async (device) => {
    console.log("CONNECTED!!!");
    console.log("DEVICE CONNECTED:\n");
    console.log(device);
    this.auth(device);
    // return this.manager.discoverAllServicesAndCharacteristicsForDevice(device.id)
  })
  // .then((device) => {
  //   console.log(device);
    // this.send(device);
  // })
  // .catch((error) => {
  //   console.log("ERROR: ");
  //   console.log(error);
  // });
}

async auth(device) {
  console.log("DEVICE: \n");console.log(this.device);
  console.log("DEVICE'S SERVICE UUID: \n" +this.device.serviceUUIDs[0]);

  console.log("TRYING");

  this.manager.writeCharacteristicWithoutResponseForDevice('D7:2D:F8:F2:24:3F', '0000fee0-0000-1000-8000-00805f9b34fb', '00000009-0000-3512-2118-0009af100700', 0x01 + 0x00 + new Buffer("OLA MUNDO"))
  .then((device) => {
      console.log("STUFF GOING ON:\n");
      console.log(device);
  })
  .catch((error) => {
    throw error;
  });

}

Really need help and thanks for that.

If there is something I need to describe more please just tell me.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Rafael Botas
  • 125
  • 1
  • 1
  • 9
  • Anyone, I really need help with this – Rafael Botas Jan 21 '19 at 20:51
  • I have not used React Native before so I cannot help with the programming part. Can you please try the following:- 1) Do a full GATT table discovery, make sure that you see all available services, characteristics, descriptors, and *their properties/permissions*. This way you will have a better understanding of the device's capabilities. 2) Perform the same sequence but against another device (i.e. not the MiBand 3). You can use a phone and any app (e.g. nRF Connect) to simulate a GATT server and then use your React Native app to connect to it. This will ensure the issue is not with your app. – Youssif Saeed Feb 28 '19 at 06:49

1 Answers1

0

Directly after getting connected you must first discover the services and characteristics. After that you can start the authentication part. However your authentication part is totally wrong. Do a bit of Googling to find out how to do it properly...

  • Martijn do you have any idea on how to get real time heart data from Miband3? if yes I will open up a new question. The info on the web does not work for real time heart rate:( – aytunch Nov 03 '19 at 23:50