Modify the log print and descriptions of remote control API 19/146119/1
authorSungmin Kwak <sungmin.kwak@samsung.com>
Fri, 25 Aug 2017 04:54:34 +0000 (13:54 +0900)
committerSungmin Kwak <sungmin.kwak@samsung.com>
Fri, 25 Aug 2017 04:54:34 +0000 (13:54 +0900)
Change-Id: I01779d27df8f2e10aa53fd65a11cb6f24fc4cdc6

ism/src/isf_remote_control.cpp
ism/src/isf_remote_control.h

index bd70e85..56ef863 100644 (file)
@@ -75,7 +75,7 @@ remote_handler(GIOChannel *source, GIOCondition condition, gpointer user_data)
                         data->autocapital_type = static_cast<Ecore_IMF_Autocapital_Type> (autocapital_type);
                         data->return_key_disabled = return_key_disabled;
 
-                        LOGD ("REMOTE_CONTROL_CALLBACK_ENTRY_METADATA hint: 0x%04x, layout: %d, variation: %d, autocapital: %d, return_key: %d",
+                        LOGD ("REMOTE_CONTROL_CALLBACK_ENTRY_METADATA: hint=0x%04x, layout=%d, variation=%d, autocap=%d, retKey_disabled=%d",
                             data->hint, data->layout, data->variation, data->autocapital_type, data->return_key_disabled);
 
                         if (client->metadata_cb)
@@ -91,7 +91,7 @@ remote_handler(GIOChannel *source, GIOCondition condition, gpointer user_data)
                         int cursor = -1;
 
                         client->remote_client.get_surrounding_text (surrounding_text, &cursor);
-                        SECURE_LOGD ("REMOTE_CONTROL_CALLBACK_TEXT_UPDATED \"%s\" %d", surrounding_text.c_str (), cursor);
+                        SECURE_LOGD ("REMOTE_CONTROL_CALLBACK_TEXT_UPDATED: %d \"%s\"", cursor, surrounding_text.c_str ());
 
                         if (client->text_updated_cb)
                             client->text_updated_cb (client->text_updated_cb_user_data, surrounding_text.c_str (), cursor);
@@ -113,6 +113,7 @@ remote_handler(GIOChannel *source, GIOCondition condition, gpointer user_data)
                     break;
                 }
                 case REMOTE_CONTROL_CALLBACK_ERROR:
+                    LOGE ("REMOTE_CONTROL_CALLBACK_ERROR");
                     break;
                 default:
                     break;
@@ -143,8 +144,10 @@ EXAPI remote_control_client * remote_control_connect(void)
         }
 
         remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-        if (error_e)
+        if (error_e) {
+            LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
             goto cleanup;
+        }
 
         client->remote_client_id = client->remote_client.get_panel2remote_connection_number();
 
@@ -172,6 +175,7 @@ EXAPI remote_control_client * remote_control_connect(void)
 
     LOGD ("%p", client);
     return client;
+
 cleanup:
     if (client)
         delete client;
@@ -187,8 +191,10 @@ EXAPI int remote_control_disconnect(remote_control_client *client)
     }
 
     remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-    if (error_e)
+    if (error_e) {
+        LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
         return error_e;
+    }
 
     if (client->remote_client_iochannel)
         g_io_channel_unref (client->remote_client_iochannel);
@@ -224,8 +230,10 @@ EXAPI int remote_control_focus_in_callback_set(remote_control_client *client, re
     }
 
     remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-    if (error_e)
+    if (error_e) {
+        LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
         return error_e;
+    }
 
     client->focus_in_cb = func;
     client->focus_in_cb_user_data = user_data;
@@ -242,8 +250,10 @@ EXAPI int remote_control_focus_in_callback_unset(remote_control_client *client)
     }
 
     remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-    if (error_e)
+    if (error_e) {
+        LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
         return error_e;
+    }
 
     client->focus_in_cb = NULL;
     client->focus_in_cb_user_data = NULL;
@@ -260,8 +270,10 @@ EXAPI int remote_control_focus_out_callback_set(remote_control_client *client, r
     }
 
     remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-    if (error_e)
+    if (error_e) {
+        LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
         return error_e;
+    }
 
     client->focus_out_cb = func;
     client->focus_out_cb_user_data = user_data;
@@ -278,8 +290,10 @@ EXAPI int remote_control_focus_out_callback_unset(remote_control_client *client)
     }
 
     remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-    if (error_e)
+    if (error_e) {
+        LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
         return error_e;
+    }
 
     client->focus_out_cb = NULL;
     client->focus_out_cb_user_data = NULL;
@@ -296,8 +310,10 @@ EXAPI int remote_control_entry_metadata_callback_set(remote_control_client *clie
     }
 
     remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-    if (error_e)
+    if (error_e) {
+        LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
         return error_e;
+    }
 
     client->metadata_cb = func;
     client->metadata_cb_user_data = user_data;
@@ -314,8 +330,10 @@ EXAPI int remote_control_entry_metadata_callback_unset(remote_control_client *cl
     }
 
     remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-    if (error_e)
+    if (error_e) {
+        LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
         return error_e;
+    }
 
     client->metadata_cb = NULL;
     client->metadata_cb_user_data = NULL;
@@ -332,8 +350,10 @@ EXAPI int remote_control_text_updated_callback_set(remote_control_client *client
     }
 
     remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-    if (error_e)
