Heart Rate measuring using Xiaomi MiBand and BLE

后端 未结 2 521
梦谈多话
梦谈多话 2021-02-05 17:22

I\'m trying to implement simple sdk for working with fitness tracker Xiaomi Mi Band. Currently I can track steps, actuate the vibration, handle the sensor touch but I have a pro

相关标签:
2条回答
  • 2021-02-05 17:50

    I solved the problem! Before calling setNotifyListener to track the change of pulse value you must to write User Information (age, weight) to appropriate characteristic, because without this Mi Band doesn't start the measuring.

    0 讨论(0)
  • 2021-02-05 18:00

    Im working with BLE A&D , to obatin the iformation i use:

    To find UUID

      @SuppressLint("NewApi")
    private void displayGattServicesService(List<BluetoothGattService> gattServices) {
        //  salida.append("Buscando servicio");
        if (gattServices == null)
            return;
        for (BluetoothGattService gattService : gattServices) {
    
            String uuid = gattService.getUuid().toString();
    
            List<BluetoothGattCharacteristic> gattCharacteristics = gattService
                    .getCharacteristics();
            if (uuid.equals("00001810-0000-1000-8000-00805f9b34fb")) {
                //  salida.append("Ecnontro");
                for (BluetoothGattCharacteristic gattCharacteristic : gattCharacteristics) {
                    String uuid1 = gattCharacteristic.getUuid().toString();
                    if (uuid1.equals("00002a35-0000-1000-8000-00805f9b34fb")) {
                        //     salida.append("Envio caracterisitca");
                        mensaje(getResources().getString(R.string.Espere_res));
                        mBluetoothLeService.setCharacteristicNotification(
                                gattCharacteristic, true);
                    }
                }
            }
        }
    }
    

    To set UUID

    BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED.equals(action)) {
    
                // Show all the supported services and characteristics on the user interface.
                displayGattServicesService(mBluetoothLeService.getSupportedGattServices());
    

    Use BleGatt Example https://github.com/googlesamples/android-BluetoothLeGatt

    0 讨论(0)
提交回复
热议问题