bluetooth lowenergy - connecting issue with android ble -
i have issue ble getting disconnecting, below code changes based on answer earlier used response show data ble device phone ,
but after code change can not data device think has "enable_indication_value" , "enable_notification_value"
can call both @ same time
public void setcharacteristicnotification(bluetoothgattcharacteristic bluetoothgattcharacteristic, boolean flag) { if(mbluetoothadapter == null || mbluetoothgatt == null) { log.w(tag, "bluetoothadapter not initialized"); } else { mbluetoothgatt.setcharacteristicnotification(bluetoothgattcharacteristic, flag); bluetoothgattdescriptor bluetoothgattdescriptor = bluetoothgattcharacteristic.getdescriptor(uuid.fromstring(samplegattattributes.client_characteristic_config)); if(bluetoothgattdescriptor != null) { bluetoothgattdescriptor.setvalue(bluetoothgattdescriptor.enable_notification_value); mbluetoothgatt.writedescriptor(bluetoothgattdescriptor); return; } } }
later based on given stackoverflow question:
i changed below line
bluetoothgattdescriptor.setvalue(bluetoothgattdescriptor.enable_notification_value);
to bluetoothgattdescriptor.setvalue(bluetoothgattdescriptor.enable_indication_value);
Comments
Post a Comment