+    if (error_e) {
+        LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
         return error_e;
+    }
 
     client->text_updated_cb = func;
     client->text_updated_cb_user_data = user_data;
@@ -350,8 +370,10 @@ EXAPI int remote_control_text_updated_callback_unset(remote_control_client *clie
     }
 
     remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-    if (error_e)
+    if (error_e) {
+        LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
         return error_e;
+    }
 
     client->text_updated_cb = NULL;
     client->text_updated_cb_user_data = NULL;
@@ -368,8 +390,10 @@ EXAPI int remote_control_input_resource_changed_callback_set(remote_control_clie
     }
 
     remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-    if (error_e)
+    if (error_e) {
+        LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
         return error_e;
+    }
 
     client->input_resource_changed_cb = func;
     client->input_resource_changed_cb_user_data = user_data;
@@ -386,8 +410,10 @@ EXAPI int remote_control_input_resource_changed_callback_unset(remote_control_cl
     }
 
     remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-    if (error_e)
+    if (error_e) {
+        LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
         return error_e;
+    }
 
     client->input_resource_changed_cb = NULL;
     client->input_resource_changed_cb_user_data = NULL;
@@ -404,8 +430,10 @@ EXAPI int remote_control_send_key_event(remote_control_client *client, remote_co
     }
 
     remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-    if (error_e)
+    if (error_e) {
+        LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
         return error_e;
+    }
 
     char key_str[10] = {};
     snprintf(key_str, sizeof(key_str), "%d", key);
@@ -426,12 +454,16 @@ EXAPI int remote_control_send_key_event(remote_control_client *client, remote_co
 
 EXAPI int remote_control_send_commit_string(remote_control_client *client, const char *text)
 {
-    if (client == NULL || !text)
+    if (client == NULL || !text) {
+        LOGE ("REMOTE_CONTROL_INVALID_PARAMETER");
         return REMOTE_CONTROL_INVALID_PARAMETER;
+    }
 
     remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-    if (error_e)
+    if (error_e) {
+        LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
         return error_e;
+    }
 
     String command = String ("|plain|commit_string|") + String (text) + String ("|");
 
@@ -450,12 +482,16 @@ EXAPI int remote_control_send_commit_string(remote_control_client *client, const
 
 EXAPI int remote_control_update_preedit_string(remote_control_client *client, const char *text, Eina_List *attrs, int cursor_pos)
 {
-    if (client == NULL)
+    if (client == NULL) {
+        LOGE ("REMOTE_CONTROL_INVALID_PARAMETER");
         return REMOTE_CONTROL_INVALID_PARAMETER;
+    }
 
     remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-    if (error_e)
+    if (error_e) {
+        LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
         return error_e;
+    }
 
     char cursor_position[10] = {};
     snprintf(cursor_position, sizeof(cursor_position), "%d", cursor_pos);
@@ -465,7 +501,7 @@ EXAPI int remote_control_update_preedit_string(remote_control_client *client, co
         error_e = (remote_control_error_e)client->remote_client.send_remote_input_message(command.c_str ());
 
         if (!error_e)
-            SECURE_LOGD ("%p, \"%s\", %d", client, text, cursor_pos);
+            SECURE_LOGD ("%p, %d, \"%s\"", client, cursor_pos, text);
 
         return error_e;
     }
@@ -482,8 +518,10 @@ EXAPI int remote_control_delete_surrounding_text(remote_control_client *client,
     }
 
     remote_control_error_e error_e = (remote_control_error_e)client->remote_client.check_privilege();
-    if (error_e)
+    if (error_e) {
+        LOGE ("REMOTE_CONTROL_PERMISSION_DENIED");
         return error_e;
+    }
 
     if (focus_flag) {
         error_e = (remote_control_error_e)client->remote_client.delete_surrounding_text(offset, len);
index 748235f..839077a 100644 (file)
@@ -265,7 +265,7 @@ int remote_control_focus_out_callback_unset(remote_control_client *client);
  *
  * @privilege %http://tizen.org/privilege/imemanager
  *
- * @remarks remote_control_entry_metadata_cb() called after focus_in event.
+ * @remarks remote_control_entry_metadata_cb() will be called after focus_in event and it can be called again when the associated text field's attributes are changed
  *
  * @param[in] user_data User data to be passed from the callback registration function
  * @param[in] data The structure pointer of text field attributes
@@ -334,7 +334,7 @@ int remote_control_entry_metadata_callback_unset(remote_control_client *client);
  *
  * @privilege %http://tizen.org/privilege/imemanager
  *
- * @remarks remote_control_text_updated_cb() called after remote_control_entry_metadata_cb()
+ * @remarks remote_control_text_updated_cb() will be called after remote_control_entry_metadata_cb() and it can be called again when the text or the cursor position in the associated text field is changed
  *
  * @param[in] user_data User data to be passed from the callback registration function
  * @param[in] surrounding_text The UTF-8 string requested
@@ -522,7 +522,7 @@ int remote_control_send_commit_string(remote_control_client *client, const char
  * @param[in] client The remote control client
  * @param[in] text The UTF-8 string to be updated in preedit
  * @param[in] attrs An Eina_List of attributes
- * @param[in] cursor_pos The cursor position
+ * @param[in] cursor_pos The cursor position; -1 means at the end of line
  *
  * @return 0 on success, otherwise a negative error value
  * @retval #REMOTE_CONTROL_ERROR_NONE No error