Commit Graph

63 Commits

Author SHA1 Message Date
Johan Hedberg
0ca6eacb9a Remove redundant parentheses 2010-09-22 10:55:11 +03:00
Santiago Carot-Nemesio
bab7bc682b Remove magic numbers in MCAP CSP 2010-09-22 10:48:16 +03:00
Santiago Carot-Nemesio
d9c916ac62 Simplify logic to calculate the BT/system clock latency
This is only a cosmetic change. Using a while loop
we avoid direct manipulation of counter loop variable
when error happens reading the BT clock.
2010-09-22 10:48:11 +03:00
Elvis Pfützenreuter
5500d6f8a8 Use hciops functions instead of HCI raw sockets 2010-09-22 10:22:52 +03:00
Elvis Pfützenreuter
ce86aba22d Fix potential lockup while finding latency
This patch fixes a potential infinite loop while finding the
BT/system clock read latency. If the adapter is removed exactly
at that moment, BT clock simply can't be read and it must quit.
This is handled as a temporary failure (if a new connection is
made, adapter is probably in place again).
2010-09-21 21:03:08 +03:00
Jose Antonio Santos Cadenas
2b34bb1e19 Code reorganization to avoid unnecessary forward declarations 2010-09-21 21:03:02 +03:00
Jose Antonio Santos Cadenas
1dee81c167 Some code reordering in mcap_sync
Declaration, defines and struct definitions are moved to the begining
of the file. Just for make the code more readable.
2010-09-21 14:01:12 +03:00
Santiago Carot-Nemesio
7fec3cc784 Fix potential NULL pointer access in MCAP CSP code
NULL pointer acces may hapen when an attemp to send a
synchronization command happens over a closed MCL.
2010-09-20 14:14:06 +03:00
Santiago Carot-Nemesio
f7d72451b4 Fix minor coding style issues in MCAP CSP code 2010-09-20 14:14:03 +03:00
Johan Hedberg
73d16df5fc Fix minor coding style issues in HDP code 2010-09-17 18:01:58 +03:00
Jose Antonio Santos Cadenas
2aceae7e35 Add watcher for client disconnection 2010-09-17 16:40:58 +02:00
Jose Antonio Santos Cadenas
022fe44099 Register and unregister interfaces for health devices 2010-09-17 16:40:58 +02:00
Santiago Carot-Nemesio
ced4231b06 Register features in SDP record 2010-09-17 16:40:58 +02:00
Jose Antonio Santos Cadenas
bb0b2e841e Manage adapters 2010-09-17 16:40:51 +02:00
Jose Antonio Santos Cadenas
bbbdb87fc6 Managing applications (create and destroy) 2010-09-17 16:34:53 +02:00
Santiago Carot-Nemesio
2792e639a9 Initial support for HDP plugin 2010-09-17 11:38:02 +02:00
Johan Hedberg
0d1d944281 Make read_btclock return value clearer 2010-09-16 17:57:48 +03:00
Johan Hedberg
bfc9ce9a21 Fix memory leak 2010-09-16 17:56:07 +03:00
Johan Hedberg
3ed7e64096 Fix coding style issues in MCAP CSP code 2010-09-16 17:54:27 +03:00
Elvis Pfützenreuter
afceadebb7 Fixes several small issues found with PTS testing
1. BT clock reading is retried a few times upon failure. Temporary
   failures seem to be common (at least in a VM environment) and
   CSP needs to deal with it more gracefully.
2. Do not read local BT clock if ioctl() fails; fail and let the
   higher-level function to retry. No clock is better than the wrong
   one.
3. Add a field to SyncLeadTime in capabilities struct, since this
   is checked by PTS and a better/clearer estimate is needed
   throughout the code (see below).
4. Make sure every scheduling is delayed by SyncLeadTime. PTS does
   not like to receive a message before this.
5. Added a more conservative (and bigger) estimate of SyncLeadTime
   (PTS insists about receiving immediate responses within it).
6. Sync Indication is immediately sent in two ocasions: right after
   a sync set, and right after sync set response (and every "n"
   seconds after that, depending on required accuracy).
7. Timestamp resolution is set to 1 when operating system call
   yields resolution = 0.
2010-09-16 10:54:11 -03:00
Elvis Pfützenreuter
cf25fc1f49 Added CSP enabling/disabling API; GError argument positioning
MCAP stack wakes up with CSP disabled. It must be enabled
explicitly. MCL connections created prior to CSP enabling
won't be CSP-capable; only new MCLs will.

