2017-04-25 10:43:28

by [email protected]

[permalink] [raw]
Subject: SENDING GATT NOTIFICATION USING DBUS

I am trying to send GATT notification in bluez 5.43 using DBUS. But
currently the gatt-service.c doesn't provide any details how to send
it using DBUS. Currently

static DBusMessage *chr_start_notify(DBusConnection *conn, DBusMessage
*msg, void *user_data)

return g_dbus_create_error(msg, DBUS_ERROR_NOT_SUPPORTED, "Not Supported")


is given like this as no characteristic supports notification in the
given code. But I am trying to build a custom service which has
notifiable characteristics. How should i handle it. What should be the
code that i need to write inside char_start_notify to achieve it.


2017-04-25 16:23:15

by [email protected]

[permalink] [raw]
Subject: Re: SENDING GATT NOTIFICATION USING DBUS

Hi Barry,

I did look at it. But I want a solution in C and not python. I am not
conversant with Python. How do it convert this into C. I am a beginner
in bluez. Can you help me on this .

On Tue, Apr 25, 2017 at 7:59 PM, Barry Byford <[email protected]> wrote:
> Hello,
>
> On 25 April 2017 at 11:43, [email protected]
> <[email protected]> wrote:
>> I am trying to send GATT notification in bluez 5.43 using DBUS. But
>> currently the gatt-service.c doesn't provide any details how to send
>> it using DBUS. Currently
>>
>> static DBusMessage *chr_start_notify(DBusConnection *conn, DBusMessage
>> *msg, void *user_data)
>>
>> return g_dbus_create_error(msg, DBUS_ERROR_NOT_SUPPORTED, "Not Supported")
>>
>>
>> is given like this as no characteristic supports notification in the
>> given code. But I am trying to build a custom service which has
>> notifiable characteristics. How should i handle it. What should be the
>> code that i need to write inside char_start_notify to achieve it.
>
> Have you taken a look at test/example-gatt-server?
>
> The notifications are done with the PropertiesChanged signal on the
> value of the characteristic
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/gatt-api.txt#n121
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-server#n200
>
> And in the example are issued with:
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-server#n297
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-server#n399
>
> Hope that helps
>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html

2017-04-25 14:29:10

by Barry Byford

[permalink] [raw]
Subject: Re: SENDING GATT NOTIFICATION USING DBUS

Hello,

On 25 April 2017 at 11:43, [email protected]
<[email protected]> wrote:
> I am trying to send GATT notification in bluez 5.43 using DBUS. But
> currently the gatt-service.c doesn't provide any details how to send
> it using DBUS. Currently
>
> static DBusMessage *chr_start_notify(DBusConnection *conn, DBusMessage
> *msg, void *user_data)
>
> return g_dbus_create_error(msg, DBUS_ERROR_NOT_SUPPORTED, "Not Supported")
>
>
> is given like this as no characteristic supports notification in the
> given code. But I am trying to build a custom service which has
> notifiable characteristics. How should i handle it. What should be the
> code that i need to write inside char_start_notify to achieve it.

Have you taken a look at test/example-gatt-server?

The notifications are done with the PropertiesChanged signal on the
value of the characteristic
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/gatt-api.txt#n121
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-server#n200

And in the example are issued with:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-server#n297
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-server#n399

Hope that helps

> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html