return 1;
}
+static int
+_on_cmd_manager_request_scan(char *cmd, char *args)
+{
+ if (args)
+ _tok(args);
+
+ if (!args)
+ args = "";
+
+ if (e_connman_manager_request_scan(args, NULL, NULL))
+ printf(":::Manager Request Scan for %s\n", args[0] ? args : "<all>");
+ else
+ fputs("ERROR: can't request scan on manager\n", stderr);
+ return 1;
+}
+
+static int
+_on_cmd_manager_technology_enable(char *cmd, char *args)
+{
+ if (!args)
+ {
+ fputs("ERROR: missing the technology type\n", stderr);
+ return 1;
+ }
+ _tok(args);
+
+ if (e_connman_manager_technology_enable(args, NULL, NULL))
+ printf(":::Manager Enable Technology %s\n", args);
+ else
+ fputs("ERROR: can't enable technology on manager\n", stderr);
+ return 1;
+}
+
+static int
+_on_cmd_manager_technology_disable(char *cmd, char *args)
+{
+ if (!args)
+ {
+ fputs("ERROR: missing the technology type\n", stderr);
+ return 1;
+ }
+ _tok(args);
+
+ if (e_connman_manager_technology_disable(args, NULL, NULL))
+ printf(":::Manager Disable Technology %s\n", args);
+ else
+ fputs("ERROR: can't disable technology on manager\n", stderr);
+ return 1;
+}
+
/* Device Commands */
static int
_on_cmd_device_propose_scan(char *cmd, char *args)
{"manager_get_state", _on_cmd_manager_get_state},
{"manager_get_offline_mode", _on_cmd_manager_get_offline_mode},
{"manager_set_offline_mode", _on_cmd_manager_set_offline_mode},
+ {"manager_request_scan", _on_cmd_manager_request_scan},
+ {"manager_technology_enable", _on_cmd_manager_technology_enable},
+ {"manager_technology_disable", _on_cmd_manager_technology_disable},
{"device_propose_scan", _on_cmd_device_propose_scan},
{"device_get_address", _on_cmd_device_get_address},
{"device_get_name", _on_cmd_device_get_name},
static const struct test_desc test_desc_manager[] = {
TEST_DESC_STRING_GET_GLOBAL(e_connman_manager_state_get, 0),
TEST_DESC_BOOL_GET_GLOBAL(e_connman_manager_offline_mode_get, 0),
+ //TEST_DESC_STRING_SET_GLOBAL(e_connman_manager_request_scan, 0),
//TEST_DESC_BOOL_SET_GLOBAL(e_connman_manager_offline_mode_set, 0),
TEST_DESC_ELEMENTS_GET_GLOBAL(e_connman_manager_profiles_get, 0),
TEST_DESC_ELEMENTS_GET_GLOBAL(e_connman_manager_devices_get, 0),
Eina_Inlist *property_set;
Eina_Inlist *agent_register;
Eina_Inlist *agent_unregister;
+ Eina_Inlist *request_scan;
+ Eina_Inlist *technology_enable;
+ Eina_Inlist *technology_disable;
Eina_Inlist *device_propose_scan;
Eina_Inlist *service_connect;
Eina_Inlist *service_disconnect;
EAPI unsigned int e_connman_system_shutdown(void);
/* Manager Methods */
- EAPI E_Connman_Element *e_connman_manager_get(void) EINA_ARG_NONNULL(1) EINA_PURE EINA_WARN_UNUSED_RESULT;
+ EAPI E_Connman_Element *e_connman_manager_get(void) EINA_PURE EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_manager_agent_register(const char *object_path, E_DBus_Method_Return_Cb cb, const void *data);
- EAPI bool e_connman_manager_agent_unregister(const char *object_path, E_DBus_Method_Return_Cb cb, const void *data);
+ EAPI bool e_connman_manager_agent_register(const char *object_path, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
+ EAPI bool e_connman_manager_agent_unregister(const char *object_path, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_manager_state_get(const char **state);
+ EAPI bool e_connman_manager_state_get(const char **state) EINA_PURE EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_manager_offline_mode_get(bool *offline);
- EAPI bool e_connman_manager_offline_mode_set(bool offline, E_DBus_Method_Return_Cb cb, const void *data);
+ EAPI bool e_connman_manager_offline_mode_get(bool *offline) EINA_PURE EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
+ EAPI bool e_connman_manager_offline_mode_set(bool offline, E_DBus_Method_Return_Cb cb, const void *data) EINA_WARN_UNUSED_RESULT;
- EAPI bool e_connman_manager_profiles_get(unsigned int *count, E_Connman_Element ***p_elements);
- EAPI bool e_connman_manager_devices_get(unsigned int *count, E_Connman_Element ***p_elements);
- EAPI bool e_connman_manager_services_get(unsigned int *count, E_Connman_Element ***p_elements);
+ EAPI bool e_connman_manager_profiles_get(unsigned int *count, E_Connman_Element ***p_elements) EINA_WARN_UNUSED_RESULT;
+ EAPI bool e_connman_manager_devices_get(unsigned int *count, E_Connman_Element ***p_elements) EINA_WARN_UNUSED_RESULT;
+ EAPI bool e_connman_manager_services_get(unsigned int *count, E_Connman_Element ***p_elements) EINA_WARN_UNUSED_RESULT;
+
+ EAPI bool e_connman_manager_request_scan(const char *type, E_DBus_Method_Return_Cb cb, const void *data) EINA_WARN_UNUSED_RESULT;
+
+ EAPI bool e_connman_manager_technology_default_get(const char **type) EINA_ARG_NONNULL(1) EINA_PURE EINA_WARN_UNUSED_RESULT;
+
+ EAPI bool e_connman_manager_technology_enable(const char *type, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
+ EAPI bool e_connman_manager_technology_disable(const char *type, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
// TODO: profile_create()
// TODO: profile_remove()
// TODO: profile_active_get()
// TODO: profile_active_set()
- // TODO: request_scan()
- // TODO: technology_enable()
- // TODO: technology_disable()
- // TODO: technology_default_get()
// TODO: technologies_available_get()
// TODO: technologies_enabled_get()
// TODO: technologies_connected_get()
const char *e_connman_prop_mcc = NULL;
const char *e_connman_prop_mnc = NULL;
const char *e_connman_prop_roaming = NULL;
+const char *e_connman_prop_technology_default = NULL;
int _e_dbus_connman_log_dom = -1;
e_connman_prop_mnc = eina_stringshare_add("MCN");
if (e_connman_prop_roaming == NULL)
e_connman_prop_roaming = eina_stringshare_add("Roaming");
+ if (e_connman_prop_technology_default == NULL)
+ e_connman_prop_technology_default = eina_stringshare_add("DefaultTechnology");
e_connman_conn = edbus_conn;
cb_name_owner_changed = e_dbus_signal_handler_add
_stringshare_del(&e_connman_prop_mcc);
_stringshare_del(&e_connman_prop_mnc);
_stringshare_del(&e_connman_prop_roaming);
+ _stringshare_del(&e_connman_prop_technology_default);
if (pending_get_name_owner)
{
e_connman_element_pending_cancel_and_free(&element->_pending.agent_register);
e_connman_element_pending_cancel_and_free(&element->_pending.agent_unregister);
e_connman_element_pending_cancel_and_free(&element->_pending.request_scan);
+ e_connman_element_pending_cancel_and_free(&element->_pending.technology_enable);
+ e_connman_element_pending_cancel_and_free(&element->_pending.technology_disable);
e_connman_element_pending_cancel_and_free(&element->_pending.device_propose_scan);
e_connman_element_pending_cancel_and_free(&element->_pending.service_connect);
e_connman_element_pending_cancel_and_free(&element->_pending.service_disconnect);
return e_connman_element_objects_array_get_stringshared
(element, e_connman_prop_services, count, p_elements);
}
+
+/**
+ * Request to trigger a scan for given technology.
+ *
+ * Call method RequestScan(type) on server in order to
+ * find new services and networks for such technology type.
+ *
+ * The empty string for type means all technolgies.
+ *
+ * @param type technology type to scan. Empty or NULL for all technologies.
+ * @param cb function to call when server replies or some error happens.
+ * @param data data to give to cb when it is called.
+ *
+ * @return 1 on success, 0 otherwise.
+ */
+bool
+e_connman_manager_request_scan(const char *type, E_DBus_Method_Return_Cb cb, const void *data)
+{
+ const char name[] = "RequestScan";
+ E_Connman_Element *element;
+
+ if (!type)
+ type = "";
+
+ element = e_connman_manager_get();
+ if (!element)
+ return 0;
+
+ return e_connman_element_call_with_string
+ (element, name, type, NULL,
+ &element->_pending.request_scan, cb, data);
+}
+
+/**
+ * Enable specified type of technology.
+ *
+ * Call method EnableTechnology(type) on server.
+ *
+ * @param type technology type to enable.
+ * @param cb function to call when server replies or some error happens.
+ * @param data data to give to cb when it is called.
+ *
+ * @return 1 on success, 0 otherwise.
+ */
+bool
+e_connman_manager_technology_enable(const char *type, E_DBus_Method_Return_Cb cb, const void *data)
+{
+ const char name[] = "EnableTechnology";
+ E_Connman_Element *element;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(type, 0);
+
+ element = e_connman_manager_get();
+ if (!element)
+ return 0;
+
+ return e_connman_element_call_with_string
+ (element, name, type, NULL,
+ &element->_pending.technology_enable, cb, data);
+}
+
+/**
+ * Disable specified type of technology.
+ *
+ * Call method DisableTechnology(type) on server.
+ *
+ * @param type technology type to disable.
+ * @param cb function to call when server replies or some error happens.
+ * @param data data to give to cb when it is called.
+ *
+ * @return 1 on success, 0 otherwise.
+ */
+bool
+e_connman_manager_technology_disable(const char *type, E_DBus_Method_Return_Cb cb, const void *data)
+{
+ const char name[] = "DisableTechnology";
+ E_Connman_Element *element;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(type, 0);
+
+ element = e_connman_manager_get();
+ if (!element)
+ return 0;
+
+ return e_connman_element_call_with_string
+ (element, name, type, NULL,
+ &element->_pending.technology_disable, cb, data);
+}
+
+/**
+ * Get property "DefaultTechnology" 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 current connected technology which holds the default route.
+ *
+ * @param type 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_manager_technology_default_get(const char **type)
+{
+ E_Connman_Element *element;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(type, 0);
+
+ element = e_connman_manager_get();
+ if (!element)
+ return 0;
+ return e_connman_element_property_get_stringshared
+ (element, e_connman_prop_technology_default, NULL, type);
+}
extern const char *e_connman_prop_mcc;
extern const char *e_connman_prop_mnc;
extern const char *e_connman_prop_roaming;
+extern const char *e_connman_prop_technology_default;
extern int _e_dbus_connman_log_dom;