Remove unnecessary header include
[platform/core/uifw/isf.git] / ism / src / isf_remote_control.h
1 #ifndef _ISF_REMOTE_CONTROL_H_
2 #define _ISF_REMOTE_CONTROL_H_
3
4 /**
5  * @file isf_remote_control.h
6  * @brief This file contains remote control APIs for TV profile.
7  */
8
9 #include <Ecore_IMF.h>
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif /* __cplusplus */
14
15 /**
16  * @brief Enumeration for remote control function error.
17  *
18  * @since_tizen @if TV 3.0 @endif
19  */
20 typedef enum {
21     REMOTE_CONTROL_ERROR_NONE = 0, /**< Successful */
22     REMOTE_CONTROL_PERMISSION_DENIED, /**< Permission denied */
23     REMOTE_CONTROL_REPLY_TIMEOUT, /**< Reply timeout */
24     REMOTE_CONTROL_CONNECTION_LOST, /**< Connection to server lost */
25     REMOTE_CONTROL_INVALID_OPERATION, /**< Invalid operation */
26     REMOTE_CONTROL_INVALID_PARAMETER, /**< Invalid parameter */
27 } remote_control_error_e;
28
29 /**
30  * @brief Enumeration for key types.
31  *
32  * @since_tizen @if TV 3.0 @endif
33  *
34  * @see remote_control_send_key_event()
35  */
36 typedef enum {
37     REMOTE_CONTROL_KEY_ENTER = 0, /**< Enter key */
38     REMOTE_CONTROL_KEY_SPACE, /**< Space key */
39     REMOTE_CONTROL_KEY_BACKSPACE, /**< Backspace key */
40     REMOTE_CONTROL_KEY_ESC, /**< Escape key */
41     REMOTE_CONTROL_KEY_UP, /**< Up key */
42     REMOTE_CONTROL_KEY_DOWN, /**< Down key */
43     REMOTE_CONTROL_KEY_LEFT, /**< LEFT key */
44     REMOTE_CONTROL_KEY_RIGHT, /**< Right key */
45     REMOTE_CONTROL_KEY_PAGE_UP, /**< Page up key */
46     REMOTE_CONTROL_KEY_PAGE_DOWN, /**< Page down key */
47     REMOTE_CONTROL_KEY_SELECT, /**< Select key */
48     REMOTE_CONTROL_KEY_CANCEL, /**< Cancel key */
49 } remote_control_key_type_e;
50
51 /**
52  * @brief Enumeration for input resources.
53  *
54  * @since_tizen @if TV 3.0 @endif
55  *
56  * @see remote_control_input_resource_changed_cb()
57  */
58 typedef enum {
59     REMOTE_CONTROL_INPUT_RESOURCE_LOCAL, /**< Input event from TV IME, H/W keyboard */
60     REMOTE_CONTROL_INPUT_RESOURCE_REMOTE, /**< Input event from remote control API */
61 } remote_control_input_resource;
62
63 /**
64  * @brief The structure type to contain the attributes of text field.
65  *
66  * @since_tizen @if TV 3.0 @endif
67  *
68  * @see remote_control_entry_metadata_cb
69  */
70 typedef struct {
71     Ecore_IMF_Input_Hints hint; /**< The input hint information */
72     Ecore_IMF_Input_Panel_Layout layout; /**< The layout information */
73     int variation; /**< The layout variation information */
74     Ecore_IMF_Autocapital_Type autocapital_type; /**< The autocapital type information */
75     bool return_key_disabled; /**< The return key state information */
76     Ecore_IMF_Input_Panel_Return_Key_Type return_key_type; /**< The return key type information */
77 } remote_control_entry_metadata_s;
78
79 /**
80  * @brief A structure type to contain the attributes for socket and callback function.
81  *
82  * @since_tizen @if TV 3.0 @endif
83  *
84  * @see remote_control_connect()
85  */
86 typedef struct _remote_control_client remote_control_client;
87
88 /**
89  * @brief Creates a new remote control client.
90  *
91  * @details This function provides socket connection and register a fd_handler for the callback function.
92  *
93  * @since_tizen @if TV 3.0 @endif
94  *
95  * @privlevel platform
96  *
97  * @privilege %http://tizen.org/privilege/imemanager
98  *
99  * @return The remote control client on success, otherwise NULL
100  *
101  * @see remote_control_disconnect()
102  */
103 remote_control_client * remote_control_connect(void);
104
105 /**
106  * @brief Destroys a remote control client.
107  *
108  * @since_tizen @if TV 3.0 @endif
109  *
110  * @privlevel platform
111  *
112  * @privilege %http://tizen.org/privilege/imemanager
113  *
114  * @param[in] client The remote control client
115  *
116  * @return 0 on success, otherwise a negative error value
117  * @retval #REMOTE_CONTROL_ERROR_NONE No error
118  * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function
119  * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
120  * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Reply timeout
121  * @retval #REMOTE_CONTROL_CONNECTION_LOST Connection to server lost
122  *
123  * @see remote_control_connect()
124  */
125 int remote_control_disconnect(remote_control_client *client);
126
127 /**
128  * @brief Called when an associated text field has focus.
129  *
130  * @since_tizen @if TV 3.0 @endif
131  *
132  * @privlevel platform
133  *
134  * @privilege %http://tizen.org/privilege/imemanager
135  *
136  * @param[in] user_data User data to be passed from the callback registration function
137  *
138  * @pre The callback can be registered using remote_control_focus_in_callback_set() function.
139  *
140  * @see remote_control_focus_in_callback_set()
141  * @see remote_control_focus_in_callback_unset()
142  */
143 typedef void (*remote_control_focus_in_cb)(void *user_data);
144
145 /**
146  * @brief Register a callback function to be called when an associated text field has focus.
147  *
148  * @since_tizen @if TV 3.0 @endif
149  *
150  * @privlevel platform
151  *
152  * @privilege %http://tizen.org/privilege/imemanager
153  *
154  * @param[in] client The remote control client
155  * @param[in] func focus_in event callback function
156  * @param[in] user_data User data to be passed to the callback function
157  *
158  * @return 0 on success, otherwise a negative error value
159  * @retval #REMOTE_CONTROL_ERROR_NONE No error
160  * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function
161  * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
162  * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Reply timeout
163  * @retval #REMOTE_CONTROL_CONNECTION_LOST Connection to server lost
164  *
165  * @see remote_control_focus_in_cb()
166  * @see remote_control_focus_in_callback_unset()
167  */
168 int remote_control_focus_in_callback_set(remote_control_client *client, remote_control_focus_in_cb func, void *user_data);
169
170 /**
171  * @brief Remove a remote_control_focus_in_cb() callback function.
172  *
173  * @since_tizen @if TV 3.0 @endif
174  *
175  * @privlevel platform
176  *
177  * @privilege %http://tizen.org/privilege/imemanager
178  *
179  * @param[in] client The remote control client
180  *
181  * @return 0 on success, otherwise a negative error value
182  * @retval #REMOTE_CONTROL_ERROR_NONE No error
183  * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function
184  * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
185  * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Reply timeout
186  * @retval #REMOTE_CONTROL_CONNECTION_LOST Connection to server lost
187  *
188  * @see remote_control_focus_in_cb()
189  * @see remote_control_focus_in_callback_set()
190  */
191 int remote_control_focus_in_callback_unset(remote_control_client *client);
192
193 /**
194  * @brief Called when an associated text field loses focus.
195  *
196  * @since_tizen @if TV 3.0 @endif
197  *
198  * @privlevel platform
199  *
200  * @privilege %http://tizen.org/privilege/imemanager
201  *
202  * @param[in] user_data User data to be passed from the callback registration function
203  *
204  * @pre The callback can be registered using remote_control_focus_out_callback_set() function.
205  *
206  * @see remote_control_focus_out_callback_set()
207  * @see remote_control_focus_out_callback_unset()
208  */
209 typedef void (*remote_control_focus_out_cb)(void *user_data);
210
211 /**
212  * @brief Register a callback function to be called when an associated text field loses focus.
213  *
214  * @since_tizen @if TV 3.0 @endif
215  *
216  * @privlevel platform
217  *
218  * @privilege %http://tizen.org/privilege/imemanager
219  *
220  * @param[in] client The remote control client
221  * @param[in] func focus_out event callback function
222  * @param[in] user_data User data to be passed to the callback function
223  *
224  * @return 0 on success, otherwise a negative error value
225  * @retval #REMOTE_CONTROL_ERROR_NONE No error
226  * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function
227  * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
228  * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Reply timeout
229  * @retval #REMOTE_CONTROL_CONNECTION_LOST Connection to server lost
230  *
231  * @see remote_control_focus_out_cb()
232  * @see remote_control_focus_out_callback_unset()
233  */
234 int remote_control_focus_out_callback_set(remote_control_client *client, remote_control_focus_out_cb func , void *user_data);
235
236 /**
237  * @brief Remove a remote_control_focus_out_cb() callback function.
238  *
239  * @since_tizen @if TV 3.0 @endif
240  *
241  * @privlevel platform
242  *
243  * @privilege %http://tizen.org/privilege/imemanager
244  *
245  * @param[in] client The remote control client
246  *
247  * @return 0 on success, otherwise a negative error value
248  * @retval #REMOTE_CONTROL_ERROR_NONE No error
249  * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function
250  * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
251  * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Reply timeout
252  * @retval #REMOTE_CONTROL_CONNECTION_LOST Connection to server lost
253  *
254  * @see remote_control_focus_out_cb()
255  * @see remote_control_focus_out_callback_set()
256  */
257 int remote_control_focus_out_callback_unset(remote_control_client *client);
258
259 /**
260  * @brief Called when an associated text field requests the input panel to set its attributes.
261  *
262  * @since_tizen @if TV 3.0 @endif
263  *
264  * @privlevel platform
265  *
266  * @privilege %http://tizen.org/privilege/imemanager
267  *
268  * @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
269  *
270  * @param[in] user_data User data to be passed from the callback registration function
271  * @param[in] data The structure pointer of text field attributes
272  *
273  * @pre The callback can be registered using remote_control_entry_metadata_callback_set() function.
274  *
275  * @see remote_control_entry_metadata_callback_set()
276  * @see remote_control_entry_metadata_callback_unset()
277  */
278 typedef void (*remote_control_entry_metadata_cb)(void *user_data, remote_control_entry_metadata_s *data);
279
280 /**
281  * @brief Register a remote_control_entry_metadata_cb() callback function.
282  *
283  * @since_tizen @if TV 3.0 @endif
284  *
285  * @privlevel platform
286  *
287  * @privilege %http://tizen.org/privilege/imemanager
288  *
289  * @param[in] client The remote control client
290  * @param[in] func remote_control_entry_metadata_cb() callback function
291  * @param[in] user_data User data to be passed to the callback function
292  *
293  * @return 0 on success, otherwise a negative error value
294  * @retval #REMOTE_CONTROL_ERROR_NONE No error
295  * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function
296  * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
297  * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Reply timeout
298  * @retval #REMOTE_CONTROL_CONNECTION_LOST Connection to server lost
299  *
300  * @see remote_control_entry_metadata_cb()
301  * @see remote_control_entry_metadata_callback_unset()
302  */
303 int remote_control_entry_metadata_callback_set(remote_control_client *client, remote_control_entry_metadata_cb func, void *user_data);
304
305 /**
306  * @brief Remove a remote_control_entry_metadata_cb() callback function.
307  *
308  * @since_tizen @if TV 3.0 @endif
309  *
310  * @privlevel platform
311  *
312  * @privilege %http://tizen.org/privilege/imemanager
313  *
314  * @param[in] client The remote control client
315  *
316  * @return 0 on success, otherwise a negative error value
317  * @retval #REMOTE_CONTROL_ERROR_NONE No error
318  * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function
319  * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
320  * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Reply timeout
321  * @retval #REMOTE_CONTROL_CONNECTION_LOST Connection to server lost
322  *
323  * @see remote_control_entry_metadata_cb()
324  * @see remote_control_entry_metadata_callback_set()
325  */
326 int remote_control_entry_metadata_callback_unset(remote_control_client *client);
327
328 /**
329  * @brief Called when an associated text field responds to a request with the surrounding text.
330  *
331  * @since_tizen @if TV 3.0 @endif
332  *
333  * @privlevel platform
334  *
335  * @privilege %http://tizen.org/privilege/imemanager
336  *
337  * @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
338  *
339  * @param[in] user_data User data to be passed from the callback registration function
340  * @param[in] surrounding_text The UTF-8 string requested
341  * @param[in] cursor_pos The cursor position
342  *
343  * @pre The callback can be registered using remote_control_text_updated_callback_set() function.
344  *
345  * @see remote_control_text_updated_callback_set()
346  * @see remote_control_text_updated_callback_unset()
347  */
348 typedef void (*remote_control_text_updated_cb)(void *user_data, const char *surrounding_text, int cursor_pos);
349
350 /**
351  * @brief Register a remote_control_text_updated_cb() callback function.
352  *
353  * @since_tizen @if TV 3.0 @endif
354  *
355  * @privlevel platform
356  *
357  * @privilege %http://tizen.org/privilege/imemanager
358  *
359  * @param[in] client The remote control client
360  * @param[in] func remote_control_text_updated_cb() callback function
361  * @param[in] user_data User data to be passed to the callback function
362  *
363  * @return 0 on success, otherwise a negative error value
364  * @retval #REMOTE_CONTROL_ERROR_NONE No error
365  * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function
366  * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
367  * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Reply timeout
368  * @retval #REMOTE_CONTROL_CONNECTION_LOST Connection to server lost
369  *
370  * @see remote_control_text_updated_cb()
371  * @see remote_control_text_updated_callback_unset()
372  */
373 int remote_control_text_updated_callback_set(remote_control_client *client, remote_control_text_updated_cb func, void *user_data);
374
375 /**
376  * @brief Remove a remote_control_text_updated_cb() callback function.
377  *
378  * @since_tizen @if TV 3.0 @endif
379  *
380  * @privlevel platform
381  *
382  * @privilege %http://tizen.org/privilege/imemanager
383  *
384  * @param[in] client The remote control client
385  *
386  * @return 0 on success, otherwise a negative error value
387  * @retval #REMOTE_CONTROL_ERROR_NONE No error
388  * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function
389  * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
390  * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Reply timeout
391  * @retval #REMOTE_CONTROL_CONNECTION_LOST Connection to server lost
392  *
393  * @see remote_control_text_updated_cb()
394  * @see remote_control_text_updated_callback_set()
395  */
396 int remote_control_text_updated_callback_unset(remote_control_client *client);
397
398 /**
399  * @brief Called when the input resource is changed.
400  *
401  * @since_tizen @if TV 3.0 @endif
402  *
403  * @privlevel platform
404  *
405  * @privilege %http://tizen.org/privilege/imemanager
406  *
407  * @param[in] user_data User data to be passed from the callback registration function
408  * @param[in] resource local input event callback function
409  *
410  * @pre The callback can be registered using remote_control_input_resource_changed_callback_set() function.
411  *
412  * @see remote_control_local_input_callback_set()
413  * @see remote_control_local_input_callback_unset()
414  */
415 typedef void (*remote_control_input_resource_changed_cb)(void *user_data, remote_control_input_resource resource);
416
417 /**
418  * @brief Register a callback function to be called when the input resource is changed.
419  *
420  * @since_tizen @if TV 3.0 @endif
421  *
422  * @privlevel platform
423  *
424  * @privilege %http://tizen.org/privilege/imemanager
425  *
426  * @param[in] client The remote control client
427  * @param[in] func Input resource changed callback function
428  * @param[in] user_data User data to be passed to the callback function
429  *
430  * @return 0 on success, otherwise a negative error value
431  * @retval #REMOTE_CONTROL_ERROR_NONE No error
432  * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function
433  * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
434  * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Reply timeout
435  * @retval #REMOTE_CONTROL_CONNECTION_LOST Connection to server lost
436  *
437  * @see remote_control_input_resource_changed_cb()
438  * @see remote_control_input_resource_changed_callback_unset()
439  */
440 int remote_control_input_resource_changed_callback_set(remote_control_client *client, remote_control_input_resource_changed_cb func , void *user_data);
441
442 /**
443  * @brief Remove a remote_control_input_resource_changed_cb() callback function.
444  *
445  * @since_tizen @if TV 3.0 @endif
446  *
447  * @privlevel platform
448  *
449  * @privilege %http://tizen.org/privilege/imemanager
450  *
451  * @param[in] client The remote control client
452  *
453  * @return 0 on success, otherwise a negative error value
454  * @retval #REMOTE_CONTROL_ERROR_NONE No error
455  * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function
456  * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
457  * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Reply timeout
458  * @retval #REMOTE_CONTROL_CONNECTION_LOST Connection to server lost
459  *
460  * @see remote_control_input_resource_changed_cb()
461  * @see remote_control_input_resource_changed_callback_set()
462  */
463 int remote_control_input_resource_changed_callback_unset(remote_control_client *client);
464
465 /**
466  * @brief Sends the key event to the associated text field.
467  *
468  * @since_tizen @if TV 3.0 @endif
469  *
470  * @privlevel platform
471  *
472  * @privilege %http://tizen.org/privilege/imemanager
473  *
474  * @param[in] client The remote control client
475  * @param[in] key The remote_control_key_type_e information
476  *
477  * @return 0 on success, otherwise a negative error value
478  * @retval #REMOTE_CONTROL_ERROR_NONE No error
479  * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function
480  * @retval #REMOTE_CONTROL_INVALID_OPERATION Invalid operation
481  * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
482  * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Reply timeout
483  * @retval #REMOTE_CONTROL_CONNECTION_LOST Connection to server lost
484  *
485  * @see remote_control_key_type_e
486  */
487 int remote_control_send_key_event(remote_control_client *client, remote_control_key_type_e key);
488
489 /**
490  * @brief Sends the text to the associated text field.
491  *
492  * @since_tizen @if TV 3.0 @endif
493  *
494  * @privlevel platform
495  *
496  * @privilege %http://tizen.org/privilege/imemanager
497  *
498  * @param[in] client The remote control client
499  * @param[in] text The UTF-8 string to be committed
500  *
501  * @return 0 on success, otherwise a negative error value
502  * @retval #REMOTE_CONTROL_ERROR_NONE No error
503  * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function
504  * @retval #REMOTE_CONTROL_INVALID_OPERATION Invalid operation
505  * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
506  * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Reply timeout
507  * @retval #REMOTE_CONTROL_CONNECTION_LOST Connection to server lost
508  *
509  * @see remote_control_update_preedit_string()
510  */
511 int remote_control_send_commit_string(remote_control_client *client, const char *text);
512
513 /**
514  * @brief Updates a new preedit string to the associated text field.
515  *
516  * @since_tizen @if TV 3.0 @endif
517  *
518  * @privlevel platform
519  *
520  * @privilege %http://tizen.org/privilege/imemanager
521  *
522  * @param[in] client The remote control client
523  * @param[in] text The UTF-8 string to be updated in preedit
524  * @param[in] attrs An Eina_List of attributes
525  * @param[in] cursor_pos The cursor position; -1 means at the end of line
526  *
527  * @return 0 on success, otherwise a negative error value
528  * @retval #REMOTE_CONTROL_ERROR_NONE No error
529  * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function
530  * @retval #REMOTE_CONTROL_INVALID_OPERATION Invalid operation
531  * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
532  * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Reply timeout
533  * @retval #REMOTE_CONTROL_CONNECTION_LOST Connection to server lost
534  *
535  * @see remote_control_send_commit_string()
536  */
537 int remote_control_update_preedit_string(remote_control_client *client, const char *text, Eina_List *attrs, int cursor_pos);
538
539 /**
540  * @brief Requests to delete surrounding text.
541  *
542  * @since_tizen @if TV 3.0 @endif
543  *
544  * @privlevel platform
545  *
546  * @privilege %http://tizen.org/privilege/imemanager
547  *
548  * @param[in] client The remote control client
549  * @param[in] offset The offset value from the cursor position
550  * @param[in] len The length of the text to delete
551  *
552  * @return 0 on success, otherwise a negative error value
553  * @retval #REMOTE_CONTROL_ERROR_NONE No error
554  * @retval #REMOTE_CONTROL_PERMISSION_DENIED The application does not have the privilege to call this function
555  * @retval #REMOTE_CONTROL_INVALID_OPERATION Invalid operation
556  * @retval #REMOTE_CONTROL_INVALID_PARAMETER Invalid parameter
557  * @retval #REMOTE_CONTROL_REPLY_TIMEOUT Reply timeout
558  * @retval #REMOTE_CONTROL_CONNECTION_LOST Connection to server lost
559  */
560 int remote_control_delete_surrounding_text(remote_control_client *client, int offset, int len);
561
562 #ifdef __cplusplus
563 }
564 #endif /* __cplusplus */
565
566 #endif