GError pointer is by convention the last parameter in request functions.
2010-09-16 10:54:11 -03:00
Elvis Pfützenreuter
62fb66c518 Read native BT clock if connection has no handle
Loopback connections (between two processes in the same machine)
have no ACL handle. In this case, just use the native BT clock.
2010-09-16 10:54:11 -03:00
Elvis Pfützenreuter
c1e45717d5 CSP-Master implementation 2010-09-16 10:54:11 -03:00
Elvis Pfützenreuter
1e6a00608a Internal CSP capabilities use signed int
Using plain, signed ints for the internal representation
of CSP capabilities makes it easier to do math on those
values, as well as avoiding casts.
2010-09-16 10:54:11 -03:00
Elvis Pfützenreuter
9fd248f100 Make sure CSP-slave set phase2 is always 'late'
Also, if the phase2 callback arrives too early (unlikely),
makes sure that timestamp will not underflow, because it
is unsigned.
2010-09-16 10:54:11 -03:00
Elvis Pfützenreuter
73397e56ec CSP Slave: Implemented role switch detection 2010-09-16 10:54:11 -03:00
Elvis Pfützenreuter
4f9819b1e3 Added a TODO about btclock-based scheduling (is possible at all?) 2010-09-16 10:54:11 -03:00
Elvis Pfützenreuter
83609c9b0f CSP-Slave: info indication implementation 2010-09-16 10:54:09 -03:00
Elvis Pfützenreuter
79fd304349 CSP-Slave set request: implemented delayed response 2010-09-16 10:28:49 -03:00
Elvis Pfützenreuter
3c01182f08 Added sync stop function for when MCL disconnects 2010-09-16 10:27:37 -03:00
Elvis Pfützenreuter
1073e95c1e Put chosen system clock in evidence as a macro 2010-09-16 10:26:28 -03:00
Elvis Pfützenreuter
bc0a9c66c9 Added BT clock validation function 2010-09-16 10:26:27 -03:00
Elvis Pfützenreuter
ecf7610cbe Implementation of CSP-Slave capabilities 2010-09-16 10:24:58 -03:00
Elvis Pfützenreuter
68a87ad124 Added member to MCL structure, CSP control struct initialization 2010-09-16 10:22:21 -03:00
Elvis Pfützenreuter
dd6f2eafe0 Added basic CSP macros, fix in error response
CSP error responses must be of the same length as normal
responses, except that all parameters are set to zero.
2010-09-16 10:11:54 -03:00
Johan Hedberg
2c51f57c81 Use mcap_rsp instead of uint8_t where it makes sense
Get rid of unnecessary uint8_t * variables where mcap_rsp can be
directly used.
2010-09-16 15:33:54 +03:00
Johan Hedberg
c640b57f56 Get rid of unnecessary mdl variables 2010-09-16 15:19:53 +03:00
Johan Hedberg
9031c47dde Get rid of unnecessary type casts with mcap_send_data 2010-09-16 15:19:18 +03:00
Johan Hedberg
028d168131 Make mcap_send_data accept void *
This makes it easier to pass the function data without having to do
explicit type casts.
2010-09-16 15:04:24 +03:00
Jose Antonio Santos Cadenas
e32375e831 Change the way that connections are rejected
MCAP requires that connections are refused at L2CAP layer using a
connection response "Connection refused -no resources available".
By default, deferred connections in BlueZ are rejected using the
code "Connection refused - security block".

As in BlueZ is not possible to reject the defer connection with
this response code. This patch don't defer the connection and
close it immediately. This is also a valid behaviour for rejecting
connections in MCAP.
2010-09-15 13:26:04 +02:00
Jose Antonio Santos Cadenas
5c90bde90b Remove GError only when there is an error 2010-09-15 13:26:04 +02:00
Santiago Carot-Nemesio
d67dee724e Supress glib warnings when a sources is removed with tag 0 2010-09-15 13:26:04 +02:00
Jose Antonio Santos Cadenas
b2ae2f7220 Avoid memory leak while connecting BTIO channels 2010-09-15 13:26:04 +02:00
Santiago Carot-Nemesio
b6d761f8ed Use reference counter to manage MCL references in MCAP 2010-09-15 13:26:04 +02:00
Johan Hedberg
f47ef246ff Fix potential NULL pointer access in MCAP code 2010-09-02 15:05:52 +03:00
Johan Hedberg
5c10242bc4 Simplify logic in close_mcl() 2010-09-02 15:04:56 +03:00
Johan Hedberg
4299e6f62d Fix minor coding style issues in MCAP code 2010-09-02 15:02:00 +03:00
Santiago Carot-Nemesio
4ed1e1c608 Add initial support for synchronization protocol 2010-09-02 14:52:06 +03:00
Santiago Carot-Nemesio
d25f53fe90 Add version and supported procedures values 2010-09-02 14:52:06 +03:00
Santiago Carot-Nemesio
e6a5eef667 Response with invalid operation when an invalid request is received 2010-09-02 14:52:06 +03:00