24c3b18e5f97ec470d4c425eed4b391cd4e669ec
[framework/uifw/edbus.git] / src / lib / bluez / E_Bluez.h
1 #ifndef E_BLUEZ_H
2 #define E_BLUEZ_H
3
4 #include <stdint.h>
5 #include <stdbool.h>
6 #include <stdio.h>
7
8 #include <Eina.h>
9 #include <Ecore.h>
10 #include <E_DBus.h>
11
12 #ifdef EAPI
13 #undef EAPI
14 #endif
15 #ifdef _MSC_VER
16 # ifdef BUILDING_DLL
17 #  define EAPI __declspec(dllexport)
18 # else
19 #  define EAPI __declspec(dllimport)
20 # endif
21 #else
22 # ifdef __GNUC__
23 #  if __GNUC__ >= 4
24 #   define EAPI __attribute__ ((visibility("default")))
25 #  else
26 #   define EAPI
27 #  endif
28 # else
29 #  define EAPI
30 # endif
31 #endif
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37   /* Ecore Events */
38   extern int E_BLUEZ_EVENT_ELEMENT_IN;
39   extern int E_BLUEZ_EVENT_ELEMENT_OUT;
40   extern int E_BLUEZ_EVENT_ELEMENT_ADD;
41   extern int E_BLUEZ_EVENT_ELEMENT_DEL;
42   extern int E_BLUEZ_EVENT_ELEMENT_UPDATED;
43
44   typedef struct _E_Bluez_Element E_Bluez_Element;
45
46   struct _E_Bluez_Element
47   {
48      const char *path;
49      const char *interface;
50      E_DBus_Signal_Handler *signal_handler;
51      Eina_Inlist *props;
52
53      /* private */
54      struct {
55         Eina_Inlist *properties_get;
56         Eina_Inlist *property_set;
57         Eina_Inlist *agent_register;
58         Eina_Inlist *agent_unregister;
59      } _pending;
60      struct {
61         Ecore_Idler *changed;
62      } _idler;
63      Eina_Inlist *_listeners;
64      int _references;
65   };
66
67   /* General Public API */
68   EAPI unsigned int e_bluez_system_init(E_DBus_Connection *edbus_conn) EINA_ARG_NONNULL(1);
69   EAPI unsigned int e_bluez_system_shutdown(void);
70
71   /* Manager Methods */
72   EAPI E_Bluez_Element *e_bluez_manager_get(void) EINA_WARN_UNUSED_RESULT;
73
74   /* Low-Level API:
75    *
76    * Should just be used to work around problems until proper solution
77    * is made into e_bluez.
78    */
79   EAPI bool e_bluez_manager_sync_elements(void);
80
81   EAPI bool e_bluez_elements_get_all(unsigned int *count, E_Bluez_Element ***p_elements) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
82   EAPI 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;
83   EAPI E_Bluez_Element *e_bluez_element_get(const char *path);
84
85   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);
86   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);
87
88   EAPI int e_bluez_element_ref(E_Bluez_Element *element) EINA_ARG_NONNULL(1);
89   EAPI int e_bluez_element_unref(E_Bluez_Element *element) EINA_ARG_NONNULL(1);
90
91   EAPI void e_bluez_element_print(FILE *fp, const E_Bluez_Element *element) EINA_ARG_NONNULL(1, 2);
92
93
94   EAPI bool e_bluez_element_properties_sync(E_Bluez_Element *element) EINA_ARG_NONNULL(1);
95   EAPI bool e_bluez_element_properties_sync_full(E_Bluez_Element *element, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1);
96
97   EAPI 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;
98   EAPI 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;
99   EAPI 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;
100
101   EAPI void e_bluez_element_properties_list(const E_Bluez_Element *element, 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);
102
103   EAPI 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;
104   EAPI 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;
105   EAPI 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;
106   EAPI 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;
107   EAPI 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;
108
109 #ifdef __cplusplus
110 }
111 #endif
112 #endif /* E_BLUEZ_H */