e_connman0_7x: phase-1 - revert to old code
[framework/uifw/edbus.git] / src / lib / connman / e_connman_technology.c
1 #include "e_connman_private.h"
2
3 E_Connman_Element *
4 e_connman_technology_get(const char *path)
5 {
6    E_Connman_Element *technology;
7
8    EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
9
10    technology = e_connman_element_get(path);
11    if (!technology)
12       return NULL;
13
14    if (!e_connman_element_is_technology(technology))
15      {
16         WRN("path '%s' is not a technology!", path);
17         return NULL;
18      }
19
20    return technology;
21 }
22
23 /**
24  * Get property "Name" value.
25  *
26  * If this property isn't found then @c EINA_FALSE is returned.
27  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
28  * values shall be considered invalid.
29  *
30  * Name of this technology.
31  *
32  * @param technology path to get property
33  * @param name where to store the property value, must be a pointer
34  *        to string (const char *), it will not be allocated or
35  *        copied and references will be valid until element changes,
36  *        so copy it if you want to use it later.
37  *
38  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
39  */
40 Eina_Bool
41 e_connman_technology_name_get(const E_Connman_Element *technology, const char **name)
42 {
43    EINA_SAFETY_ON_NULL_RETURN_VAL(technology, EINA_FALSE);
44    EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
45    return e_connman_element_property_get_stringshared
46              (technology, e_connman_prop_name, NULL, name);
47 }
48
49 /**
50  * Get property "Type" value.
51  *
52  * If this property isn't found then @c EINA_FALSE is returned.
53  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
54  * values shall be considered invalid.
55  *
56  * The technology type (for example "ethernet" etc.)
57  *
58  * This information should only be used to determine
59  * advanced properties or showing the correct icon
60  * to the user.
61  *
62  * @param technology path to get property.
63  * @param type where to store the property value, must be a pointer
64  *        to string (const char **), it will not be allocated or
65  *        copied and references will be valid until element changes,
66  *        so copy it if you want to use it later.
67  *
68  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
69  */
70 Eina_Bool
71 e_connman_technology_type_get(const E_Connman_Element *technology, const char **type)
72 {
73    EINA_SAFETY_ON_NULL_RETURN_VAL(technology, EINA_FALSE);
74    EINA_SAFETY_ON_NULL_RETURN_VAL(type, EINA_FALSE);
75    return e_connman_element_property_get_stringshared
76              (technology, e_connman_prop_type, NULL, type);
77 }
78
79 /**
80  * Get property "State" value.
81  *
82  * If this property isn't found then @c EINA_FALSE is returned.
83  * If @c EINA_FALSE is returned, then this call failed and parameter-returned
84  * values shall be considered invalid.
85  *
86  * The technology state information.
87  *
88  * Valid states are "offline", "available", "enabled",
89  * and "connected".
90  *
91  * @param technology path to get property.
92  * @param state where to store the property value, must be a pointer
93  *        to string (const char **), it will not be allocated or
94  *        copied and references will be valid until element changes,
95  *        so copy it if you want to use it later.
96  *
97  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
98  */
99 Eina_Bool
100 e_connman_technology_state_get(const E_Connman_Element *technology, const char **state)
101 {
102    EINA_SAFETY_ON_NULL_RETURN_VAL(technology, EINA_FALSE);
103    EINA_SAFETY_ON_NULL_RETURN_VAL(state, EINA_FALSE);
104    return e_connman_element_property_get_stringshared
105              (technology, e_connman_prop_state, NULL, state);
106 }