summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWiktor Lawski <wiktor.lawski@tieto.com>2012-09-19 15:20:41 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2012-09-21 09:20:24 +0200
commitbeb7d3bdbd1343e47b9b4b9bf74c97e19f997901 (patch)
treea184badfcb49ce2f297698abcfab7bd0eca0ebd7 /src
parent5a11613ca38a979ea6caf07e3b5d04507ca4adfa (diff)
downloadneard-beb7d3bdbd1343e47b9b4b9bf74c97e19f997901.tar.gz
neard-beb7d3bdbd1343e47b9b4b9bf74c97e19f997901.tar.bz2
neard-beb7d3bdbd1343e47b9b4b9bf74c97e19f997901.zip
adapter: Fix error message for StopPollLoop
Now when adapter is not polling and StopPollLoop is called, correct error message will be returned.
Diffstat (limited to 'src')
-rw-r--r--src/adapter.c3
-rw-r--r--src/error.c6
-rw-r--r--src/near.h1
3 files changed, 10 insertions, 0 deletions
diff --git a/src/adapter.c b/src/adapter.c
index 892381c..e5f9e6a 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -424,6 +424,9 @@ static DBusMessage *stop_poll_loop(DBusConnection *conn,
DBG("conn %p", conn);
+ if (adapter->polling == FALSE)
+ return __near_error_not_polling(msg);
+
err = __near_netlink_stop_poll(adapter->idx);
if (err < 0)
return __near_error_failed(msg, -err);
diff --git a/src/error.c b/src/error.c
index f166380..4012b5b 100644
--- a/src/error.c
+++ b/src/error.c
@@ -119,6 +119,12 @@ DBusMessage *__near_error_not_found(DBusMessage *msg)
".NotFound", "Not found");
}
+DBusMessage *__near_error_not_polling(DBusMessage *msg)
+{
+ return g_dbus_create_error(msg, NFC_ERROR_INTERFACE
+ ".Failed", "Not polling");
+}
+
DBusMessage *__near_error_no_carrier(DBusMessage *msg)
{
return g_dbus_create_error(msg, NFC_ERROR_INTERFACE
diff --git a/src/near.h b/src/near.h
index c6debdd..aee34be 100644
--- a/src/near.h
+++ b/src/near.h
@@ -51,6 +51,7 @@ DBusMessage *__near_error_not_unique(DBusMessage *msg);
DBusMessage *__near_error_not_supported(DBusMessage *msg);
DBusMessage *__near_error_not_implemented(DBusMessage *msg);
DBusMessage *__near_error_not_found(DBusMessage *msg);
+DBusMessage *__near_error_not_polling(DBusMessage *msg);
DBusMessage *__near_error_no_carrier(DBusMessage *msg);
DBusMessage *__near_error_in_progress(DBusMessage *msg);
DBusMessage *__near_error_already_exists(DBusMessage *msg);