e_dbus/connman: add Ethernet.Speed property
authorlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 14 Nov 2011 15:19:16 +0000 (15:19 +0000)
committerlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 14 Nov 2011 15:19:16 +0000 (15:19 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/e_dbus@65178 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 3f5bdca..7876b11 100644 (file)
@@ -173,6 +173,7 @@ EAPI Eina_Bool              e_connman_service_ethernet_method_get(const E_Connma
 EAPI Eina_Bool              e_connman_service_ethernet_interface_get(const E_Connman_Element *service, const char **iface) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
 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;
 
 /* 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;
@@ -185,7 +186,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_speed_get (not in connman yet)
 // TODO: ethernet_duplex_get (not in connman yet)
 
 /* Low-Level API:
index 245a6f7..4a0a6de 100644 (file)
@@ -30,6 +30,7 @@ const char *e_connman_prop_ipv4 = NULL;
 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_method = NULL;
 const char *e_connman_prop_address = NULL;
 const char *e_connman_prop_gateway = NULL;
@@ -279,6 +280,7 @@ e_connman_system_init(E_DBus_Connection *edbus_conn)
    ADD_STRINGSHARE(e_connman_prop_ipv4_configuration, "IPv4.Configuration");
    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_method, "Method");
    ADD_STRINGSHARE(e_connman_prop_address, "Address");
    ADD_STRINGSHARE(e_connman_prop_gateway, "Gateway");
@@ -377,6 +379,7 @@ e_connman_system_shutdown(void)
    _stringshare_del(&e_connman_prop_ipv4_configuration);
    _stringshare_del(&e_connman_prop_ethernet);
    _stringshare_del(&e_connman_prop_interface);
+   _stringshare_del(&e_connman_prop_speed);
    _stringshare_del(&e_connman_prop_method);
    _stringshare_del(&e_connman_prop_address);
    _stringshare_del(&e_connman_prop_gateway);
index 2c3d0de..39ea8a8 100644 (file)
@@ -41,6 +41,7 @@ extern const char *e_connman_prop_ipv4;
 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_method;
 extern const char *e_connman_prop_address;
 extern const char *e_connman_prop_gateway;
index 5faf067..011f14b 100644 (file)
@@ -1229,6 +1229,29 @@ e_connman_service_ethernet_interface_get(const E_Connman_Element *service, const
 }
 
 /**
+ * Get property "Ethernet.Speed" 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 speed of the line. This information might not always be available.
+ *
+ * @param service path to get property.
+ * @param speed where to store the property value.
+ *
+ * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
+ */
+Eina_Bool
+e_connman_service_ethernet_speed_get(const E_Connman_Element *service, unsigned short *speed)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(service, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(speed, EINA_FALSE);
+   return e_connman_element_property_dict_get_stringshared
+             (service, e_connman_prop_ethernet, e_connman_prop_speed, NULL, speed);
+}
+
+/**
  * Get property "Ethernet.Address" value.
  *
  * If this property isn't found then @c EINA_FALSE is returned.