notifications - Android SensorTag: writeDescriptor failed -


device testing:android 4.4

connection working fine ondescriptorwrite method of callback never called. , bluetoothgatt , characteristics got. when want setcharacteristicnotification , writedescriptor, no callback recieved, including ondescriptorwrite , oncharacteristicchanged. notification code showed following:

    private static void enablemagnetometernotifications(bluetoothgatt     bluetoothgatt) {     uuid magnetserviceuuid = uuid.fromstring("f000aa30-0451-4000-b000-000000000000");     uuid magnetdatauuid = uuid.fromstring("f000aa31-0451-4000-b000-000000000000");     uuid ccc = uuid.fromstring("00002902-0000-1000-8000-00805f9b34fb");     boolean ok = false;     boolean notify = false;      bluetoothgattservice magnetservice = bluetoothgatt.getservice(magnetserviceuuid);     bluetoothgattcharacteristic magnetdatacharacteristic = magnetservice.getcharacteristic(             magnetdatauuid);     notify = bluetoothgatt.setcharacteristicnotification(             magnetdatacharacteristic, true); //enabled locally      if (notify){         bluetoothgattdescriptor config = magnetdatacharacteristic.getdescriptor(ccc);         list<bluetoothgattdescriptor> cof = magnetdatacharacteristic.getdescriptors();         for(bluetoothgattdescriptor a: cof  ){             log.i("gattdescriptor ",a.getuuid().tostring());         }         ok = config.setvalue(bluetoothgattdescriptor.enable_notification_value);         if(ok){             mbusy = true;             bluetoothgatt.writedescriptor(config); //enabled remotely             //delay 300 seconds             waitidle(300);         }     } 


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -