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,
70 bool input_smartreply_init(app_control_h app_control)
75 void input_smartreply_deinit(void)
80 bool input_smartreply_get_reply(void)
85 bool input_smartreply_get_reply_async(void)
90 int input_smartreply_get_reply_num(void)
92 if (g_input_smartreply_data == NULL) {
93 PRINTFUNC(DLOG_ERROR, "InputSmartreplyData uninitialized");
97 if (g_input_smartreply_data->enabled == 0) {
98 PRINTFUNC(DLOG_WARN, "Smartreply is disabled");
102 return g_input_smartreply_data->candidate_list_len;
105 char *input_smartreply_get_nth_item(int index)
107 char *message = NULL;
112 bool input_smartreply_send_feedback(const char *str)
119 void input_smartreply_set_notify(input_smartreply_changed callback,
122 if (callback == NULL) {
123 PRINTFUNC(DLOG_ERROR, "empty callback function");
127 if (g_input_smartreply_data == NULL) {
128 PRINTFUNC(DLOG_WARN, "InputSmartreplyData uninitialized");
132 g_input_smartreply_data->callback = callback;
133 g_input_smartreply_data->user_data = user_data;
137 void input_smartreply_unset_notify(void)
139 if (g_input_smartreply_data == NULL) {
140 PRINTFUNC(DLOG_WARN, "InputSmartreplyData uninitialized");
144 g_input_smartreply_data->callback = NULL;
145 g_input_smartreply_data->user_data = NULL;
148 bool input_smartreply_is_enabled(void)
150 if (g_input_smartreply_data == NULL) {
151 PRINTFUNC(DLOG_WARN, "InputSmartreplyData uninitialized");
155 if (g_input_smartreply_data->enabled)