android - No OnCharacteristicChanged callbacks when I write a characteristic in OnServiceDiscovered callback -
i have app need write , read characteristics ble device. both processes should done simultaneously. furthermore, need write before read.
i understand process not asynchronous. not have other option write characteristic after services discovered.
i can write these characteristic sucessfully, problem oncharacteristicchange never callbacks. if not onservicesdiscovered, oncharacteristicchange callback
any idea?
this code called onservicesdiscovered:
public void onservicesdiscovered(bluetoothgatt gatt, int status) super.onservicesdiscovered(gatt, status); writecharac(gatt.getservices()); } private void writecharac(list<bluetoothgattservice> list) { if (list == null) return; if (!indf) { (bluetoothgattservice gattservice : list) { list<bluetoothgattcharacteristic> gattcharacteristics = gattservice.getcharacteristics(); (final bluetoothgattcharacteristic gattcharacteristic : gattcharacteristics) { if (writablecharac_uuid.equals(gattcharacteristic.getuuid())) { indf = true; break; } } if (indf) { break; } } } if (indf) { writecharac(); } else { string intentaction = "string_action_connected"; broadcastupdate(intentaction, 0); } }
Comments
Post a Comment