service's "immutable" property.
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 30 Dec 2009 18:09:39 +0000 (18:09 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 30 Dec 2009 18:09:39 +0000 (18:09 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/e_dbus@44799 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/e_dbus_connman_test.c
src/bin/e_dbus_connman_test_api.c
src/lib/connman/E_Connman.h
src/lib/connman/e_connman.c
src/lib/connman/e_connman_private.h
src/lib/connman/e_connman_service.c

index faec9c3..a53f52e 100644 (file)
@@ -1296,6 +1296,29 @@ _on_cmd_service_get_favorite(char *cmd, char *args)
 }
 
 static int
+_on_cmd_service_get_immutable(char *cmd, char *args)
+{
+   const char *path;
+   bool immutable;
+   E_Connman_Element *e;
+
+   if (!args)
+     {
+       fputs("ERROR: missing the service path\n", stderr);
+       return 1;
+     }
+   _tok(args);
+   path = args;
+
+   e = e_connman_service_get(path);
+   if (e_connman_service_immutable_get(e, &immutable))
+     printf(":::Service %s Immutable = %hhu\n", path, immutable);
+   else
+     fputs("ERROR: can't get service immutable\n", stderr);
+   return 1;
+}
+
+static int
 _on_cmd_service_get_auto_connect(char *cmd, char *args)
 {
    const char *path;
@@ -1597,6 +1620,7 @@ _on_input(void *data, Ecore_Fd_Handler *fd_handler)
      {"service_get_passphrase_required", _on_cmd_service_get_passphrase_required},
      {"service_get_strength", _on_cmd_service_get_strength},
      {"service_get_favorite", _on_cmd_service_get_favorite},
+     {"service_get_immutable", _on_cmd_service_get_immutable},
      {"service_get_auto_connect", _on_cmd_service_get_auto_connect},
      {"service_set_auto_connect", _on_cmd_service_set_auto_connect},
      {"service_get_setup_required", _on_cmd_service_get_setup_required},
index 51efa95..2e3f704 100644 (file)
@@ -356,7 +356,7 @@ static const struct test_desc test_desc_device[] = {
 };
 
 static const struct test_desc test_desc_profile[] = {
-  TEST_DESC_STRING_GET(e_connman_profile_name_get, 0),
+  TEST_DESC_STRING_GET(e_connman_profile_name_get, 1),
   TEST_DESC_BOOL_GET(e_connman_profile_offline_mode_get, 0),
   //TEST_DESC_BOOL_SET(e_connman_profile_offline_mode_set, 0),
   TEST_DESC_ELEMENTS_GET(e_connman_profile_services_get, 1),
@@ -379,16 +379,17 @@ static const struct test_desc test_desc_service[] = {
   /* TODO: need to check exactly what properties may fail */
   TEST_DESC_STRING_GET(e_connman_service_state_get, 1),
   TEST_DESC_STRING_GET(e_connman_service_error_get, 1),
-  TEST_DESC_STRING_GET(e_connman_service_name_get, 1),
-  TEST_DESC_STRING_GET(e_connman_service_type_get, 1),
+  TEST_DESC_STRING_GET(e_connman_service_name_get, 0),
+  TEST_DESC_STRING_GET(e_connman_service_type_get, 0),
   TEST_DESC_STRING_GET(e_connman_service_mode_get, 1),
   TEST_DESC_STRING_GET(e_connman_service_security_get, 1),
   TEST_DESC_STRING_GET(e_connman_service_passphrase_get, 1),
   //TEST_DESC_STRING_SET(e_connman_service_passphrase_set, 1),
   TEST_DESC_BOOL_GET(e_connman_service_passphrase_required_get, 1),
   TEST_DESC_UCHAR_GET(e_connman_service_strength_get, 1),
-  TEST_DESC_BOOL_GET(e_connman_service_favorite_get, 1),
-  TEST_DESC_BOOL_GET(e_connman_service_auto_connect_get, 1),
+  TEST_DESC_BOOL_GET(e_connman_service_favorite_get, 0),
+  TEST_DESC_BOOL_GET(e_connman_service_immutable_get, 0),
+  TEST_DESC_BOOL_GET(e_connman_service_auto_connect_get, 0),
   //TEST_DESC_BOOL_SET(e_connman_service_auto_connect_set, 1),
   TEST_DESC_BOOL_GET(e_connman_service_setup_required_get, 1),
   TEST_DESC_STRING_GET(e_connman_service_apn_get, 1),
index a8d022b..7100caf 100644 (file)
@@ -151,6 +151,8 @@ extern "C" {
 
   EAPI bool e_connman_service_favorite_get(const E_Connman_Element *service, bool *favorite) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
 
+  EAPI bool e_connman_service_immutable_get(const E_Connman_Element *service, bool *immutable) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
+
   EAPI bool e_connman_service_auto_connect_get(const E_Connman_Element *service, bool *auto_connect) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
   EAPI bool e_connman_service_auto_connect_set(E_Connman_Element *service, bool auto_connect, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
 
@@ -169,7 +171,6 @@ extern "C" {
 
   EAPI bool e_connman_service_ipv4_address_get(const E_Connman_Element *service, const char **address) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
 
-  // TODO: immutable_get
   // TODO: ipv4_netmask_get
   // TODO: ipv4_gateway_get
   // TODO: ipv4_configuration_metod_get
index 1512d5e..9a1fecb 100644 (file)
@@ -61,6 +61,7 @@ const char *e_connman_prop_security = NULL;
 const char *e_connman_prop_passphrase = NULL;
 const char *e_connman_prop_passphrase_required = NULL;
 const char *e_connman_prop_favorite = NULL;
+const char *e_connman_prop_immutable = NULL;
 const char *e_connman_prop_auto_connect = NULL;
 const char *e_connman_prop_setup_required = NULL;
 const char *e_connman_prop_apn = NULL;
@@ -339,6 +340,8 @@ e_connman_system_init(E_DBus_Connection *edbus_conn)
      e_connman_prop_passphrase_required = eina_stringshare_add("PassphraseRequired");
    if (e_connman_prop_favorite == NULL)
      e_connman_prop_favorite = eina_stringshare_add("Favorite");
+   if (e_connman_prop_immutable == NULL)
+     e_connman_prop_immutable = eina_stringshare_add("Immutable");
    if (e_connman_prop_auto_connect == NULL)
      e_connman_prop_auto_connect = eina_stringshare_add("AutoConnect");
    if (e_connman_prop_setup_required == NULL)
@@ -436,6 +439,7 @@ e_connman_system_shutdown(void)
    _stringshare_del(&e_connman_prop_passphrase);
    _stringshare_del(&e_connman_prop_passphrase_required);
    _stringshare_del(&e_connman_prop_favorite);
+   _stringshare_del(&e_connman_prop_immutable);
    _stringshare_del(&e_connman_prop_auto_connect);
    _stringshare_del(&e_connman_prop_setup_required);
    _stringshare_del(&e_connman_prop_apn);
index 228384a..aadb04c 100644 (file)
@@ -52,6 +52,7 @@ extern const char *e_connman_prop_security;
 extern const char *e_connman_prop_passphrase;
 extern const char *e_connman_prop_passphrase_required;
 extern const char *e_connman_prop_favorite;
+extern const char *e_connman_prop_immutable;
 extern const char *e_connman_prop_auto_connect;
 extern const char *e_connman_prop_setup_required;
 extern const char *e_connman_prop_apn;
index e51350b..8b2c8c9 100644 (file)
@@ -550,6 +550,31 @@ e_connman_service_favorite_get(const E_Connman_Element *service, bool *favorite)
 }
 
 /**
+ * Get property "Immutable" value.
+ *
+ * This value will be set to true if the service is configured
+ * externally via a configuration file.
+ *
+ * The only valid operation are e_connman_service_connect() and
+ * e_connman_service_disconnect(). The e_connman_service_remove()
+ * method will result in an error.
+
+ * @param service_path to get property.
+ * @param immutable where to store the property value, must be a
+ *        pointer to bollean (bool *).
+ *
+ * @return 1 on success, 0 otherwise.
+ */
+bool
+e_connman_service_immutable_get(const E_Connman_Element *service, bool *immutable)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(immutable, 0);
+   return e_connman_element_property_get_stringshared
+     (service, e_connman_prop_immutable, NULL, immutable);
+}
+
+/**
  * Get property "AutoConnect" value.
  *
  * If this property isn't found then 0 is returned.