Data Structures

struct  _E_Bluez_Array
 
struct  _E_Bluez_Device_Found
 
struct  _E_Bluez_Element
 

Typedefs

typedef struct _E_Bluez_Array E_Bluez_Array
 
typedef struct
_E_Bluez_Device_Found 
E_Bluez_Device_Found
 
typedef struct _E_Bluez_Element E_Bluez_Element
 

Functions

EAPI Eina_Bool e_bluez_adapter_address_get (const E_Bluez_Element *element, const char **address) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_adapter_agent_register (E_Bluez_Element *element, const char *object_path, const char *capability, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_adapter_agent_unregister (E_Bluez_Element *element, const char *object_path, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_adapter_create_paired_device (E_Bluez_Element *element, const char *object_path, const char *capability, const char *device, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_adapter_discoverable_get (const E_Bluez_Element *element, Eina_Bool *discoverable) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
 
EAPI Eina_Bool e_bluez_adapter_discoverable_set (E_Bluez_Element *profile, Eina_Bool discoverable, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
 
EAPI Eina_Bool e_bluez_adapter_discoverable_timeout_get (const E_Bluez_Element *element, unsigned int *timeout) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_adapter_discoverable_timeout_set (E_Bluez_Element *element, unsigned int timeout, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
 
EAPI Eina_Bool e_bluez_adapter_discovering_get (const E_Bluez_Element *element, Eina_Bool *discovering) EINA_ARG_NONNULL(1
 
EAPI E_Bluez_Elemente_bluez_adapter_get (const char *path) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
 
EAPI Eina_Bool e_bluez_adapter_name_get (const E_Bluez_Element *element, const char **name) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_adapter_name_set (E_Bluez_Element *element, const char *name, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_adapter_powered_get (const E_Bluez_Element *element, Eina_Bool *powered) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_adapter_powered_set (E_Bluez_Element *profile, Eina_Bool powered, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
 
EAPI Eina_Bool e_bluez_adapter_start_discovery (E_Bluez_Element *element, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
 
EAPI Eina_Bool e_bluez_adapter_stop_discovery (E_Bluez_Element *element, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
 
EAPI Eina_Bool e_bluez_device_alias_get (const E_Bluez_Element *element, const char **alias) EINA_ARG_NONNULL(1
 
EAPI E_Bluez_Elemente_bluez_device_get (const char *path) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
 
EAPI Eina_Bool e_bluez_device_name_get (const E_Bluez_Element *element, const char **name) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_device_paired_get (const E_Bluez_Element *element, Eina_Bool *paired) EINA_ARG_NONNULL(1
 
EAPI const char * e_bluez_devicefound_alias_get (const E_Bluez_Device_Found *device) EINA_ARG_NONNULL(1)
 
EAPI void e_bluez_devicefound_free (E_Bluez_Device_Found *device) EINA_ARG_NONNULL(1)
 
EAPI void EAPI void e_bluez_element_array_print (FILE *fp, E_Bluez_Array *array)
 
EAPI E_Bluez_Elemente_bluez_element_get (const char *path)
 
EAPI Eina_Bool e_bluez_element_is_adapter (const E_Bluez_Element *element) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
 
EAPI Eina_Bool e_bluez_element_is_device (const E_Bluez_Element *element) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
 
EAPI void e_bluez_element_listener_add (E_Bluez_Element *element, void(*cb)(void *data, const E_Bluez_Element *element), const void *data, void(*free_data)(void *data)) EINA_ARG_NONNULL(1
 
EAPI void EAPI void e_bluez_element_listener_del (E_Bluez_Element *element, void(*cb)(void *data, const E_Bluez_Element *element), const void *data) EINA_ARG_NONNULL(1
 
EAPI void e_bluez_element_print (FILE *fp, const E_Bluez_Element *element) EINA_ARG_NONNULL(1
 
EAPI void e_bluez_element_properties_list (const E_Bluez_Element *element, Eina_Bool(*cb)(void *data, const E_Bluez_Element *element, const char *name, int type, const void *value), const void *data) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_element_properties_sync (E_Bluez_Element *element) EINA_ARG_NONNULL(1)
 
EAPI Eina_Bool e_bluez_element_properties_sync_full (E_Bluez_Element *element, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1)
 
EAPI Eina_Bool e_bluez_element_property_dict_get_stringshared (const E_Bluez_Element *element, const char *dict_name, const char *key_name, int *type, void *value) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_element_property_dict_set_full (E_Bluez_Element *element, const char *prop, const char *key, int type, const void *value, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_element_property_get (const E_Bluez_Element *element, const char *name, int *type, void *value) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_element_property_get_stringshared (const E_Bluez_Element *element, const char *name, int *type, void *value) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_element_property_set (E_Bluez_Element *element, const char *prop, int type, const void *value) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_element_property_set_full (E_Bluez_Element *element, const char *prop, int type, const void *value, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_element_property_type_get (const E_Bluez_Element *element, const char *name, int *type) EINA_ARG_NONNULL(1
 
EAPI void EAPI Eina_Bool e_bluez_element_property_type_get_stringshared (const E_Bluez_Element *element, const char *name, int *type) EINA_ARG_NONNULL(1
 
EAPI void EAPI void EAPI int e_bluez_element_ref (E_Bluez_Element *element) EINA_ARG_NONNULL(1)
 
EAPI int e_bluez_element_unref (E_Bluez_Element *element) EINA_ARG_NONNULL(1)
 
EAPI Eina_Bool e_bluez_elements_get_all (unsigned int *count, E_Bluez_Element ***p_elements) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_elements_get_all_type (const char *type, unsigned int *count, E_Bluez_Element ***p_elements) EINA_ARG_NONNULL(1
 
EAPI Eina_Bool e_bluez_manager_default_adapter (E_DBus_Method_Return_Cb cb, void *data) EINA_WARN_UNUSED_RESULT
 
EAPI E_Bluez_Elemente_bluez_manager_get (void) EINA_WARN_UNUSED_RESULT
 
EAPI Eina_Bool e_bluez_manager_sync_elements (void)
 
EAPI unsigned int e_bluez_system_init (E_DBus_Connection *edbus_conn) EINA_ARG_NONNULL(1)
 
EAPI unsigned int e_bluez_system_shutdown (void)
 

Variables

int E_BLUEZ_EVENT_DEVICE_FOUND
 
int E_BLUEZ_EVENT_ELEMENT_ADD
 
int E_BLUEZ_EVENT_ELEMENT_DEL
 
int E_BLUEZ_EVENT_ELEMENT_UPDATED
 
int E_BLUEZ_EVENT_MANAGER_IN
 
int E_BLUEZ_EVENT_MANAGER_OUT
 
EAPI Eina_Bool EINA_WARN_UNUSED_RESULT
 

Detailed Description

Typedef Documentation

typedef struct _E_Bluez_Array E_Bluez_Array

Function Documentation

EAPI Eina_Bool e_bluez_adapter_address_get ( const E_Bluez_Element element,
const char **  address 
)
EAPI Eina_Bool e_bluez_adapter_agent_register ( E_Bluez_Element element,
const char *  object_path,
const char *  capability,
E_DBus_Method_Return_Cb  cb,
const void *  data 
)
EAPI Eina_Bool e_bluez_adapter_agent_unregister ( E_Bluez_Element element,
const char *  object_path,
E_DBus_Method_Return_Cb  cb,
const void *  data 
)
EAPI Eina_Bool e_bluez_adapter_create_paired_device ( E_Bluez_Element element,
const char *  object_path,
const char *  capability,
const char *  device,
E_DBus_Method_Return_Cb  cb,
const void *  data 
)
EAPI Eina_Bool e_bluez_adapter_discoverable_get ( const E_Bluez_Element element,
Eina_Bool *  discoverable 
)

Get property "Discoverable" value.

If this property isn't found then EINA_FALSE is returned. If EINA_FALSE is returned, then this call failed and parameter-returned values shall be considered invalid.

Parameters
discoverablewhere to store the property value, must be a pointer to booleans (Eina_Bool *).
Returns
EINA_TRUE on success, EINA_FALSE otherwise.
See Also
e_bluez_adapter_discoverable_set()

References e_bluez_element_property_get_stringshared(), and e_bluez_prop_discoverable.

EAPI Eina_Bool e_bluez_adapter_discoverable_set ( E_Bluez_Element element,
Eina_Bool  discoverable,
E_DBus_Method_Return_Cb  cb,
const void *  data 
)

Call method SetProperty("Discoverable", discoverable) at the given element on server.

Parameters
discoverablevalue to set.
cbfunction to call when server replies or some error happens.
datadata to give to cb when it is called.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

References e_bluez_element_property_set_full(), and e_bluez_prop_discoverable.

EAPI Eina_Bool e_bluez_adapter_discoverable_timeout_get ( const E_Bluez_Element element,
unsigned int *  timeout 
)
EAPI Eina_Bool e_bluez_adapter_discoverable_timeout_set ( E_Bluez_Element element,
unsigned int  timeout,
E_DBus_Method_Return_Cb  cb,
const void *  data 
)

Call method SetProperty("DiscoverableTimeout", timeout) at the given element on server.

This is a server call, not local, so it may fail and in that case no property is updated locally. If the value was set the event E_BLUEZ_EVENT_ELEMENT_UPDATED will be added to main loop.

Parameters
adapterpath to set property.
discoverabletimeout value to set.
cbfunction to call when server replies or some error happens.
datadata to give to cb when it is called.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.
See Also
e_bluez_adapter_discoverable_timeout_get()

References e_bluez_element_property_set_full(), and e_bluez_prop_discoverabletimeout.

EAPI Eina_Bool e_bluez_adapter_discovering_get ( const E_Bluez_Element element,
Eina_Bool *  discovering 
)
EAPI E_Bluez_Element* e_bluez_adapter_get ( const char *  path)
EAPI Eina_Bool e_bluez_adapter_name_get ( const E_Bluez_Element element,
const char **  name 
)
EAPI Eina_Bool e_bluez_adapter_name_set ( E_Bluez_Element element,
const char *  name,
E_DBus_Method_Return_Cb  cb,
const void *  data 
)
EAPI Eina_Bool e_bluez_adapter_powered_get ( const E_Bluez_Element element,
Eina_Bool *  powered 
)
EAPI Eina_Bool e_bluez_adapter_powered_set ( E_Bluez_Element element,
Eina_Bool  powered,
E_DBus_Method_Return_Cb  cb,
const void *  data 
)

Call method SetProperty("Powered", powered) at the given element on server.

Parameters
poweredvalue to set.
cbfunction to call when server replies or some error happens.
datadata to give to cb when it is called.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

References e_bluez_element_property_set_full(), and e_bluez_prop_powered.

EAPI Eina_Bool e_bluez_adapter_start_discovery ( E_Bluez_Element element,
E_DBus_Method_Return_Cb  cb,
const void *  data 
)

Start Discovery of Bluetooth Devices

call StartDiscovery()

Parameters
elementthe adapter's element.
cbfunction to call when server replies or some error happens.
datadata to give to cb when it is called.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

References _E_Bluez_Element::_pending, _E_Bluez_Element::device_found_handler, e_bluez_conn, e_bluez_element_call_full(), e_bluez_system_bus_name_get(), e_dbus_signal_handler_add(), _E_Bluez_Element::interface, _E_Bluez_Element::path, and _E_Bluez_Element::start_discovery.

EAPI Eina_Bool e_bluez_adapter_stop_discovery ( E_Bluez_Element element,
E_DBus_Method_Return_Cb  cb,
const void *  data 
)

Stop Discovery of Bluetooth Devices

call StopDiscovery()

Parameters
elementthe adapter's element.
cbfunction to call when server replies or some error happens.
datadata to give to cb when it is called.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

References _E_Bluez_Element::_pending, e_bluez_element_call_full(), and _E_Bluez_Element::stop_discovery.

EAPI Eina_Bool e_bluez_device_alias_get ( const E_Bluez_Element element,
const char **  alias 
)
EAPI E_Bluez_Element* e_bluez_device_get ( const char *  path)
EAPI Eina_Bool e_bluez_device_name_get ( const E_Bluez_Element element,
const char **  name 
)
EAPI Eina_Bool e_bluez_device_paired_get ( const E_Bluez_Element element,
Eina_Bool *  paired 
)
EAPI const char* e_bluez_devicefound_alias_get ( const E_Bluez_Device_Found device)

Return the pointer to the stringshared alias for the given found device.

Returns
stringshared pointer, or NULL if unknown.

References _E_Bluez_Device_Found::array, e_bluez_element_array_dict_find_stringshared(), e_bluez_prop_alias, _E_Bluez_Element_Dict_Entry::str, _E_Bluez_Element_Dict_Entry::type, and _E_Bluez_Element_Dict_Entry::value.

EAPI void e_bluez_devicefound_free ( E_Bluez_Device_Found device)

Free a E_Bluez_Device_Found struct

Parameters
devicethe struct to be freed

References _E_Bluez_Device_Found::array, e_bluez_element_array_free(), and _E_Bluez_Device_Found::name.

EAPI E_Bluez_Element* e_bluez_element_get ( const char *  path)

Get the element registered at given path.

Parameters
paththe path to query for registered object.
Returns
element pointer if found, NULL otherwise. No references are added.

References e_bluez_elements_get_all_str_data::elements.

Referenced by e_bluez_adapter_get(), e_bluez_device_get(), e_bluez_element_objects_array_get_stringshared(), e_bluez_manager_default_adapter(), and e_bluez_manager_get().

EAPI Eina_Bool e_bluez_element_is_adapter ( const E_Bluez_Element element)

References e_bluez_iface_adapter.

Referenced by e_bluez_adapter_get().

EAPI Eina_Bool e_bluez_element_is_device ( const E_Bluez_Element element)

References e_bluez_iface_device.

Referenced by e_bluez_device_get().

EAPI void e_bluez_element_listener_add ( E_Bluez_Element element,
void(*)(void *data, const E_Bluez_Element *element)  cb,
const void *  data,
void(*)(void *data)  free_data 
)
EAPI void EAPI void e_bluez_element_listener_del ( E_Bluez_Element element,
void(*)(void *data, const E_Bluez_Element *element)  cb,
const void *  data 
)
EAPI void e_bluez_element_print ( FILE *  fp,
const E_Bluez_Element element 
)
EAPI void e_bluez_element_properties_list ( const E_Bluez_Element element,
Eina_Bool(*)(void *data, const E_Bluez_Element *element, const char *name, int type, const void *value)  cb,
const void *  data 
)
EAPI Eina_Bool e_bluez_element_properties_sync ( E_Bluez_Element element)

Sync element properties with server, simple version.

Call method GetProperties() at the given element on server in order to sync them. This is the simple version and there is no check of server reply for errors.

Parameters
elementto call method on server.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

References e_bluez_element_properties_sync_full().

Referenced by e_bluez_manager_sync_elements().

EAPI Eina_Bool e_bluez_element_properties_sync_full ( E_Bluez_Element element,
E_DBus_Method_Return_Cb  cb,
const void *  data 
)

Sync element properties with server.

Call method GetProperties() at the given element on server in order to sync them.

Parameters
elementto call method on server.
cbfunction to call when server replies or some error happens.
datadata to give to cb when it is called.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

References _E_Bluez_Element::_pending, e_bluez_element_call_full(), and _E_Bluez_Element::properties_get.

Referenced by e_bluez_element_properties_sync().

EAPI Eina_Bool e_bluez_element_property_dict_get_stringshared ( const E_Bluez_Element element,
const char *  dict_name,
const char *  key_name,
int *  type,
void *  value 
)
EAPI Eina_Bool e_bluez_element_property_dict_set_full ( E_Bluez_Element element,
const char *  prop,
const char *  key,
int  type,
const void *  value,
E_DBus_Method_Return_Cb  cb,
const void *  data 
)
EAPI Eina_Bool e_bluez_element_property_get ( const E_Bluez_Element element,
const char *  name,
int *  type,
void *  value 
)
EAPI Eina_Bool e_bluez_element_property_set ( E_Bluez_Element element,
const char *  prop,
int  type,
const void *  value 
)
EAPI Eina_Bool e_bluez_element_property_set_full ( E_Bluez_Element element,
const char *  prop,
int  type,
const void *  value,
E_DBus_Method_Return_Cb  cb,
const void *  data 
)
EAPI Eina_Bool e_bluez_element_property_type_get ( const E_Bluez_Element element,
const char *  name,
int *  type 
)
EAPI void EAPI Eina_Bool e_bluez_element_property_type_get_stringshared ( const E_Bluez_Element element,
const char *  name,
int *  type 
)
EAPI void EAPI void EAPI int e_bluez_element_ref ( E_Bluez_Element element)

Add reference to element.

References _E_Bluez_Element::_references.

Referenced by e_bluez_element_event_add().

EAPI int e_bluez_element_unref ( E_Bluez_Element element)

Remove reference from element.

If reference count drops to 0 element will be freed.

References _E_Bluez_Element::_references, and ERR.

EAPI Eina_Bool e_bluez_elements_get_all ( unsigned int *  count,
E_Bluez_Element ***  p_elements 
)
EAPI Eina_Bool e_bluez_elements_get_all_type ( const char *  type,
unsigned int *  count,
E_Bluez_Element ***  p_elements 
)
EAPI Eina_Bool e_bluez_manager_default_adapter ( E_DBus_Method_Return_Cb  cb,
void *  data 
)

Call method DefaultAdapter() on Manager. TODO: Soon this method will be replaced by ANY adapter inside BlueZ, so we won't need t to call it anymore.

Parameters
cbfunction to call when server replies or some error happens.
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

References _E_Bluez_Element::_pending, e_bluez_element_call_full(), e_bluez_element_get(), and _E_Bluez_Element::properties_get.

EAPI E_Bluez_Element* e_bluez_manager_get ( void  )

Get the element manager.

Returns
element pointer if found, NULL otherwise.

References e_bluez_element_get().

EAPI Eina_Bool e_bluez_manager_sync_elements ( void  )

Synchronize elements with server.

This will call Manager.GetProperties() on server, retrieve properties and some element paths and then request their properties.

This call will add events E_BLUEZ_EVENT_ELEMENT_ADD and E_BLUEZ_EVENT_ELEMENT_UPDATED to the main loop.

This will not remove stale elements.

Returns
EINA_TRUE on success, EINA_FALSE otherwise.

References DBG, e_bluez_element_properties_sync(), e_bluez_element_register(), and e_bluez_iface_manager.

EAPI unsigned int e_bluez_system_init ( E_DBus_Connection edbus_conn)

Initialize E BlueZ (E_Bluez) system.

This will connect and watch org.bluez.Manager and Element events and translate to Ecore main loop events, also provide a proxy for method invocation on server.

Interesting events are:

  • E_BLUEZ_EVENT_MANAGER_IN: issued when bluez is avaiable.
  • E_BLUEZ_EVENT_MANAGER_OUT: issued when bluez connection is lost.
  • E_BLUEZ_EVENT_ELEMENT_ADD: element was added.
  • E_BLUEZ_EVENT_ELEMENT_DEL: element was deleted.
  • E_BLUEZ_EVENT_ELEMENT_UPDATED: element was updated (properties or state changed).
  • E_BLUEZ_EVENT_DEVICE_FOUND: a device was found, raised after calling Adapter.StartDiscorvery()

Manager IN/OUT events do not provide any event information, just tells you that system is usable or not. After manager is out, all elements will be removed, so after this event do not use the system anymore.

Element events will give you an element object. After DEL event callback returns, that element will not be valid anymore.

References _e_dbus_bluez_log_dom, e_bluez_elements_init(), E_BLUEZ_EVENT_DEVICE_FOUND, E_BLUEZ_EVENT_ELEMENT_ADD, E_BLUEZ_EVENT_ELEMENT_DEL, E_BLUEZ_EVENT_ELEMENT_UPDATED, E_BLUEZ_EVENT_MANAGER_IN, E_BLUEZ_EVENT_MANAGER_OUT, e_bluez_iface_adapter, e_bluez_iface_device, e_bluez_iface_manager, e_bluez_prop_address, e_bluez_prop_alias, e_bluez_prop_class, e_bluez_prop_connected, e_bluez_prop_devices, e_bluez_prop_discoverable, e_bluez_prop_discoverabletimeout, e_bluez_prop_discovering, e_bluez_prop_icon, e_bluez_prop_name, e_bluez_prop_pairable, e_bluez_prop_pairabletimeout, e_bluez_prop_paired, e_bluez_prop_powered, e_bluez_prop_trusted, e_bluez_prop_uuids, E_DBUS_FDO_BUS, E_DBUS_FDO_INTERFACE, E_DBUS_FDO_PATH, e_dbus_get_name_owner(), e_dbus_signal_handler_add(), and EINA_LOG_DEFAULT_COLOR.

Variable Documentation

int E_BLUEZ_EVENT_DEVICE_FOUND

Referenced by e_bluez_system_init().

int E_BLUEZ_EVENT_ELEMENT_ADD
int E_BLUEZ_EVENT_ELEMENT_DEL

Referenced by e_bluez_system_init().

int E_BLUEZ_EVENT_ELEMENT_UPDATED

Referenced by e_bluez_system_init().

int E_BLUEZ_EVENT_MANAGER_IN

Referenced by e_bluez_system_init().

int E_BLUEZ_EVENT_MANAGER_OUT

Referenced by e_bluez_system_init().

EAPI Eina_Bool EINA_WARN_UNUSED_RESULT