Giter VIP home page Giter VIP logo

Comments (8)

philips77 avatar philips77 commented on August 16, 2024 1

Which profile are you testing?

from android-ble-library.

philips77 avatar philips77 commented on August 16, 2024 1

Hi, I was on vacations and now I'm busy with another project right now and didn't have time to look into it. But I'll look into it when i have time.

from android-ble-library.

philips77 avatar philips77 commented on August 16, 2024 1

Yes, I'm going to add null checks is all callbacks.

from android-ble-library.

midhun3112 avatar midhun3112 commented on August 16, 2024

@philips77 I am using the BleProfileServiceReadyActivity in RSCActivity. After the disconnect, this crash occurs frequently if some data is pending. I am manually turning off the Bluetooth. Since there is no null check in the library for the onCharacteristicWriteSafe method the app crashes.

from android-ble-library.

midhun3112 avatar midhun3112 commented on August 16, 2024

@philips77 Any updates? :)

from android-ble-library.

midhun3112 avatar midhun3112 commented on August 16, 2024

@philips77 Thanks for the quick reply :)

from android-ble-library.

midhun3112 avatar midhun3112 commented on August 16, 2024

@philips77 The crash is occurring on BleManager because when I turn off the Bluetooth the request queue is cleared But in onCharacteristicWriteSafe there is no null check for request
final WriteRequest request = (WriteRequest) mRequest;
request.notifyPacketSent(gatt.getDevice(), data);

This is where the crash occurs. Can you please check this and let me know.

	final void onCharacteristicWriteSafe(@NonNull final BluetoothGatt gatt,
										 @NonNull final BluetoothGattCharacteristic characteristic,
										 @Nullable final byte[] data,
										 final int status) {
		if (status == BluetoothGatt.GATT_SUCCESS) {
			log(Level.INFO, "Data written to " + characteristic.getUuid() +
					", value: " + ParserUtils.parse(data));

			onCharacteristicWrite(gatt, characteristic);
			final WriteRequest request = (WriteRequest) mRequest;
			request.notifyPacketSent(gatt.getDevice(), data);
			if (request.hasMore()) {
				enqueueFirst(mRequest);
			} else {
				mRequest.notifySuccess(gatt.getDevice());
			}
		} else if (status == BluetoothGatt.GATT_INSUFFICIENT_AUTHENTICATION
				|| status == 137 /* GATT AUTH FAIL */) {
			log(Level.WARNING, "Authentication required (" + status + ")");
			if (gatt.getDevice().getBondState() != BluetoothDevice.BOND_NONE) {
				// This should never happen but it used to: http://stackoverflow.com/a/20093695/2115352
				Log.w(TAG, ERROR_AUTH_ERROR_WHILE_BONDED);
				mCallbacks.onError(gatt.getDevice(), ERROR_AUTH_ERROR_WHILE_BONDED, status);
			}
            // The request will be repeated when the bond state changes to BONDED.
            return;
		} else {
			Log.e(TAG, "onCharacteristicWrite error " + status);
			mRequest.notifyFail(gatt.getDevice(), status);
			mValueChangedRequest = null;
			onError(gatt.getDevice(), ERROR_WRITE_CHARACTERISTIC, status);
		}
		nextRequest(true);
	}

from android-ble-library.

midhun3112 avatar midhun3112 commented on August 16, 2024

@philips77 Thanks 👍. When are you planning to release the next version.

from android-ble-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.