1 #include "e_connman_private.h"
4 e_connman_service_get(const char *path)
6 E_Connman_Element *service;
8 EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
10 service = e_connman_element_get(path);
14 if (!e_connman_element_is_service(service))
16 WRN("path '%s' is not a service!", path);
24 * Connect this service.
26 * Connect this service. It will attempt to connect
27 * WiFi, WiMAX or Bluetooth services.
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
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.
39 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
42 e_connman_service_connect(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data)
44 const char name[] = "Connect";
46 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
47 return e_connman_element_call_full
48 (service, name, NULL, &service->_pending.service_connect, cb, data);
52 * Disconnect this service.
54 * Disconnect this service. If the service is not
55 * connected an error message will be generated.
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
62 * This method can also be used to abort a previous
63 * connectiong attempt via the Connect method.
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.
69 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
72 e_connman_service_disconnect(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data)
74 const char name[] = "Disconnect";
76 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
77 return e_connman_element_call_full
78 (service, name, NULL, &service->_pending.service_disconnect, cb, data);
82 * Remove this service.
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.
88 * If the service requires a passphrase it will be
89 * cleared and forgotten when removing.
91 * This is similar to setting the Favorite property
92 * to false, but that is currently not supported.
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.
98 * Calling this method on Ethernet devices will cause
99 * an error message. It is not possible to remove these
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.
106 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
109 e_connman_service_remove(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data)
111 const char name[] = "Remove";
113 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
114 return e_connman_element_call_full
115 (service, name, NULL, &service->_pending.service_remove, cb, data);
119 * Clears the value of the specified property.
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.
127 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
130 e_connman_service_clear_property(E_Connman_Element *service, const char *property, E_DBus_Method_Return_Cb cb, const void *data)
132 const char name[] = "ClearProperty";
134 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
135 EINA_SAFETY_ON_NULL_RETURN_VAL(property, EINA_FALSE);
136 return e_connman_element_call_with_string
137 (service, name, property, NULL, &service->_pending.service_clear_property,
142 * Move service before in favorites list.
144 * Call method MoveBefore(object service) at the given service on server.
146 * If a service has been used before, this allows a
147 * reorder of the favorite services.
149 * The target service object must be part of this
150 * profile. Moving between profiles is not supported.
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.
157 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
160 e_connman_service_move_before(E_Connman_Element *service, const char *object_path, E_DBus_Method_Return_Cb cb, const void *data)
162 const char name[] = "MoveBefore";
164 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
165 EINA_SAFETY_ON_NULL_RETURN_VAL(object_path, EINA_FALSE);
166 return e_connman_element_call_with_path
167 (service, name, object_path, NULL,
168 &service->_pending.service_move_before, cb, data);
172 * Move service after in favorites list.
174 * Call method MoveAfter(object service) at the given service on server.
176 * If a service has been used before, this allows a
177 * reorder of the favorite services.
179 * The target service object must be part of this
180 * profile. Moving between profiles is not supported.
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.
186 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
189 e_connman_service_move_after(E_Connman_Element *service, const char *object_path, E_DBus_Method_Return_Cb cb, const void *data)
191 const char name[] = "MoveAfter";
193 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
194 EINA_SAFETY_ON_NULL_RETURN_VAL(object_path, EINA_FALSE);
195 return e_connman_element_call_with_path
196 (service, name, object_path, NULL,
197 &service->_pending.service_move_after, cb, data);
201 * Get property "State" value.
203 * If this property isn't found then @c EINA_FALSE is returned.
204 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
205 * values shall be considered invalid.
207 * The service state information.
209 * Valid states are "idle", "failure", "association",
210 * "configuration", "ready", "login" and "online".
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.
218 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
221 e_connman_service_state_get(const E_Connman_Element *service, const char **state)
223 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
224 EINA_SAFETY_ON_NULL_RETURN_VAL(state, EINA_FALSE);
225 return e_connman_element_property_get_stringshared
226 (service, e_connman_prop_state, NULL, state);
230 * Get property "Error" value.
232 * If this property isn't found then @c EINA_FALSE is returned.
233 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
234 * values shall be considered invalid.
236 * The service error status details.
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.
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.
247 * Current defined error code is "dhcp-failed".
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.
255 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
258 e_connman_service_error_get(const E_Connman_Element *service, const char **error)
260 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
261 EINA_SAFETY_ON_NULL_RETURN_VAL(error, EINA_FALSE);
262 return e_connman_element_property_get_stringshared
263 (service, e_connman_prop_error, NULL, error);
267 * Get property "Name" value.
269 * If this property isn't found then @c EINA_FALSE is returned.
270 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
271 * values shall be considered invalid.
273 * The service name (for example "Wireless" etc.)
275 * This name can be used for directly displaying it in
276 * the application. It has pure informational purpose.
278 * For Ethernet devices and hidden WiFi networks it is
279 * not guaranteed that this property is present.
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.
287 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
290 e_connman_service_name_get(const E_Connman_Element *service, const char **name)
292 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
293 EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
294 return e_connman_element_property_get_stringshared
295 (service, e_connman_prop_name, NULL, name);
299 * Get property "Type" value.
301 * If this property isn't found then @c EINA_FALSE is returned.
302 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
303 * values shall be considered invalid.
305 * The service type (for example "ethernet", "wifi" etc.)
307 * This information should only be used to determine
308 * advanced properties or showing the correct icon
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.
317 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
320 e_connman_service_type_get(const E_Connman_Element *service, const char **type)
322 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
323 EINA_SAFETY_ON_NULL_RETURN_VAL(type, EINA_FALSE);
324 return e_connman_element_property_get_stringshared
325 (service, e_connman_prop_type, NULL, type);
329 * Get property "Mode" value.
331 * If this property isn't found then @c EINA_FALSE is returned.
332 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
333 * values shall be considered invalid.
335 * If the service type is WiFi or Cellular, then this
336 * property is present and contains the mode of the
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"
344 * This property might be only present for WiFi and
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.
353 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
356 e_connman_service_mode_get(const E_Connman_Element *service, const char **mode)
358 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
359 EINA_SAFETY_ON_NULL_RETURN_VAL(mode, EINA_FALSE);
360 return e_connman_element_property_get_stringshared
361 (service, e_connman_prop_mode, NULL, mode);
365 * Get property "Security" value.
367 * If this property isn't found then @c EINA_FALSE is returned.
368 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
369 * values shall be considered invalid.
371 * If the service type is WiFi, then this property is
372 * present and contains the list of security method or key
373 * management setting.
375 * Possible values are "none", "wep", "wpa", "rsn", "psk", "ieee8021x" and "wps"
377 * This property might be only present for WiFi
380 * @param service path to get property.
381 * @param security where to store the property value, must be a pointer
382 * to E_Connman_Array, 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.
386 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
389 e_connman_service_security_get(const E_Connman_Element *service, const E_Connman_Array **security)
391 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
392 EINA_SAFETY_ON_NULL_RETURN_VAL(security, EINA_FALSE);
393 return e_connman_element_property_get_stringshared
394 (service, e_connman_prop_security, NULL, security);
398 * Get property "Passphrase" value.
400 * If this property isn't found then @c EINA_FALSE is returned.
401 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
402 * values shall be considered invalid.
404 * If the service type is WiFi, then this property
405 * can be used to store a passphrase.
407 * No PropertyChanged signals will be send for this
408 * property. The PassphraseRequired property should
409 * be monitored instead.
411 * This property might also not always be included
412 * since it is protected by a different security policy.
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.
420 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
421 * @see e_connman_service_passphrase_set()
424 e_connman_service_passphrase_get(const E_Connman_Element *service, const char **passphrase)
426 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
427 EINA_SAFETY_ON_NULL_RETURN_VAL(passphrase, EINA_FALSE);
428 return e_connman_element_property_get_stringshared
429 (service, e_connman_prop_passphrase, NULL, passphrase);
433 * Set property "Passphrase" value.
435 * If this property isn't found then @c EINA_FALSE is returned.
436 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
437 * values shall be considered invalid.
439 * If the service type is WiFi, then this property
440 * can be used to store a passphrase.
442 * No PropertyChanged signals will be send for this
443 * property. The PassphraseRequired property should
444 * be monitored instead.
446 * This property might also not always be included
447 * since it is protected by a different security policy.
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.
454 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
455 * @see e_connman_service_passphrase_get()
458 e_connman_service_passphrase_set(E_Connman_Element *service, const char *passphrase, E_DBus_Method_Return_Cb cb, const void *data)
460 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
461 return e_connman_element_property_set_full
462 (service, e_connman_prop_passphrase, DBUS_TYPE_STRING,
463 passphrase, cb, data);
467 * Get property "PassphraseRequired" value.
469 * If this property isn't found then @c EINA_FALSE is returned.
470 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
471 * values shall be considered invalid.
473 * If the service type is WiFi, then this property
474 * indicates if a passphrase is required.
476 * If a passphrase has been set already or if no
477 * passphrase is needed, then this property will
480 * @param service path to get property.
481 * @param passphrase_required where to store the property value, must be a
482 * pointer to Eina_Bool (Eina_Bool *).
484 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
487 e_connman_service_passphrase_required_get(const E_Connman_Element *service, Eina_Bool *passphrase_required)
489 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
490 EINA_SAFETY_ON_NULL_RETURN_VAL(passphrase_required, EINA_FALSE);
491 return e_connman_element_property_get_stringshared
492 (service, e_connman_prop_passphrase_required, NULL, passphrase_required);
496 * Get property "LoginRequired" value.
498 * If this property isn't found then @c EINA_FALSE is returned.
499 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
500 * values shall be considered invalid.
502 * Indicates that a manual configuration must be done to login the
503 * user, likely access an website using a browser.
505 * If a login has been set already or if no
506 * login is needed, then this property will
509 * @param service path to get property.
510 * @param login_required where to store the property value, must be a
511 * pointer to Eina_Bool (Eina_Bool *).
513 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
518 e_connman_service_login_required_get(const E_Connman_Element *service, Eina_Bool *login_required)
520 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
521 EINA_SAFETY_ON_NULL_RETURN_VAL(login_required, EINA_FALSE);
522 return e_connman_element_property_get_stringshared
523 (service, e_connman_prop_login_required, NULL, login_required);
527 * Get property "Strength" value.
529 * If this property isn't found then @c EINA_FALSE is returned.
530 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
531 * values shall be considered invalid.
533 * Indicates the signal strength of the service. This
534 * is a normalized value between 0 and 100.
536 * This property will not be present for Ethernet
539 * @param service path to get property.
540 * @param strength where to store the property value, must be a pointer
541 * to byte (unsigned char*).
543 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
546 e_connman_service_strength_get(const E_Connman_Element *service, unsigned char *strength)
548 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
549 EINA_SAFETY_ON_NULL_RETURN_VAL(strength, EINA_FALSE);
550 return e_connman_element_property_get_stringshared
551 (service, e_connman_prop_strength, NULL, strength);
555 * Get property "Favorite" value.
557 * If this property isn't found then @c EINA_FALSE is returned.
558 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
559 * values shall be considered invalid.
561 * Will be true if a cable is plugged in or the user
562 * selected and successfully connected to this service.
564 * This value is automatically changed and to revert
565 * it back to false the Remove() method needs to be
568 * @param service path to get property.
569 * @param favorite where to store the property value, must be a
570 * pointer to Eina_Bool (Eina_Bool *).
572 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
575 e_connman_service_favorite_get(const E_Connman_Element *service, Eina_Bool *favorite)
577 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
578 EINA_SAFETY_ON_NULL_RETURN_VAL(favorite, EINA_FALSE);
579 return e_connman_element_property_get_stringshared
580 (service, e_connman_prop_favorite, NULL, favorite);
584 * Get property "Immutable" value.
586 * This value will be set to true if the service is configured
587 * externally via a configuration file.
589 * The only valid operation are e_connman_service_connect() and
590 * e_connman_service_disconnect(). The e_connman_service_remove()
591 * method will result in an error.
593 * @param service path to get property.
594 * @param immutable where to store the property value, must be a
595 * pointer to Eina_Bool (Eina_Bool *).
597 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
600 e_connman_service_immutable_get(const E_Connman_Element *service, Eina_Bool *immutable)
602 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
603 EINA_SAFETY_ON_NULL_RETURN_VAL(immutable, EINA_FALSE);
604 return e_connman_element_property_get_stringshared
605 (service, e_connman_prop_immutable, NULL, immutable);
609 * Get property "AutoConnect" value.
611 * If this property isn't found then @c EINA_FALSE is returned.
612 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
613 * values shall be considered invalid.
615 * If set to true, this service will auto-connect
616 * when not other connection is available.
618 * For favorite services it is possible to change
619 * this value to prevent or permit automatic
620 * connection attempts.
622 * @param service path to get property.
623 * @param auto_connect where to store the property value, must be a
624 * pointer to Eina_Bool (Eina_Bool *).
626 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
627 * @see e_connman_service_auto_connect_set()
630 e_connman_service_auto_connect_get(const E_Connman_Element *service, Eina_Bool *auto_connect)
632 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
633 EINA_SAFETY_ON_NULL_RETURN_VAL(auto_connect, EINA_FALSE);
634 return e_connman_element_property_get_stringshared
635 (service, e_connman_prop_auto_connect, NULL, auto_connect);
639 * Set property "AutoConnect" value.
641 * If this property isn't found then @c EINA_FALSE is returned.
642 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
643 * values shall be considered invalid.
645 * If set to true, this service will auto-connect
646 * when not other connection is available.
648 * For favorite services it is possible to change
649 * this value to prevent or permit automatic
650 * connection attempts.
652 * @param service path to get property.
653 * @param service_favorite where to store the property value, must be a
654 * pointer to Eina_Bool (Eina_Bool *).
656 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
657 * @see e_connman_service_auto_connect_get()
660 e_connman_service_auto_connect_set(E_Connman_Element *service, Eina_Bool auto_connect, E_DBus_Method_Return_Cb cb, const void *data)
662 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
663 return e_connman_element_property_set_full
664 (service, e_connman_prop_auto_connect, DBUS_TYPE_BOOLEAN, &auto_connect, cb, data);
668 * Get property "SetupRequired" value.
670 * If this property isn't found then @c EINA_FALSE is returned.
671 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
672 * values shall be considered invalid.
674 * If the service is Cellular, then this property
675 * indicates that some extra setup steps are required.
677 * In most cases it is required to fill in the APN
680 * @param service path to get property.
681 * @param setup_required where to store the property value, must be a
682 * pointer to Eina_Bool (Eina_Bool *).
684 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
687 e_connman_service_setup_required_get(const E_Connman_Element *service, Eina_Bool *setup_required)
689 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
690 EINA_SAFETY_ON_NULL_RETURN_VAL(setup_required, EINA_FALSE);
691 return e_connman_element_property_get_stringshared
692 (service, e_connman_prop_setup_required, NULL, setup_required);
696 * Get property "APN" value.
698 * If this property isn't found then @c EINA_FALSE is returned.
699 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
700 * values shall be considered invalid.
702 * If the service is Cellular, then this property
703 * contains the APN details.
705 * The APN is network provider specific and even
706 * sometimes data plan specific. Possible examples
707 * are "isp.cingular" or "internet.t-mobile".
709 * This property might also not always be included
710 * since it is protected by a different security policy.
712 * @param service path to get property.
713 * @param apn where to store the property value, must be a pointer
714 * to string (const char **), it will not be allocated or
715 * copied and references will be valid until element changes,
716 * so copy it if you want to use it later.
718 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
719 * @see e_connman_service_apn_set()
722 e_connman_service_apn_get(const E_Connman_Element *service, const char **apn)
724 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
725 EINA_SAFETY_ON_NULL_RETURN_VAL(apn, EINA_FALSE);
726 return e_connman_element_property_get_stringshared
727 (service, e_connman_prop_apn, NULL, apn);
731 * Set property "APN" value.
733 * If this property isn't found then @c EINA_FALSE is returned.
734 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
735 * values shall be considered invalid.
737 * If the service is Cellular, then this property
738 * contains the APN details.
740 * The APN is network provider specific and even
741 * sometimes data plan specific. Possible examples
742 * are "isp.cingular" or "internet.t-mobile".
744 * This property might also not always be included
745 * since it is protected by a different security policy.
747 * @param service path to get property.
748 * @param passphrase value to set.
749 * @param cb function to call when server replies or some error happens.
750 * @param data data to give to cb when it is called.
752 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
753 * @see e_connman_service_apn_get()
756 e_connman_service_apn_set(E_Connman_Element *service, const char *apn, E_DBus_Method_Return_Cb cb, const void *data)
758 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
759 return e_connman_element_property_set_full
760 (service, e_connman_prop_apn, DBUS_TYPE_STRING,
765 * Get property "MCC" value.
767 * If this property isn't found then @c EINA_FALSE is returned.
768 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
769 * values shall be considered invalid.
771 * If the service is Cellular, then this property
772 * contains the Mobile Country Code.
774 * @param service path to get property.
775 * @param mcc where to store the property value, must be a pointer
776 * to string (const char **), it will not be allocated or
777 * copied and references will be valid until element changes,
778 * so copy it if you want to use it later.
780 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
783 e_connman_service_mcc_get(const E_Connman_Element *service, const char **mcc)
785 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
786 EINA_SAFETY_ON_NULL_RETURN_VAL(mcc, EINA_FALSE);
787 return e_connman_element_property_get_stringshared
788 (service, e_connman_prop_mcc, NULL, mcc);
792 * Get property "MNC" value.
794 * If this property isn't found then @c EINA_FALSE is returned.
795 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
796 * values shall be considered invalid.
798 * If the service is Cellular, then this property
799 * contains the Mobile Network Code.
801 * @param service path to get property.
802 * @param mnc where to store the property value, must be a pointer
803 * to string (const char **), it will not be allocated or
804 * copied and references will be valid until element changes,
805 * so copy it if you want to use it later.
807 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
810 e_connman_service_mnc_get(const E_Connman_Element *service, const char **mnc)
812 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
813 EINA_SAFETY_ON_NULL_RETURN_VAL(mnc, EINA_FALSE);
814 return e_connman_element_property_get_stringshared
815 (service, e_connman_prop_mnc, NULL, mnc);
819 * Get property "Roaming" value.
821 * If this property isn't found then @c EINA_FALSE is returned.
822 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
823 * values shall be considered invalid.
825 * This property indicates if this service is roaming.
827 * In the case of Cellular services this normally
828 * indicates connections to a foreign provider when
831 * @param service path to get property.
832 * @param roaming where to store the property value, must be a
833 * pointer to Eina_Bool (Eina_Bool *).
835 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
838 e_connman_service_roaming_get(const E_Connman_Element *service, Eina_Bool *roaming)
840 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
841 EINA_SAFETY_ON_NULL_RETURN_VAL(roaming, EINA_FALSE);
842 return e_connman_element_property_get_stringshared
843 (service, e_connman_prop_roaming, NULL, roaming);
847 * Get property "IPv4.Method" value.
849 * If this property isn't found then @c EINA_FALSE is returned.
850 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
851 * values shall be considered invalid.
853 * The IPv4 method in use. Possible values here are "dhcp" and
856 * @param service path to get property.
857 * @param method where to store the property value, must be a pointer
858 * to string (const char **), it will not be allocated or
859 * copied and references will be valid until element changes,
860 * so copy it if you want to use it later.
862 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
865 e_connman_service_ipv4_method_get(const E_Connman_Element *service, const char **method)
867 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
868 EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
869 return e_connman_element_property_dict_get_stringshared
870 (service, e_connman_prop_ipv4, e_connman_prop_method, NULL, method);
874 * Get property "IPv4.Address" value.
876 * If this property isn't found then @c EINA_FALSE is returned.
877 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
878 * values shall be considered invalid.
880 * The current IPv4 address.
882 * @param service path to get property.
883 * @param address where to store the property value, must be a pointer
884 * to string (const char **), it will not be allocated or
885 * copied and references will be valid until element changes,
886 * so copy it if you want to use it later.
888 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
891 e_connman_service_ipv4_address_get(const E_Connman_Element *service, const char **address)
893 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
894 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
895 return e_connman_element_property_dict_get_stringshared
896 (service, e_connman_prop_ipv4, e_connman_prop_address, NULL, address);
900 * Get property "IPv4.Gateway" value.
902 * If this property isn't found then @c EINA_FALSE is returned.
903 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
904 * values shall be considered invalid.
906 * The current IPv4 gateway.
908 * @param service path to get property.
909 * @param gateway where to store the property value, must be a pointer
910 * to string (const char **), it will not be allocated or
911 * copied and references will be valid until element changes,
912 * so copy it if you want to use it later.
914 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
917 e_connman_service_ipv4_gateway_get(const E_Connman_Element *service, const char **gateway)
919 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
920 EINA_SAFETY_ON_NULL_RETURN_VAL(gateway, EINA_FALSE);
921 return e_connman_element_property_dict_get_stringshared
922 (service, e_connman_prop_ipv4, e_connman_prop_gateway, NULL, gateway);
926 * Get property "IPv4.Netmask" value.
928 * If this property isn't found then @c EINA_FALSE is returned.
929 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
930 * values shall be considered invalid.
932 * The current IPv4 netmask.
934 * @param service path to get property.
935 * @param netmask where to store the property value, must be a pointer
936 * to string (const char **), it will not be allocated or
937 * copied and references will be valid until element changes,
938 * so copy it if you want to use it later.
940 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
943 e_connman_service_ipv4_netmask_get(const E_Connman_Element *service, const char **netmask)
945 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
946 EINA_SAFETY_ON_NULL_RETURN_VAL(netmask, EINA_FALSE);
947 return e_connman_element_property_dict_get_stringshared
948 (service, e_connman_prop_ipv4, e_connman_prop_netmask, NULL, netmask);
952 * Get property "IPv4.Configuration.Method" value.
954 * Unlike IPv4.Method, this is the user-set value, rather than the
957 * If this property isn't found then @c EINA_FALSE is returned.
958 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
959 * values shall be considered invalid.
961 * The IPv4 configured method. Possible values here are "dhcp" and
964 * @param service path to get property.
965 * @param method where to store the property value, must be a pointer
966 * to string (const char **), it will not be allocated or
967 * copied and references will be valid until element changes,
968 * so copy it if you want to use it later.
970 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
973 e_connman_service_ipv4_configuration_method_get(const E_Connman_Element *service, const char **method)
975 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
976 EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
977 return e_connman_element_property_dict_get_stringshared
978 (service, e_connman_prop_ipv4_configuration, e_connman_prop_method,
983 * Get property "IPv4.Configuration.Address" value.
985 * Unlike IPv4.Address, this is the user-set value, rather than the
988 * If this property isn't found then @c EINA_FALSE is returned.
989 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
990 * values shall be considered invalid.
992 * The current configured IPv4 address.
994 * @param service path to get property.
995 * @param address where to store the property value, must be a pointer
996 * to string (const char **), it will not be allocated or
997 * copied and references will be valid until element changes,
998 * so copy it if you want to use it later.
1000 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1003 e_connman_service_ipv4_configuration_address_get(const E_Connman_Element *service, const char **address)
1005 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1006 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
1007 return e_connman_element_property_dict_get_stringshared
1008 (service, e_connman_prop_ipv4_configuration, e_connman_prop_address,
1013 * Get property "IPv4.Configuration.Gateway" value.
1015 * Unlike IPv4.Gateway, this is the user-set value, rather than the
1018 * If this property isn't found then @c EINA_FALSE is returned.
1019 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1020 * values shall be considered invalid.
1022 * The current configured IPv4 gateway.
1024 * @param service path to get property.
1025 * @param gateway where to store the property value, must be a pointer
1026 * to string (const char **), it will not be allocated or
1027 * copied and references will be valid until element changes,
1028 * so copy it if you want to use it later.
1030 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1033 e_connman_service_ipv4_configuration_gateway_get(const E_Connman_Element *service, const char **gateway)
1035 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1036 EINA_SAFETY_ON_NULL_RETURN_VAL(gateway, EINA_FALSE);
1037 return e_connman_element_property_dict_get_stringshared
1038 (service, e_connman_prop_ipv4_configuration, e_connman_prop_gateway,
1043 * Get property "IPv4.Configuration.Netmask" value.
1045 * Unlike IPv4.Netmask, this is the user-set value, rather than the
1048 * If this property isn't found then @c EINA_FALSE is returned.
1049 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1050 * values shall be considered invalid.
1052 * The current configured IPv4 netmask.
1054 * @param service path to get property.
1055 * @param netmask where to store the property value, must be a pointer
1056 * to string (const char **), it will not be allocated or
1057 * copied and references will be valid until element changes,
1058 * so copy it if you want to use it later.
1060 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1063 e_connman_service_ipv4_configuration_netmask_get(const E_Connman_Element *service, const char **netmask)
1065 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1066 EINA_SAFETY_ON_NULL_RETURN_VAL(netmask, EINA_FALSE);
1067 return e_connman_element_property_dict_get_stringshared
1068 (service, e_connman_prop_ipv4_configuration, e_connman_prop_netmask,
1073 * Set IPv4 to connect automatically using DHCP.
1075 * @param service path to set.
1076 * @param cb function to call when server replies or some error happens.
1077 * @param data data to give to cb when it is called.
1079 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1082 e_connman_service_ipv4_configure_dhcp(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data)
1084 const char method[] = "dhcp";
1085 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1086 return e_connman_element_property_dict_set_full
1087 (service, e_connman_prop_ipv4_configuration, e_connman_prop_method,
1088 DBUS_TYPE_STRING, method, cb, data);
1092 * Set IPv4 to connect using manually set parameters.
1094 * @param service path to set.
1095 * @param address IPv4 address.
1096 * @param netmask IPv4 netmask, or @c NULL for "/32".
1097 * @param gateway IPv4 gateway address.
1098 * @param cb function to call when server replies or some error happens.
1099 * @param data data to give to cb when it is called.
1101 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1104 e_connman_service_ipv4_configure_manual(E_Connman_Element *service, const char *address, const char *netmask, const char *gateway, E_DBus_Method_Return_Cb cb, const void *data)
1106 const char name[] = "SetProperty";
1107 const char *method = "manual"; /* not method[] as gcc screws it with dbus */
1109 DBusMessageIter itr, variant, dict, entry;
1111 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1112 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
1114 msg = dbus_message_new_method_call
1115 (e_connman_system_bus_name_get(), service->path, service->interface, name);
1120 dbus_message_iter_init_append(msg, &itr);
1121 dbus_message_iter_append_basic
1122 (&itr, DBUS_TYPE_STRING, &e_connman_prop_ipv4_configuration);
1124 dbus_message_iter_open_container
1125 (&itr, DBUS_TYPE_VARIANT,
1126 (DBUS_TYPE_ARRAY_AS_STRING
1127 DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
1128 DBUS_TYPE_STRING_AS_STRING
1129 DBUS_TYPE_STRING_AS_STRING
1130 DBUS_DICT_ENTRY_END_CHAR_AS_STRING),
1132 dbus_message_iter_open_container
1133 (&variant, DBUS_TYPE_ARRAY,
1134 (DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
1135 DBUS_TYPE_STRING_AS_STRING
1136 DBUS_TYPE_STRING_AS_STRING
1137 DBUS_DICT_ENTRY_END_CHAR_AS_STRING),
1140 dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1141 dbus_message_iter_append_basic
1142 (&entry, DBUS_TYPE_STRING, &e_connman_prop_method);
1143 dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &method);
1144 dbus_message_iter_close_container(&dict, &entry);
1146 dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1147 dbus_message_iter_append_basic
1148 (&entry, DBUS_TYPE_STRING, &e_connman_prop_address);
1149 dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &address);
1150 dbus_message_iter_close_container(&dict, &entry);
1154 dbus_message_iter_open_container
1155 (&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1156 dbus_message_iter_append_basic
1157 (&entry, DBUS_TYPE_STRING, &e_connman_prop_netmask);
1158 dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &netmask);
1159 dbus_message_iter_close_container(&dict, &entry);
1164 dbus_message_iter_open_container
1165 (&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1166 dbus_message_iter_append_basic
1167 (&entry, DBUS_TYPE_STRING, &e_connman_prop_gateway);
1168 dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &gateway);
1169 dbus_message_iter_close_container(&dict, &entry);
1172 dbus_message_iter_close_container(&variant, &dict);
1173 dbus_message_iter_close_container(&itr, &variant);
1175 return e_connman_element_message_send
1176 (service, name, NULL, msg, &service->_pending.property_set, cb, data);
1180 * Get property "Ethernet.Method" value.
1182 * If this property isn't found then @c EINA_FALSE is returned.
1183 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1184 * values shall be considered invalid.
1186 * The Ethernet configuration method. Possible values here "auto" and "manual".
1188 * @param service path to get property.
1189 * @param method where to store the property value, must be a pointer
1190 * to string (const char **), it will not be allocated or
1191 * copied and references will be valid until element changes,
1192 * so copy it if you want to use it later.
1194 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1197 e_connman_service_ethernet_method_get(const E_Connman_Element *service, const char **method)
1199 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1200 EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
1201 return e_connman_element_property_dict_get_stringshared
1202 (service, e_connman_prop_ethernet, e_connman_prop_method, NULL, method);
1206 * Get property "Ethernet.Interface" value.
1208 * If this property isn't found then @c EINA_FALSE is returned.
1209 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1210 * values shall be considered invalid.
1212 * Interface name (for example eth0).
1214 * @param service path to get property.
1215 * @param iface where to store the property value, must be a pointer
1216 * to string (const char **), it will not be allocated or
1217 * copied and references will be valid until element changes,
1218 * so copy it if you want to use it later.
1220 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1223 e_connman_service_ethernet_interface_get(const E_Connman_Element *service, const char **iface)
1225 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1226 EINA_SAFETY_ON_NULL_RETURN_VAL(iface, EINA_FALSE);
1227 return e_connman_element_property_dict_get_stringshared
1228 (service, e_connman_prop_ethernet, e_connman_prop_interface, NULL, iface);
1232 * Get property "Ethernet.Speed" value.
1234 * If this property isn't found then @c EINA_FALSE is returned.
1235 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1236 * values shall be considered invalid.
1238 * Selected speed of the line. This information might not always be available.
1240 * @param service path to get property.
1241 * @param speed where to store the property value.
1243 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1246 e_connman_service_ethernet_speed_get(const E_Connman_Element *service, unsigned short *speed)
1248 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1249 EINA_SAFETY_ON_NULL_RETURN_VAL(speed, EINA_FALSE);
1250 return e_connman_element_property_dict_get_stringshared
1251 (service, e_connman_prop_ethernet, e_connman_prop_speed, NULL, speed);
1255 * Get property "Ethernet.Address" value.
1257 * If this property isn't found then @c EINA_FALSE is returned.
1258 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1259 * values shall be considered invalid.
1261 * The current configured Ethernet address (mac-address).
1263 * @param service path to get property.
1264 * @param address where to store the property value, must be a pointer
1265 * to string (const char **), it will not be allocated or
1266 * copied and references will be valid until element changes,
1267 * so copy it if you want to use it later.
1269 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1272 e_connman_service_ethernet_address_get(const E_Connman_Element *service, const char **address)
1274 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1275 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
1276 return e_connman_element_property_dict_get_stringshared
1277 (service, e_connman_prop_ethernet, e_connman_prop_address, NULL, address);
1281 * Get property "Ethernet.MTU" value.
1283 * If this property isn't found then @c EINA_FALSE is returned.
1284 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1285 * values shall be considered invalid.
1287 * The current configured Ethernet MTU.
1289 * @param service path to get property.
1290 * @param gateway where to store the property value, must be a pointer
1291 * to string (const char **), it will not be allocated or
1292 * copied and references will be valid until element changes,
1293 * so copy it if you want to use it later.
1295 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1298 e_connman_service_ethernet_mtu_get(const E_Connman_Element *service, unsigned short *mtu)
1300 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1301 EINA_SAFETY_ON_NULL_RETURN_VAL(mtu, EINA_FALSE);
1302 return e_connman_element_property_dict_get_stringshared
1303 (service, e_connman_prop_ethernet, e_connman_prop_mtu, NULL, mtu);