Commit Graph

7035 Commits

Author SHA1 Message Date
Claudio Takahasi
30ff7e9ea8 Attribute server cleanup 2010-08-09 18:06:46 -04:00
Claudio Takahasi
b3897627c2 Change unix socket properties of the attribute server
Sets the unix socket GIOChannel encoding to NULL, this is the
recommended value to handle binary data. Sets O_NONBLOCK flag.
2010-08-09 18:06:46 -04:00
Anderson Lizardo
e840565e17 Implement initial UNIX socket support
Only socket creation and close is implemented for now.
2010-08-09 18:06:46 -04:00
Vinicius Costa Gomes
5c56282acd Fix invalid data when building a Read by Group response 2010-08-09 18:06:46 -04:00
Vinicius Costa Gomes
9645c63fae Fix a segmentation fault when we just use g_attrib_register() 2010-08-09 18:06:46 -04:00
Vinicius Costa Gomes
915b66d026 Fix crash when removing the GIO watch
As the destroy function is called when the watch is removed, the best way to
avoid a crash when shutting the service down is to remove the watch.
2010-08-09 18:06:46 -04:00
Vinicius Costa Gomes
36683630b9 Fix Read by Group skipping two bytes when encoding 2010-08-09 18:06:46 -04:00
Claudio Takahasi
387d69382e Implement read by group type in the attribute server
Returns an attribute data list containing found services. Each
element of the list contains the start, end group handle and the
UUID16 of the given service. UUID128 is not being addressed yet.
2010-08-09 18:06:46 -04:00
Vinicius Costa Gomes
989f1dec60 Add g_attrib_register() to the server
Now the server will respond to requests using the GAttrib functions.
2010-08-09 18:06:46 -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
Vinicius Costa Gomes
498a41f217 Fix the return value of Read by Group response encoder
To mantain consistency, the size (in bytes) written to the PDU should
be returned.
2010-08-09 18:06:45 -04:00
Vinicius Costa Gomes
fdef314221 Add support for dealing with Read Request/Response PDUs
This adds encoders and decoders for Requests and Responses of this type. The
value extracted/inserted is just copied, the user shall ensure that it is in
the right byte order.
2010-08-09 18:06:45 -04:00
Bruna Moreira
01b0c411ad Add start/end options to gatttool
Add new command line options to change the fields of discover primary
services requests:
    --start: Starting handle(default 0x0001)
    --end: Ending handle(default 0xffff)
2010-08-09 18:06:45 -04:00
Bruna Moreira
d873388b67 Add initial gatttool skeleton
New command line tool to test GATT features. For now, it is only parsing
options.
2010-08-09 18:06:45 -04:00
Claudio Takahasi
7d092d5447 Add unix socket support for attribute server
Add a socket interface for local interprocess communication. GATT
clients can connect using the addresss: "/var/run/gatt".
2010-08-09 18:06:45 -04:00
Vinicius Costa Gomes
d55fa3f45d Add stubs for dealing with Read Request/Response PDUs 2010-08-09 18:06:45 -04:00
Vinicius Costa Gomes
25d2720869 Add encoder for Read By Group Type Response PDU 2010-08-09 18:06:45 -04:00
Vinicius Costa Gomes
02641ec20b Add decoder for Attribute Read by Group Type request 2010-08-09 18:06:45 -04:00
Vinicius Costa Gomes
ca4bea9d07 Add support for the attrib server to receive connections
The connections are only accepted and kept open for now.
2010-08-09 18:06:45 -04:00
Vinicius Costa Gomes
db86285382 Fix attrib files being compiled only for the plugin
Now as attrib is part of the core bluetoothd, it should be included
as part of the core.
2010-08-09 18:06:45 -04:00
Claudio Takahasi
2581dc90f0 Remove __ATT_H macro definition 2010-08-09 18:06:45 -04:00
Claudio Takahasi
2448a8ba03 Move gatt_discover_char to gatt.c 2010-08-09 18:06:45 -04:00
Claudio Takahasi
d2657982a8 Move gatt_discover_primary to gatt.c 2010-08-09 18:06:45 -04:00
Claudio Takahasi
e79eff7995 Add secondary service attributes into the attribute database
Add all secondary services attributes required by includes definition
on primary services declared previously.
2010-08-09 18:06:45 -04:00
Claudio Takahasi
309c4edc38 Add Thermometer Service attributes into the attribute database
Add all attributes of the Thermometer Primary Service according to
example described in the SPEC. See "APPENDIX: Example Attribute
server attributes". Includes of secondary services are not supported yet.
2010-08-09 18:06:45 -04:00
Claudio Takahasi
1ad03a7606 Add Battery Service attributes into the attribute database
Add all attributes of the Battery Primary Service according to example
described in the SPEC. See "APPENDIX: Example Attribute server
attributes". Battery service and state UUID are not defined yet, random
values have been selected: 0xA002 and 0xA003.
2010-08-09 18:06:45 -04:00
Claudio Takahasi
d23a2e302b Add GATT Service attributes into the attribute database
Add all attributes of the GATT Primary Service according to example
described in the SPEC. See "APPENDIX: Example Attribute server
attributes". Attribute Opcodes Supported UUID is not defined yet, a
random value has been selected: 0xA001.
2010-08-09 18:06:45 -04:00
Claudio Takahasi
f6620753d6 Add GAP Service attributes into the attribute database
Add all attributes of the GAP Primary Service according to example
described in the SPEC. See "APPENDIX: Example Attribute server
attributes".
2010-08-09 18:06:45 -04:00
Claudio Takahasi
a7eb76097e Add Generic Access Profile UUID definition 2010-08-09 18:06:45 -04:00
Claudio Takahasi
4d1df500df Add functions to add/delete entries in the attribute database
Initial functions to allow plugins to add/delete entries in the
attribute database. Handles are being assigned by the callers,
static handles are more suitable for automatic tests.
2010-08-09 18:06:44 -04:00
Claudio Takahasi
84244c3c59 Add host/little endian/host conversion functions for uint128_t values
ATT Multi-octet fields uses little endian format. htob128 converts from
host to little endian. btoh128 converts from little endian.
2010-08-09 18:06:44 -04:00
Vinicius Costa Gomes
803a045797 Add support for discovering all characteristics of a server
Until we don't have a proper command queue all the requests are manually
serialized.

