summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2017-12-14 21:27:11 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2017-12-14 22:29:23 -0800
commit947854e44f5d06399123ed31857fa1ccfd58d423 (patch)
treee48c57e439a867bc9602de4ca2778a93d9b1e222
parent65f8c85747517fcb41dac06b863ad02005a45e50 (diff)
binding: wifi: set initial Wi-Fi HMI state
Wait for homescreen service to become active and set initial Wi-Fi state Bug-AGL: SPEC-1197 Change-Id: I46c9eeb14b392b4cc6e580d6dd86695849c59484 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r--binding-wifi/wifi-api.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/binding-wifi/wifi-api.c b/binding-wifi/wifi-api.c
index 7dcc603..45341e3 100644
--- a/binding-wifi/wifi-api.c
+++ b/binding-wifi/wifi-api.c
@@ -667,12 +667,40 @@ static const struct afb_verb_v2 binding_verbs[] = {
{ } /* marker for end of the array */
};
+
+gboolean initial_homescreen(gpointer ptr)
+{
+ struct wifiStatus *status = g_try_malloc0(sizeof(struct wifiStatus));
+ GError *error = NULL;
+ int ret = 0;
+
+ ret = wifi_state(status);
+
+ if (ret < 0) {
+ g_object_unref(status);
+ return TRUE;
+ }
+
+ error = setHMIStatus(status->connected == 1 ? BAR_FULL : BAR_NO);
+ g_error_free(error);
+
+ return ret != NULL;
+}
+
+static void *thread_func()
+{
+ g_timeout_add_seconds(5, initial_homescreen, NULL);
+ g_main_loop_run(g_main_loop_new(NULL, FALSE));
+}
+
static int init()
{
+ pthread_t thread_id;
+
event_add("passkey");
event_add("networkList");
- return 0;
+ return pthread_create(&thread_id, NULL, thread_func, NULL);
}
/*