summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/wifi/Wifi.qml21
-rw-r--r--binding-wifi/agent.c46
-rw-r--r--binding-wifi/wifi-api.c46
-rw-r--r--binding-wifi/wifi-connman.c91
-rw-r--r--binding-wifi/wifi-connman.h12
5 files changed, 95 insertions, 121 deletions
diff --git a/app/wifi/Wifi.qml b/app/wifi/Wifi.qml
index 53ab274..3bf4774 100644
--- a/app/wifi/Wifi.qml
+++ b/app/wifi/Wifi.qml
@@ -53,24 +53,23 @@ SettingPage {
url: address_str
onTextMessageReceived: {
var message_json = JSON.parse(message)
- //console.log("Raw response: " + message)
- //console.log("JSON response: " + message_json)
+ console.debug("Raw response: " + message)
/* server is not happy with our request, ignore it */
if ((message_json[0] === msgid_enu.reterr)) {
- console.log("Return value is not ok !")
- console.log("Raw response: " + message)
+ console.error("Return value is not OK!")
+ console.error("Raw response: " + message)
return
} else if ((message_json[0] === msgid_enu.event)) {
var eventContent = JSON.parse(JSON.stringify(message_json[2]))
- console.log("Return value is EVENT: " + eventContent.event)
+ console.log("Received EVENT: " + eventContent.event)
if (eventContent.event === "wifi-manager/networkListUpdated") {
- console.log("Event data:" + eventContent.data.data1 + ", " + eventContent.data.data2 )
+ console.debug("Event data:" + eventContent.data.data1 + ", " + eventContent.data.data2 )
console.log("Network List was updated, sending scan_result request")
//update network list
@@ -81,8 +80,7 @@ SettingPage {
else if (eventContent.event === "wifi-manager/passwordQuery") {
- console.log("Event data:" + eventContent.data.data1 + ", " + eventContent.data.data2 )
-
+ console.debug("Event data:" + eventContent.data.data1 + ", " + eventContent.data.data2 )
console.log("Passkey requested")
dialog.visible = true
@@ -125,14 +123,13 @@ SettingPage {
}
} else
- console.log("ELSE msgid", message_json[0])
+ console.log("Unhadled websocket message", message_json[0])
}
onStatusChanged: {
var parameterJson = 0
var requestJson = 0
- console.log("Status changed")
if (websocket.status == WebSocket.Error) {
status_str = "Error: " + websocket.errorString
@@ -141,7 +138,6 @@ SettingPage {
//subscribe for events
-
//network list updated event
verb_str = "eventadd"
parameterJson = {
@@ -193,7 +189,6 @@ SettingPage {
}
console.log(status_str)
- console.log(websocket.status)
}
active: false
}
@@ -315,7 +310,7 @@ SettingPage {
} else {
- console.log("Connect to", index, " ,", name)
+ console.log("Requesting connection to network #", index, ", ", name, ".")
view.currentIndex = model.index
//make some indication that connection is in progress
diff --git a/binding-wifi/agent.c b/binding-wifi/agent.c
index 66f23be..6b0f235 100644
--- a/binding-wifi/agent.c
+++ b/binding-wifi/agent.c
@@ -52,7 +52,7 @@ static void handle_method_call(GDBusConnection *connection, const gchar *sender,
//MyObject *myobj = user_data;
if (g_strcmp0(method_name, "RequestInput") == 0) {
- printf("Input requested\n");
+ DEBUG(afbitf,"RequestInput method on Agent interface has been called\n");
invocation_passkey = invocation;
@@ -79,25 +79,25 @@ static void handle_method_call(GDBusConnection *connection, const gchar *sender,
)
]
*/
- printf("Passphrase requested for network : %s\n", object_path);
+ NOTICE(afbitf,"Passphrase requested for network : %s\n", object_path);
(*password_callback)(0, object_path);
}
if (g_strcmp0(method_name, "ReportError") == 0) {
- printf("Error reported\n");
+ ERROR(afbitf,"ReportError method on Agent interface has een called\n");
gchar *error_string; // = NULL;
gchar * object_path;
g_variant_get(parameters, "(os)", &object_path, &error_string);
- printf("Error %s for %s\n", error_string, object_path);
+ ERROR(afbitf, "Error %s for %s\n", error_string, object_path);
if (g_strcmp0(error_string, "invalid-key") == 0) {
- printf("Passkey is not correct.\n");
+ WARNING(afbitf, "Passkey is not correct.\n");
(*password_callback)(1, "invalid-key");
}
@@ -110,7 +110,7 @@ GError* sendPasskey(gchar *passkey) {
GVariantBuilder *builder;
GVariant *value = NULL;
- printf("Passkey to send: %s\n", passkey);
+ NOTICE(afbitf, "Passkey to send: %s\n", passkey);
builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
@@ -145,40 +145,26 @@ static void on_bus_acquired(GDBusConnection *connection, const gchar *name,
static void test_signal_handler (GDBusConnection *connection, const gchar *sender_name, const gchar *object_path, const gchar *interface_name, const gchar *signal_name, GVariant *parameters, gpointer user_data) {
- //openlog("WIFI Binder", LOG_PID | LOG_CONS, LOG_USER);
-
-
//do not parse, just check what has changed and make callback -
// we need to refresh completelist anyway..
if (g_strcmp0(signal_name, "PropertiesChanged") == 0) {
- //syslog(LOG_INFO, "PropertiesChanged");
(*wifiListChanged_callback)(1, "PropertiesChanged");
}
else if (g_strcmp0(signal_name, "BSSRemoved") == 0) {
- //syslog(LOG_INFO, "BSSRemoved" );
(*wifiListChanged_callback)(2, "BSSRemoved");
}
- else if (g_strcmp0(signal_name, "BSSAdded") == 0) {
- //syslog(LOG_INFO, "BSSAdded" );
+ else if (g_strcmp0(signal_name, "BSSAdded") == 0) {
(*wifiListChanged_callback)(2, "BSSAdded");
}
- else printf ("unhandled signal %s %s %s, %s", sender_name, object_path, interface_name, signal_name);//syslog(LOG_INFO, "unhandled signal %s %s %s, %s", sender_name, object_path, interface_name, signal_name);
-
-
-
- //closelog();
-
-
+ else WARNING(afbitf,"unhandled signal %s %s %s, %s", sender_name, object_path, interface_name, signal_name);
}
void* register_agent(void *data) {
- printf("Loop start\n");
-
guint owner_id;
guint networkChangedID;
@@ -210,16 +196,12 @@ void* register_agent(void *data) {
//sleep(10);
g_main_loop_run(loop);
- printf("Loop running\n");
-
g_bus_unown_name(owner_id);
g_dbus_node_info_unref(introspection_data);
//g_object_unref(myobj);
- //printf("Loop end\n");
-
return NULL;
}
@@ -235,8 +217,8 @@ GError* create_agent(GDBusConnection *connection) {
err = pthread_create((&tid[0]), NULL, register_agent, NULL);
if (err != 0) {
- printf("\ncan't create thread :[%d]", err);
- printf("Fatal error!\n\n");
+ ERROR(afbitf,"\ncan't create thread :[%d]", err);
+ ERROR(afbitf,"Fatal error!\n\n");
return NULL;
}
@@ -255,12 +237,12 @@ GError* create_agent(GDBusConnection *connection) {
DBUS_REPLY_TIMEOUT, NULL, &error);
if (error) {
- printf("error: %d:%s\n", error->code, error->message);
+ ERROR(afbitf,"error: %d:%s\n", error->code, error->message);
return error;
} else {
- printf("Agent registered\n");
+ INFO(afbitf,"Agent registered\n");
return NULL;
}
@@ -285,11 +267,11 @@ GError* stop_agent(GDBusConnection *connection) {
DBUS_REPLY_TIMEOUT, NULL, &error);
if (error) {
- printf("error: %d:%s\n", error->code, error->message);
+ ERROR(afbitf, "error: %d:%s\n", error->code, error->message);
return error;
} else {
- printf("Agent unregistered\n");
+ DEBUG(afbitf,"Agent unregistered\n");
return NULL;
}
diff --git a/binding-wifi/wifi-api.c b/binding-wifi/wifi-api.c
index dba07d9..933a121 100644
--- a/binding-wifi/wifi-api.c
+++ b/binding-wifi/wifi-api.c
@@ -32,10 +32,7 @@
#include "wifi-api.h"
#include "wifi-connman.h"
-/*
- * the interface to afb-daemon
- */
-const struct afb_binding_interface *afbitf;
+
static int need_password_flag = 0;
static int password_not_correct_flag = 0;
@@ -64,7 +61,7 @@ void wifi_passkey(struct afb_req request) {
/* retrieves the argument, expects password string */
passkey_from_user = afb_req_value(request, "passkey");
- printf("Passkey inserted: %s\n", passkey_from_user);
+ NOTICE(afbitf, "Passkey inserted: %s\n", passkey_from_user);
sendPasskey(passkey_from_user);
@@ -73,7 +70,7 @@ void wifi_passkey(struct afb_req request) {
registerPasskey(passkey);
} else {
- printf("Please enter the password first\n");
+ NOTICE(afbitf, "Please enter the password first\n");
}
}
@@ -127,9 +124,8 @@ static void eventpush (struct afb_req request)
*
* */
void ask_for_passkey(int number, const char* asciidata) {
- //TODO: show network we are asking password for
- printf("Insert passkey.\n");
- ERROR(afbitf, "Insert passkey.");
+ NOTICE(afbitf, "Passkey for %s network needed.", asciidata);
+ NOTICE(afbitf, "Sending event.");
json_object *jresp = json_object_new_object();
@@ -187,8 +183,6 @@ static void wifi_activate(struct afb_req request) /*AFB_SESSION_CHECK*/
if (ptr_my_callback == NULL) {
- printf("Registering callback\n");
-
ptr_my_callback = ask_for_passkey;
register_callbackSecurity(ptr_my_callback);
@@ -196,8 +190,6 @@ static void wifi_activate(struct afb_req request) /*AFB_SESSION_CHECK*/
if (wifiListChanged_clbck == NULL) {
- printf("Registering callback wifiListChanged_clbck \n");
-
wifiListChanged_clbck = wifiListChanged;
register_callbackWiFiList(wifiListChanged_clbck);
@@ -325,7 +317,8 @@ void wifi_scanResult(struct afb_req request) /*AFB_SESSION_CHECK*/
json_object_object_add(jresp, "IPAddress", jstring3);
json_object_object_add(jresp, "State", jstring4);
- //printf("The object json: %s\n", json_object_to_json_string(jresp));
+ DEBUG(afbitf, "The object json: %s\n", json_object_to_json_string(jresp));
+
/*input each scan result into my_array*/
json_object_array_add(my_array, jresp);
number += 1;
@@ -359,7 +352,6 @@ void wifi_scanResult(struct afb_req request) /*AFB_SESSION_CHECK*/
}
while (list != NULL) {
- printf("Should be freed");
holdMe = list->next;
g_free(list);
list = holdMe;
@@ -396,7 +388,8 @@ void wifi_connect(struct afb_req request) {
else {
network_index = atoi(network);
- printf("Joining network number %d\n", network_index);
+ NOTICE(afbitf,"Joining network number %d\n", network_index);
+
}
@@ -405,17 +398,16 @@ void wifi_connect(struct afb_req request) {
if (item == NULL) {
//Index starts from 1
- printf("Network with number %d not found.\n", network_index + 1);
+ ERROR(afbitf, "Network with number %d not found.\n", network_index + 1);
//TODO:better error message
afb_req_fail(request, "failed", "bad arguments");
}
else {
wifiProfileToConnect = (struct wifi_profile_info *) item;
- printf("Name: %s, strength: %d, %s\n", wifiProfileToConnect->ESSID,
+ INFO(afbitf, "Name: %s, strength: %d, %s\n", wifiProfileToConnect->ESSID,
wifiProfileToConnect->Strength,
wifiProfileToConnect->NetworkPath);
- //printf ("Connecting to %s\n", wifiProfileToConnect->NetworkPath);
}
error = do_connectNetwork(wifiProfileToConnect->NetworkPath);
@@ -461,7 +453,7 @@ void wifi_disconnect(struct afb_req request) {
else {
network_index = atoi(network);
- printf("Joining network number %d\n", network_index);
+ NOTICE(afbitf, "Joining network number %d\n", network_index);
}
@@ -470,17 +462,16 @@ void wifi_disconnect(struct afb_req request) {
if (item == NULL) {
//Index starts from 1
- printf("Network with number %d not found.\n", network_index + 1);
+ ERROR(afbitf,"Network with number %d not found.\n", network_index + 1);
//TODO:better error message
afb_req_fail(request, "failed", "bad arguments");
}
else {
wifiProfileToConnect = (struct wifi_profile_info *) item;
- printf("Name: %s, strength: %d, %s\n", wifiProfileToConnect->ESSID,
+ INFO(afbitf, "Name: %s, strength: %d, %s\n", wifiProfileToConnect->ESSID,
wifiProfileToConnect->Strength,
wifiProfileToConnect->NetworkPath);
- //printf ("Connecting to %s\n", wifiProfileToConnect->NetworkPath);
}
error = do_disconnectNetwork(wifiProfileToConnect->NetworkPath);
@@ -508,18 +499,18 @@ void wifi_status(struct afb_req request) {
json_object_object_add(jresp, "Power",
json_object_new_string("OFF"));
//json_object_object_add(jresp, "Connection", json_object_new_string("Disconnected"));
- printf("Wi-Fi OFF\n");
+ DEBUG(afbitf, "Wi-Fi OFF\n");
} else {/*Wi-Fi is ON*/
json_object_object_add(jresp, "Power",
json_object_new_string("ON"));
if (status->connected == 0) {/*disconnected*/
json_object_object_add(jresp, "Connection",
json_object_new_string("Disconnected"));
- printf("Wi-Fi ON - Disconnected \n");
+ DEBUG(afbitf, "Wi-Fi ON - Disconnected \n");
} else {/*Connected*/
json_object_object_add(jresp, "Connection",
json_object_new_string("Connected"));
- printf("Wi-Fi ON - Connected \n");
+ DEBUG(afbitf, "Wi-Fi ON - Connected \n");
}
}
afb_req_success(request, jresp, "Wi-Fi - Connection Status Checked");
@@ -584,9 +575,6 @@ static void eventadd (struct afb_req request)
const char *tag = afb_req_value(request, "tag");
const char *name = afb_req_value(request, "name");
- printf ("Name: %s\n", name);
- printf ("Tag: %s\n", tag);
-
json_object *query = afb_req_json(request);
if (tag == NULL || name == NULL)
diff --git a/binding-wifi/wifi-connman.c b/binding-wifi/wifi-connman.c
index 7dc2aac..924898e 100644
--- a/binding-wifi/wifi-connman.c
+++ b/binding-wifi/wifi-connman.c
@@ -25,8 +25,6 @@
#include "wifi-api.h"
#include "wifi-connman.h"
-//#include "syslog.h"
-
static __thread struct security_profile Security = { NULL, NULL, NULL, NULL, 0,
0 };
@@ -94,7 +92,6 @@ int extract_values(GVariantIter *content, struct wifi_profile_info* wifiProfile)
}
}
}
- //printf ("SSID= %s, security= %s, Strength= %d, wps support= %d\n", wifiProfile->ESSID, wifiProfile->Security.sec_type, wifiProfile->Strength, wifiProfile->Security.wps_support);
return 0;
}
@@ -109,7 +106,7 @@ int wifi_state(struct wifiStatus *status) {
connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
if (connection == NULL) {
- printf("GDBusconnection is NULL");
+ ERROR(afbitf,"Cannot connect to D-Bus, %s", error->message);
return -1;
}
message = g_dbus_connection_call_sync(connection, CONNMAN_SERVICE,
@@ -117,8 +114,8 @@ int wifi_state(struct wifiStatus *status) {
NULL, NULL, G_DBUS_CALL_FLAGS_NONE,
DBUS_REPLY_TIMEOUT, NULL, &error);
if (message == NULL) {
- printf("message is NULL");
- return -1;
+ ERROR(afbitf,"Error %s while calling GetProperties method", error->message);
+ return -1;
}
g_variant_get(message, "(a{sv})", &array);
while (g_variant_iter_loop(array, "{sv}", &key, &var)) {
@@ -151,8 +148,8 @@ GError* do_wifiActivate() {
connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
if (connection == NULL) {
- printf("GDBusconnection is NULL");
- return error;
+ ERROR(afbitf,"Cannot connect to D-Bus, %s", error->message);
+ return error;
}
//create the agent to handle security
@@ -167,13 +164,13 @@ GError* do_wifiActivate() {
params, NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, &error);
if (error) {
- printf("error: %d:%s\n", error->code, error->message);
+ ERROR(afbitf,"Error %s while calling SetProperty method", error->message);
return error;
}
else {
- printf("Power ON succeeded\n");
+ NOTICE(afbitf,"Power ON succeeded\n");
return NULL;
}
@@ -188,15 +185,15 @@ GError* do_wifiDeactivate() {
/*connection = gdbus_conn->connection;*/
connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
if (connection == NULL) {
- printf("GDBusconnection is NULL");
- return error;
+ ERROR(afbitf,"Cannot connect to D-Bus, %s", error->message);
+ return error;
}
//create the agent to handle security
error = stop_agent(connection);
if (error) {
- printf("Error while unregistering the agent, ignoring.");
+ WARNING(afbitf, "Error while unregistering the agent, ignoring.");
}
@@ -205,13 +202,13 @@ GError* do_wifiDeactivate() {
params, NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, &error);
if (error) {
- printf("error: %d:%s\n", error->code, error->message);
+ ERROR(afbitf,"Error %s while calling SetProperty method", error->message);
return error;
}
else {
- printf("Power OFF succeeded\n");
+ NOTICE(afbitf, "Power OFF succeeded\n");
return NULL;
}
}
@@ -223,21 +220,21 @@ GError* do_wifiScan() {
/*connection = gdbus_conn->connection;*/
connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
if (connection == NULL) {
- printf("GDBusconnection is NULL");
- return error;
+ ERROR(afbitf,"Cannot connect to D-Bus, %s", error->message);
+ return error;
}
g_dbus_connection_call(connection, CONNMAN_SERVICE,
CONNMAN_WIFI_TECHNOLOGY_PREFIX, CONNMAN_TECHNOLOGY_INTERFACE, "Scan", NULL,
NULL, G_DBUS_CALL_FLAGS_NONE, DBUS_REPLY_TIMEOUT, NULL, NULL, &error);
if (error) {
- printf("error: %d:%s\n", error->code, error->message);
+ ERROR(afbitf,"Error %s while calling Scan method", error->message);
return error;
}
else {
- printf("Scan succeeded\n");
+ INFO(afbitf, "Scan succeeded\n");
return NULL;
}
}
@@ -254,16 +251,16 @@ GError* do_displayScan(GSList **wifi_list) {
/*connection = gdbus_conn->connection;*/
connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
if (connection == NULL) {
- printf("GDBusconnection is NULL");
- return error;
+ ERROR(afbitf,"Cannot connect to D-Bus, %s", error->message);
+ return error;
}
message = g_dbus_connection_call_sync(connection, CONNMAN_SERVICE,
CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE, "GetServices", NULL, NULL,
G_DBUS_CALL_FLAGS_NONE,
DBUS_REPLY_TIMEOUT, NULL, &error);
if (message == NULL) {
- printf("message is NULL");
- return error;
+ ERROR(afbitf,"Error %s while calling GetServices method", error->message);
+ return error;
}
g_variant_get(message, "(a(oa{sv}))", &array);
while (g_variant_iter_loop(array, "(oa{sv})", &object, &content)) {
@@ -274,15 +271,15 @@ GError* do_displayScan(GSList **wifi_list) {
extract_values(content, wifiProfile);
wifiProfile->NetworkPath = g_try_malloc0(strlen(object));
strcpy(wifiProfile->NetworkPath, object);
- /*printf(
+ DEBUG(afbitf,
"SSID= %s, security= %s, path= %s, Strength= %d, wps support= %d\n",
wifiProfile->ESSID, wifiProfile->Security.sec_type,
wifiProfile->NetworkPath, wifiProfile->Strength,
wifiProfile->Security.wps_support);
- printf("method= %s, ip address= %s, netmask= %s\n",
+ DEBUG(afbitf, "method= %s, ip address= %s, netmask= %s\n",
wifiProfile->wifiNetwork.method,
wifiProfile->wifiNetwork.IPaddress,
- wifiProfile->wifiNetwork.netmask);*/
+ wifiProfile->wifiNetwork.netmask);
*wifi_list = g_slist_append(*wifi_list,
(struct wifi_profile_info *) wifiProfile);
}
@@ -294,7 +291,7 @@ GError* do_displayScan(GSList **wifi_list) {
GError* do_connectNetwork(gchar *networkPath) {
- printf("Connecting to: %s\n", networkPath);
+ NOTICE(afbitf, "Connecting to: %s\n", networkPath);
GVariant *message = NULL;
GError *error = NULL;
@@ -307,14 +304,13 @@ GError* do_connectNetwork(gchar *networkPath) {
G_DBUS_CALL_FLAGS_NONE,
DBUS_REPLY_TIMEOUT_SHORT, NULL, &error);
- //printf("message error %s\n", message);
//TODO: do we need retunrn value in message
if (error) {
- printf("do_connectNetwork error: %s\n", error->message);
- return error;
+ ERROR(afbitf,"Error %s while calling Connect method", error->message);
+ return error;
} else {
- printf("Connection succeeded\n");
+ INFO(afbitf,"Connection succeeded\n");
return NULL;
}
@@ -322,7 +318,7 @@ GError* do_connectNetwork(gchar *networkPath) {
GError* do_disconnectNetwork(gchar *networkPath) {
- printf("Connecting to: %s\n", networkPath);
+ NOTICE(afbitf, "Connecting to: %s\n", networkPath);
GVariant *message = NULL;
GError *error = NULL;
@@ -330,6 +326,11 @@ GError* do_disconnectNetwork(gchar *networkPath) {
connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (connection == NULL) {
+ ERROR(afbitf,"Cannot connect to D-Bus, %s", error->message);
+ return error;
+ }
+
message = g_dbus_connection_call_sync(connection, CONNMAN_SERVICE,
networkPath, CONNMAN_SERVICE_INTERFACE, "Disconnect", NULL, NULL,
G_DBUS_CALL_FLAGS_NONE,
@@ -338,18 +339,18 @@ GError* do_disconnectNetwork(gchar *networkPath) {
//TODO: do we need return value in message
if (error) {
- printf("error: %s\n", error->message);
- return error;
+ ERROR(afbitf,"Error %s while calling Disconnect method", error->message);
+ return error;
} else {
- printf("Disconnected\n");
- return NULL;
+ INFO(afbitf,"Disconnection succeeded\n");
+ return NULL;
}
}
void registerPasskey(gchar *passkey) {
- printf("Passkey: %s\n", passkey);
+ INFO(afbitf,"Passkey: %s\n", passkey);
sendPasskey(passkey);
@@ -363,21 +364,19 @@ GError* setHMIStatus(enum wifiStates state) {
GVariant *message = NULL;
GError *error = NULL;
- //openlog("WIFI Binder", LOG_PID | LOG_CONS, LOG_USER);
-
if (state==BAR_NO) iconString = "qrc:/images/Status/HMI_Status_Wifi_NoBars-01.png";
else if (state==BAR_1) iconString = "qrc:/images/Status/HMI_Status_Wifi_1Bar-01.png";
else if (state==BAR_2) iconString = "qrc:/images/Status/HMI_Status_Wifi_2Bars-01.png";
else if (state==BAR_3) iconString = "qrc:/images/Status/HMI_Status_Wifi_3Bars-01.png";
else if (state==BAR_FULL) iconString = "qrc:/images/Status/HMI_Status_Wifi_Full-01.png";
- //else {syslog(LOG_ERR, "Default value for wifi HMI icon, should not happened.. : %d", state);
- // iconString = "qrc:/images/Status/HMI_Status_Wifi_NoBars-01.png";
- //}
-
- //syslog(LOG_INFO, "%s", iconString);
connection = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
+ if (connection == NULL) {
+ ERROR(afbitf,"Cannot connect to D-Bus, %s", error->message);
+ return error;
+ }
+
params = g_variant_new("(is)", HOMESCREEN_WIFI_ICON_POSITION, iconString);
message = g_dbus_connection_call_sync(connection, HOMESCREEN_SERVICE,
@@ -386,14 +385,12 @@ GError* setHMIStatus(enum wifiStates state) {
DBUS_REPLY_TIMEOUT, NULL, &error);
if (error) {
- printf("error: %s\n", error->message);
+ ERROR(afbitf,"Error %s while setting up the status icon", error->message);
return error;
} else {
return NULL;
}
- //closelog();
-
}
diff --git a/binding-wifi/wifi-connman.h b/binding-wifi/wifi-connman.h
index 90533dd..dfc0d5b 100644
--- a/binding-wifi/wifi-connman.h
+++ b/binding-wifi/wifi-connman.h
@@ -13,16 +13,28 @@
* limitations under the License.
*/
+#define _GNU_SOURCE
+
//#include <dlog.h>
#include <glib.h>
#include <stdlib.h>
#include <gio/gio.h>
#include <glib-object.h>
+#include <afb/afb-binding.h>
+
#ifdef __cplusplus
extern "C" {
#endif
+//
+
+
+/*
+ * the interface to afb-daemon
+ */
+const struct afb_binding_interface *afbitf;
+
/** Maximum Profile Count */
#define CONNMAN_MAX_BUFLEN 512