android - Bluetooth is not reading every characteristic -


i've got problem bluetooth in app. i've got lots of characteristics , can read 2. when try read more i'm not getting callback. read should create queue don't know how it. help, please ?

here's characteristics :

 private void registerparameterscharacteristics(list<bluetoothgattcharacteristic> characteristics) {         (bluetoothgattcharacteristic characteristic : characteristics) {             uuid characteristicuuid = characteristic.getuuid();             if (characteristics.eon_params_eddystone_uid_char.equals(characteristicuuid)) {                 euidcharacteristic = characteristic;                 log.e(tag, "registerparameterscharacteristics: euid" );             }             else if (characteristics.eon_params_eddystone_eid_char.equals(characteristicuuid)) {                 eeidcharacteristic = characteristic;}             else if (characteristics.eon_params_eddystone_url_char.equals(characteristicuuid)) {                 eurlcharacteristic = characteristic;}             else if (characteristics.eon_params_eddystone_tlm_char.equals(characteristicuuid)) {                 etlmcharacteristic = characteristic;}             else if (characteristics.eon_params_eddystone_uid_uuid.equals(characteristicuuid)) {                 euiduuidcharacteristic = characteristic;}             else if (characteristics.eon_params_eddystone_url_uuid.equals(characteristicuuid)) {                 eurluuidcharacteristic = characteristic;                 log.e(tag, "registerparameterscharacteristics: eurluuid" );             }             else if (characteristics.minor_characteristic_uuid.equals(characteristicuuid)) {                 minorcharacteristic = characteristic;}             else if (characteristics.major_characteristic_uuid.equals(characteristicuuid)) {                 majorcharacteristic = characteristic;             }             else if (characteristics.uuid_characteristic_uuid.equals(characteristicuuid)){                 uuidcharacteristic = characteristic;             }             else if (characteristics.interval_characteristic_uuid.equals(characteristicuuid)) {                 intervalcharacteristic = characteristic;             }             else if (characteristics.tx_characteristic_uuid.equals(characteristicuuid)) {                 txcharacteristic = characteristic;             }             else if (characteristics.battery_characteristic_uuid.equals(characteristicuuid)) {                 batterycharacteristic = characteristic;                 log.e(tag, "registerparameterscharacteristics: bat" );             }             log.e(tag, "registerparameterscharacteristics: " + characteristic.getuuid().tostring() );         }     } 

and onservicediscovered method :

@override         public void onservicesdiscovered(bluetoothgatt gatt, int status) {             super.onservicesdiscovered(gatt, status);             if (status == bluetoothgatt.gatt_success) {                 list<bluetoothgattservice> services = gatt.getservices();                 (bluetoothgattservice service : services) {                     registerservice(service);                     log.e(tag, "onservicesdiscovered: " + service.getuuid().tostring() );                 }                 callback.connectedstatechanged(true);             } else                 disconnect();         }         @override         public void oncharacteristicread(bluetoothgatt gatt, bluetoothgattcharacteristic characteristic, int status) {             super.oncharacteristicread(gatt, characteristic, status);             characteristicvalueread(characteristic);             bluetoothcommunicationmanager.getinstance().processnext();         } 

i lost 2 days write queue , can't it. in advance every help.

you should use 'command' design pattern. basically, you'll have abstract class or interface single 'execute(..)' method. create classes, extending 'command' class, every implementation own work. can create 'arraylist', add tasks , process tasks in 'for' loop like:

for (command c : commands){  c.execute(..); { 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -