Commit Graph

82 Commits

Author SHA1 Message Date
Vinicius Costa Gomes
c606feeb48 Add the GetCharacteristics() DBus method
This method allows the retrieval of every known information about the
characteristics beloging to a Service.
2010-08-09 18:06:49 -04:00
Vinicius Costa Gomes
a9a4e52bee Fix wrong paths for the Services objects
When restoring the Service information from storage, the path was created
before reading the information from storage.
2010-08-09 18:06:49 -04:00
Anderson Lizardo
08e83df251 gatttool: simplify characteristic discovery output 2010-08-09 18:06:49 -04:00
Anderson Lizardo
4dc133a198 gatttool: Replace --char-value-read with generic --char-read option
The new option is useful for reading either characteristic values or
descriptors, which use the same Read Request. This commit also fixes a
few errors related to the handle options.
2010-08-09 18:06:49 -04:00
Bruna Moreira
cafebc60e7 Remove multiple calls for g_idle_add() in gatttool 2010-08-09 18:06:49 -04:00
Bruna Moreira
0e7aa8f0ac Move connection operations to main in gatttool
The connection operations (do_connect) were moved to main. So, the
internal call to do_connect() were removed and GAttrib structure is
initialized/freed in main. All callbacks receive the GAttrib structure
through the user_data parameter.
2010-08-09 18:06:49 -04:00
Anderson Lizardo
a3f410d1f2 gatttool: coding style fixes 2010-08-09 18:06:49 -04:00
Bruna Moreira
eaef3c6c2c Add function to open connections in gatttool
The do_connect() function was created to open unix/l2cap sockets. It is
used by primary, characteristics and characteristics value options.
2010-08-09 18:06:48 -04:00
Bruna Moreira
6489a249a5 Change client to use dec_read_by_grp_resp() 2010-08-09 18:06:48 -04:00
Bruna Moreira
af40b52994 Change gatttool to use dec_read_by_grp_resp()
The primary callback in gatttool was updated to use
dec_read_by_grp_resp() function. Also, the printed message was updated
to use same spec nomenclature.
2010-08-09 18:06:48 -04:00
Claudio Takahasi
b862c11182 Remove unused parameter for register_characteristics function 2010-08-09 18:06:48 -04:00
Claudio Takahasi
754fce193b Initial implementation of characteristics GetProperties()
Returns a dictionary of characteristic properties. Format, Value and
Representation are not supported yet.
2010-08-09 18:06:48 -04:00
Vinicius Costa Gomes
68299d1d74 Fix some memory leaks when closing a GATT connection 2010-08-09 18:06:48 -04:00
Vinicius Costa Gomes
1e1434c1b7 Fix coding style issues
Some lines were passing the 79 columns limit.
2010-08-09 18:06:48 -04:00
Vinicius Costa Gomes
ee2b848176 Add support for the GAttrib queue to the client plugin
Now, that we have a proper queue for command serialization, we can remove
the previous hacks to implement a partial serialization in the client.
2010-08-09 18:06:48 -04:00
Vinicius Costa Gomes
79cb696f56 Fix the last group of characteristic not being stored
The characteristic group beloging to the last service was not being stored,
because the condition to trigger the storage was missing that last group.
2010-08-09 18:06:48 -04:00
Vinicius Costa Gomes
d7b3bbbd6e Add a Queue to serialize the GATT PDU's
With this queue we can have more control about which commands are sent, and
be sure that what is received is what we expect.
2010-08-09 18:06:48 -04:00
Anderson Lizardo
765b7e0e56 Implement characteristic value read in gatttool 2010-08-09 18:06:48 -04:00
Anderson Lizardo
262323b597 Implement characteristic value read on attribute server 2010-08-09 18:06:48 -04:00
Bruna Moreira
d8827654f9 Add characteristics value read option in gatttool
Only skeleton for new option was added (empty callback and options). The
characteristics value readi must receive a handle.
2010-08-09 18:06:48 -04:00
Bruna Moreira
416809f34b Change discover characteristics output
Make the discover characteristics output more readable (the result
values were split in permission, characteristic value handle and uuid).
2010-08-09 18:06:48 -04:00
Bruna Moreira
765a807fdc Fix memory leaks in gatttool 2010-08-09 18:06:48 -04:00
Claudio Takahasi
253ccc6d4a Remove dynamic memory allocation for uuid_t of the primary service 2010-08-09 18:06:48 -04:00
Vinicius Costa Gomes
de731d19c9 Fix wrong value for each characteristic end handle 2010-08-09 18:06:47 -04:00
Vinicius Costa Gomes
baa95be886 Fix the byte order of some of the examples handles
Some of the handles of the example's attributes were in the wrong order.
2010-08-09 18:06:47 -04:00
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