
У меня есть два устройства. один Android-телефон с уровнем API более 18, а другой - устройство с голубым зубом 4.0.
Устройства успешно подключены друг к другу. Теперь поток команды следующий: а. Отправьте текст "привет" на устройство с синим зубом.
UUID uuid = UUID.fromString("18cda784-4bd3-4370-85bb-bfed91ec86af");
BluetoothGattCharacteristic selectedChar = selectedGattService.getCharacteristic(uuid);
mBluetoothLeService.setCharacteristicNotification(selectedChar, true);
boolean flag = selectedChar.setValue("");
mBluetoothLeService.writeCharacteristic(selectedChar);
В этом случае я получаю привет через ресивера GATT. что это значит.
registerReceiver(mGattUpdateReceiver, makeGattUpdateIntentFilter());
    private static IntentFilter makeGattUpdateIntentFilter() {
        final IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(BluetoothLeService.ACTION_GATT_CONNECTED);
        intentFilter.addAction(BluetoothLeService.ACTION_GATT_DISCONNECTED);
        intentFilter.addAction(BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED);
        intentFilter.addAction(BluetoothLeService.ACTION_DATA_AVAILABLE);
        intentFilter.addAction(BluetoothLeService.EXTRA_DATA);
        return intentFilter;
    }
б. устройство Bluetooth будет выполнять некоторые операции авто, сделанное устройством Bluetooth.
с. Результат операции отправляется на Android-телефон Бродировано устройством. Для этого я использовал уведомление.
public void setCharacteristicNotification(BluetoothGattCharacteristic characteristic,
            boolean enabled) {
        if (mBluetoothAdapter == null || mBluetoothGatt == null) {
            return;
        }
        BluetoothGattDescriptor descriptor = characteristic.getDescriptor(UUID
                .fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
        System.out.println("nov7 descriptordescriptor " + descriptor);
        if (descriptor != null) {
            descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
            mBluetoothGatt.writeDescriptor(descriptor);
        }
    }
Я не получаю никаких данных. Любая идея, пожалуйста.
