Commit Graph

14 Commits

Author SHA1 Message Date
Vinicius Costa Gomes
0f92869a3b gattrib: Add support for listening for events for specific handles
We want only the profile that implements a service to be notified of
changes on that service. Before this patch, all the registered event
notifiers are being called.
2012-10-11 08:55:50 +02:00
Vinicius Costa Gomes
8a39d6ed2d attrib: Remove opcode parameter from g_attrib_send()
In all uses of g_attrib_send() the opcode of the command/event is
already clear because of the att.h functions used to build the ATT
PDU.
2012-10-09 10:56:52 +02:00
Johan Hedberg
04be4fe0c0 attrib: Use proper types for size variables
size_t/ssize_t/off_t/etc are more appropriate for variables denoting
some kind of size than simply using int.

This patch includes a couple of other related changes to avoid gcc
signedness errors resulting from it treating (for whatever reason) const
variables and integer literals as signed.
2012-08-15 12:20:51 +03:00
Claudio Takahasi
9e6a11719f GAttrib: Remove unused function
GAttrib disconnection tracking is being moved to device.c
2012-02-14 14:11:54 +02:00
Vinicius Costa Gomes
eb41b504d0 Fix the attrib server trying to handle responses
The attribute server should only try to handle ATT requests, responses
and events should be handled by the client.
2011-09-22 20:25:25 +09:00
Bruna Moreira
68887c2133 Add internal buffer to GAttrib struct
The new buffer is allocated in g_attrib_new() and it will be used to
send/receive PDUs. The buffer size is the MTU read from L2CAP channel
limited to ATT_MAX_MTU. Functions to handle the buffer size were also
created.
2011-03-18 11:14:35 +02:00
Brian Gix
7f0b31cbb4 Fix g_attrib_send() to include a new ID parameter
Overall purpose of change is to enable a GATT procedure to be
executed atomically, even if it requires multiple ATT
request/response transactions.

Fix g_attrib_send() to include an ID parameter, if the pkt to
be sent should be added to the Head of the pkt queue.  If the
ID is Zero, legacy functionality is maintained, and the pkt will
be added at the tail of the queuer, and a new ID will be generated,
and returned to the caller. If ID is non-zero, the pkt will be
added to the head of the queue, with the ID value requested, which
will also be returned to the caller.

Fix received_data() to not service the send queue until after the
received data has been processed by calling the cmd->func()
callback, to allow the callback to insert another pkt on the head
of the queue.

Fix all callers of g_attrib_send() to include new parameter.
2011-01-07 21:31:31 +02:00
Claudio Takahasi
41d3eb82b8 Change security level on demand when reading characteristic value
If a characteristic requires a higher security level, change it on
demand and re-send the GATT Charateristic Value Read. Request will not
be sent until the SMP negotiation finishes. This change doesn't affect
GATT over BR/EDR, since encryption is mandatory for BR/EDR.
2011-01-05 14:04:51 +02:00
Bruna Moreira
d599b9e2b8 Check the security level on a per request base
Check security level on attribute server on each request, and update the
"encrypted" flag.
2010-12-09 15:59:46 +02:00
Claudio Takahasi
8545bdc1ea Add g_attrib_set_destroy_function in gattrib
Add a new function to notify the GAttrib "users" when the GAttrib has
beed destroyed. The disconnect function is called only for remote initiated
disconnections or external events(not unref).
2010-09-22 15:55:18 -04:00
Vinicius Costa Gomes
8307634aa6 Update copyright information of GATT library/tools 2010-08-09 18:06:49 -04:00
Vinicius Costa Gomes
9da32607c8 Add support to events to g_attrib_register()
Passing GATTRIB_ALL_EVENTS we can cause the notify callback to be called for
all events received.
2010-08-09 18:06:46 -04:00
Vinicius Costa Gomes
238c9432c6 Fix the notify callback not receiving the pdu lenght 2010-08-09 18:06:46 -04:00
Claudio Takahasi
fcc6c7788e Initial GAttrib functions
GAttrib aims to provide high level functions to hide GATT/ATT internals.
GATT client and server shall use these functions to serialize ATT
requests/responses.
2010-08-09 18:06:44 -04:00