Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing to the Bluno : Null error #22

Open
AudeGr opened this issue Oct 28, 2019 · 0 comments
Open

Writing to the Bluno : Null error #22

AudeGr opened this issue Oct 28, 2019 · 0 comments

Comments

@AudeGr
Copy link

AudeGr commented Oct 28, 2019

I want to add to my android project a ble bluno connection ( target sdk : 26, min sdk : 21, compile sdk : 28). I followed the demo but i had a problem with the scan (obselete?) so i found a solution, i connected directly with a paired device using the "connect" function. But now i want to write something to the bluno using the "serialSend" function and it says :
"serialSend: Attempt to invoke virtual method 'boolean android.bluetooth.BluetoothGattCharacteristic.setValue(java.lang.String)' on a null object reference"

my SerialSend function :
` public void serialSend(String theString){

	if (mConnectionState == connectionStateEnum.isConnected) {

		try{

			mSCharacteristic.setValue(theString);
			mBluetoothLeService.writeCharacteristic(mSCharacteristic);

		}catch (Exception e){

			Log.d(TAG, "serialSend: "+e.getMessage());

		}

	}

}`

The characteristic i want to write in is null and the BroadcastReceiver is never used, in my opinion the characteristic is instanced in this receiver. the BroadcastReceiver is called after the broadcastUpdate but i enter well in the 'update' function and dont in the receiver.
private void broadcastUpdate(final String action) { final Intent intent = new Intent(action.toLowerCase()); sendBroadcast(intent); }

Is it because i dont used the scan to connect my bluno or there is a problem with version or there is an other problem?

Waiting for an answer, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant