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 security method or key
373 * management setting.
375 * Possible values are "none", "wep", "wpa" and "rsn".
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 string (const char **), it will not be allocated or
383 * copied and references will be valid until element changes,
384 * so copy it if you want to use it later.
386 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
389 e_connman_service_security_get(const E_Connman_Element *service, const char **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 "Strength" 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 the signal strength of the service. This
503 * is a normalized value between 0 and 100.
505 * This property will not be present for Ethernet
508 * @param service path to get property.
509 * @param strength where to store the property value, must be a pointer
510 * to byte (unsigned char*).
512 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
515 e_connman_service_strength_get(const E_Connman_Element *service, unsigned char *strength)
517 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
518 EINA_SAFETY_ON_NULL_RETURN_VAL(strength, EINA_FALSE);
519 return e_connman_element_property_get_stringshared
520 (service, e_connman_prop_strength, NULL, strength);
524 * Get property "Favorite" value.
526 * If this property isn't found then @c EINA_FALSE is returned.
527 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
528 * values shall be considered invalid.
530 * Will be true if a cable is plugged in or the user
531 * selected and successfully connected to this service.
533 * This value is automatically changed and to revert
534 * it back to false the Remove() method needs to be
537 * @param service path to get property.
538 * @param favorite where to store the property value, must be a
539 * pointer to Eina_Bool (Eina_Bool *).
541 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
544 e_connman_service_favorite_get(const E_Connman_Element *service, Eina_Bool *favorite)
546 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
547 EINA_SAFETY_ON_NULL_RETURN_VAL(favorite, EINA_FALSE);
548 return e_connman_element_property_get_stringshared
549 (service, e_connman_prop_favorite, NULL, favorite);
553 * Get property "Immutable" value.
555 * This value will be set to true if the service is configured
556 * externally via a configuration file.
558 * The only valid operation are e_connman_service_connect() and
559 * e_connman_service_disconnect(). The e_connman_service_remove()
560 * method will result in an error.
562 * @param service path to get property.
563 * @param immutable where to store the property value, must be a
564 * pointer to Eina_Bool (Eina_Bool *).
566 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
569 e_connman_service_immutable_get(const E_Connman_Element *service, Eina_Bool *immutable)
571 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
572 EINA_SAFETY_ON_NULL_RETURN_VAL(immutable, EINA_FALSE);
573 return e_connman_element_property_get_stringshared
574 (service, e_connman_prop_immutable, NULL, immutable);
578 * Get property "AutoConnect" value.
580 * If this property isn't found then @c EINA_FALSE is returned.
581 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
582 * values shall be considered invalid.
584 * If set to true, this service will auto-connect
585 * when not other connection is available.
587 * For favorite services it is possible to change
588 * this value to prevent or permit automatic
589 * connection attempts.
591 * @param service path to get property.
592 * @param auto_connect where to store the property value, must be a
593 * pointer to Eina_Bool (Eina_Bool *).
595 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
596 * @see e_connman_service_auto_connect_set()
599 e_connman_service_auto_connect_get(const E_Connman_Element *service, Eina_Bool *auto_connect)
601 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
602 EINA_SAFETY_ON_NULL_RETURN_VAL(auto_connect, EINA_FALSE);
603 return e_connman_element_property_get_stringshared
604 (service, e_connman_prop_auto_connect, NULL, auto_connect);
608 * Set property "AutoConnect" value.
610 * If this property isn't found then @c EINA_FALSE is returned.
611 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
612 * values shall be considered invalid.
614 * If set to true, this service will auto-connect
615 * when not other connection is available.
617 * For favorite services it is possible to change
618 * this value to prevent or permit automatic
619 * connection attempts.
621 * @param service path to get property.
622 * @param service_favorite where to store the property value, must be a
623 * pointer to Eina_Bool (Eina_Bool *).
625 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
626 * @see e_connman_service_auto_connect_get()
629 e_connman_service_auto_connect_set(E_Connman_Element *service, Eina_Bool auto_connect, E_DBus_Method_Return_Cb cb, const void *data)
631 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
632 return e_connman_element_property_set_full
633 (service, e_connman_prop_auto_connect, DBUS_TYPE_BOOLEAN, &auto_connect, cb, data);
637 * Get property "SetupRequired" value.
639 * If this property isn't found then @c EINA_FALSE is returned.
640 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
641 * values shall be considered invalid.
643 * If the service is Cellular, then this property
644 * indicates that some extra setup steps are required.
646 * In most cases it is required to fill in the APN
649 * @param service path to get property.
650 * @param setup_required where to store the property value, must be a
651 * pointer to Eina_Bool (Eina_Bool *).
653 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
656 e_connman_service_setup_required_get(const E_Connman_Element *service, Eina_Bool *setup_required)
658 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
659 EINA_SAFETY_ON_NULL_RETURN_VAL(setup_required, EINA_FALSE);
660 return e_connman_element_property_get_stringshared
661 (service, e_connman_prop_setup_required, NULL, setup_required);
665 * Get property "APN" value.
667 * If this property isn't found then @c EINA_FALSE is returned.
668 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
669 * values shall be considered invalid.
671 * If the service is Cellular, then this property
672 * contains the APN details.
674 * The APN is network provider specific and even
675 * sometimes data plan specific. Possible examples
676 * are "isp.cingular" or "internet.t-mobile".
678 * This property might also not always be included
679 * since it is protected by a different security policy.
681 * @param service path to get property.
682 * @param apn where to store the property value, must be a pointer
683 * to string (const char **), it will not be allocated or
684 * copied and references will be valid until element changes,
685 * so copy it if you want to use it later.
687 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
688 * @see e_connman_service_apn_set()
691 e_connman_service_apn_get(const E_Connman_Element *service, const char **apn)
693 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
694 EINA_SAFETY_ON_NULL_RETURN_VAL(apn, EINA_FALSE);
695 return e_connman_element_property_get_stringshared
696 (service, e_connman_prop_apn, NULL, apn);
700 * Set property "APN" value.
702 * If this property isn't found then @c EINA_FALSE is returned.
703 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
704 * values shall be considered invalid.
706 * If the service is Cellular, then this property
707 * contains the APN details.
709 * The APN is network provider specific and even
710 * sometimes data plan specific. Possible examples
711 * are "isp.cingular" or "internet.t-mobile".
713 * This property might also not always be included
714 * since it is protected by a different security policy.
716 * @param service path to get property.
717 * @param passphrase value to set.
718 * @param cb function to call when server replies or some error happens.
719 * @param data data to give to cb when it is called.
721 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
722 * @see e_connman_service_apn_get()
725 e_connman_service_apn_set(E_Connman_Element *service, const char *apn, E_DBus_Method_Return_Cb cb, const void *data)
727 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
728 return e_connman_element_property_set_full
729 (service, e_connman_prop_apn, DBUS_TYPE_STRING,
734 * Get property "MCC" value.
736 * If this property isn't found then @c EINA_FALSE is returned.
737 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
738 * values shall be considered invalid.
740 * If the service is Cellular, then this property
741 * contains the Mobile Country Code.
743 * @param service path to get property.
744 * @param mcc where to store the property value, must be a pointer
745 * to string (const char **), it will not be allocated or
746 * copied and references will be valid until element changes,
747 * so copy it if you want to use it later.
749 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
752 e_connman_service_mcc_get(const E_Connman_Element *service, const char **mcc)
754 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
755 EINA_SAFETY_ON_NULL_RETURN_VAL(mcc, EINA_FALSE);
756 return e_connman_element_property_get_stringshared
757 (service, e_connman_prop_mcc, NULL, mcc);
761 * Get property "MNC" value.
763 * If this property isn't found then @c EINA_FALSE is returned.
764 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
765 * values shall be considered invalid.
767 * If the service is Cellular, then this property
768 * contains the Mobile Network Code.
770 * @param service path to get property.
771 * @param mnc where to store the property value, must be a pointer
772 * to string (const char **), it will not be allocated or
773 * copied and references will be valid until element changes,
774 * so copy it if you want to use it later.
776 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
779 e_connman_service_mnc_get(const E_Connman_Element *service, const char **mnc)
781 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
782 EINA_SAFETY_ON_NULL_RETURN_VAL(mnc, EINA_FALSE);
783 return e_connman_element_property_get_stringshared
784 (service, e_connman_prop_mnc, NULL, mnc);
788 * Get property "Roaming" value.
790 * If this property isn't found then @c EINA_FALSE is returned.
791 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
792 * values shall be considered invalid.
794 * This property indicates if this service is roaming.
796 * In the case of Cellular services this normally
797 * indicates connections to a foreign provider when
800 * @param service path to get property.
801 * @param roaming where to store the property value, must be a
802 * pointer to Eina_Bool (Eina_Bool *).
804 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
807 e_connman_service_roaming_get(const E_Connman_Element *service, Eina_Bool *roaming)
809 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
810 EINA_SAFETY_ON_NULL_RETURN_VAL(roaming, EINA_FALSE);
811 return e_connman_element_property_get_stringshared
812 (service, e_connman_prop_roaming, NULL, roaming);
816 * Get property "IPv4.Method" value.
818 * If this property isn't found then @c EINA_FALSE is returned.
819 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
820 * values shall be considered invalid.
822 * The IPv4 method in use. Possible values here are "dhcp" and
825 * @param service path to get property.
826 * @param method where to store the property value, must be a pointer
827 * to string (const char **), it will not be allocated or
828 * copied and references will be valid until element changes,
829 * so copy it if you want to use it later.
831 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
834 e_connman_service_ipv4_method_get(const E_Connman_Element *service, const char **method)
836 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
837 EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
838 return e_connman_element_property_dict_get_stringshared
839 (service, e_connman_prop_ipv4, e_connman_prop_method, NULL, method);
843 * Get property "IPv4.Address" value.
845 * If this property isn't found then @c EINA_FALSE is returned.
846 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
847 * values shall be considered invalid.
849 * The current IPv4 address.
851 * @param service path to get property.
852 * @param address where to store the property value, must be a pointer
853 * to string (const char **), it will not be allocated or
854 * copied and references will be valid until element changes,
855 * so copy it if you want to use it later.
857 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
860 e_connman_service_ipv4_address_get(const E_Connman_Element *service, const char **address)
862 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
863 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
864 return e_connman_element_property_dict_get_stringshared
865 (service, e_connman_prop_ipv4, e_connman_prop_address, NULL, address);
869 * Get property "IPv4.Gateway" value.
871 * If this property isn't found then @c EINA_FALSE is returned.
872 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
873 * values shall be considered invalid.
875 * The current IPv4 gateway.
877 * @param service path to get property.
878 * @param gateway where to store the property value, must be a pointer
879 * to string (const char **), it will not be allocated or
880 * copied and references will be valid until element changes,
881 * so copy it if you want to use it later.
883 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
886 e_connman_service_ipv4_gateway_get(const E_Connman_Element *service, const char **gateway)
888 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
889 EINA_SAFETY_ON_NULL_RETURN_VAL(gateway, EINA_FALSE);
890 return e_connman_element_property_dict_get_stringshared
891 (service, e_connman_prop_ipv4, e_connman_prop_gateway, NULL, gateway);
895 * Get property "IPv4.Netmask" value.
897 * If this property isn't found then @c EINA_FALSE is returned.
898 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
899 * values shall be considered invalid.
901 * The current IPv4 netmask.
903 * @param service path to get property.
904 * @param netmask where to store the property value, must be a pointer
905 * to string (const char **), it will not be allocated or
906 * copied and references will be valid until element changes,
907 * so copy it if you want to use it later.
909 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
912 e_connman_service_ipv4_netmask_get(const E_Connman_Element *service, const char **netmask)
914 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
915 EINA_SAFETY_ON_NULL_RETURN_VAL(netmask, EINA_FALSE);
916 return e_connman_element_property_dict_get_stringshared
917 (service, e_connman_prop_ipv4, e_connman_prop_netmask, NULL, netmask);
921 * Get property "IPv4.Configuration.Method" value.
923 * Unlike IPv4.Method, this is the user-set value, rather than the
926 * If this property isn't found then @c EINA_FALSE is returned.
927 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
928 * values shall be considered invalid.
930 * The IPv4 configured method. Possible values here are "dhcp" and
933 * @param service path to get property.
934 * @param method where to store the property value, must be a pointer
935 * to string (const char **), it will not be allocated or
936 * copied and references will be valid until element changes,
937 * so copy it if you want to use it later.
939 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
942 e_connman_service_ipv4_configuration_method_get(const E_Connman_Element *service, const char **method)
944 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
945 EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
946 return e_connman_element_property_dict_get_stringshared
947 (service, e_connman_prop_ipv4_configuration, e_connman_prop_method,
952 * Get property "IPv4.Configuration.Address" value.
954 * Unlike IPv4.Address, 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 current configured IPv4 address.
963 * @param service path to get property.
964 * @param address where to store the property value, must be a pointer
965 * to string (const char **), it will not be allocated or
966 * copied and references will be valid until element changes,
967 * so copy it if you want to use it later.
969 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
972 e_connman_service_ipv4_configuration_address_get(const E_Connman_Element *service, const char **address)
974 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
975 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
976 return e_connman_element_property_dict_get_stringshared
977 (service, e_connman_prop_ipv4_configuration, e_connman_prop_address,
982 * Get property "IPv4.Configuration.Gateway" value.
984 * Unlike IPv4.Gateway, this is the user-set value, rather than the
987 * If this property isn't found then @c EINA_FALSE is returned.
988 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
989 * values shall be considered invalid.
991 * The current configured IPv4 gateway.
993 * @param service path to get property.
994 * @param gateway where to store the property value, must be a pointer
995 * to string (const char **), it will not be allocated or
996 * copied and references will be valid until element changes,
997 * so copy it if you want to use it later.
999 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1002 e_connman_service_ipv4_configuration_gateway_get(const E_Connman_Element *service, const char **gateway)
1004 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1005 EINA_SAFETY_ON_NULL_RETURN_VAL(gateway, EINA_FALSE);
1006 return e_connman_element_property_dict_get_stringshared
1007 (service, e_connman_prop_ipv4_configuration, e_connman_prop_gateway,
1012 * Get property "IPv4.Configuration.Netmask" value.
1014 * Unlike IPv4.Netmask, this is the user-set value, rather than the
1017 * If this property isn't found then @c EINA_FALSE is returned.
1018 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1019 * values shall be considered invalid.
1021 * The current configured IPv4 netmask.
1023 * @param service path to get property.
1024 * @param netmask where to store the property value, must be a pointer
1025 * to string (const char **), it will not be allocated or
1026 * copied and references will be valid until element changes,
1027 * so copy it if you want to use it later.
1029 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1032 e_connman_service_ipv4_configuration_netmask_get(const E_Connman_Element *service, const char **netmask)
1034 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1035 EINA_SAFETY_ON_NULL_RETURN_VAL(netmask, EINA_FALSE);
1036 return e_connman_element_property_dict_get_stringshared
1037 (service, e_connman_prop_ipv4_configuration, e_connman_prop_netmask,
1042 * Set IPv4 to connect automatically using DHCP.
1044 * @param service path to set.
1045 * @param cb function to call when server replies or some error happens.
1046 * @param data data to give to cb when it is called.
1048 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1051 e_connman_service_ipv4_configure_dhcp(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data)
1053 const char method[] = "dhcp";
1054 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1055 return e_connman_element_property_dict_set_full
1056 (service, e_connman_prop_ipv4_configuration, e_connman_prop_method,
1057 DBUS_TYPE_STRING, method, cb, data);
1061 * Set IPv4 to connect using manually set parameters.
1063 * @param service path to set.
1064 * @param address IPv4 address.
1065 * @param netmask IPv4 netmask, or @c NULL for "/32".
1066 * @param gateway IPv4 gateway address.
1067 * @param cb function to call when server replies or some error happens.
1068 * @param data data to give to cb when it is called.
1070 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1073 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)
1075 const char name[] = "SetProperty";
1076 const char *method = "manual"; /* not method[] as gcc screws it with dbus */
1078 DBusMessageIter itr, variant, dict, entry;
1080 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1081 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
1083 msg = dbus_message_new_method_call
1084 (e_connman_system_bus_name_get(), service->path, service->interface, name);
1089 dbus_message_iter_init_append(msg, &itr);
1090 dbus_message_iter_append_basic
1091 (&itr, DBUS_TYPE_STRING, &e_connman_prop_ipv4_configuration);
1093 dbus_message_iter_open_container
1094 (&itr, DBUS_TYPE_VARIANT,
1095 (DBUS_TYPE_ARRAY_AS_STRING
1096 DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
1097 DBUS_TYPE_STRING_AS_STRING
1098 DBUS_TYPE_STRING_AS_STRING
1099 DBUS_DICT_ENTRY_END_CHAR_AS_STRING),
1101 dbus_message_iter_open_container
1102 (&variant, DBUS_TYPE_ARRAY,
1103 (DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
1104 DBUS_TYPE_STRING_AS_STRING
1105 DBUS_TYPE_STRING_AS_STRING
1106 DBUS_DICT_ENTRY_END_CHAR_AS_STRING),
1109 dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1110 dbus_message_iter_append_basic
1111 (&entry, DBUS_TYPE_STRING, &e_connman_prop_method);
1112 dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &method);
1113 dbus_message_iter_close_container(&dict, &entry);
1115 dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1116 dbus_message_iter_append_basic
1117 (&entry, DBUS_TYPE_STRING, &e_connman_prop_address);
1118 dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &address);
1119 dbus_message_iter_close_container(&dict, &entry);
1123 dbus_message_iter_open_container
1124 (&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1125 dbus_message_iter_append_basic
1126 (&entry, DBUS_TYPE_STRING, &e_connman_prop_netmask);
1127 dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &netmask);
1128 dbus_message_iter_close_container(&dict, &entry);
1133 dbus_message_iter_open_container
1134 (&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
1135 dbus_message_iter_append_basic
1136 (&entry, DBUS_TYPE_STRING, &e_connman_prop_gateway);
1137 dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &gateway);
1138 dbus_message_iter_close_container(&dict, &entry);
1141 dbus_message_iter_close_container(&variant, &dict);
1142 dbus_message_iter_close_container(&itr, &variant);
1144 return e_connman_element_message_send
1145 (service, name, NULL, msg, &service->_pending.property_set, cb, data);
1149 * Get property "Ethernet.Method" value.
1151 * If this property isn't found then @c EINA_FALSE is returned.
1152 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1153 * values shall be considered invalid.
1155 * The Ethernet configuration method. Possible values here "auto".
1157 * @param service path to get property.
1158 * @param method where to store the property value, must be a pointer
1159 * to string (const char **), it will not be allocated or
1160 * copied and references will be valid until element changes,
1161 * so copy it if you want to use it later.
1163 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1166 e_connman_service_ethernet_method_get(const E_Connman_Element *service, const char **method)
1168 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1169 EINA_SAFETY_ON_NULL_RETURN_VAL(method, EINA_FALSE);
1170 return e_connman_element_property_dict_get_stringshared
1171 (service, e_connman_prop_ethernet, e_connman_prop_method, NULL, method);
1175 * Get property "Ethernet.Address" value.
1177 * If this property isn't found then @c EINA_FALSE is returned.
1178 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1179 * values shall be considered invalid.
1181 * The current configured Ethernet address (mac-address).
1183 * @param service path to get property.
1184 * @param address where to store the property value, must be a pointer
1185 * to string (const char **), it will not be allocated or
1186 * copied and references will be valid until element changes,
1187 * so copy it if you want to use it later.
1189 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1192 e_connman_service_ethernet_address_get(const E_Connman_Element *service, const char **address)
1194 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1195 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINA_FALSE);
1196 return e_connman_element_property_dict_get_stringshared
1197 (service, e_connman_prop_ethernet, e_connman_prop_address, NULL, address);
1201 * Get property "Ethernet.MTU" value.
1203 * If this property isn't found then @c EINA_FALSE is returned.
1204 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1205 * values shall be considered invalid.
1207 * The current configured Ethernet MTU.
1209 * @param service path to get property.
1210 * @param gateway where to store the property value, must be a pointer
1211 * to string (const char **), it will not be allocated or
1212 * copied and references will be valid until element changes,
1213 * so copy it if you want to use it later.
1215 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1218 e_connman_service_ethernet_mtu_get(const E_Connman_Element *service, unsigned short *mtu)
1220 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1221 EINA_SAFETY_ON_NULL_RETURN_VAL(mtu, EINA_FALSE);
1222 return e_connman_element_property_dict_get_stringshared
1223 (service, e_connman_prop_ethernet, e_connman_prop_mtu, NULL, mtu);
1227 * Get property "Ethernet.Netmask" value.
1229 * If this property isn't found then @c EINA_FALSE is returned.
1230 * If @c EINA_FALSE is returned, then this call failed and parameter-returned
1231 * values shall be considered invalid.
1233 * The current configured Ethernet netmask.
1235 * @param service path to get property.
1236 * @param netmask where to store the property value, must be a pointer
1237 * to string (const char **), it will not be allocated or
1238 * copied and references will be valid until element changes,
1239 * so copy it if you want to use it later.
1241 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
1244 e_connman_service_ethernet_netmask_get(const E_Connman_Element *service, const char **netmask)
1246 EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
1247 EINA_SAFETY_ON_NULL_RETURN_VAL(netmask, EINA_FALSE);
1248 return e_connman_element_property_dict_get_stringshared
1249 (service, e_connman_prop_ethernet, e_connman_prop_netmask, NULL, netmask);