From: Giacinto Cifelli <gciofono@gmail.com>
To: ofono@ofono.org
Subject: [PATCH] src/location-reporting: driver properties handling
Date: Sun, 23 Sep 2018 08:19:21 +0200 [thread overview]
Message-ID: <20180923061922.23288-2-gciofono@gmail.com> (raw)
In-Reply-To: <20180923061922.23288-1-gciofono@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2166 bytes --]
---
src/location-reporting.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/location-reporting.c b/src/location-reporting.c
index 6a3e03c4..d787f0c0 100644
--- a/src/location-reporting.c
+++ b/src/location-reporting.c
@@ -64,7 +64,6 @@ static const char *location_reporting_type_to_string(
static DBusMessage *location_reporting_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
-
{
struct ofono_location_reporting *lr = data;
DBusMessage *reply;
@@ -74,7 +73,7 @@ static DBusMessage *location_reporting_get_properties(DBusConnection *conn,
dbus_bool_t value;
reply = dbus_message_new_method_return(msg);
- if (reply == NULL)
+ if (lr == NULL || reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -88,11 +87,25 @@ static DBusMessage *location_reporting_get_properties(DBusConnection *conn,
type = location_reporting_type_to_string(lr->driver->type);
ofono_dbus_dict_append(&dict, "Type", DBUS_TYPE_STRING, &type);
+ if (lr->driver && lr->driver->get_properties)
+ lr->driver->get_properties(lr, &dict);
+
dbus_message_iter_close_container(&iter, &dict);
return reply;
}
+static DBusMessage *location_reporting_set_property(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct ofono_location_reporting *lr = data;
+
+ if (!lr || !lr->driver || !lr->driver->set_property)
+ return __ofono_error_not_available(msg);
+
+ return lr->driver->set_property(lr, msg);
+}
+
static void client_remove(struct ofono_location_reporting *lr)
{
DBusConnection *conn = ofono_dbus_get_connection();
@@ -243,6 +256,9 @@ static const GDBusMethodTable location_reporting_methods[] = {
{ GDBUS_METHOD("GetProperties",
NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
location_reporting_get_properties) },
+ { GDBUS_ASYNC_METHOD("SetProperty",
+ GDBUS_ARGS({ "property", "s" }, { "value", "v" }),
+ NULL, location_reporting_set_property) },
{ GDBUS_ASYNC_METHOD("Request",
NULL, GDBUS_ARGS({ "fd", "h" }),
location_reporting_request) },
--
2.17.1
next prev parent reply other threads:[~2018-09-23 6:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-23 6:19 [PATCH] location-reporting.h: driver properties handling Giacinto Cifelli
2018-09-23 6:19 ` Giacinto Cifelli [this message]
2018-09-23 6:19 ` [PATCH] gemalto/location-reporting: add driver properties Giacinto Cifelli
2018-09-24 21:07 ` [PATCH] location-reporting.h: driver properties handling Denis Kenzior
2018-09-25 3:49 ` Giacinto Cifelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180923061922.23288-2-gciofono@gmail.com \
--to=gciofono@gmail.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox