#define CA_BLE_LINUX_CONTEXT_H
#include "caadapterinterface.h"
-#include "camutex.h"
+#include "octhread.h"
#include "cathreadpool.h"
#include "caleinterface.h"
#include <gio/gio.h>
+#include <semaphore.h>
/**
GList * devices;
/**
- * Bluetooth MAC address to GATT characteristic map.
- *
- * Hash table that maps Bluetooth MAC address to a OIC Transport
- * Profile GATT characteristic. The key is a string containing
- * the peer Bluetooth adapter MAC address. The value is an
- * interface proxy (@c GDBusProxy) to an
- * @c org.bluez.GattCharacteristic1 object.
- *
- * On the client side, this maps a Bluetooth peripheral MAC
- * address to the corresponding request characteristic proxy. On
- * the server side, this maps Bluetooth central MAC address to the
- * corresponding response characteristic proxy.
- *
- * @note On the server side a map is overkill since only one
- * client is ever connected to the server. No?
- *
- * @todo We may want to have a seperate server-side map to reduce
- * contention on this map.
- */
- GHashTable * characteristic_map;
-
- /**
* GATT characteristics to Bluetooth MAC address map.
*
* Hash table that maps OIC Transport Profile GATT characteristic
*
* @li @c org.freedesktop.DBus.ObjectManager.InterfacesAdded
* @li @c org.freedesktop.DBus.ObjectManager.InterfacesRemoved
- * @li @c org.freedesktop.DBus.Properties.PropertiesChanged
- * @li @c org.bluez.Adapter1.PropertyChanged
*
* These subscription identifiers are only used when unsubscribing
* from the signals when stopping the LE transport.
//@{
guint interfaces_added_sub_id;
guint interfaces_removed_sub_id;
- guint properties_changed_sub_id;
- guint property_changed_sub_id;
//@}
/// Glib event loop that drives D-Bus signal handling.
CABLEErrorHandleCallback on_server_error;
/// Mutex used to synchronize access to context fields.
- ca_mutex lock;
+ oc_mutex lock;
/**
* BlueZ adapter list initialization condition variable.
*
* @see @c GMainLoop documentation for further details.
*/
- ca_cond condition;
+ oc_cond condition;
+
+ /**
+ * Semaphore that indicates completed start of the LE transport.
+ *
+ * In some corner cases the transport stop will complete before
+ * transport start completes. In such cases, the event loop
+ * run during LE transport start will never exit since the
+ * transport stop will have completed before the event loop that
+ * drives was
+ * run. This semaphore is used to force the call to
+ * ::CAStartLEAdapter() to wait for the thread that runs the GLib
+ * event loop that drives D-Bus signal handling to completely
+ * start.
+ */
+ sem_t le_started;
} CALEContext;