Button event triggers and timing



  • Official comment
    VSN Mobil Support

    You have to write one value to the characteristic.  The value/field is a bit mask field.  Thus you have to enable the bit for the setting that you want.  In your case, since you want short (0x01) and long (0x02) press detection, you should write 0x03 to characteristic 0xFFFFFFF2-00F7-4000-B000- 000000000000

    Comment actions Permalink
  • Avatar
    John Developer

    I want to differentiate the button events in the onCharacteristicChanged-method. But this part

    while(var6.hasNext()) { 
    BluetoothGattService service = (BluetoothGattService)var6.next(); 
    if(service != null && service.getUuid() != null && Constants.SERVICE_VSN_SIMPLE_SERVICE.equals(service.getUuid())) { 
    BluetoothService.this.mCharVerification = service.getCharacteristic(Constants.CHAR_APP_VERIFICATION); 
    BluetoothService.this.enableForDetect(gatt, service.getCharacteristic(Constants.CHAR_DETECTION_CONFIG), Constants.ENABLE_KEY_DETECTION); 
    BluetoothService.this.setCharacteristicNotification(gatt, service.getCharacteristic(Constants.CHAR_DETECTION_NOTIFY), true); 

    seems to call the method as well and with the same value (3) as the long press. 
    Can you tell me why the onCharacteristicChanged method is called with the value 3 in the part above and how I can differentiate this one from the long-press-characteristic changed (which has the value 3, too).

    Thanks for your help. 

    Comment actions Permalink
  • Avatar
    VSN Mobil Support

    Is the constant  Constants.ENABLE_KEY_DETECTION  set to byte array with value 0x03?

    For the onCharacteristicChanged callback, how did you verify that the value is always 3?  Did you check to see which characteristic caused the function to be called?

    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk