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