Update RegisterCounter method parameters
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 24 Jul 2010 03:01:49 +0000 (20:01 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 24 Jul 2010 03:01:49 +0000 (20:01 -0700)
doc/manager-api.txt
src/manager.c

index 40dac01..20ceb70 100644 (file)
@@ -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
 
index 514cd1e..54c5c3e 100644 (file)
@@ -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    },