GMainLoop *main_loop = NULL;
static guint onoff_timer = 0;
+static int cnt = 0;
+
+static gboolean __bt_onoff_timeout_cb(gpointer data);
+
+static void __bt_retry_onoff(bt_adapter_state_e state)
+{
+ int ret;
+
+ cnt++;
+
+ TC_PRT("Retry cnt: %d", cnt);
+
+ onoff_timer = g_timeout_add(20000, (GSourceFunc)__bt_onoff_timeout_cb, NULL);
+
+ if (state == BT_ADAPTER_DISABLED)
+ ret = bt_adapter_enable();
+ else
+ ret = bt_adapter_disable();
+
+ TC_PRT("bt_adapter_%s() error(%d)",
+ state == BT_ADAPTER_DISABLED ? "enable" : "disable", ret);
+}
static void __bt_adapter_state_changed_cb(int result,
bt_adapter_state_e adapter_state, void *user_data)
execv("all_log_dump.sh", argv);
}
- if (main_loop)
- g_main_loop_quit(main_loop);
- else
- exit(0);
+ __bt_retry_onoff(adapter_state);
}
static gboolean __bt_onoff_timeout_cb(gpointer data)
NULL);
if (argc <= 1) {
- if (state == BT_ADAPTER_DISABLED)
+ if (state == BT_ADAPTER_DISABLED) {
ret = bt_adapter_enable();
else
ret = bt_adapter_disable();
+
TC_PRT("bt_adapter_%s() error(%d)",
- state == BT_ADAPTER_DISABLED ? "enable" : "disable",
- ret);
+ state == BT_ADAPTER_DISABLED ? "enable" : "disable", ret);
+ }
} else {
if (argv[1][0] == '0') {
if (state == BT_ADAPTER_DISABLED) {