lib/bluez/E_Bluez.h
Go to the documentation of this file.
00001 #ifndef E_BLUEZ_H 00002 #define E_BLUEZ_H 00003 00004 #include <stdint.h> 00005 #include <stdio.h> 00006 00007 #include <Eina.h> 00008 #include <Ecore.h> 00009 #include <E_DBus.h> 00010 00017 #ifdef __cplusplus 00018 extern "C" { 00019 #endif 00020 00021 /* Ecore Events */ 00022 extern int E_BLUEZ_EVENT_MANAGER_IN; 00023 extern int E_BLUEZ_EVENT_MANAGER_OUT; 00024 extern int E_BLUEZ_EVENT_ELEMENT_ADD; 00025 extern int E_BLUEZ_EVENT_ELEMENT_DEL; 00026 extern int E_BLUEZ_EVENT_ELEMENT_UPDATED; 00027 extern int E_BLUEZ_EVENT_DEVICE_FOUND; 00028 // TODO: extern int E_BLUEZ_EVENT_DEVICE_DISAPPEARED; 00029 00030 typedef struct _E_Bluez_Element E_Bluez_Element; 00031 typedef struct _E_Bluez_Array E_Bluez_Array; 00032 typedef struct _E_Bluez_Device_Found E_Bluez_Device_Found; 00033 00034 struct _E_Bluez_Element 00035 { 00036 const char *path; 00037 const char *interface; 00038 E_DBus_Signal_Handler *signal_handler; 00039 E_DBus_Signal_Handler *device_found_handler; 00040 Eina_Inlist *props; 00041 00042 /* private */ 00043 struct 00044 { 00045 Eina_Inlist *properties_get; 00046 Eina_Inlist *property_set; 00047 Eina_Inlist *agent_register; 00048 Eina_Inlist *agent_unregister; 00049 Eina_Inlist *start_discovery; 00050 Eina_Inlist *stop_discovery; 00051 Eina_Inlist *create_paired_device; 00052 } _pending; 00053 struct 00054 { 00055 Ecore_Idler *changed; 00056 } _idler; 00057 Eina_Inlist *_listeners; 00058 int _references; 00059 }; 00060 00061 struct _E_Bluez_Array 00062 { 00063 int type; 00064 Eina_Array *array; 00065 }; 00066 00067 struct _E_Bluez_Device_Found 00068 { 00069 E_Bluez_Element *adapter; 00070 const char *name; 00071 E_Bluez_Array *array; 00072 }; 00073 00074 /* General Public API */ 00075 EAPI unsigned int e_bluez_system_init(E_DBus_Connection *edbus_conn) EINA_ARG_NONNULL(1); 00076 EAPI unsigned int e_bluez_system_shutdown(void); 00077 00078 /* Manager Methods */ 00079 EAPI E_Bluez_Element * e_bluez_manager_get(void) EINA_WARN_UNUSED_RESULT; 00080 EAPI Eina_Bool e_bluez_manager_default_adapter(E_DBus_Method_Return_Cb cb, void *data) EINA_WARN_UNUSED_RESULT; 00081 00082 /* Adapter Methods */ 00083 EAPI E_Bluez_Element * e_bluez_adapter_get(const char *path) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; 00084 00085 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, 2) EINA_WARN_UNUSED_RESULT; 00086 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, 2) EINA_WARN_UNUSED_RESULT; 00087 EAPI Eina_Bool e_bluez_adapter_address_get(const E_Bluez_Element *element, const char **address) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; 00088 EAPI Eina_Bool e_bluez_adapter_name_get(const E_Bluez_Element *element, const char **name) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; 00089 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,2) EINA_WARN_UNUSED_RESULT; 00090 EAPI Eina_Bool e_bluez_adapter_powered_get(const E_Bluez_Element *element, Eina_Bool *powered) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; 00091 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; 00092 EAPI Eina_Bool e_bluez_adapter_discoverable_get(const E_Bluez_Element *element, Eina_Bool *discoverable) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; 00093 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; 00094 EAPI Eina_Bool e_bluez_adapter_discoverable_timeout_get(const E_Bluez_Element *element, unsigned int *timeout) EINA_ARG_NONNULL(1,2) EINA_WARN_UNUSED_RESULT; 00095 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; 00096 EAPI Eina_Bool e_bluez_adapter_discovering_get(const E_Bluez_Element *element, Eina_Bool *discovering) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; 00097 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; 00098 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; 00099 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, 2, 4) EINA_WARN_UNUSED_RESULT; 00100 00101 /* Device Found Methods */ 00102 EAPI void e_bluez_devicefound_free(E_Bluez_Device_Found *device) EINA_ARG_NONNULL(1); 00103 EAPI const char * e_bluez_devicefound_alias_get(const E_Bluez_Device_Found *device) EINA_ARG_NONNULL(1); 00104 00105 /* Devices Methods */ 00106 EAPI E_Bluez_Element * e_bluez_device_get(const char *path) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; 00107 EAPI Eina_Bool e_bluez_device_name_get(const E_Bluez_Element *element, const char **name) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; 00108 EAPI Eina_Bool e_bluez_device_alias_get(const E_Bluez_Element *element, const char **alias) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; 00109 EAPI Eina_Bool e_bluez_device_paired_get(const E_Bluez_Element *element, Eina_Bool *paired) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; 00110 00111 /* Low-Level API: 00112 * 00113 * Should just be used to work around problems until proper solution 00114 * is made into e_bluez. 00115 */ 00116 EAPI Eina_Bool e_bluez_manager_sync_elements(void); 00117 00118 EAPI Eina_Bool e_bluez_elements_get_all(unsigned int *count, E_Bluez_Element ***p_elements) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; 00119 EAPI Eina_Bool e_bluez_elements_get_all_type(const char *type, unsigned int *count, E_Bluez_Element ***p_elements) EINA_ARG_NONNULL(1, 2, 3) EINA_WARN_UNUSED_RESULT; 00120 EAPI E_Bluez_Element * e_bluez_element_get(const char *path); 00121 00122 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, 2); 00123 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, 2); 00124 00125 EAPI int e_bluez_element_ref(E_Bluez_Element *element) EINA_ARG_NONNULL(1); 00126 EAPI int e_bluez_element_unref(E_Bluez_Element *element) EINA_ARG_NONNULL(1); 00127 00128 EAPI void e_bluez_element_print(FILE *fp, const E_Bluez_Element *element) EINA_ARG_NONNULL(1, 2); 00129 EAPI void e_bluez_element_array_print(FILE *fp, E_Bluez_Array *array); 00130 00131 EAPI Eina_Bool e_bluez_element_properties_sync(E_Bluez_Element *element) EINA_ARG_NONNULL(1); 00132 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); 00133 00134 EAPI Eina_Bool e_bluez_element_property_set(E_Bluez_Element *element, const char *prop, int type, const void *value) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; 00135 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, 2) EINA_WARN_UNUSED_RESULT; 00136 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, 2, 3) EINA_WARN_UNUSED_RESULT; 00137 00138 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, 2); 00139 00140 EAPI Eina_Bool e_bluez_element_property_type_get_stringshared(const E_Bluez_Element *element, const char *name, int *type) EINA_ARG_NONNULL(1, 2, 3) EINA_WARN_UNUSED_RESULT; 00141 EAPI Eina_Bool e_bluez_element_property_type_get(const E_Bluez_Element *element, const char *name, int *type) EINA_ARG_NONNULL(1, 2, 3) EINA_WARN_UNUSED_RESULT; 00142 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, 2, 4) EINA_WARN_UNUSED_RESULT; 00143 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, 2, 4) EINA_WARN_UNUSED_RESULT; 00144 EAPI Eina_Bool e_bluez_element_property_get(const E_Bluez_Element *element, const char *name, int *type, void *value) EINA_ARG_NONNULL(1, 2, 4) EINA_WARN_UNUSED_RESULT; 00145 00146 EAPI Eina_Bool e_bluez_element_is_adapter(const E_Bluez_Element *element) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; 00147 EAPI Eina_Bool e_bluez_element_is_device(const E_Bluez_Element *element) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; 00148 00149 #ifdef __cplusplus 00150 } 00151 #endif 00152 00157 #endif /* E_BLUEZ_H */