e_dbus/connman: add Ethernet.Duplex property
authorlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 14 Nov 2011 15:19:22 +0000 (15:19 +0000)
committerlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 14 Nov 2011 15:19:22 +0000 (15:19 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/e_dbus@65179 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

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 7876b11..7241241 100644 (file)
@@ -174,6 +174,7 @@ EAPI Eina_Bool              e_connman_service_ethernet_interface_get(const E_Con
 EAPI Eina_Bool              e_connman_service_ethernet_address_get(const E_Connman_Element *service, const char **address) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
 EAPI Eina_Bool              e_connman_service_ethernet_mtu_get(const E_Connman_Element *service, unsigned short *mtu) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
 EAPI Eina_Bool              e_connman_service_ethernet_speed_get(const E_Connman_Element *service, unsigned short *speed) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
+EAPI Eina_Bool              e_connman_service_ethernet_duplex_get(const E_Connman_Element *service, const char **duplex) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
 
 /* Methods to configure IPv4 service */
 EAPI Eina_Bool              e_connman_service_ipv4_configure_dhcp(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
@@ -186,8 +187,6 @@ EAPI Eina_Bool              e_connman_technology_state_get(const E_Connman_Eleme
 EAPI Eina_Bool              e_connman_technology_name_get(const E_Connman_Element *technology, const char **state) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
 EAPI Eina_Bool              e_connman_technology_type_get(const E_Connman_Element *technology, const char **state) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
 
-// TODO: ethernet_duplex_get (not in connman yet)
-
 /* Low-Level API:
  *
  * Should just be used to work around problems until proper solution
index 4a0a6de..e6b4f5b 100644 (file)
@@ -31,6 +31,7 @@ const char *e_connman_prop_ipv4_configuration = NULL;
 const char *e_connman_prop_ethernet = NULL;
 const char *e_connman_prop_interface = NULL;
 const char *e_connman_prop_speed = NULL;
+const char *e_connman_prop_duplex = NULL;
 const char *e_connman_prop_method = NULL;
 const char *e_connman_prop_address = NULL;
 const char *e_connman_prop_gateway = NULL;
@@ -281,6 +282,7 @@ e_connman_system_init(E_DBus_Connection *edbus_conn)
    ADD_STRINGSHARE(e_connman_prop_ethernet, "Ethernet");
    ADD_STRINGSHARE(e_connman_prop_interface, "Interface");
    ADD_STRINGSHARE(e_connman_prop_speed, "Speed");
+   ADD_STRINGSHARE(e_connman_prop_duplex, "Duplex");
    ADD_STRINGSHARE(e_connman_prop_method, "Method");
    ADD_STRINGSHARE(e_connman_prop_address, "Address");
    ADD_STRINGSHARE(e_connman_prop_gateway, "Gateway");
@@ -380,6 +382,7 @@ e_connman_system_shutdown(void)
    _stringshare_del(&e_connman_prop_ethernet);
    _stringshare_del(&e_connman_prop_interface);
    _stringshare_del(&e_connman_prop_speed);
+   _stringshare_del(&e_connman_prop_duplex);
    _stringshare_del(&e_connman_prop_method);
    _stringshare_del(&e_connman_prop_address);
    _stringshare_del(&e_connman_prop_gateway);
index 39ea8a8..a32c716 100644 (file)
@@ -42,6 +42,7 @@ extern const char *e_connman_prop_ipv4_configuration;
 extern const char *e_connman_prop_ethernet;
 extern const char *e_connman_prop_interface;
 extern const char *e_connman_prop_speed;
+extern const char *e_connman_prop_duplex;
 extern const char *e_connman_prop_method;
 extern const char *e_connman_prop_address;
 extern const char *e_connman_prop_gateway;
index 011f14b..22fe693 100644 (file)
@@ -1278,6 +1278,33 @@ e_connman_service_ethernet_address_get(const E_Connman_Element *service, const c
 }
 
 /**
+ * Get property "Ethernet.Duplex" value.
+ *
+ * If this property isn't found then @c EINA_FALSE is returned.
+ * If @c EINA_FALSE is returned, then this call failed and parameter-returned
+ * values shall be considered invalid.
+ *
+ * Selected duplex settings of the line. Possible values are "half" and "full".
+ * This information might not always be available.
+ *
+ * @param service path to get property.
+ * @param duplex where to store the property value, must be a pointer
+ *        to string (const char **), it will not be allocated or
+ *        copied and references will be valid until element changes,
+ *        so copy it if you want to use it later.
+ *
+ * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
+ */
+Eina_Bool
+e_connman_service_ethernet_duplex_get(const E_Connman_Element *service, const char **duplex)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(duplex, EINA_FALSE);
+   return e_connman_element_property_dict_get_stringshared
+             (service, e_connman_prop_ethernet, e_connman_prop_duplex, NULL, duplex);
+}
+
+/**
  * Get property "Ethernet.MTU" value.
  *
  * If this property isn't found then @c EINA_FALSE is returned.