From: barbieri Date: Mon, 15 Mar 2010 20:45:09 +0000 (+0000) Subject: e_dbus/ofono: add functions to check element's interface. X-Git-Tag: 2.0_alpha~43^2~225 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d73e662b7878a1f93ce307c18b16101aebee92b;p=framework%2Fuifw%2Fedbus.git e_dbus/ofono: add functions to check element's interface. By: João Paulo Rechi Vita git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/e_dbus@47256 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/ofono/E_Ofono.h b/src/lib/ofono/E_Ofono.h index a79104e..5aab65d 100644 --- a/src/lib/ofono/E_Ofono.h +++ b/src/lib/ofono/E_Ofono.h @@ -118,6 +118,10 @@ extern "C" { EAPI 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; EAPI 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; + EAPI bool e_ofono_element_is_manager(const E_Ofono_Element *element) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; + EAPI bool e_ofono_element_is_modem(const E_Ofono_Element *element) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; + EAPI bool e_ofono_element_is_netreg(const E_Ofono_Element *element) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; + #ifdef __cplusplus } #endif diff --git a/src/lib/ofono/e_ofono_element.c b/src/lib/ofono/e_ofono_element.c index 6d8b35d..3c2f058 100644 --- a/src/lib/ofono/e_ofono_element.c +++ b/src/lib/ofono/e_ofono_element.c @@ -2310,3 +2310,30 @@ e_ofono_elements_shutdown(void) eina_hash_free(elements); elements = NULL; } + +static inline bool +_e_ofono_element_is(const E_Ofono_Element *element, const char *interface) +{ + return element->interface == interface; +} + +bool +e_ofono_element_is_manager(const E_Ofono_Element *element) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(element, 0); + return _e_ofono_element_is(element, e_ofono_iface_manager); +} + +bool +e_ofono_element_is_modem(const E_Ofono_Element *element) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(element, 0); + return _e_ofono_element_is(element, e_ofono_iface_modem); +} + +bool +e_ofono_element_is_netreg(const E_Ofono_Element *element) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(element, 0); + return _e_ofono_element_is(element, e_ofono_iface_netreg); +}