No DBus object path is registered yet
2010-08-09 18:06:44 -04:00
Vinicius Costa Gomes
735bc5019a Fix ATT utility functions naming
If we want to support both client and server roles, we must be clear that we
are encoding/decoding requests or responses.
2010-08-09 18:06:44 -04:00
Vinicius Costa Gomes
cb1b86a6ab Fix using the wrong byte as Error Code
In the Error Response PDU, the Error Code is the fifth byte in the PDU.
2010-08-09 18:06:44 -04:00
Vinicius Costa Gomes
dafe0b2820 Add support to deal with Read by Type PDUs
This adds att_read_by_type_{encode,decode}, so we can create Read by Type
Requests and parse Read by Type Responses.
2010-08-09 18:06:44 -04:00
Vinicius Costa Gomes
17b9256fbd Store discovered primary services information
Information (start handle, end handle and uuid) about the discovered primary
services are stored (in memory) in the gatt_service struct.
2010-08-09 18:06:44 -04:00
Vinicius Costa Gomes
70a6091ccf Add a way to decode the Read by Group type response
att_read_by_grp_type_decode() returns a attribute data list structure.
2010-08-09 18:06:44 -04:00
Claudio Takahasi
813d9f5c4b Add utility function to convert ATT error code to string 2010-08-09 18:06:44 -04:00
Claudio Takahasi
1c9223abcc Register Generic Attribute Profile service record
Publishes SDP service record for GATT support over BR/EDR. Currently,
the record is registered for all available adapters.
2010-08-09 18:06:44 -04:00
Claudio Takahasi
9ab555c32a Request primary service until the server replies Attribute Not Found
Read by Group Type Request shall be sent until the server replies
Attribute Not Found Error. The current implementation does not address
UUID128 endianess, only UUID16 is supported.
2010-08-09 18:06:44 -04:00
Vinicius Costa Gomes
83915080d7 Add simple implementation of g_attrib_send()
Generic function to send ATT PDUs. Timeout and notification are not
being addressed yet.
2010-08-09 18:06:44 -04:00
Claudio Takahasi
281e98d397 Initial Discover primary service implementation
Add read by group type encode function and initial skeleton for discover
all primary services on attribute client plugin.
2010-08-09 18:06:44 -04:00
Claudio Takahasi
6fdb8a10eb Add g_attrib_unref implementation 2010-08-09 18:06:44 -04:00
Claudio Takahasi
27ed6fa165 Add g_attrib_ref implementation 2010-08-09 18:06:44 -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
Claudio Takahasi
b4ad35aafe Initial GATT server example integration
Initial changes to start the GATT server example. For the server side,
attrib plugin will only register the GATT service record and add
the attributes into the attribute database.
2010-08-09 18:06:44 -04:00
Claudio Takahasi
fc558ffc2a Add attribute server database
Attribute server database will contain functions to manage attributes,
allowing any plugin to add, remove or change attributes. Advertising
data shall be also generated based on exported services/attributes.
2010-08-09 18:06:44 -04:00
Claudio Takahasi
97cd604657 Add BR/EDR connection establishment for GATT
Parses the psm for GATT and triggers the L2CAP connection for GATT.
2010-08-09 18:06:44 -04:00
Claudio Takahasi
5f722b2780 Register fake characteristic object
Testing purpose only. This patch registers paths and interfaces for
fake BLE service.
2010-08-09 18:06:44 -04:00