Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
jaschroe
Posts: 32
Registered: ‎08-26-2008
My Device: Not Specified

bt_gatt_connect_service() example?

[ Edited ]

Hi Developers and Shahid,

 

I am following the JAM-21 PDF on using Bluetooth Low Energy. I am successfully receiving advertising callbacks and packets, and successfully parsed them following the Bluetooth 4.0 specification.

 

I am trying to use bt_gatt_connect_service(), but none of my bt_gatt_callbacks_t are invoked.

 

I am testing with a Polar H7 heart rate sensor. The "advertisement" message says it supports Service (16-bit UUID) 0x180D, but I call:

 

static bt_le_callbacks_t le_callbacks = { HRM_advertisement_cb };

static bt_gatt_callbacks_t gatt_callbacks = {
            HRM_service_connected_cb,
            HRM_service_disconnected_cb,
            HRM_service_updated_cb
    };


bt_le_init(&le_callbacks);
bt_gatt_init(&gatt_callbacks);

bt_gatt_connect_service("00:22:D0:00:21:C0", "0x180d", NULL, NULL, NULL");

 What am I doing wrong? I also don't have any luck with Service 0x180A (Device Information) or 0x10F (Battery Service).

 

Testing with BlackBerry DevAlpha B, OS 10.9.9.339. Compiled with BlackBerry 10 Native SDK 10.0.9.2318 on a Linux 64-bit host.

 

Thanks in advance!

 * Updated: (16-bit UDID, not 16-byte)

Please use plain text.
BlackBerry Development Advisor (Retired)
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10
My Carrier: Bell Canada

Re: bt_gatt_connect_service() example?

What return codes are you getting from those calls?

--
Rob is no longer associated with BlackBerry.
Please use plain text.
Developer
jaschroe
Posts: 32
Registered: ‎08-26-2008
My Device: Not Specified

Re: bt_gatt_connect_service() example?

EOK everywhere.

Please use plain text.
BlackBerry Development Advisor (Retired)
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10
My Carrier: Bell Canada

Re: bt_gatt_connect_service() example?

[ Edited ]

Have you done a 

    bt_device_init( bt_controller_cb );

 I think it is necessary for any BT events in your app... (and you do say you're getting some..)

 

 

--
Rob is no longer associated with BlackBerry.
Please use plain text.
Developer
jaschroe
Posts: 32
Registered: ‎08-26-2008
My Device: Not Specified

Re: bt_gatt_connect_service() example?

I will give it a try tonight. I didn't think it was necessary, as this is Bluetooth LE.

Thanks, Robbie!

 

Please use plain text.
BlackBerry Development Advisor (Retired)
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10
My Carrier: Bell Canada

Re: bt_gatt_connect_service() example?

any luck?

--
Rob is no longer associated with BlackBerry.
Please use plain text.
Developer
jaschroe
Posts: 32
Registered: ‎08-26-2008
My Device: Not Specified

Re: bt_gatt_connect_service() example?

That didn't help either, but it did point me in the right direction! The BB10 device has to be paired with the Bluetooth LE device, which I did in the Settings app. Then everything started to work correctly.

 

Thanks for the nudge in the right direction!

Please use plain text.