lib/ofono/E_Ofono.h
Go to the documentation of this file.
00001 #ifndef E_OFONO_H
00002 #define E_OFONO_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_OFONO_EVENT_MANAGER_IN;
00023 extern int E_OFONO_EVENT_MANAGER_OUT;
00024 extern int E_OFONO_EVENT_ELEMENT_ADD;
00025 extern int E_OFONO_EVENT_ELEMENT_DEL;
00026 extern int E_OFONO_EVENT_ELEMENT_UPDATED;
00027 
00028 typedef struct _E_Ofono_Element   E_Ofono_Element;
00029 
00030 struct _E_Ofono_Element
00031 {
00032    const char            *path;
00033    const char            *interface;
00034    E_DBus_Signal_Handler *signal_handler;
00035    Eina_Inlist           *props;
00036 
00037    /* private */
00038    struct
00039    {
00040       Eina_Inlist *properties_get;
00041       Eina_Inlist *property_set;
00042       Eina_Inlist *send_sms;
00043    } _pending;
00044    struct
00045    {
00046       Ecore_Idler *changed;
00047    } _idler;
00048    Eina_Inlist *_listeners;
00049    int          _references;
00050 };
00051 
00052 /* General Public API */
00053 EAPI unsigned int         e_ofono_system_init(E_DBus_Connection *edbus_conn) EINA_ARG_NONNULL(1);
00054 EAPI unsigned int         e_ofono_system_shutdown(void);
00055 
00056 /* Manager Methods */
00057 EAPI E_Ofono_Element *    e_ofono_manager_get(void) EINA_WARN_UNUSED_RESULT;
00058 EAPI Eina_Bool            e_ofono_manager_modems_get(Eina_Array **array);
00059 
00060 /* Modem Methods */
00061 EAPI Eina_Bool            e_ofono_modem_powered_get(const E_Ofono_Element *element, Eina_Bool *powered) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
00062 EAPI Eina_Bool            e_ofono_modem_powered_set(E_Ofono_Element *element, Eina_Bool powered, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
00063 EAPI Eina_Bool            e_ofono_modem_name_get(const E_Ofono_Element *element, const char **name) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
00064 
00065 /* NetworkRegistration Methods */
00066 EAPI Eina_Bool            e_ofono_netreg_mode_get(const E_Ofono_Element *element, const char **mode) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
00067 EAPI Eina_Bool            e_ofono_netreg_status_get(const E_Ofono_Element *element, const char **status) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
00068 EAPI Eina_Bool            e_ofono_netreg_operator_get(const E_Ofono_Element *element, const char **op) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
00069 EAPI Eina_Bool            e_ofono_netreg_strength_get(const E_Ofono_Element *element, uint8_t *strength) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
00070 
00071 /* SMS Methods */
00072 EAPI Eina_Bool            e_ofono_sms_sca_get(const E_Ofono_Element *element, const char **sca) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
00073 EAPI Eina_Bool            e_ofono_sms_sca_set(E_Ofono_Element *element, const char *sca, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
00074 EAPI Eina_Bool            e_ofono_sms_send_message(E_Ofono_Element *element, const char *number, const char *message, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2, 3) EINA_WARN_UNUSED_RESULT;
00075 
00076 /* Low-Level API:
00077  *
00078  * Should just be used to work around problems until proper solution
00079  * is made into e_ofono.
00080  */
00081 EAPI Eina_Bool            e_ofono_manager_sync_elements(void);
00082 
00083 EAPI Eina_Bool            e_ofono_elements_get_all(unsigned int *count, E_Ofono_Element ***p_elements) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
00084 EAPI Eina_Bool            e_ofono_elements_get_all_type(const char *type, unsigned int *count, E_Ofono_Element ***p_elements) EINA_ARG_NONNULL(1, 2, 3) EINA_WARN_UNUSED_RESULT;
00085 EAPI E_Ofono_Element *    e_ofono_element_get(const char *path, const char *interface) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
00086 
00087 EAPI void                 e_ofono_element_listener_add(E_Ofono_Element *element, void (*cb)(void *data, const E_Ofono_Element *element), const void *data, void (*free_data)(void *data)) EINA_ARG_NONNULL(1, 2);
00088 EAPI void                 e_ofono_element_listener_del(E_Ofono_Element *element, void (*cb)(void *data, const E_Ofono_Element *element), const void *data) EINA_ARG_NONNULL(1, 2);
00089 
00090 EAPI int                  e_ofono_element_ref(E_Ofono_Element *element) EINA_ARG_NONNULL(1);
00091 EAPI int                  e_ofono_element_unref(E_Ofono_Element *element) EINA_ARG_NONNULL(1);
00092 
00093 EAPI void                 e_ofono_element_print(FILE *fp, const E_Ofono_Element *element) EINA_ARG_NONNULL(1, 2);
00094 
00095 EAPI Eina_Bool            e_ofono_element_properties_sync(E_Ofono_Element *element) EINA_ARG_NONNULL(1);
00096 EAPI Eina_Bool            e_ofono_element_properties_sync_full(E_Ofono_Element *element, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1);
00097 
00098 EAPI Eina_Bool            e_ofono_element_property_set(E_Ofono_Element *element, const char *prop, int type, const void *value) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
00099 EAPI Eina_Bool            e_ofono_element_property_set_full(E_Ofono_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;
00100 EAPI Eina_Bool            e_ofono_element_property_dict_set_full(E_Ofono_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;
00101 
00102 EAPI void                 e_ofono_element_properties_list(const E_Ofono_Element *element, Eina_Bool (*cb)(void *data, const E_Ofono_Element *element, const char *name, int type, const void *value), const void *data) EINA_ARG_NONNULL(1, 2);
00103 
00104 EAPI Eina_Bool            e_ofono_element_property_type_get_stringshared(const E_Ofono_Element *element, const char *name, int *type) EINA_ARG_NONNULL(1, 2, 3) EINA_WARN_UNUSED_RESULT;
00105 EAPI Eina_Bool            e_ofono_element_property_type_get(const E_Ofono_Element *element, const char *name, int *type) EINA_ARG_NONNULL(1, 2, 3) EINA_WARN_UNUSED_RESULT;
00106 EAPI Eina_Bool            e_ofono_element_property_dict_get_stringshared(const E_Ofono_Element *element, const char *dict_name, const char *key_name, int *type, void *value) EINA_ARG_NONNULL(1, 2, 4) EINA_WARN_UNUSED_RESULT;
00107 EAPI Eina_Bool            e_ofono_element_property_get_stringshared(const E_Ofono_Element *element, const char *name, int *type, void *value) EINA_ARG_NONNULL(1, 2, 4) EINA_WARN_UNUSED_RESULT;
00108 EAPI Eina_Bool            e_ofono_element_property_get(const E_Ofono_Element *element, const char *name, int *type, void *value) EINA_ARG_NONNULL(1, 2, 4) EINA_WARN_UNUSED_RESULT;
00109 
00110 EAPI Eina_Bool            e_ofono_element_is_manager(const E_Ofono_Element *element) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
00111 EAPI Eina_Bool            e_ofono_element_is_modem(const E_Ofono_Element *element) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
00112 EAPI Eina_Bool            e_ofono_element_is_netreg(const E_Ofono_Element *element) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
00113 
00114 #ifdef __cplusplus
00115 }
00116 #endif
00117 
00122 #endif /* E_OFONO_H */