Service::ClearProperty implemented.
[framework/uifw/edbus.git] / src / lib / connman / e_connman_service.c
1 #include "e_connman_private.h"
2
3 E_Connman_Element *
4 e_connman_service_get(const char *path)
5 {
6    E_Connman_Element *service;
7
8    EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
9
10    service = e_connman_element_get(path);
11    if (!service)
12      return NULL;
13
14    if (!e_connman_element_is_service(service))
15      {
16         WRN("path '%s' is not a service!", path);
17         return NULL;
18      }
19
20    return service;
21 }
22
23 /**
24  * Connect this service.
25  *
26  * Connect this service. It will attempt to connect
27  * WiFi, WiMAX or Bluetooth services.
28  *
29  * For Ethernet devices this method can only be used
30  * if it has previously been disconnected. Otherwise
31  * the plugging of a cable will trigger connecting
32  * automatically. If no cable is plugged in this method
33  * will fail.
34  *
35  * @param service_path to call method on server.
36  * @param cb function to call when server replies or some error happens.
37  * @param data data to give to cb when it is called.
38  *
39  * @return 1 on success, 0 otherwise.
40  */
41 bool
42 e_connman_service_connect(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data)
43 {
44    const char name[] = "Connect";
45
46    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
47    return e_connman_element_call_full
48      (service, name, NULL, &service->_pending.service_connect, cb, data);
49 }
50
51 /**
52  * Disconnect this service.
53  *
54  * Disconnect this service. If the service is not
55  * connected an error message will be generated.
56  *
57  * On Ethernet devices this will disconnect the IP
58  * details from the service. It will not magically
59  * unplug the cable. When no cable is plugged in this
60  * method will fail.
61  *
62  * This method can also be used to abort a previous
63  * connectiong attempt via the Connect method.
64  *
65  * @param service_path to call method on server.
66  * @param cb function to call when server replies or some error happens.
67  * @param data data to give to cb when it is called.
68  *
69  * @return 1 on success, 0 otherwise.
70  */
71 bool
72 e_connman_service_disconnect(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data)
73 {
74    const char name[] = "Disconnect";
75
76    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
77    return e_connman_element_call_full
78      (service, name, NULL, &service->_pending.service_disconnect, cb, data);
79 }
80
81 /**
82  * Remove this service.
83  *
84  * A successfully connected service with Favorite=true
85  * can be removed this way. If it is connected, it will
86  * be automatically disconnected first.
87  *
88  * If the service requires a passphrase it will be
89  * cleared and forgotten when removing.
90  *
91  * This is similar to setting the Favorite property
92  * to false, but that is currently not supported.
93  *
94  * In the case a connection attempt failed and the
95  * service is in the State=failure, this method can
96  * also be used to reset the service.
97  *
98  * Calling this method on Ethernet devices will cause
99  * an error message. It is not possible to remove these
100  * kind of devices.
101  *
102  * @param service_path to call method on server.
103  * @param cb function to call when server replies or some error happens.
104  * @param data data to give to cb when it is called.
105  *
106  * @return 1 on success, 0 otherwise.
107  */
108 bool
109 e_connman_service_remove(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data)
110 {
111    const char name[] = "Remove";
112
113    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
114    return e_connman_element_call_full
115      (service, name, NULL, &service->_pending.service_remove, cb, data);
116 }
117
118 /**
119  * Clears the value of the specified property.
120  *
121  *
122  * @param service_path to call method on server.
123  * @param property to be cleared.
124  * @param cb function to call when server replies or some error happens.
125  * @param data data to give to cb when it is called.
126  *
127  * @return 1 on success, 0 otherwise.
128  */
129 bool
130 e_connman_service_clear_property(E_Connman_Element *service, const char *property, E_DBus_Method_Return_Cb cb, const void *data)
131 {
132    const char name[] = "ClearProperty";
133
134    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
135    EINA_SAFETY_ON_NULL_RETURN_VAL(property, 0);
136    return e_connman_element_call_with_string
137      (service, name, property, NULL, &service->_pending.service_clear_property,
138       cb, data);
139 }
140
141 /**
142  * Move service before in favorites list.
143  *
144  * Call method MoveBefore(object service) at the given service on server.
145  *
146  * If a service has been used before, this allows a
147  * reorder of the favorite services.
148  *
149  * The target service object must be part of this
150  * profile. Moving between profiles is not supported.
151  *
152  * @param service_path to call method on server.
153  * @param object_path object service.
154  * @param cb function to call when server replies or some error happens.
155  * @param data data to give to cb when it is called.
156  *
157  * @return 1 on success, 0 otherwise.
158  */
159 bool
160 e_connman_service_move_before(E_Connman_Element *service, const char *object_path, E_DBus_Method_Return_Cb cb, const void *data)
161 {
162    const char name[] = "MoveBefore";
163
164    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
165    EINA_SAFETY_ON_NULL_RETURN_VAL(object_path, 0);
166    return e_connman_element_call_with_path
167      (service, name, object_path, NULL,
168       &service->_pending.service_move_before, cb, data);
169 }
170
171 /**
172  * Move service after in favorites list.
173  *
174  * Call method MoveAfter(object service) at the given service on server.
175  *
176  * If a service has been used before, this allows a
177  * reorder of the favorite services.
178  *
179  * The target service object must be part of this
180  * profile. Moving between profiles is not supported.
181  *
182  * @param service_path to call method on server.
183  * @param cb function to call when server replies or some error happens.
184  * @param data data to give to cb when it is called.
185  *
186  * @return 1 on success, 0 otherwise.
187  */
188 bool
189 e_connman_service_move_after(E_Connman_Element *service, const char *object_path, E_DBus_Method_Return_Cb cb, const void *data)
190 {
191    const char name[] = "MoveAfter";
192
193    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
194    EINA_SAFETY_ON_NULL_RETURN_VAL(object_path, 0);
195    return e_connman_element_call_with_path
196      (service, name, object_path, NULL,
197       &service->_pending.service_move_after, cb, data);
198 }
199
200 /**
201  * Get property "State" value.
202  *
203  * If this property isn't found then 0 is returned.
204  * If zero is returned, then this call failed and parameter-returned
205  * values shall be considered invalid.
206  *
207  * The service state information.
208  *
209  * Valid states are "idle", "failure", "association",
210  * "configuration" and "ready".
211  *
212  * @param service_path to get property.
213  * @param state where to store the property value, must be a pointer
214  *        to string (const char **), it will not be allocated or
215  *        copied and references will be valid until element changes,
216  *        so copy it if you want to use it later.
217  *
218  * @return 1 on success, 0 otherwise.
219  */
220 bool
221 e_connman_service_state_get(const E_Connman_Element *service, const char **state)
222 {
223    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
224    EINA_SAFETY_ON_NULL_RETURN_VAL(state, 0);
225    return e_connman_element_property_get_stringshared
226      (service, e_connman_prop_state, NULL, state);
227 }
228
229 /**
230  * Get property "Error" value.
231  *
232  * If this property isn't found then 0 is returned.
233  * If zero is returned, then this call failed and parameter-returned
234  * values shall be considered invalid.
235  *
236  * The service error status details.
237  *
238  * When error occur during connection or disconnection
239  * the detailed information are represented in this
240  * property to help the user interface to present the
241  * user with alternate options.
242  *
243  * This property is only valid when the service is in
244  * the "failure" state. Otherwise it might be empty or
245  * not present at all.
246  *
247  * Current defined error code is "dhcp-failed".
248  *
249  * @param service_path to get property.
250  * @param error where to store the property value, must be a pointer
251  *        to string (const char **), it will not be allocated or
252  *        copied and references will be valid until element changes,
253  *        so copy it if you want to use it later.
254  *
255  * @return 1 on success, 0 otherwise.
256  */
257 bool
258 e_connman_service_error_get(const E_Connman_Element *service, const char **error)
259 {
260    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
261    EINA_SAFETY_ON_NULL_RETURN_VAL(error, 0);
262    return e_connman_element_property_get_stringshared
263      (service, e_connman_prop_error, NULL, error);
264 }
265
266 /**
267  * Get property "Name" value.
268  *
269  * If this property isn't found then 0 is returned.
270  * If zero is returned, then this call failed and parameter-returned
271  * values shall be considered invalid.
272  *
273  * The service name (for example "Wireless" etc.)
274  *
275  * This name can be used for directly displaying it in
276  * the application. It has pure informational purpose.
277  *
278  * For Ethernet devices and hidden WiFi networks it is
279  * not guaranteed that this property is present.
280  *
281  * @param service_path to get property.
282  * @param name where to store the property value, must be a pointer
283  *        to string (const char **), it will not be allocated or
284  *        copied and references will be valid until element changes,
285  *        so copy it if you want to use it later.
286  *
287  * @return 1 on success, 0 otherwise.
288  */
289 bool
290 e_connman_service_name_get(const E_Connman_Element *service, const char **name)
291 {
292    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
293    EINA_SAFETY_ON_NULL_RETURN_VAL(name, 0);
294    return e_connman_element_property_get_stringshared
295      (service, e_connman_prop_name, NULL, name);
296 }
297
298 /**
299  * Get property "Type" value.
300  *
301  * If this property isn't found then 0 is returned.
302  * If zero is returned, then this call failed and parameter-returned
303  * values shall be considered invalid.
304  *
305  * The service type (for example "ethernet", "wifi" etc.)
306  *
307  * This information should only be used to determine
308  * advanced properties or showing the correct icon
309  * to the user.
310  *
311  * @param service_path to get property.
312  * @param type where to store the property value, must be a pointer
313  *        to string (const char **), it will not be allocated or
314  *        copied and references will be valid until element changes,
315  *        so copy it if you want to use it later.
316  *
317  * @return 1 on success, 0 otherwise.
318  */
319 bool
320 e_connman_service_type_get(const E_Connman_Element *service, const char **type)
321 {
322    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
323    EINA_SAFETY_ON_NULL_RETURN_VAL(type, 0);
324    return e_connman_element_property_get_stringshared
325      (service, e_connman_prop_type, NULL, type);
326 }
327
328 /**
329  * Get property "Mode" value.
330  *
331  * If this property isn't found then 0 is returned.
332  * If zero is returned, then this call failed and parameter-returned
333  * values shall be considered invalid.
334  *
335  * If the service type is WiFi or Cellular, then this
336  * property is present and contains the mode of the
337  * network.
338  *
339  * For WiFi services the possible values are "managed"
340  * and "adhoc". For Cellular services it describes the
341  * network technology. Possible values are "gprs", "edge"
342  * and "umts".
343  *
344  * This property might be only present for WiFi and
345  * Cellular services.
346  *
347  * @param service_path to get property.
348  * @param mode where to store the property value, must be a pointer
349  *        to string (const char **), it will not be allocated or
350  *        copied and references will be valid until element changes,
351  *        so copy it if you want to use it later.
352  *
353  * @return 1 on success, 0 otherwise.
354  */
355 bool
356 e_connman_service_mode_get(const E_Connman_Element *service, const char **mode)
357 {
358    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
359    EINA_SAFETY_ON_NULL_RETURN_VAL(mode, 0);
360    return e_connman_element_property_get_stringshared
361      (service, e_connman_prop_mode, NULL, mode);
362 }
363
364 /**
365  * Get property "Security" value.
366  *
367  * If this property isn't found then 0 is returned.
368  * If zero is returned, then this call failed and parameter-returned
369  * values shall be considered invalid.
370  *
371  * If the service type is WiFi, then this property is
372  * present and contains the security method or key
373  * management setting.
374  *
375  * Possible values are "none", "wep", "wpa" and "rsn".
376  *
377  * This property might be only present for WiFi
378  * services.
379  *
380  * @param service_path to get property.
381  * @param security where to store the property value, must be a pointer
382  *        to string (const char **), it will not be allocated or
383  *        copied and references will be valid until element changes,
384  *        so copy it if you want to use it later.
385  *
386  * @return 1 on success, 0 otherwise.
387  */
388 bool
389 e_connman_service_security_get(const E_Connman_Element *service, const char **security)
390 {
391    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
392    EINA_SAFETY_ON_NULL_RETURN_VAL(security, 0);
393    return e_connman_element_property_get_stringshared
394      (service, e_connman_prop_security, NULL, security);
395 }
396
397 /**
398  * Get property "Passphrase" value.
399  *
400  * If this property isn't found then 0 is returned.
401  * If zero is returned, then this call failed and parameter-returned
402  * values shall be considered invalid.
403  *
404  * If the service type is WiFi, then this property
405  * can be used to store a passphrase.
406  *
407  * No PropertyChanged signals will be send for this
408  * property. The PassphraseRequired property should
409  * be monitored instead.
410  *
411  * This property might also not always be included
412  * since it is protected by a different security policy.
413  *
414  * @param service_path to get property.
415  * @param passphrase where to store the property value, must be a pointer
416  *        to string (const char **), it will not be allocated or
417  *        copied and references will be valid until element changes,
418  *        so copy it if you want to use it later.
419  *
420  * @return 1 on success, 0 otherwise.
421  * @see e_connman_service_passphrase_set()
422  */
423 bool
424 e_connman_service_passphrase_get(const E_Connman_Element *service, const char **passphrase)
425 {
426    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
427    EINA_SAFETY_ON_NULL_RETURN_VAL(passphrase, 0);
428    return e_connman_element_property_get_stringshared
429      (service, e_connman_prop_passphrase, NULL, passphrase);
430 }
431
432 /**
433  * Set property "Passphrase" value.
434  *
435  * If this property isn't found then 0 is returned.
436  * If zero is returned, then this call failed and parameter-returned
437  * values shall be considered invalid.
438  *
439  * If the service type is WiFi, then this property
440  * can be used to store a passphrase.
441  *
442  * No PropertyChanged signals will be send for this
443  * property. The PassphraseRequired property should
444  * be monitored instead.
445  *
446  * This property might also not always be included
447  * since it is protected by a different security policy.
448  *
449  * @param service_path to get property.
450  * @param passphrase value to set.
451  * @param cb function to call when server replies or some error happens.
452  * @param data data to give to cb when it is called.
453  *
454  * @return 1 on success, 0 otherwise.
455  * @see e_connman_service_passphrase_get()
456  */
457 bool
458 e_connman_service_passphrase_set(E_Connman_Element *service, const char *passphrase, E_DBus_Method_Return_Cb cb, const void *data)
459 {
460    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
461    return e_connman_element_property_set_full
462      (service, e_connman_prop_passphrase, DBUS_TYPE_STRING,
463       passphrase, cb, data);
464 }
465
466 /**
467  * Get property "PassphraseRequired" value.
468  *
469  * If this property isn't found then 0 is returned.
470  * If zero is returned, then this call failed and parameter-returned
471  * values shall be considered invalid.
472  *
473  * If the service type is WiFi, then this property
474  * indicates if a passphrase is required.
475  *
476  * If a passphrase has been set already or if no
477  * passphrase is needed, then this property will
478  * be set to false.
479  *
480  * @param service_path to get property.
481  * @param passphrase_required where to store the property value, must be a
482  *        pointer to boolean (bool *).
483  *
484  * @return 1 on success, 0 otherwise.
485  */
486 bool
487 e_connman_service_passphrase_required_get(const E_Connman_Element *service, bool *passphrase_required)
488 {
489    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
490    EINA_SAFETY_ON_NULL_RETURN_VAL(passphrase_required, 0);
491    return e_connman_element_property_get_stringshared
492      (service, e_connman_prop_passphrase_required, NULL, passphrase_required);
493 }
494
495 /**
496  * Get property "Strength" value.
497  *
498  * If this property isn't found then 0 is returned.
499  * If zero is returned, then this call failed and parameter-returned
500  * values shall be considered invalid.
501  *
502  * Indicates the signal strength of the service. This
503  * is a normalized value between 0 and 100.
504  *
505  * This property will not be present for Ethernet
506  * devices.
507  *
508  * @param service_path to get property.
509  * @param strength where to store the property value, must be a pointer
510  *        to byte (unsigned char*).
511  *
512  * @return 1 on success, 0 otherwise.
513  */
514 bool
515 e_connman_service_strength_get(const E_Connman_Element *service, unsigned char *strength)
516 {
517    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
518    EINA_SAFETY_ON_NULL_RETURN_VAL(strength, 0);
519    return e_connman_element_property_get_stringshared
520      (service, e_connman_prop_strengh, NULL, strength);
521 }
522
523 /**
524  * Get property "Favorite" value.
525  *
526  * If this property isn't found then 0 is returned.
527  * If zero is returned, then this call failed and parameter-returned
528  * values shall be considered invalid.
529  *
530  * Will be true if a cable is plugged in or the user
531  * selected and successfully connected to this service.
532  *
533  * This value is automatically changed and to revert
534  * it back to false the Remove() method needs to be
535  * used.
536  *
537  * @param service_path to get property.
538  * @param favorite where to store the property value, must be a
539  *        pointer to boolean (bool *).
540  *
541  * @return 1 on success, 0 otherwise.
542  */
543 bool
544 e_connman_service_favorite_get(const E_Connman_Element *service, bool *favorite)
545 {
546    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
547    EINA_SAFETY_ON_NULL_RETURN_VAL(favorite, 0);
548    return e_connman_element_property_get_stringshared
549      (service, e_connman_prop_favorite, NULL, favorite);
550 }
551
552 /**
553  * Get property "AutoConnect" value.
554  *
555  * If this property isn't found then 0 is returned.
556  * If zero is returned, then this call failed and parameter-returned
557  * values shall be considered invalid.
558  *
559  * If set to true, this service will auto-connect
560  * when not other connection is available.
561  *
562  * For favorite services it is possible to change
563  * this value to prevent or permit automatic
564  * connection attempts.
565  *
566  * @param service_path to get property.
567  * @param auto_connect where to store the property value, must be a
568  *        pointer to boolean (bool *).
569  *
570  * @return 1 on success, 0 otherwise.
571  * @see e_connman_service_auto_connect_set()
572  */
573 bool
574 e_connman_service_auto_connect_get(const E_Connman_Element *service, bool *auto_connect)
575 {
576    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
577    EINA_SAFETY_ON_NULL_RETURN_VAL(auto_connect, 0);
578    return e_connman_element_property_get_stringshared
579      (service, e_connman_prop_auto_connect, NULL, auto_connect);
580 }
581
582 /**
583  * Set property "AutoConnect" value.
584  *
585  * If this property isn't found then 0 is returned.
586  * If zero is returned, then this call failed and parameter-returned
587  * values shall be considered invalid.
588  *
589  * If set to true, this service will auto-connect
590  * when not other connection is available.
591  *
592  * For favorite services it is possible to change
593  * this value to prevent or permit automatic
594  * connection attempts.
595  *
596  * @param service_path to get property.
597  * @param service_favorite where to store the property value, must be a
598  *        pointer to boolean (bool *).
599  *
600  * @return 1 on success, 0 otherwise.
601  * @see e_connman_service_auto_connect_get()
602  */
603 bool
604 e_connman_service_auto_connect_set(E_Connman_Element *service, bool auto_connect, E_DBus_Method_Return_Cb cb, const void *data)
605 {
606    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
607    return e_connman_element_property_set_full
608      (service, e_connman_prop_auto_connect, DBUS_TYPE_BOOLEAN, &auto_connect, cb, data);
609 }
610
611 /**
612  * Get property "SetupRequired" value.
613  *
614  * If this property isn't found then 0 is returned.
615  * If zero is returned, then this call failed and parameter-returned
616  * values shall be considered invalid.
617  *
618  * If the service is Cellular, then this property
619  * indicates that some extra setup steps are required.
620  *
621  * In most cases it is required to fill in the APN
622  * details.
623  *
624  * @param service_path to get property.
625  * @param setup_required where to store the property value, must be a
626  *        pointer to boolean (bool *).
627  *
628  * @return 1 on success, 0 otherwise.
629  */
630 bool
631 e_connman_service_setup_required_get(const E_Connman_Element *service, bool *setup_required)
632 {
633    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
634    EINA_SAFETY_ON_NULL_RETURN_VAL(setup_required, 0);
635    return e_connman_element_property_get_stringshared
636      (service, e_connman_prop_setup_required, NULL, setup_required);
637 }
638
639 /**
640  * Get property "APN" value.
641  *
642  * If this property isn't found then 0 is returned.
643  * If zero is returned, then this call failed and parameter-returned
644  * values shall be considered invalid.
645  *
646  * If the service is Cellular, then this property
647  * contains the APN details.
648  *
649  * The APN is network provider specific and even
650  * sometimes data plan specific. Possible examples
651  * are "isp.cingular" or "internet.t-mobile".
652  *
653  * This property might also not always be included
654  * since it is protected by a different security policy.
655  *
656  * @param service_path to get property.
657  * @param apn where to store the property value, must be a pointer
658  *        to string (const char **), it will not be allocated or
659  *        copied and references will be valid until element changes,
660  *        so copy it if you want to use it later.
661  *
662  * @return 1 on success, 0 otherwise.
663  * @see e_connman_service_apn_set()
664  */
665 bool
666 e_connman_service_apn_get(const E_Connman_Element *service, const char **apn)
667 {
668    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
669    EINA_SAFETY_ON_NULL_RETURN_VAL(apn, 0);
670    return e_connman_element_property_get_stringshared
671      (service, e_connman_prop_apn, NULL, apn);
672 }
673
674 /**
675  * Set property "APN" value.
676  *
677  * If this property isn't found then 0 is returned.
678  * If zero is returned, then this call failed and parameter-returned
679  * values shall be considered invalid.
680  *
681  * If the service is Cellular, then this property
682  * contains the APN details.
683  *
684  * The APN is network provider specific and even
685  * sometimes data plan specific. Possible examples
686  * are "isp.cingular" or "internet.t-mobile".
687  *
688  * This property might also not always be included
689  * since it is protected by a different security policy.
690  *
691  * @param service_path to get property.
692  * @param passphrase value to set.
693  * @param cb function to call when server replies or some error happens.
694  * @param data data to give to cb when it is called.
695  *
696  * @return 1 on success, 0 otherwise.
697  * @see e_connman_service_apn_get()
698  */
699 bool
700 e_connman_service_apn_set(E_Connman_Element *service, const char *apn, E_DBus_Method_Return_Cb cb, const void *data)
701 {
702    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
703    return e_connman_element_property_set_full
704      (service, e_connman_prop_apn, DBUS_TYPE_STRING,
705       apn, cb, data);
706 }
707
708 /**
709  * Get property "MCC" value.
710  *
711  * If this property isn't found then 0 is returned.
712  * If zero is returned, then this call failed and parameter-returned
713  * values shall be considered invalid.
714  *
715  * If the service is Cellular, then this property
716  * contains the Mobile Country Code.
717  *
718  * @param service_path to get property.
719  * @param mcc where to store the property value, must be a pointer
720  *        to string (const char **), it will not be allocated or
721  *        copied and references will be valid until element changes,
722  *        so copy it if you want to use it later.
723  *
724  * @return 1 on success, 0 otherwise.
725  */
726 bool
727 e_connman_service_mcc_get(const E_Connman_Element *service, const char **mcc)
728 {
729    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
730    EINA_SAFETY_ON_NULL_RETURN_VAL(mcc, 0);
731    return e_connman_element_property_get_stringshared
732      (service, e_connman_prop_mcc, NULL, mcc);
733 }
734
735 /**
736  * Get property "MNC" value.
737  *
738  * If this property isn't found then 0 is returned.
739  * If zero is returned, then this call failed and parameter-returned
740  * values shall be considered invalid.
741  *
742  * If the service is Cellular, then this property
743  * contains the Mobile Network Code.
744  *
745  * @param service_path to get property.
746  * @param mnc where to store the property value, must be a pointer
747  *        to string (const char **), it will not be allocated or
748  *        copied and references will be valid until element changes,
749  *        so copy it if you want to use it later.
750  *
751  * @return 1 on success, 0 otherwise.
752  */
753 bool
754 e_connman_service_mnc_get(const E_Connman_Element *service, const char **mnc)
755 {
756    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
757    EINA_SAFETY_ON_NULL_RETURN_VAL(mnc, 0);
758    return e_connman_element_property_get_stringshared
759      (service, e_connman_prop_mnc, NULL, mnc);
760 }
761
762 /**
763  * Get property "Roaming" value.
764  *
765  * If this property isn't found then 0 is returned.
766  * If zero is returned, then this call failed and parameter-returned
767  * values shall be considered invalid.
768  *
769  * This property indicates if this service is roaming.
770  *
771  * In the case of Cellular services this normally
772  * indicates connections to a foreign provider when
773  * traveling abroad.
774  *
775  * @param service_path to get property.
776  * @param roaming where to store the property value, must be a
777  *        pointer to boolean (bool *).
778  *
779  * @return 1 on success, 0 otherwise.
780  */
781 bool
782 e_connman_service_roaming_get(const E_Connman_Element *service, bool *roaming)
783 {
784    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
785    EINA_SAFETY_ON_NULL_RETURN_VAL(roaming, 0);
786    return e_connman_element_property_get_stringshared
787      (service, e_connman_prop_roaming, NULL, roaming);
788 }
789
790 /**
791  * Get property "IPv4.Method" value.
792  *
793  * If this property isn't found then 0 is returned.
794  * If zero is returned, then this call failed and parameter-returned
795  * values shall be considered invalid.
796  *
797  * The IPv4 configuration method. Possible values here
798  * are "dhcp" and "static".
799  *
800  * @param service_path to get property.
801  * @param method where to store the property value, must be a pointer
802  *        to string (const char **), it will not be allocated or
803  *        copied and references will be valid until element changes,
804  *        so copy it if you want to use it later.
805  *
806  * @return 1 on success, 0 otherwise.
807  * @see e_connman_service_ipv4_method_set()
808  */
809 bool
810 e_connman_service_ipv4_method_get(const E_Connman_Element *service, const char **method)
811 {
812    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
813    EINA_SAFETY_ON_NULL_RETURN_VAL(method, 0);
814    return e_connman_element_property_get_stringshared
815      (service, e_connman_prop_ipv4_method, NULL, method);
816 }
817
818 /**
819  * Set property "IPv4.Method" value.
820  *
821  * If this property isn't found then 0 is returned.
822  * If zero is returned, then this call failed and parameter-returned
823  * values shall be considered invalid.
824  *
825  * The IPv4 configuration method. Possible values here
826  * are "dhcp" and "static".
827  *
828  * @param service_path to get property.
829  * @param method value to set.
830  * @param cb function to call when server replies or some error happens.
831  * @param data data to give to cb when it is called.
832  *
833  * @return 1 on success, 0 otherwise.
834  * @see e_connman_service_ipv4_method_get()
835  */
836 bool
837 e_connman_service_ipv4_method_set(E_Connman_Element *service, const char *method, E_DBus_Method_Return_Cb cb, const void *data)
838 {
839    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
840    return e_connman_element_property_set_full
841      (service, e_connman_prop_ipv4_method, DBUS_TYPE_STRING,
842       method, cb, data);
843 }
844
845 /**
846  * Get property "IPv4.Address" value.
847  *
848  * If this property isn't found then 0 is returned.
849  * If zero is returned, then this call failed and parameter-returned
850  * values shall be considered invalid.
851  *
852  * The current configured IPv4 address.
853  *
854  * @param service_path to get property.
855  * @param address where to store the property value, must be a pointer
856  *        to string (const char **), it will not be allocated or
857  *        copied and references will be valid until element changes,
858  *        so copy it if you want to use it later.
859  *
860  * @return 1 on success, 0 otherwise.
861  * @see e_connman_service_ipv4_address_set()
862  */
863 bool
864 e_connman_service_ipv4_address_get(const E_Connman_Element *service, const char **address)
865 {
866    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
867    EINA_SAFETY_ON_NULL_RETURN_VAL(address, 0);
868    return e_connman_element_property_get_stringshared
869      (service, e_connman_prop_ipv4_address, NULL, address);
870 }
871
872 /**
873  * Set property "IPv4.Address" value.
874  *
875  * If this property isn't found then 0 is returned.
876  * If zero is returned, then this call failed and parameter-returned
877  * values shall be considered invalid.
878  *
879  * The current configured IPv4 address.
880  *
881  * @param service_path to get property.
882  * @param address value to set.
883  * @param cb function to call when server replies or some error happens.
884  * @param data data to give to cb when it is called.
885  *
886  * @return 1 on success, 0 otherwise.
887  * @see e_connman_service_ipv4_address_get()
888  */
889 bool
890 e_connman_service_ipv4_address_set(E_Connman_Element *service, const char *address, E_DBus_Method_Return_Cb cb, const void *data)
891 {
892    EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
893    return e_connman_element_property_set_full
894      (service, e_connman_prop_ipv4_address, DBUS_TYPE_STRING,
895       address, cb, data);
896 }