Bluetooth low energy for Samsung Galaxy S3 and TI CC2540 heart rate monitor

2.7k Views Asked by At

I am developing a bluetooth low energy application for the Samsung Galaxy S3. I am using Broadcom ble jar file into my project. I am able to search the TI CC2540 ble device.

But when I try to connect the Galaxy S3 to CC2540, I immediately get a null pointer exception and I am not able to connect to it. I tried many times but I am not able to connect to it. Below is the line of code in my application which connects to the remote ble device.

mFindMe.connect(mDevice);

mfindme is my HRM profile and mDevice is the bluetooth address of my CC2540 TI ble device.

It always throws a null pointer exception when I try to connect to the device.

1

There are 1 best solutions below

1
On

I am using the following code for my project. I hope it helps you to understand my problem.

btconnect = (Button)findViewById(R.id.btn_connect);
btconnect.setOnClickListener(new View.OnClickListener()
{
    @Override
    public void onClick(View view)
    {
        try
        {
            mFindMe.connect(mDevice);
        }
        catch(Exception e)
        {
            Log.d("Error","connecting");
        }
    }
});

setUiState();
registerReceiver(regReceiver, new IntentFilter(FindMeProfileClient.FINDME_REGISTERD));

mDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(HRM_BD_ADDRESS);
mFindMe = new FindMeProfileClient(this);

I have also found that the public static final String BLUETOOTH_LE_SERVICE is missing in the broadcom jar file so mservice variable is null.

Please kindly provide any help on this bluetooth low energy profile.