Handhabung Indikationen anstelle von Benachrichtigungen in Android BLE

Mithilfe der Bluetooth SIG Application Accelerator-code, und es macht einen guten job zu demonstrieren die verschiedenen Konzepte von bluetooth low energy. Jedoch erwähnt nichts über Indikationen im Gegensatz zu Benachrichtigungen. Ich weiß, dass Indikationen werden müssen anerkennen, im Gegensatz zu notifcations, und in dem code, den ich tun würde byte[] val = enabled ? BluetoothGattDescriptor.ENABLE_INDICATION_VALUE : BluetoothGattDescriptor.DISABLE_INDICATION_VALUE; statt byte[] val = enabled ? BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE : BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE;, aber gibt es irgendetwas, was ich sonst noch tun müssen? Wie genau lasse ich die server wissen, dass ich erhielt den Hinweis, dass erforderlich ist? Gibt es etwas, was ich brauche, um hinzuzufügen in

@Override
        public void onCharacteristicChanged(BluetoothGatt gatt,
                                            BluetoothGattCharacteristic characteristic)
        {

            notification_id++;
            Log.d("BleWrapper","notification count = " + notification_id);
            //characteristic's value was updated due to enabled notification, lets get this value
            //the value itself will be reported to the UI inside getCharacteristicValue
            getCharacteristicValue(characteristic);
            //also, notify UI that notification are enabled for particular characteristic
            mUiCallback.uiGotNotification(mBluetoothGatt, mBluetoothDevice, mBluetoothSelectedService, characteristic);
        }

?

Schreibe einen Kommentar