00001 #ifdef HAVE_CONFIG_H
00002 #include "config.h"
00003 #endif
00004
00005 #ifdef HAVE_ALLOCA_H
00006 # include <alloca.h>
00007 #elif defined __GNUC__
00008 # define alloca __builtin_alloca
00009 #elif defined _AIX
00010 # define alloca __alloca
00011 #elif defined _MSC_VER
00012 # include <malloc.h>
00013 # define alloca _alloca
00014 #else
00015 # include <stddef.h>
00016 # ifdef __cplusplus
00017 extern "C"
00018 # endif
00019 void * alloca (size_t);
00020 #endif
00021
00022 #include <stdio.h>
00023
00024 #include <Eina.h>
00025 #include <eina_safety_checks.h>
00026
00027 #include "E_Ofono.h"
00028
00029 static const char manager_path[] = "/";
00030
00031 extern const char *e_ofono_iface_manager;
00032 extern const char *e_ofono_prop_modems;
00033 extern const char *e_ofono_iface_modem;
00034 extern const char *e_ofono_prop_name;
00035 extern const char *e_ofono_prop_powered;
00036 extern const char *e_ofono_prop_interfaces;
00037 extern const char *e_ofono_iface_netreg;
00038 extern const char *e_ofono_prop_mode;
00039 extern const char *e_ofono_prop_status;
00040 extern const char *e_ofono_prop_operator;
00041 extern const char *e_ofono_prop_strength;
00042 extern const char *e_ofono_iface_sms;
00043 extern const char *e_ofono_prop_sca;
00044 extern const char *e_ofono_method_send_sms;
00045
00046 extern int _e_dbus_ofono_log_dom;
00047
00048 #ifndef EINA_LOG_DEFAULT_COLOR
00049 #define EINA_LOG_DEFAULT_COLOR EINA_COLOR_CYAN
00050 #endif
00051
00052 #undef DBG
00053 #undef INF
00054 #undef WRN
00055 #undef ERR
00056
00057 #define DBG(...) EINA_LOG_DOM_DBG(_e_dbus_ofono_log_dom, __VA_ARGS__)
00058 #define INF(...) EINA_LOG_DOM_INFO(_e_dbus_ofono_log_dom, __VA_ARGS__)
00059 #define WRN(...) EINA_LOG_DOM_WARN(_e_dbus_ofono_log_dom, __VA_ARGS__)
00060 #define ERR(...) EINA_LOG_DOM_ERR(_e_dbus_ofono_log_dom, __VA_ARGS__)
00061
00062 typedef struct _E_Ofono_Array E_Ofono_Array;
00063
00064 struct _E_Ofono_Array
00065 {
00066 int type;
00067 Eina_Array *array;
00068 };
00069
00070 static inline Eina_Bool
00071 _dbus_callback_check_and_init(DBusMessage *msg, DBusMessageIter *itr, DBusError *err)
00072 {
00073 if (!msg)
00074 {
00075 if (err)
00076 ERR("an error was reported by server: "
00077 "name=\"%s\", message=\"%s\"",
00078 err->name, err->message);
00079 else
00080 ERR("callback without message arguments!");
00081
00082 return EINA_FALSE;
00083 }
00084
00085 if (!dbus_message_iter_init(msg, itr))
00086 {
00087 ERR("could not init iterator.");
00088 return EINA_FALSE;
00089 }
00090
00091 return EINA_TRUE;
00092 }
00093
00094 static inline Eina_Bool
00095 __dbus_iter_type_check(int type, int expected, const char *expected_name)
00096 {
00097 if (type == expected)
00098 return EINA_TRUE;
00099
00100 ERR("expected type %s (%c) but got %c instead!",
00101 expected_name, expected, type);
00102
00103 return EINA_FALSE;
00104 }
00105
00106 #define _dbus_iter_type_check(t, e) __dbus_iter_type_check(t, e, # e)
00107
00108 extern E_DBus_Connection *e_ofono_conn;
00109
00110 const char * e_ofono_system_bus_name_get(void);
00111
00112 void e_ofono_manager_clear_elements(void);
00113
00114 void e_ofono_elements_init(void);
00115 void e_ofono_elements_shutdown(void);
00116
00117 E_Ofono_Element * e_ofono_element_register(const char *path, const char *interface);
00118 void e_ofono_element_unregister(E_Ofono_Element *element);
00119
00120 Eina_Bool e_ofono_element_message_send(E_Ofono_Element *element, const char *method_name, const char *interface, E_DBus_Method_Return_Cb cb, DBusMessage *msg, Eina_Inlist **pending, E_DBus_Method_Return_Cb user_cb, const void *user_data);
00121
00122 Eina_Bool e_ofono_element_call_full(E_Ofono_Element *element, const char *method_name, const char *interface, E_DBus_Method_Return_Cb cb, Eina_Inlist **pending, E_DBus_Method_Return_Cb user_cb, const void *user_data);
00123 Eina_Bool e_ofono_element_call_with_path(E_Ofono_Element *element, const char *method_name, const char *string, E_DBus_Method_Return_Cb cb, Eina_Inlist **pending, E_DBus_Method_Return_Cb user_cb, const void *user_data);
00124 Eina_Bool e_ofono_element_call_with_string(E_Ofono_Element *element, const char *method_name, const char *string, E_DBus_Method_Return_Cb cb, Eina_Inlist **pending, E_DBus_Method_Return_Cb user_cb, const void *user_data);
00125 Eina_Bool e_ofono_element_call_with_path_and_string(E_Ofono_Element *element, const char *method_name, const char *path, const char *string, E_DBus_Method_Return_Cb cb, Eina_Inlist **pending, E_DBus_Method_Return_Cb user_cb, const void *user_data);