Implement new feature
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 19 Jul 2012 02:19:22 +0000 (11:19 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Thu, 19 Jul 2012 02:19:22 +0000 (11:19 +0900)
But the operation is not work perfectly yet.
Just added API for the new features.

Delete cluster/sub-cluster API added
List up the cluster/sub-cluster API added

Change-Id: Ibaae680a10d76e7e2bbb86b801a5d96feed7401b

debian/changelog
include/livebox.h
packaging/liblivebox-viewer.spec
src/livebox.c

index 229ecba..2f5b53e 100644 (file)
@@ -1,3 +1,10 @@
+livebox-viewer (0.3.3) unstable; urgency=low
+
+  * Git: slp/pkgs/l/livebox-viewer
+  * Tag: livebox-viewer_0.3.3
+
+ -- Sung-jae Park <nicesj.park@samsung.com>  Thu, 19 Jul 2012 11:19:10 +0900
+
 livebox-viewer (0.3.2) unstable; urgency=low
 
   * Git: slp/pkgs/l/livebox-viewer
index 3b535e2..f4aded6 100644 (file)
@@ -508,6 +508,21 @@ extern int livebox_subscribe_group(const char *cluster, const char *category);
  */
 extern int livebox_unsubscribe_group(const char *cluster, const char *category);
 
+/*!
+ * \brief Get the list of cluster (SYNC Callback)
+ * \param[in] cb Callback for getting the name(id) list of the cluster
+ * \return int Number of listed items, or negative value(errno) for error
+ */
+extern int livebox_enumerate_cluster_list(void (*cb)(const char *cluster));
+
+/*!
+ * \brief Get the list of sub-cluster of the "cluster" (SYNC Callback)
+ * \param[in] cluster Cluster ID for getting the sub-cluster list
+ * \param[in] cb Callback for getting the name(id) list of the category of the "cluster"
+ * \return int Number of listed items, or negative value(errno) for error
+ */
+extern int livebox_enumerate_category_list(const char *cluster, void (*cb)(const char *category));
+
 #ifdef __cplusplus
 }
 #endif
index bc63c25..a40e77d 100644 (file)
@@ -1,6 +1,6 @@
 Name: liblivebox-viewer
 Summary: Library for the development of a livebox viewer
-Version: 0.3.2
+Version: 0.3.3
 Release: 1
 Group: main/app
 License: Samsung Proprietary License
index c2a349a..6f30b0f 100644 (file)
@@ -394,6 +394,54 @@ static void pd_destroy_cb(struct livebox *handler, const struct packet *result,
                cb(handler, ret, cbdata);
 }
 
+static void delete_cluster_cb(struct livebox *handler, const struct packet *result, void *data)
+{
+       struct cb_info *info = data;
+       int ret;
+       ret_cb_t cb;
+       void *cbdata;
+
+       cb = info->cb;
+       cbdata = info->data;
+       destroy_cb_info(info);
+
+       if (!result) {
+               ret = -EFAULT;
+       } else {
+               if (packet_get(result, "i", &ret) != 1)
+                       ret = -EINVAL;
+       }
+
+       DbgPrint("Delete category returns: %d\n", ret);
+
+       if (cb)
+               cb(handler, ret, cbdata);
+}
+
+static void delete_category_cb(struct livebox *handler, const struct packet *result, void *data)
+{
+       struct cb_info *info = data;
+       int ret;
+       ret_cb_t cb;
+       void *cbdata;
+
+       cb = info->cb;
+       cbdata = info->data;
+       destroy_cb_info(info);
+
+       if (!result) {
+               ret = -EFAULT;
+       } else {
+               if (packet_get(result, "i", &ret) != 1)
+                       ret = -EINVAL;
+       }
+
+       DbgPrint("Delete category returns: %d\n", ret);
+
+       if (cb)
+               cb(handler, ret, cbdata);
+}
+
 static void pinup_done_cb(struct livebox *handler, const struct packet *result, void *data)
 {
        int ret;
@@ -1115,14 +1163,28 @@ EAPI double livebox_priority(struct livebox *handler)
 
 EAPI int livebox_delete_cluster(const char *cluster, ret_cb_t cb, void *data)
 {
-       ErrPrint("Not implemented yet\n");
-       return -ENOSYS;
+       struct packet *packet;
+
+       packet = packet_create("delete_cluster", "s", cluster);
+       if (!packet) {
+               ErrPrint("Failed to build a param\n");
+               return -EFAULT;
+       }
+
+       return master_rpc_async_request(NULL, packet, 0, delete_cluster_cb, create_cb_info(cb, data));
 }
 
 EAPI int livebox_delete_category(const char *cluster, const char *category, ret_cb_t cb, void *data)
 {
-       ErrPrint("Not implemented yet\n");
-       return -ENOSYS;
+       struct packet *packet;
+
+       packet = packet_create("delete_category", "ss", cluster, category);
+       if (!packet) {
+               ErrPrint("Failed to build a param\n");
+               return -EFAULT;
+       }
+
+       return master_rpc_async_request(NULL, packet, 0, delete_category_cb, create_cb_info(cb, data));
 }
 
 EAPI enum livebox_lb_type livebox_lb_type(struct livebox *handler)
@@ -1867,4 +1929,18 @@ EAPI int livebox_unsubscribe_group(const char *cluster, const char *category)
        return master_rpc_async_request(NULL, packet, 0, NULL, NULL);
 }
 
+EAPI int livebox_enumerate_cluster_list(void (*cb)(const char *cluster))
+{
+       DbgPrint("Not implemented\n");
+       /* Use the DB for this */
+       return -ENOSYS;
+}
+
+EAPI int livebox_enumerate_category_list(const char *cluster, void (*cb)(const char *category))
+{
+       DbgPrint("Not implemented\n");
+       /* Use the DB for this */
+       return -ENOSYS;
+}
+
 /* End of a file */