1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
/*
* Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
*
* Licensed under the Flora License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://floralicense.org/license/
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "tel-request.h"
#include "sat-ui-debug.h"
#include "sat-ui.h"
#include <stdbool.h>
int setup_tapi_init(void *data)
{
SatUiAppData_t *ad = (SatUiAppData_t *)data;
if (ad->tapi_handle) {
DBG("tapi_handle is already exist");
} else {
ad->tapi_handle = tel_init(NULL);
if(ad->tapi_handle == NULL) {
DBG("tapi_init() error!! tapi_handle is NULL");
return -1;
}
}
return 0;
}
int send_app_execution_result(TelSatAppsRetInfo_t *app_ret_info, void *data)
{
SatUiAppData_t *ad = (SatUiAppData_t *)data;
TapiResult_t ret;
ret = tel_send_sat_app_exec_result(ad->tapi_handle, app_ret_info);
if(ret == TAPI_API_SUCCESS)
return 0;
else
return -1;
}
int send_ui_display_status(int cmd_id, TelSatUiDisplayStatusType_t ui_display_status_info, void *data)
{
SatUiAppData_t *ad = (SatUiAppData_t *)data;
TapiResult_t tapi_ret;
tapi_ret = tel_send_sat_ui_display_status(ad->tapi_handle, cmd_id, ui_display_status_info);
retvm_if(tapi_ret != TAPI_API_SUCCESS, -1, "TAPI_ERROR\n");
return 0;
}
static void on_resp_select_menu(TapiHandle *handle, int result, void *data, void *user_data)
{
DBG("");
DBG("select menu item result(%d)", result);
}
int satui_send_menu_selection_env(TapiHandle *handle, TelSatMenuSelectionReqInfo_t *menu_selection_req_info)
{
TapiResult_t tapi_ret;
//tapi_ret = tel_select_sat_menu(menu_selection_req_info, &request_id);
tapi_ret = tel_select_sat_menu(handle, menu_selection_req_info, on_resp_select_menu, NULL);
retvm_if(tapi_ret != TAPI_API_SUCCESS, false, "TAPI_ERROR\n");
return 1;
}
int send_menu_selection_info(TapiHandle *handle, char item_id, int bIsRequestingHelpText)
{
TapiResult_t tapi_ret;
TelSatMenuSelectionReqInfo_t menu_selection_info;
menu_selection_info.itemIdentifier = item_id;
menu_selection_info.bIsHelpRequested = bIsRequestingHelpText;
tapi_ret = tel_select_sat_menu(handle, &menu_selection_info, on_resp_select_menu, NULL);
return tapi_ret;
}
int send_ui_user_confirm(int cmd_id, int cmd_type, int key_type, int data_len, void *data, void *app_data)
{
TapiResult_t tapi_ret;
SatUiAppData_t *ad = (SatUiAppData_t *)app_data;
TelSatUiUserConfirmInfo_t user_confirm_info;
memset(&user_confirm_info, 0, sizeof(TelSatUiUserConfirmInfo_t));
user_confirm_info.commandId = cmd_id;
user_confirm_info.commandType = cmd_type;
user_confirm_info.keyType = key_type;
user_confirm_info.pAdditionalData = (unsigned char *)data;
user_confirm_info.dataLen = data_len;
DBG("cmd_id(%d), cmd_type(%d), key_type(%d), data_len(%d)", cmd_id, cmd_type, key_type, data_len);
tapi_ret = tel_send_sat_ui_user_confirm(ad->tapi_handle, &user_confirm_info);
DBG("tel_send_sat_ui_user_confirm return =%d", tapi_ret);
if(tapi_ret == TAPI_API_SUCCESS)
return 0;
else
return -1;
}
|