summaryrefslogtreecommitdiffstats
path: root/binding-wifi/wifi-api.c
diff options
context:
space:
mode:
authorsrimaldia <hariasti.srimaldia-1@jp.alps.com>2016-12-22 18:47:12 +0900
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2016-12-22 21:24:42 +0000
commit9b6ef23ba4a5cc3389dacad20220dd4308986da7 (patch)
tree738d9a283bbc5c058e4884fee83a8723f58885ea /binding-wifi/wifi-api.c
parent7097e7d0d17cd52cfc20a6216004653b88340caf (diff)
Add status icon for wifi
to test this, you need to add conf file under /etc/dbus-1/session.d/ <?xml version="1.0"?> <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> <busconfig> <policy context="default"> <allow send_destination="org.agl.homescreen"/> </policy> </busconfig> Change-Id: I8fa1707883fa4c74460255949bc4ce1cd29cabf2 Signed-off-by: srimaldia <hariasti.srimaldia-1@jp.alps.com>
Diffstat (limited to 'binding-wifi/wifi-api.c')
-rw-r--r--binding-wifi/wifi-api.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/binding-wifi/wifi-api.c b/binding-wifi/wifi-api.c
index 2d9748f..f6d6d52 100644
--- a/binding-wifi/wifi-api.c
+++ b/binding-wifi/wifi-api.c
@@ -272,6 +272,34 @@ void wifi_scanResult(struct afb_req request) /*AFB_SESSION_CHECK*/
/*input each scan result into my_array*/
json_object_array_add(my_array, jresp);
number += 1;
+
+ //set the HMI icon according to strength, only if "ready" or "online"
+
+ int error = 0;
+ struct wifiStatus *status;
+
+ status = g_try_malloc0(sizeof(struct wifiStatus));
+ error = wifi_state(status); /*get current status of power and connection*/
+ if (!error) {
+
+ if (status->connected == 1) {
+
+ if ((strcmp(state, "ready") == 0)
+ || ((strcmp(state, "online") == 0))) {
+
+ if (strength < 30)
+ setHMIStatus(BAR_1);
+ else if (strength < 50)
+ setHMIStatus(BAR_2);
+ else if (strength < 70)
+ setHMIStatus(BAR_3);
+ else
+ setHMIStatus(BAR_FULL);
+ }
+ } else
+ setHMIStatus(BAR_NO);
+ }
+
}
while (list != NULL) {
printf("Should be freed");