0

Bluegiga BLE113 모듈과 Android 앱이 포함 된 프로젝트를 진행하고 있습니다. Bluegiga 모듈에서 몇 가지 특성을 설정했습니다. 하나의 특성으로 클라이언트 알림을 활성화하는 설명자를 정의했습니다 (내 경우 클라이언트는 Android 앱 임). BLE113 모듈의 특성 정의는 다음과 같습니다Android BLE onCharacteristicChanged가 호출되지 않았습니다.

characteristic = gatt.getService(BLEuuids.DATAFLOW_SERVICE).getCharacteristic(BLEuuids.DATAFLOW_OUT_CHARACT); 
//Enable local notifications 
gatt.setCharacteristicNotification(characteristic, true); 
//Enabled remote notifications 
BluetoothGattDescriptor desc = characteristic.getDescriptor(BLEuuids.DATAFLOW_OUT_DESCRIPT); 
boolean test; 
test = desc.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); // return value = true 
test = gatt.readDescriptor(desc); // return value = true 
test = gatt.writeDescriptor(desc); // return value = true 

: 나는 안드로이드 블루투스 로우 에너지 가이드에 따라 onServicesDiscovered(...) 콜백 내에서 알림을 설정 한 안드로이드 측면에서

: 
<characteristic uuid="dcfa2671-974d-4e4a-96cd-6221afeabb62" id="ez1_flow_data_out"> 
    <!-- org.bluetooth.descriptor.gatt.characteristic_user_description --> 
    <description>Data to transmit to Android device</description> 
    <properties write="true" read="true" /> 
    <value variable_length="true" length="255" type="hex" /> 
    <!-- org.bluetooth.descriptor.gatt.client_characteristic_configuration --> 
    <descriptor uuid="2902"> 
    <properties write="true" read="true" const="false" /> 
    <!-- Bit 0 = 1: Notifications enabled --> 
    <value type="hex">0001</value> 
    </descriptor> 
: 
: 
</characteristic> 

그러나 Bluegiga 모듈의 직렬 인터페이스를 사용하여 DATAFLOW_OUT_CHARACT 특성 UUID의 값을 변경하면 의도 한 콜백 onCharacteristicChanged(...)이 내 Android 앱에서 실행되지 않습니다.

답변

2

설명자를 읽지 마십시오. 설정 직후에 설명자를 작성하십시오. 제대로 읽으면 설정이 덮어 쓰여지고 같은 값을 다시 쓰게됩니까?

+0

'test = gatt.readDescriptor (desc);를 다시 한 다음 알림이 제대로 실행됩니다. 고마워! – bitlischieber

+0

그래, 나는 동의한다, 이것은 나에게도 효과가있다. –

관련 문제