Commit Graph

107 Commits

Author SHA1 Message Date
Claudio Takahasi
58b0cbbdd7 Register stored primary services and characteristic objects
Primary services and characteristic declarations of trusted devices are
stored. When the device is probed, object paths shall be registered.
2010-08-09 18:06:47 -04:00
Claudio Takahasi
ba800b48e1 Fix characteristics and primary service methods
Characteristic objects shall provide GetProperties() method. Primary
service objects: GetCharacteristics(), RegisterCharacteristicsWatcher()
and UnregisterCharacteristicsWatcher().
2010-08-09 18:06:47 -04:00
Bruna Moreira
a6a0f24a24 Implement discovery characteristics for gatttool 2010-08-09 18:06:47 -04:00
Bruna Moreira
280b92ef33 Change menu to make the start/end options more generic
The start/end addresses will be used by characteristics too, so some
changes were done to do the menu messages more generic.
2010-08-09 18:06:47 -04:00
Vinicius Costa Gomes
70a27054c2 Add support from restoring characteristics from storage
Now every known characteristic object is restored from storage with
essential information. Each characteristic DBus object path is registered
from that information.
2010-08-09 18:06:47 -04:00
Vinicius Costa Gomes
739afe307c Add support for storing essential characteristic info
This would allow for each characteristic DBus object path to be
registered.
2010-08-09 18:06:47 -04:00
Vinicius Costa Gomes
978b5c1707 Fix make use of fixed length string for storage
This way the storage is more stable and more under control.
2010-08-09 18:06:47 -04:00
Vinicius Costa Gomes
3164df0ec2 Simplify the characteristic structure
Fow now we only need to store a few pieces of information about each
characteristic. This will allow easier storage of that information.
2010-08-09 18:06:47 -04:00
Vinicius Costa Gomes
ecbef5b4d9 Fix wrong calculation for number of elements of a data list
We must take into account that the opcode and the length of each element is
included in each PDU.
2010-08-09 18:06:47 -04:00
Vinicius Costa Gomes
1f07bea585 Add support for loading previously stored services
This adds support for loading the GATT primary services information
that may exist. This will allow registering the DBus interface of a
service without connecting to the remote device.
2010-08-09 18:06:47 -04:00
Vinicius Costa Gomes
db3bf777b8 Add support to storing the discoved GATT Services
This adds support to storing the discovered primary services so
they can be loaded from storage later.
2010-08-09 18:06:47 -04:00
Claudio Takahasi
dd5279755e Discover all characteristics of the primary services
Adds characteristics discovery in the attrib client plugin. Fetches
all characteristics declaraction for each primary service found.
2010-08-09 18:06:46 -04:00
Bruna Moreira
e321c07ce0 Implement discovery all primary services for gatttool 2010-08-09 18:06:46 -04:00
Anderson Lizardo
f1d7e6a7a9 gatttool: add support for L2CAP socket connection
Connect using L2CAP by default, and add a --unix/-u option to select the
Unix socket (for local testing).
2010-08-09 18:06:46 -04:00
Anderson Lizardo
fa7e72f64b gatttool: add main loop
Also modify the option parsing to work properly with it.
2010-08-09 18:06:46 -04:00
Vinicius Costa Gomes
b0dc1632e4 Add the missing Read by Type functions
This adds the functions necessary to implement a GATT server. The encoder
for the Read by Type Response and the decoder for the Request.
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
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
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
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
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
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
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
Claudio Takahasi
44a3a09fff Add stubs for the attribute client
Contains device driver declaration for attribute protocol. Registers
D-Bus path/interface to represent the remote device client: BR/EDR or
LE. For the most common LE scenarios, devices running BlueZ will be
client role.
2010-08-09 18:06:43 -04:00
Vinicius Costa Gomes
c0abb9dc39 Add stubs for the attribute server
This plugin will have the implementation of a Generic Attribute
Protocol server over Bluetooth Basic Rate and BLE. For BR/EDR this
plugin will register the service record. GATT database will be located
in the BlueZ "core", this plugin will contain only calls to add and
change attributes.
2010-08-09 18:06:43 -04:00