BluetoothDBusService uses RawDBusConnection, but isn't one. With
this patch, the connection is instead maintained as a field of
the class.
This change also allows to delete the class instance when the
connection gets closed, which will allow for further cleanups
of the DBus connection handling within Bluetooth.
This patch changes BluetoothDBusService to use the new send methods
that have been added to RawDBusConnection. The conversion from the
old functions is
- dbus_func_send to Send,
- dbus_func_send_async to SendWithReply,
- dbus_func_args_async to SendWithReply,
- dbus_func_args to SendWithError, and
- dbus_func_args_timeout to SendWithError.
References to DBusCallback have been removed.
In order to avoid the assertion, which occurs because we can't control the
order of contruction of global static variables, I changed to use a pointer
instead of an instance, so I can really allocate the memory block at the
other place (in ctor of BluetoothDBusService).
With the completely non-blocking handling of 'GetProperties' message
there is no need for BluetoothArrayOfDevicePropertiesRunnable any longer.
--HG--
extra : rebase_source : 8cbdf1bfdf4aec3dfd797326a6846931a8099723
BluetoothArrayOfDevicePropertiesRunnable used to block while waiting
for the results of the 'GetProperties' messages it sends over DBus. With
this patch, each 'GetProperties' operation is performed asyncronously
and the result is handled in a DBus reply handler. The same reply handler
gets used for all 'GetProperties' messages until all devices have been
processed. In this case the final Bluetooth reply runnable gets
dispatched.
The old function GetPropertiesInternal is now unused and has been
removed.
--HG--
extra : rebase_source : 6e5ed63ce2077e16bcaf995c3ca89f923ec8b37e
Starting and stopping Bluetooth support can block the executing thread
for an indefinite amount of time. In most cases these operations are
only performed when Gecko starts and stops, so we don't want to keep
a separate Bluetooth command thread for this.
This patch replaces the Bluetooth command thread by a LazyIdleThread,
which only consumes resources while it executes actual code. After a
timeout period, the LazyIdleThread cleans up its internal state. The
timeout is currently 3 seconds, which has been choosen arbitrarily.
Thanks to bent for helping with the details of LazyIdleThread.