}
static int
+_on_cmd_device_get_address(char *cmd, char *args)
+{
+ const char *address, *path;
+ E_Connman_Element *e;
+
+ if (!args)
+ {
+ fputs("ERROR: missing the device path\n", stderr);
+ return 1;
+ }
+ _tok(args);
+ path = args;
+
+ e = e_connman_device_get(path);
+ if (e_connman_device_address_get(e, &address))
+ printf(":::Device %s Address = \"%s\"\n", path, address);
+ else
+ fputs("ERROR: can't get device address\n", stderr);
+ return 1;
+}
+
+static int
_on_cmd_device_get_name(char *cmd, char *args)
{
const char *name, *path;
/* Network Commands */
static int
+_on_cmd_network_get_address(char *cmd, char *args)
+{
+ const char *address, *path;
+ E_Connman_Element *e;
+
+ if (!args)
+ {
+ fputs("ERROR: missing the network path\n", stderr);
+ return 1;
+ }
+ _tok(args);
+ path = args;
+
+ e = e_connman_network_get(path);
+ if (e_connman_network_address_get(e, &address))
+ printf(":::Network %s Address = \"%s\"\n", path, address);
+ else
+ fputs("ERROR: can't get network address\n", stderr);
+ return 1;
+}
+
+static int
_on_cmd_network_get_name(char *cmd, char *args)
{
const char *name, *path;
{"manager_get_offline_mode", _on_cmd_manager_get_offline_mode},
{"manager_set_offline_mode", _on_cmd_manager_set_offline_mode},
{"device_propose_scan", _on_cmd_device_propose_scan},
+ {"device_get_address", _on_cmd_device_get_address},
{"device_get_name", _on_cmd_device_get_name},
{"device_get_type", _on_cmd_device_get_type},
{"device_get_interface", _on_cmd_device_get_interface},
{"profile_get_offline_mode", _on_cmd_profile_get_offline_mode},
{"profile_set_offline_mode", _on_cmd_profile_set_offline_mode},
{"profile_get_services", _on_cmd_profile_get_services},
+ {"network_get_address", _on_cmd_network_get_address},
{"network_get_name", _on_cmd_network_get_name},
{"network_get_connected", _on_cmd_network_get_connected},
{"network_get_strength", _on_cmd_network_get_strength},
};
static const struct test_desc test_desc_device[] = {
+ TEST_DESC_STRING_GET(e_connman_device_address_get, 0),
TEST_DESC_STRING_GET(e_connman_device_name_get, 0),
TEST_DESC_STRING_GET(e_connman_device_type_get, 0),
TEST_DESC_STRING_GET(e_connman_device_interface_get, 0),
};
static const struct test_desc test_desc_network[] = {
+ TEST_DESC_STRING_GET(e_connman_network_address_get, 0),
TEST_DESC_STRING_GET(e_connman_network_name_get, 0),
TEST_DESC_BOOL_GET(e_connman_network_connected_get, 0),
TEST_DESC_UCHAR_GET(e_connman_network_strength_get, 1),
EAPI bool e_connman_device_propose_scan(E_Connman_Element *device, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
+ EAPI bool e_connman_device_address_get(const E_Connman_Element *device, const char **address);
+
EAPI bool e_connman_device_name_get(const E_Connman_Element *device, const char **name) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_device_type_get(const E_Connman_Element *device, const char **type) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_device_networks_get(const E_Connman_Element *device, unsigned int *count, E_Connman_Element ***p_elements) EINA_ARG_NONNULL(1, 2, 3) EINA_PURE EINA_WARN_UNUSED_RESULT;
- // TODO: address_get
-
/* Network Methods: Low-Level API
*
*/
EAPI E_Connman_Element *e_connman_network_get(const char *path) EINA_ARG_NONNULL(1) EINA_PURE EINA_WARN_UNUSED_RESULT;
+ EAPI bool e_connman_network_address_get(const E_Connman_Element *network, const char **address) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
+
EAPI bool e_connman_network_name_get(const E_Connman_Element *network, const char **name) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_network_connected_get(const E_Connman_Element *network, bool *connected) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
EAPI bool e_connman_network_wifi_passphrase_get(const E_Connman_Element *network, const char **wifi_passphare) EINA_ARG_NONNULL(1, 2) EINA_PURE EINA_WARN_UNUSED_RESULT;
- // TODO: address_get
// TODO: wifi_channel_get (missing in their docs)
// TODO: wifi_eap_get (missing in their docs, only if ieee8021x)
// TODO: frequency_get (missing in their docs)
const char *e_connman_prop_interface = NULL;
const char *e_connman_prop_ipv4_address = NULL;
const char *e_connman_prop_ipv4_method = NULL;
+const char *e_connman_prop_address = NULL;
const char *e_connman_prop_name = NULL;
const char *e_connman_prop_network = NULL;
const char *e_connman_prop_networks = NULL;
e_connman_prop_ipv4_address = eina_stringshare_add("IPv4.Address");
if (e_connman_prop_ipv4_method == NULL)
e_connman_prop_ipv4_method = eina_stringshare_add("IPv4.Method");
+ if (e_connman_prop_address == NULL)
+ e_connman_prop_address = eina_stringshare_add("Address");
if (e_connman_prop_name == NULL)
e_connman_prop_name = eina_stringshare_add("Name");
if (e_connman_prop_network == NULL)
_stringshare_del(&e_connman_prop_interface);
_stringshare_del(&e_connman_prop_ipv4_address);
_stringshare_del(&e_connman_prop_ipv4_method);
+ _stringshare_del(&e_connman_prop_address);
_stringshare_del(&e_connman_prop_name);
_stringshare_del(&e_connman_prop_network);
_stringshare_del(&e_connman_prop_networks);
}
/**
+ * Get property "Address" value.
+ *
+ * If this property isn't found then 0 is returned.
+ * If zero is returned, then this call failed and parameter-returned
+ * values shall be considered invalid.
+ *
+ * The device address (mac-address for ethernet, wifi...).
+ *
+ * This address can be used for directly displaying it in
+ * the application. It has pure informational purpose.
+ *
+ * @param device path to get property.
+ * @param address 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 1 on success, 0 otherwise.
+ */
+bool
+e_connman_device_address_get(const E_Connman_Element *device, const char **address)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(device, 0);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(address, 0);
+ return e_connman_element_property_get_stringshared
+ (device, e_connman_prop_address, NULL, address);
+}
+
+/**
* Get property "Name" value.
*
* If this property isn't found then 0 is returned.
}
/**
+ * Get property "Address" value.
+ *
+ * If this property isn't found then 0 is returned.
+ * If zero is returned, then this call failed and parameter-returned
+ * values shall be considered invalid.
+ *
+ * The network hardware address (mac-address for ethernet, wifi...).
+ *
+ * This address can be used for directly displaying it in
+ * the application. It has pure informational purpose.
+ *
+ * @param network path to get property.
+ * @param address 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 1 on success, 0 otherwise.
+ */
+bool
+e_connman_network_address_get(const E_Connman_Element *network, const char **address)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(network, 0);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(address, 0);
+ return e_connman_element_property_get_stringshared
+ (network, e_connman_prop_address, NULL, address);
+}
+
+/**
* Get property "Name" value.
*
* If this property isn't found then 0 is returned.
extern const char *e_connman_prop_interface;
extern const char *e_connman_prop_ipv4_address;
extern const char *e_connman_prop_ipv4_method;
+extern const char *e_connman_prop_address;
extern const char *e_connman_prop_name;
extern const char *e_connman_prop_network;
extern const char *e_connman_prop_networks;