diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2010-07-23 20:01:49 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-07-23 20:01:49 -0700 |
commit | 07a94078b2555852355b10f56c28da55d4fe74dc (patch) | |
tree | a5ab522c4c0df9df0bc017de4d97a5ae2233cecd | |
parent | c4ece974f8fe47f5a8de2afe242546bf19b33731 (diff) | |
download | connman-07a94078b2555852355b10f56c28da55d4fe74dc.tar.gz connman-07a94078b2555852355b10f56c28da55d4fe74dc.tar.bz2 connman-07a94078b2555852355b10f56c28da55d4fe74dc.zip |
Update RegisterCounter method parameters
-rw-r--r-- | doc/manager-api.txt | 20 | ||||
-rw-r--r-- | src/manager.c | 11 |
2 files changed, 22 insertions, 9 deletions
diff --git a/doc/manager-api.txt b/doc/manager-api.txt index 40dac019..20ceb703 100644 --- a/doc/manager-api.txt +++ b/doc/manager-api.txt @@ -129,14 +129,24 @@ Methods dict GetProperties() Possible Errors: [service].Error.InvalidArguments - void RegisterCounter(object path, uint32 interval) + void RegisterCounter(object path, uint32 accuracy, uint32 period) Register a new counter for user notifications. - If the interval is zero then no timer for updates - will be started. Only kernel events can then - trigger updates. Otherwise the kernel will be - polled every n seconds for an update. + The accuracy is specified in kilo-bytes and defines + a threshold for counter updates. Together with the + period value it defines how often user space needs + to be updated. The period value is in seconds. + + This interface is not meant for time tracking. If + the time needs to be tracked down to the second, it + is better to have a real timer running inside the + application than using this interface. + + Also getting notified for every kilo-byte is a bad + choice (even if the interface supports it). Something + like 10 kilo-byte units or better 1 mega-byte seems + to be a lot more reasonable and better for the user. Possible Errors: [service].Error.InvalidArguments diff --git a/src/manager.c b/src/manager.c index 514cd1eb..54c5c3ef 100644 --- a/src/manager.c +++ b/src/manager.c @@ -572,7 +572,7 @@ static DBusMessage *register_counter(DBusConnection *conn, DBusMessage *msg, void *data) { const char *sender, *path; - unsigned int interval; + unsigned int accuracy, period; int err; DBG("conn %p", conn); @@ -580,10 +580,13 @@ static DBusMessage *register_counter(DBusConnection *conn, sender = dbus_message_get_sender(msg); dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path, - DBUS_TYPE_UINT32, &interval, + DBUS_TYPE_UINT32, &accuracy, + DBUS_TYPE_UINT32, &period, DBUS_TYPE_INVALID); - err = __connman_counter_register(sender, path, interval); + /* FIXME: add handling of accuracy parameter */ + + err = __connman_counter_register(sender, path, period); if (err < 0) return __connman_error_failed(msg, -err); @@ -670,7 +673,7 @@ static GDBusMethodTable manager_methods[] = { G_DBUS_METHOD_FLAG_ASYNC }, { "RegisterAgent", "o", "", register_agent }, { "UnregisterAgent", "o", "", unregister_agent }, - { "RegisterCounter", "ou", "", register_counter }, + { "RegisterCounter", "ouu", "", register_counter }, { "UnregisterCounter", "o", "", unregister_counter }, { "RequestSession", "s", "o", request_session }, { "ReleaseSession", "s", "", release_session }, |