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 "Security" 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, then this property is
336 * present and contains the list of security method or key
337 * management setting.
339 * Possible values are "none", "wep", "wpa", "rsn", "psk", "ieee8021x" and "wps"
341 * This property might be only present for WiFi
344 * @param service path to get property.
345 * @param security where to store the property value, must be a pointer
346 * to E_Connman_Array, it will not be allocated or
347 * copied and references will be valid until element changes,
348 * so copy it if you want to use it later.
350 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
353 e_connman_service_security_get(const E_Connman_Element *service, const E_Connman_Array **security)
355 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
356 EINA_SAFETY_ON_NULL_RETURN_VAL(security, EINA_FALSE);
357 return e_connman_element_property_get_stringshared
358 (service, e_connman_prop_security, NULL, security);
362 * Get property "Passphrase" value.
364 * If this property isn't found then @c EINA_FALSE is returned.
365 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
366 * values shall be considered invalid.
368 * If the service type is WiFi, then this property
369 * can be used to store a passphrase.
371 * No PropertyChanged signals will be send for this
372 * property. The PassphraseRequired property should
373 * be monitored instead.
375 * This property might also not always be included
376 * since it is protected by a different security policy.
378 * @param service path to get property.
379 * @param passphrase where to store the property value, must be a pointer
380 * to string (const char **), it will not be allocated or
381 * copied and references will be valid until element changes,
382 * so copy it if you want to use it later.
384 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
385 * @see e_connman_service_passphrase_set()
388 e_connman_service_passphrase_get(const E_Connman_Element *service, const char **passphrase)
390 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
391 EINA_SAFETY_ON_NULL_RETURN_VAL(passphrase, EINA_FALSE);
392 return e_connman_element_property_get_stringshared
393 (service, e_connman_prop_passphrase, NULL, passphrase);
397 * Set property "Passphrase" value.
399 * If this property isn't found then @c EINA_FALSE is returned.
400 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
401 * values shall be considered invalid.
403 * If the service type is WiFi, then this property
404 * can be used to store a passphrase.
406 * No PropertyChanged signals will be send for this
407 * property. The PassphraseRequired property should
408 * be monitored instead.
410 * This property might also not always be included
411 * since it is protected by a different security policy.
413 * @param service path to get property.
414 * @param passphrase value to set.
415 * @param cb function to call when server replies or some error happens.
416 * @param data data to give to cb when it is called.
418 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
419 * @see e_connman_service_passphrase_get()
422 e_connman_service_passphrase_set(E_Connman_Element *service, const char *passphrase, E_DBus_Method_Return_Cb cb, const void *data)
424 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
425 return e_connman_element_property_set_full
426 (service, e_connman_prop_passphrase, DBUS_TYPE_STRING,
427 passphrase, cb, data);
431 * Get property "PassphraseRequired" value.
433 * If this property isn't found then @c EINA_FALSE is returned.
434 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
435 * values shall be considered invalid.
437 * If the service type is WiFi, then this property
438 * indicates if a passphrase is required.
440 * If a passphrase has been set already or if no
441 * passphrase is needed, then this property will
444 * @param service path to get property.
445 * @param passphrase_required where to store the property value, must be a
446 * pointer to Eina_Bool (Eina_Bool *).
448 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
451 e_connman_service_passphrase_required_get(const E_Connman_Element *service, Eina_Bool *passphrase_required)
453 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
454 EINA_SAFETY_ON_NULL_RETURN_VAL(passphrase_required, EINA_FALSE);
455 return e_connman_element_property_get_stringshared
456 (service, e_connman_prop_passphrase_required, NULL, passphrase_required);
460 * Get property "LoginRequired" value.
462 * If this property isn't found then @c EINA_FALSE is returned.
463 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
464 * values shall be considered invalid.
466 * Indicates that a manual configuration must be done to login the
467 * user, likely access an website using a browser.
469 * If a login has been set already or if no
470 * login is needed, then this property will
473 * @param service path to get property.
474 * @param login_required where to store the property value, must be a
475 * pointer to Eina_Bool (Eina_Bool *).
477 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
482 e_connman_service_login_required_get(const E_Connman_Element *service, Eina_Bool *login_required)
484 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
485 EINA_SAFETY_ON_NULL_RETURN_VAL(login_required, EINA_FALSE);
486 return e_connman_element_property_get_stringshared
487 (service, e_connman_prop_login_required, NULL, login_required);
491 * Get property "Strength" value.
493 * If this property isn't found then @c EINA_FALSE is returned.
494 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
495 * values shall be considered invalid.
497 * Indicates the signal strength of the service. This
498 * is a normalized value between 0 and 100.
500 * This property will not be present for Ethernet
503 * @param service path to get property.
504 * @param strength where to store the property value, must be a pointer
505 * to byte (unsigned char*).
507 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
510 e_connman_service_strength_get(const E_Connman_Element *service, unsigned char *strength)
512 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
513 EINA_SAFETY_ON_NULL_RETURN_VAL(strength, EINA_FALSE);
514 return e_connman_element_property_get_stringshared
515 (service, e_connman_prop_strength, NULL, strength);
519 * Get property "Favorite" value.
521 * If this property isn't found then @c EINA_FALSE is returned.
522 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
523 * values shall be considered invalid.
525 * Will be true if a cable is plugged in or the user
526 * selected and successfully connected to this service.
528 * This value is automatically changed and to revert
529 * it back to false the Remove() method needs to be
532 * @param service path to get property.
533 * @param favorite where to store the property value, must be a
534 * pointer to Eina_Bool (Eina_Bool *).
536 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
539 e_connman_service_favorite_get(const E_Connman_Element *service, Eina_Bool *favorite)
541 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
542 EINA_SAFETY_ON_NULL_RETURN_VAL(favorite, EINA_FALSE);
543 return e_connman_element_property_get_stringshared
544 (service, e_connman_prop_favorite, NULL, favorite);
548 * Get property "Immutable" value.
550 * This value will be set to true if the service is configured
551 * externally via a configuration file.
553 * The only valid operation are e_connman_service_connect() and
554 * e_connman_service_disconnect(). The e_connman_service_remove()
555 * method will result in an error.
557 * @param service path to get property.
558 * @param immutable where to store the property value, must be a
559 * pointer to Eina_Bool (Eina_Bool *).
561 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
564 e_connman_service_immutable_get(const E_Connman_Element *service, Eina_Bool *immutable)
566 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
567 EINA_SAFETY_ON_NULL_RETURN_VAL(immutable, EINA_FALSE);
568 return e_connman_element_property_get_stringshared
569 (service, e_connman_prop_immutable, NULL, immutable);
573 * Get property "AutoConnect" value.
575 * If this property isn't found then @c EINA_FALSE is returned.
576 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
577 * values shall be considered invalid.
579 * If set to true, this service will auto-connect
580 * when not other connection is available.
582 * For favorite services it is possible to change
583 * this value to prevent or permit automatic
584 * connection attempts.
586 * @param service path to get property.
587 * @param auto_connect where to store the property value, must be a
588 * pointer to Eina_Bool (Eina_Bool *).
590 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
591 * @see e_connman_service_auto_connect_set()
594 e_connman_service_auto_connect_get(const E_Connman_Element *service, Eina_Bool *auto_connect)
596 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
597 EINA_SAFETY_ON_NULL_RETURN_VAL(auto_connect, EINA_FALSE);
598 return e_connman_element_property_get_stringshared
599 (service, e_connman_prop_auto_connect, NULL, auto_connect);
603 * Set property "AutoConnect" value.
605 * If this property isn't found then @c EINA_FALSE is returned.
606 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
607 * values shall be considered invalid.
609 * If set to true, this service will auto-connect
610 * when not other connection is available.
612 * For favorite services it is possible to change
613 * this value to prevent or permit automatic
614 * connection attempts.
616 * @param service path to get property.
617 * @param service_favorite where to store the property value, must be a
618 * pointer to Eina_Bool (Eina_Bool *).
620 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
621 * @see e_connman_service_auto_connect_get()
624 e_connman_service_auto_connect_set(E_Connman_Element *service, Eina_Bool auto_connect, E_DBus_Method_Return_Cb cb, const void *data)
626 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
627 return e_connman_element_property_set_full
628 (service, e_connman_prop_auto_connect, DBUS_TYPE_BOOLEAN, &auto_connect, cb, data);
632 * Get property "SetupRequired" value.
634 * If this property isn't found then @c EINA_FALSE is returned.
635 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
636 * values shall be considered invalid.
638 * If the service is Cellular, then this property
639 * indicates that some extra setup steps are required.
641 * In most cases it is required to fill in the APN
644 * @param service path to get property.
645 * @param setup_required where to store the property value, must be a
646 * pointer to Eina_Bool (Eina_Bool *).
648 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
651 e_connman_service_setup_required_get(const E_Connman_Element *service, Eina_Bool *setup_required)
653 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
654 EINA_SAFETY_ON_NULL_RETURN_VAL(setup_required, EINA_FALSE);
655 return e_connman_element_property_get_stringshared
656 (service, e_connman_prop_setup_required, NULL, setup_required);
660 * Get property "APN" value.
662 * If this property isn't found then @c EINA_FALSE is returned.
663 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
664 * values shall be considered invalid.
666 * If the service is Cellular, then this property
667 * contains the APN details.
669 * The APN is network provider specific and even
670 * sometimes data plan specific. Possible examples
671 * are "isp.cingular" or "internet.t-mobile".
673 * This property might also not always be included
674 * since it is protected by a different security policy.
676 * @param service path to get property.
677 * @param apn where to store the property value, must be a pointer
678 * to string (const char **), it will not be allocated or
679 * copied and references will be valid until element changes,
680 * so copy it if you want to use it later.
682 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
683 * @see e_connman_service_apn_set()
686 e_connman_service_apn_get(const E_Connman_Element *service, const char **apn)
688 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
689 EINA_SAFETY_ON_NULL_RETURN_VAL(apn, EINA_FALSE);
690 return e_connman_element_property_get_stringshared
691 (service, e_connman_prop_apn, NULL, apn);
695 * Set property "APN" value.
697 * If this property isn't found then @c EINA_FALSE is returned.
698 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
699 * values shall be considered invalid.
701 * If the service is Cellular, then this property
702 * contains the APN details.
704 * The APN is network provider specific and even
705 * sometimes data plan specific. Possible examples
706 * are "isp.cingular" or "internet.t-mobile".
708 * This property might also not always be included
709 * since it is protected by a different security policy.
711 * @param service path to get property.
712 * @param passphrase value to set.
713 * @param cb function to call when server replies or some error happens.
714 * @param data data to give to cb when it is called.
716 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
717 * @see e_connman_service_apn_get()
720 e_connman_service_apn_set(E_Connman_Element *service, const char *apn, E_DBus_Method_Return_Cb cb, const void *data)
722 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
723 return e_connman_element_property_set_full
724 (service, e_connman_prop_apn, DBUS_TYPE_STRING,
729 * Get property "MCC" value.
731 * If this property isn't found then @c EINA_FALSE is returned.
732 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
733 * values shall be considered invalid.
735 * If the service is Cellular, then this property
736 * contains the Mobile Country Code.
738 * @param service path to get property.
739 * @param mcc where to store the property value, must be a pointer
740 * to string (const char **), it will not be allocated or
741 * copied and references will be valid until element changes,
742 * so copy it if you want to use it later.
744 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
747 e_connman_service_mcc_get(const E_Connman_Element *service, const char **mcc)
749 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
750 EINA_SAFETY_ON_NULL_RETURN_VAL(mcc, EINA_FALSE);
751 return e_connman_element_property_get_stringshared
752 (service, e_connman_prop_mcc, NULL, mcc);
756 * Get property "MNC" value.
758 * If this property isn't found then @c EINA_FALSE is returned.
759 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
760 * values shall be considered invalid.
762 * If the service is Cellular, then this property
763 * contains the Mobile Network Code.
765 * @param service path to get property.
766 * @param mnc where to store the property value, must be a pointer
767 * to string (const char **), it will not be allocated or
768 * copied and references will be valid until element changes,
769 * so copy it if you want to use it later.
771 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
774 e_connman_service_mnc_get(const E_Connman_Element *service, const char **mnc)
776 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
777 EINA_SAFETY_ON_NULL_RETURN_VAL(mnc, EINA_FALSE);
778 return e_connman_element_property_get_stringshared
779 (service, e_connman_prop_mnc, NULL, mnc);
783 * Get property "Roaming" value.
785 * If this property isn't found then @c EINA_FALSE is returned.
786 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
787 * values shall be considered invalid.
789 * This property indicates if this service is roaming.
791 * In the case of Cellular services this normally
792 * indicates connections to a foreign provider when
795 * @param service path to get property.
796 * @param roaming where to store the property value, must be a
797 * pointer to Eina_Bool (Eina_Bool *).
799 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
802 e_connman_service_roaming_get(const E_Connman_Element *service, Eina_Bool *roaming)
804 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
805 EINA_SAFETY_ON_NULL_RETURN_VAL(roaming, EINA_FALSE);
806 return e_connman_element_property_get_stringshared
807 (service, e_connman_prop_roaming, NULL, roaming);
811 * Get property "IPv4.Method" value.
813 * If this property isn't found then @c EINA_FALSE is returned.
814 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
815 * values shall be considered invalid.
817 * The IPv4 method in use. Possible values here are "dhcp" and
820 * @param service path to get property.
821 * @param method where to store the property value, must be a pointer
822 * to string (const char **), it will not be allocated or
823 * copied and references will be valid until element changes,
824 * so copy it if you want to use it later.
826 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
829 e_connman_service_ipv4_method_get(const E_Connman_Element *service, const char **method)
831 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
832 EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
833 return e_connman_element_property_dict_get_stringshared
834 (service, e_connman_prop_ipv4, e_connman_prop_method, NULL, method);
838 * Get property "IPv4.Address" value.
840 * If this property isn't found then @c EINA_FALSE is returned.
841 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
842 * values shall be considered invalid.
844 * The current IPv4 address.
846 * @param service path to get property.
847 * @param address where to store the property value, must be a pointer
848 * to string (const char **), it will not be allocated or
849 * copied and references will be valid until element changes,
850 * so copy it if you want to use it later.
852 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
855 e_connman_service_ipv4_address_get(const E_Connman_Element *service, const char **address)
857 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
858 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
859 return e_connman_element_property_dict_get_stringshared
860 (service, e_connman_prop_ipv4, e_connman_prop_address, NULL, address);
864 * Get property "IPv4.Gateway" value.
866 * If this property isn't found then @c EINA_FALSE is returned.
867 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
868 * values shall be considered invalid.
870 * The current IPv4 gateway.
872 * @param service path to get property.
873 * @param gateway where to store the property value, must be a pointer
874 * to string (const char **), it will not be allocated or
875 * copied and references will be valid until element changes,
876 * so copy it if you want to use it later.
878 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
881 e_connman_service_ipv4_gateway_get(const E_Connman_Element *service, const char **gateway)
883 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
884 EINA_SAFETY_ON_NULL_RETURN_VAL(gateway, EINA_FALSE);
885 return e_connman_element_property_dict_get_stringshared
886 (service, e_connman_prop_ipv4, e_connman_prop_gateway, NULL, gateway);
890 * Get property "IPv4.Netmask" value.
892 * If this property isn't found then @c EINA_FALSE is returned.
893 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
894 * values shall be considered invalid.
896 * The current IPv4 netmask.
898 * @param service path to get property.
899 * @param netmask where to store the property value, must be a pointer
900 * to string (const char **), it will not be allocated or
901 * copied and references will be valid until element changes,
902 * so copy it if you want to use it later.
904 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
907 e_connman_service_ipv4_netmask_get(const E_Connman_Element *service, const char **netmask)
909 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
910 EINA_SAFETY_ON_NULL_RETURN_VAL(netmask, EINA_FALSE);
911 return e_connman_element_property_dict_get_stringshared
912 (service, e_connman_prop_ipv4, e_connman_prop_netmask, NULL, netmask);
916 * Get property "IPv4.Configuration.Method" value.
918 * Unlike IPv4.Method, this is the user-set value, rather than the
921 * If this property isn't found then @c EINA_FALSE is returned.
922 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
923 * values shall be considered invalid.
925 * The IPv4 configured method. Possible values here are "dhcp" and
928 * @param service path to get property.
929 * @param method where to store the property value, must be a pointer
930 * to string (const char **), it will not be allocated or
931 * copied and references will be valid until element changes,
932 * so copy it if you want to use it later.
934 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
937 e_connman_service_ipv4_configuration_method_get(const E_Connman_Element *service, const char **method)
939 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
940 EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
941 return e_connman_element_property_dict_get_stringshared
942 (service, e_connman_prop_ipv4_configuration, e_connman_prop_method,
947 * Get property "IPv4.Configuration.Address" value.
949 * Unlike IPv4.Address, this is the user-set value, rather than the
952 * If this property isn't found then @c EINA_FALSE is returned.
953 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
954 * values shall be considered invalid.
956 * The current configured IPv4 address.
958 * @param service path to get property.
959 * @param address where to store the property value, must be a pointer
960 * to string (const char **), it will not be allocated or
961 * copied and references will be valid until element changes,
962 * so copy it if you want to use it later.
964 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
967 e_connman_service_ipv4_configuration_address_get(const E_Connman_Element *service, const char **address)
969 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
970 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
971 return e_connman_element_property_dict_get_stringshared
972 (service, e_connman_prop_ipv4_configuration, e_connman_prop_address,
977 * Get property "IPv4.Configuration.Gateway" value.
979 * Unlike IPv4.Gateway, this is the user-set value, rather than the
982 * If this property isn't found then @c EINA_FALSE is returned.
983 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
984 * values shall be considered invalid.
986 * The current configured IPv4 gateway.
988 * @param service path to get property.
989 * @param gateway where to store the property value, must be a pointer
990 * to string (const char **), it will not be allocated or
991 * copied and references will be valid until element changes,
992 * so copy it if you want to use it later.
994 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
997 e_connman_service_ipv4_configuration_gateway_get(const E_Connman_Element *service, const char **gateway)
999 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1000 EINA_SAFETY_ON_NULL_RETURN_VAL(gateway, EINA_FALSE);
1001 return e_connman_element_property_dict_get_stringshared
1002 (service, e_connman_prop_ipv4_configuration, e_connman_prop_gateway,
1007 * Get property "IPv4.Configuration.Netmask" value.
1009 * Unlike IPv4.Netmask, this is the user-set value, rather than the
1012 * If this property isn't found then @c EINA_FALSE is returned.
1013 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1014 * values shall be considered invalid.
1016 * The current configured IPv4 netmask.
1018 * @param service path to get property.
1019 * @param netmask where to store the property value, must be a pointer
1020 * to string (const char **), it will not be allocated or
1021 * copied and references will be valid until element changes,
1022 * so copy it if you want to use it later.
1024 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1027 e_connman_service_ipv4_configuration_netmask_get(const E_Connman_Element *service, const char **netmask)
1029 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1030 EINA_SAFETY_ON_NULL_RETURN_VAL(netmask, EINA_FALSE);
1031 return e_connman_element_property_dict_get_stringshared
1032 (service, e_connman_prop_ipv4_configuration, e_connman_prop_netmask,
1037 * Set IPv4 to connect automatically using DHCP.
1039 * @param service path to set.
1040 * @param cb function to call when server replies or some error happens.
1041 * @param data data to give to cb when it is called.
1043 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1046 e_connman_service_ipv4_configure_dhcp(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data)
1048 const char method[] = "dhcp";
1049 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1050 return e_connman_element_property_dict_set_full
1051 (service, e_connman_prop_ipv4_configuration, e_connman_prop_method,
1052 DBUS_TYPE_STRING, method, cb, data);
1056 * Set IPv4 to connect using manually set parameters.
1058 * @param service path to set.
1059 * @param address IPv4 address.
1060 * @param netmask IPv4 netmask, or @c NULL for "/32".
1061 * @param gateway IPv4 gateway address.
1062 * @param cb function to call when server replies or some error happens.
1063 * @param data data to give to cb when it is called.
1065 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1068 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)
1070 const char name[] = "SetProperty";
1071 const char *method = "manual"; /* not method[] as gcc screws it with dbus */
1073 DBusMessageIter itr, variant, dict, entry;
1075 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1076 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
1078 msg = dbus_message_new_method_call
1079 (e_connman_system_bus_name_get(), service->path, service->interface, name);
1084 dbus_message_iter_init_append(msg, &itr);
1085 dbus_message_iter_append_basic
1086 (&itr, DBUS_TYPE_STRING, &e_connman_prop_ipv4_configuration);
1088 dbus_message_iter_open_container
1089 (&itr, DBUS_TYPE_VARIANT,
1090 (DBUS_TYPE_ARRAY_AS_STRING
1091 DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
1092 DBUS_TYPE_STRING_AS_STRING
1093 DBUS_TYPE_STRING_AS_STRING
1094 DBUS_DICT_ENTRY_END_CHAR_AS_STRING),
1096 dbus_message_iter_open_container
1097 (&variant, DBUS_TYPE_ARRAY,
1098 (DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
1099 DBUS_TYPE_STRING_AS_STRING
1100 DBUS_TYPE_STRING_AS_STRING
1101 DBUS_DICT_ENTRY_END_CHAR_AS_STRING),
1104 dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1105 dbus_message_iter_append_basic
1106 (&entry, DBUS_TYPE_STRING, &e_connman_prop_method);
1107 dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &method);
1108 dbus_message_iter_close_container(&dict, &entry);
1110 dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1111 dbus_message_iter_append_basic
1112 (&entry, DBUS_TYPE_STRING, &e_connman_prop_address);
1113 dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &address);
1114 dbus_message_iter_close_container(&dict, &entry);
1118 dbus_message_iter_open_container
1119 (&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1120 dbus_message_iter_append_basic
1121 (&entry, DBUS_TYPE_STRING, &e_connman_prop_netmask);
1122 dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &netmask);
1123 dbus_message_iter_close_container(&dict, &entry);
1128 dbus_message_iter_open_container
1129 (&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1130 dbus_message_iter_append_basic
1131 (&entry, DBUS_TYPE_STRING, &e_connman_prop_gateway);
1132 dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &gateway);
1133 dbus_message_iter_close_container(&dict, &entry);
1136 dbus_message_iter_close_container(&variant, &dict);
1137 dbus_message_iter_close_container(&itr, &variant);
1139 return e_connman_element_message_send
1140 (service, name, NULL, msg, &service->_pending.property_set, cb, data);
1144 * Get property "Ethernet.Method" value.
1146 * If this property isn't found then @c EINA_FALSE is returned.
1147 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1148 * values shall be considered invalid.
1150 * The Ethernet configuration method. Possible values here "auto" and "manual".
1152 * @param service path to get property.
1153 * @param method where to store the property value, must be a pointer
1154 * to string (const char **), it will not be allocated or
1155 * copied and references will be valid until element changes,
1156 * so copy it if you want to use it later.
1158 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1161 e_connman_service_ethernet_method_get(const E_Connman_Element *service, const char **method)
1163 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1164 EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
1165 return e_connman_element_property_dict_get_stringshared
1166 (service, e_connman_prop_ethernet, e_connman_prop_method, NULL, method);
1170 * Get property "Ethernet.Interface" value.
1172 * If this property isn't found then @c EINA_FALSE is returned.
1173 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1174 * values shall be considered invalid.
1176 * Interface name (for example eth0).
1178 * @param service path to get property.
1179 * @param iface where to store the property value, must be a pointer
1180 * to string (const char **), it will not be allocated or
1181 * copied and references will be valid until element changes,
1182 * so copy it if you want to use it later.
1184 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1187 e_connman_service_ethernet_interface_get(const E_Connman_Element *service, const char **iface)
1189 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1190 EINA_SAFETY_ON_NULL_RETURN_VAL(iface, EINA_FALSE);
1191 return e_connman_element_property_dict_get_stringshared
1192 (service, e_connman_prop_ethernet, e_connman_prop_interface, NULL, iface);
1196 * Get property "Ethernet.Speed" value.
1198 * If this property isn't found then @c EINA_FALSE is returned.
1199 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1200 * values shall be considered invalid.
1202 * Selected speed of the line. This information might not always be available.
1204 * @param service path to get property.
1205 * @param speed where to store the property value.
1207 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1210 e_connman_service_ethernet_speed_get(const E_Connman_Element *service, unsigned short *speed)
1212 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1213 EINA_SAFETY_ON_NULL_RETURN_VAL(speed, EINA_FALSE);
1214 return e_connman_element_property_dict_get_stringshared
1215 (service, e_connman_prop_ethernet, e_connman_prop_speed, NULL, speed);
1219 * Get property "Ethernet.Address" value.
1221 * If this property isn't found then @c EINA_FALSE is returned.
1222 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1223 * values shall be considered invalid.
1225 * The current configured Ethernet address (mac-address).
1227 * @param service path to get property.
1228 * @param address where to store the property value, must be a pointer
1229 * to string (const char **), it will not be allocated or
1230 * copied and references will be valid until element changes,
1231 * so copy it if you want to use it later.
1233 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1236 e_connman_service_ethernet_address_get(const E_Connman_Element *service, const char **address)
1238 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1239 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
1240 return e_connman_element_property_dict_get_stringshared
1241 (service, e_connman_prop_ethernet, e_connman_prop_address, NULL, address);
1245 * Get property "Ethernet.Duplex" value.
1247 * If this property isn't found then @c EINA_FALSE is returned.
1248 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1249 * values shall be considered invalid.
1251 * Selected duplex settings of the line. Possible values are "half" and "full".
1252 * This information might not always be available.
1254 * @param service path to get property.
1255 * @param duplex where to store the property value, must be a pointer
1256 * to string (const char **), it will not be allocated or
1257 * copied and references will be valid until element changes,
1258 * so copy it if you want to use it later.
1260 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1263 e_connman_service_ethernet_duplex_get(const E_Connman_Element *service, const char **duplex)
1265 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1266 EINA_SAFETY_ON_NULL_RETURN_VAL(duplex, EINA_FALSE);
1267 return e_connman_element_property_dict_get_stringshared
1268 (service, e_connman_prop_ethernet, e_connman_prop_duplex, NULL, duplex);
1272 * Get property "Ethernet.MTU" value.
1274 * If this property isn't found then @c EINA_FALSE is returned.
1275 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1276 * values shall be considered invalid.
1278 * The current configured Ethernet MTU.
1280 * @param service path to get property.
1281 * @param gateway where to store the property value, must be a pointer
1282 * to string (const char **), it will not be allocated or
1283 * copied and references will be valid until element changes,
1284 * so copy it if you want to use it later.
1286 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1289 e_connman_service_ethernet_mtu_get(const E_Connman_Element *service, unsigned short *mtu)
1291 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1292 EINA_SAFETY_ON_NULL_RETURN_VAL(mtu, EINA_FALSE);
1293 return e_connman_element_property_dict_get_stringshared
1294 (service, e_connman_prop_ethernet, e_connman_prop_mtu, NULL, mtu);