BleTransaction.Auth() documentation

  • I'm missing some documentation on the BleTransaction.Auth() functionality to get it working,
    specifically when writing a password in the auth method, the write always fails however when passing no auth object and authenticating after connecting there is no problem.

    Using the auth object:

    myAuth = new BleTransaction.Auth() {
                    protected void start() {
                        String mPassword = "fake"; //Default pw
                        byte[] arrayOfByte = asBytes(mPassword);
                        BleDescriptorWrite writePassword = new BleDescriptorWrite(MY_BEACON_PASSWORD_SERVICE, MY_BEACON_PASSWORD_CHARACTERISTIC);
                        this.write(writePassword, myPasswordWriteListener);

    In connect:

    e.device().connect(myAuth /*auth*/, null /*init*/, new DeviceConnectListener() {
                public void onEvent(ConnectEvent connectEvent) {

    Directly goes into myPasswordWriteListener and shows that the password was not written successfully:

        ReadWriteListener myPasswordWriteListener = new ReadWriteListener() {
            public void onEvent(ReadWriteEvent e) {
                if (e.wasSuccess()) {
                    connectionLog.addLog("ReadWriteListener, write password succes");
                    connectionLog.addLog("ReadWriteListener, write password failed"); //Directly goes here

    What does work is not using the Auth object, and manually writing the password in deviceConnected, using the same service, characteristic, password and readWriteListener.

    Should these 2 methods not behave in the same way? Or is the Auth start function special in the moment it is ran?

  • @Activ84HealthEU, I need a bit more info in order to help you.

    1. Does it actually ble connect to the device? (You may have to look at logcat).

    2. When the write fails in the transaction, what is the status()? That should at least give you a hint at what's going on.

    NOTE: When using any transaction, you MUST call either succeed(), or fail(). Otherwise, even if the write went through, it would just stall out and do nothing afterward (and the DeviceConnectListener onEvent will never get called, at least not for being connected).