2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
25 //#include <smartreply_service.h>
27 #include "w-input-smartreply.h"
29 #ifndef INPUT_SMARTREPLY_VCONF
30 #define INPUT_SMARTREPLY_VCONF "db/wms/smart_reply"
34 typedef struct _InputSmartreplyData InputSmartreplyData;
36 struct _InputSmartreplyData
45 input_smartreply_changed callback;
48 // smartreply_reply_h *candidate_list;
49 int candidate_list_len;
53 static void _input_smartreply_get_reply_callback(int handle, int error,
55 /* Disable smartreply on/off feature
56 static void _input_smartreply_vconf_changed(keynode_t *key, void *data);
60 static InputSmartreplyData *g_input_smartreply_data = NULL;
62 static void _input_smartreply_get_reply_callback(int handle, int error,
69 bool input_smartreply_init(app_control_h app_control)
74 void input_smartreply_deinit(void)
79 bool input_smartreply_get_reply(void)
84 bool input_smartreply_get_reply_async(void)
89 int input_smartreply_get_reply_num(void)
91 if (g_input_smartreply_data == NULL) {
92 PRINTFUNC(DLOG_ERROR, "InputSmartreplyData uninitialized");
96 if (g_input_smartreply_data->enabled == 0) {
97 PRINTFUNC(DLOG_WARN, "Smartreply is disabled");
101 return g_input_smartreply_data->candidate_list_len;
104 char *input_smartreply_get_nth_item(int index)
106 char *message = NULL;
111 bool input_smartreply_send_feedback(const char *str)
118 void input_smartreply_set_notify(input_smartreply_changed callback,
121 if (callback == NULL) {
122 PRINTFUNC(DLOG_ERROR, "empty callback function");
126 if (g_input_smartreply_data == NULL) {
127 PRINTFUNC(DLOG_WARN, "InputSmartreplyData uninitialized");
131 g_input_smartreply_data->callback = callback;
132 g_input_smartreply_data->user_data = user_data;
136 void input_smartreply_unset_notify(void)
138 if (g_input_smartreply_data == NULL) {
139 PRINTFUNC(DLOG_WARN, "InputSmartreplyData uninitialized");
143 g_input_smartreply_data->callback = NULL;
144 g_input_smartreply_data->user_data = NULL;
147 bool input_smartreply_is_enabled(void)
149 if (g_input_smartreply_data == NULL) {
150 PRINTFUNC(DLOG_WARN, "InputSmartreplyData uninitialized");
154 if (g_input_smartreply_data->enabled)