Sync with the private repository
authorSung-jae Park <nicesj.park@samsung.com>
Wed, 10 Apr 2013 11:47:25 +0000 (20:47 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Wed, 10 Apr 2013 11:47:25 +0000 (20:47 +0900)
Add unhighlight event.

Add lb access status code.
for error case

Add accessibility event for script type livebox & pd
Update VERSION

API added & changed.
livebox_service_touch_effect is changed.
livebox_service_need_frame is added.
Add size_type parameter to get attribute for specified size.

Add API for getting the "need_frame" attribute
Each box can get help from viewer to draw border for box contents.
In that case, the box can set "true" for need_frame attribute.
Then the viewer will draw border for it.
To get the need_frame value, this library supports livebox_service_need_frame API.
It will returns true of false about need_frame attribute.
If it said, true, the viewer can draw some border on its contents.
or the viewer should keep its original contents.
But it is just recomendataion, if the viewer draw something on the box,
There is no way to keep it in safe ;)

Change-Id: Ib08c9e862d169e1729ff3e6f6c6ef6aea56ceb77

include/livebox-service.h
src/livebox-service.c

index 0f4c337..2b8ffd9 100644 (file)
@@ -38,6 +38,37 @@ enum livebox_size_type {
        LB_SIZE_TYPE_UNKNOWN = 0xFFFF,
 };
 
+enum livebox_script_event {
+       LB_SCRIPT_ACCESS_EVENT          = 0x00001000,
+       LB_SCRIPT_MOUSE_EVENT           = 0x00002000,
+       LB_SCRIPT_KEY_EVENT             = 0x00004000,
+
+       LB_SCRIPT_ACCESS_HIGHLIGHT      = LB_SCRIPT_ACCESS_EVENT | 0x00000000,
+       LB_SCRIPT_ACCESS_HIGHLIGHT_NEXT = LB_SCRIPT_ACCESS_EVENT | 0x00000001,
+       LB_SCRIPT_ACCESS_HIGHLIGHT_PREV = LB_SCRIPT_ACCESS_EVENT | 0x00000002,
+       LB_SCRIPT_ACCESS_ACTIVATE       = LB_SCRIPT_ACCESS_EVENT | 0x00000004,
+       LB_SCRIPT_ACCESS_VALUE_CHANGE   = LB_SCRIPT_ACCESS_EVENT | 0x00000008,
+       LB_SCRIPT_ACCESS_SCROLL         = LB_SCRIPT_ACCESS_EVENT | 0x00000010,
+       LB_SCRIPT_ACCESS_UNHIGHLIGHT    = LB_SCRIPT_ACCESS_EVENT | 0x00000020,
+
+       LB_SCRIPT_MOUSE_DOWN    = LB_SCRIPT_MOUSE_EVENT | 0x00000000,
+       LB_SCRIPT_MOUSE_MOVE    = LB_SCRIPT_MOUSE_EVENT | 0x00000001,
+       LB_SCRIPT_MOUSE_UP      = LB_SCRIPT_MOUSE_EVENT | 0x00000002,
+       LB_SCRIPT_MOUSE_IN      = LB_SCRIPT_MOUSE_EVENT | 0x00000004,
+       LB_SCRIPT_MOUSE_OUT     = LB_SCRIPT_MOUSE_EVENT | 0x00000008,
+
+       LB_SCRIPT_KEY_DOWN      = LB_SCRIPT_KEY_EVENT | 0x00000000,
+       LB_SCRIPT_KEY_UP        = LB_SCRIPT_KEY_EVENT | 0x00000000,
+};
+
+enum livebox_access_status {
+       LB_ACCESS_STATUS_DONE,
+       LB_ACCESS_STATUS_FIRST, /*!< Reach to the first item */
+       LB_ACCESS_STATUS_LAST, /*!< Reach to the last item */
+       LB_ACCESS_STATUS_READ, /* TTS done */
+       LB_ACCESS_STATUS_ERROR,
+};
+
 /*!
  * \brief
  * \param[in] type
@@ -65,9 +96,18 @@ extern int livebox_service_mouse_event(const char *pkgid);
 /*!
  * \brief
  * \param[in] pkgid Livebox's appid
+ * \param[in] size_type
+ * \return true(1) / false(0)
+ */
+extern int livebox_service_touch_effect(const char *pkgid, int size_type);
+
+/*!
+ * \brief
+ * \param[in] pkgid Livebox's appid
+ * \param[in] size_type
  * \return true(1) / false(0)
  */
-extern int livebox_service_touch_effect(const char *pkgid);
+extern int livebox_service_need_frame(const char *pkgid, int size_type);
 
 /*!
  * \brief
index 3e1ae97..e29e8dd 100644 (file)
@@ -856,7 +856,65 @@ out:
        return pkgid;
 }
 
-EAPI int livebox_service_touch_effect(const char *pkgid)
+EAPI int livebox_service_need_frame(const char *pkgid, int size_type)
+{
+       char *lbid;
+       sqlite3_stmt *stmt;
+       sqlite3 *handle;
+       int ret;
+
+       handle = open_db();
+       if (!handle) {
+               ErrPrint("Unable to open a DB\n");
+               return 0;
+       }
+
+       ret = sqlite3_prepare_v2(handle, "SELECT need_frame FROM box_size WHERE pkgid = ? AND size_type = ?", -1, &stmt, NULL);
+       if (ret != SQLITE_OK) {
+               ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+               close_db(handle);
+               return 0;
+       }
+
+       /*!
+        */
+       lbid = livebox_service_pkgname(pkgid);
+       if (!lbid) {
+               ErrPrint("Invalid appid (%s)\n", pkgid);
+               ret = 0;
+               goto out;
+       }
+
+       ret = sqlite3_bind_text(stmt, 1, lbid, -1, SQLITE_TRANSIENT);
+       free(lbid);
+       if (ret != SQLITE_OK) {
+               ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+               ret = 0;
+               goto out;
+       }
+
+       ret = sqlite3_bind_int(stmt, 2, size_type);
+       if (ret != SQLITE_OK) {
+               ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+               ret = 0;
+               goto out;
+       }
+
+       ret = sqlite3_step(stmt);
+       if (ret == SQLITE_ROW) {
+               ret = !!sqlite3_column_int(stmt, 0);
+       } else {
+               ret = 0;
+               ErrPrint("There is no such result\n");
+       }
+out:
+       sqlite3_reset(stmt);
+       sqlite3_finalize(stmt);
+       close_db(handle);
+       return ret;
+}
+
+EAPI int livebox_service_touch_effect(const char *pkgid, int size_type)
 {
        char *lbid;
        sqlite3_stmt *stmt;
@@ -869,7 +927,7 @@ EAPI int livebox_service_touch_effect(const char *pkgid)
                return 1;
        }
 
-       ret = sqlite3_prepare_v2(handle, "SELECT touch_effect FROM client WHERE pkgid = ?", -1, &stmt, NULL);
+       ret = sqlite3_prepare_v2(handle, "SELECT touch_effect FROM box_size WHERE pkgid = ? AND size_type = ?", -1, &stmt, NULL);
        if (ret != SQLITE_OK) {
                ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
                close_db(handle);
@@ -897,6 +955,13 @@ EAPI int livebox_service_touch_effect(const char *pkgid)
                goto out;
        }
 
+       ret = sqlite3_bind_int(stmt, 2, size_type);
+       if (ret != SQLITE_OK) {
+               ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+               ret = 1;
+               goto out;
+       }
+
        ret = sqlite3_step(stmt);
        if (ret == SQLITE_ROW) {
                ret = !!sqlite3_column_int(stmt, 0);