#include "inm-dump.h"
#include "inm-ip-conflict.h"
#include "inm-arping.h"
+#include "inm-reacher.h"
#include "inm-iface-mon.h"
#include "inm-supplicant.h"
#include "inm-connman.h"
return ret;
}
+int inm_manager_add_reacher_url(const char *url)
+{
+ int ret = 0;
+
+ __INM_FUNC_ENTER__;
+
+ ret = inm_reacher_add_url(url);
+ if (ret != 0) {
+ INM_LOGI("Failed to add url");
+
+ if (ret == INM_REACHER_ERROR_IN_PROGRESS)
+ ret = INM_MANAGER_ERROR_IN_PROGRESS;
+ else
+ ret = -1;
+
+ __INM_FUNC_EXIT__;
+ return ret;
+ }
+
+ __INM_FUNC_EXIT__;
+ return INM_MANAGER_ERROR_NONE;
+}
+
+int inm_manager_remove_reacher_url(const char *url)
+{
+ int ret = 0;
+
+ __INM_FUNC_ENTER__;
+
+ ret = inm_reacher_remove_url(url);
+ if (ret != 0) {
+ INM_LOGI("Failed to remove url");
+
+ if (ret == INM_REACHER_ERROR_IN_PROGRESS)
+ ret = INM_MANAGER_ERROR_IN_PROGRESS;
+ else
+ ret = -1;
+
+ __INM_FUNC_EXIT__;
+ return ret;
+ }
+
+ __INM_FUNC_EXIT__;
+ return INM_MANAGER_ERROR_NONE;
+}
+
+static void __reacher_callback (
+ inm_reacher_error_e err,
+ gboolean found,
+ const char *url,
+ gpointer user_data)
+{
+ if (!url)
+ return;
+
+ INM_LOGI("URL : %s is %s", url, found ? "Found" : "Not Found");
+
+ return;
+}
+
+int inm_manager_start_reacher(int type)
+{
+ int ret = 0;
+
+ __INM_FUNC_ENTER__;
+
+ ret = inm_reacher_start(type, TRUE, __reacher_callback, NULL);
+ if (ret != 0) {
+ INM_LOGI("Failed to start reacher");
+
+ if (ret == INM_REACHER_ERROR_IN_PROGRESS)
+ ret = INM_MANAGER_ERROR_IN_PROGRESS;
+ else
+ ret = -1;
+
+ __INM_FUNC_EXIT__;
+ return ret;
+ }
+
+ __INM_FUNC_EXIT__;
+ return INM_MANAGER_ERROR_NONE;
+}
+
+int inm_manager_stop_reacher(int type)
+{
+ int ret = 0;
+
+ __INM_FUNC_ENTER__;
+
+ ret = inm_reacher_stop(type);
+ if (ret != 0) {
+ INM_LOGI("Failed to stop reacher");
+
+ __INM_FUNC_EXIT__;
+ return -1;
+ }
+
+ __INM_FUNC_EXIT__;
+ return INM_MANAGER_ERROR_NONE;
+}
+
+int inm_manager_get_reacher_is_running(gboolean *is_running)
+{
+ int ret = 0;
+
+ __INM_FUNC_ENTER__;
+
+ ret = inm_reacher_is_running(is_running);
+ if (ret != 0) {
+ INM_LOGI("Failed to get reacher is running");
+
+ __INM_FUNC_EXIT__;
+ return -1;
+ }
+
+ __INM_FUNC_EXIT__;
+ return INM_MANAGER_ERROR_NONE;
+}
+
+
int inm_manager_get_wifi_scan_state(gboolean *state)
{
inm_supplicant_iface_s *iface = NULL;
return;
}
+static inline void __init_reacher()
+{
+ __INM_FUNC_ENTER__;
+ if (inm_reacher_init() < 0) {
+ INM_LOGI("reacher init failed");
+ __INM_FUNC_EXIT__;
+ return;
+ }
+
+ __INM_FUNC_EXIT__;
+}
+
+static inline void __deinit_reacher()
+{
+ __INM_FUNC_ENTER__;
+
+ if (inm_reacher_deinit() < 0) {
+ INM_LOGI("reacher deinit failed");
+ }
+
+ __INM_FUNC_EXIT__;
+ return;
+}
static void __ethernet_cable_state_changed_cb(char *iface_name, int state, void *user_data)
{
gboolean is_attached = FALSE;
inm_dump_init();
__init_ip_conflict_detect();
__init_arping();
+ __init_reacher();
__init_iface_monitor();
__init_retry_tx_rate_monitor();
__init_channel_interference_monitor();
inm_dump_deinit();
__deinit_ip_conflict_detect();
__deinit_arping();
+ __deinit_reacher();
__deinit_iface_monitor();
__deinit_retry_tx_rate_monitor();
__deinit_channel_interference_monitor();