4 * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Shaik Alimulla <alimulla.s@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
24 #include <tapi_common.h>
26 #include <TapiUtility.h>
28 #include "util_common.h"
31 enum async_state async_flag;
32 TelSatSetupMenuInfo_t main_menu;
35 * tel_get_sat_main_menu_info
40 static void utc_tel_get_sat_main_menu_info (void)
44 ret = tel_get_sat_main_menu_info (handle, &main_menu);
45 if (ret != TAPI_API_SUCCESS) {
46 dts_fail("tel_get_sat_main_menu_info", "Unexpected return");
49 dts_pass("tel_get_sat_main_menu_info");
52 static void utc_fail_tel_get_sat_main_menu_info (void)
56 ret = tel_get_sat_main_menu_info (NULL, NULL);
57 if (ret == TAPI_API_SUCCESS) {
58 dts_fail("tel_get_sat_main_menu_info", "Parameter check failed");
61 ret = tel_get_sat_main_menu_info (handle, NULL);
62 if (ret == TAPI_API_SUCCESS) {
63 dts_fail("tel_get_sat_main_menu_info", "Parameter check failed");
66 dts_pass("tel_get_sat_main_menu_info");
73 static void on_tel_select_sat_menu (TapiHandle *handle, int result,
74 void *data, void *user_data)
76 int *value = user_data;
78 async_flag = ASYNC_DONE;
81 if (*value != 0xC0FFEE) {
82 dts_fail("tel_select_sat_menu", "Callback userdata crashed");
86 static void utc_tel_select_sat_menu (void)
90 TelSatMenuSelectionReqInfo_t selected_menu;
92 selected_menu.bIsHelpRequested = 0;
93 selected_menu.itemIdentifier = 0x01;
97 async_flag = ASYNC_READY;
98 ret = tel_select_sat_menu (handle, &selected_menu, on_tel_select_sat_menu, &value);
99 if (ret != TAPI_API_SUCCESS) {
100 dts_fail("tel_select_sat_menu", "Unexpected return");
106 if (async_flag != ASYNC_DONE) {
107 dts_fail("tel_select_sat_menu", "Callback not invoked");
110 dts_pass("tel_select_sat_menu");
113 static void utc_fail_tel_select_sat_menu (void)
117 ret = tel_select_sat_menu (NULL, NULL, NULL, NULL);
118 if (ret == TAPI_API_SUCCESS) {
119 dts_fail("tel_select_sat_menu", "Parameter check failed");
122 ret = tel_select_sat_menu (handle, NULL, NULL, NULL);
123 if (ret == TAPI_API_SUCCESS) {
124 dts_fail("tel_select_sat_menu", "Parameter check failed");
127 dts_pass("tel_select_sat_menu");
131 * tel_download_sat_event
134 static void on_tel_download_sat_event (TapiHandle *handle, int result,
135 void *data, void *user_data)
137 int *value = user_data;
139 async_flag = ASYNC_DONE;
142 if (*value != 0xC0FFEE) {
143 dts_fail("tel_download_sat_event", "Callback userdata crashed");
147 static void utc_tel_download_sat_event (void)
150 int value = 0xC0FFEE;
151 TelSatEventDownloadReqInfo_t event_data;
153 event_data.eventDownloadType = TAPI_EVENT_SAT_DW_TYPE_CALL_CONNECTED;
157 async_flag = ASYNC_READY;
158 ret = tel_download_sat_event (handle, &event_data, on_tel_download_sat_event, &value);
159 if (ret != TAPI_API_SUCCESS) {
160 dts_fail("tel_download_sat_event", "Unexpected return");
166 if (async_flag != ASYNC_DONE) {
167 dts_fail("tel_download_sat_event", "Callback not invoked");
170 dts_pass("tel_download_sat_event");
173 static void utc_fail_tel_download_sat_event (void)
177 ret = tel_download_sat_event (NULL, NULL, NULL, NULL);
178 if (ret == TAPI_API_SUCCESS) {
179 dts_fail("tel_download_sat_event", "Parameter check failed");
182 ret = tel_download_sat_event (handle, NULL, NULL, NULL);
183 if (ret == TAPI_API_SUCCESS) {
184 dts_fail("tel_download_sat_event", "Parameter check failed");
187 dts_pass("tel_download_sat_event");
191 * tel_send_sat_ui_display_status
194 static void utc_tel_send_sat_ui_display_status (void)
197 TelSatUiDisplayStatusType_t status;
199 status = TAPI_SAT_DISPLAY_SUCCESS;
201 ret = tel_send_sat_ui_display_status (handle, 0, status);
202 if (ret != TAPI_API_SUCCESS) {
203 dts_fail("tel_send_sat_ui_display_status", "Unexpected return");
206 dts_pass("tel_send_sat_ui_display_status");
209 static void utc_fail_tel_send_sat_ui_display_status (void)
213 ret = tel_send_sat_ui_display_status (NULL, 0, 0);
214 if (ret == TAPI_API_SUCCESS) {
215 dts_fail("tel_send_sat_ui_display_status", "Parameter check failed");
218 dts_pass("tel_send_sat_ui_display_status");
222 * tel_send_sat_ui_user_confirm
225 static void utc_tel_send_sat_ui_user_confirm (void)
228 TelSatUiUserConfirmInfo_t user_confirm_data;
230 user_confirm_data.commandId = 0;
231 user_confirm_data.commandType = TAPI_SAT_CMD_TYPE_DISPLAY_TEXT;
232 user_confirm_data.keyType = TAPI_SAT_USER_CONFIRM_YES;
233 user_confirm_data.dataLen = 0;
234 user_confirm_data.pAdditionalData = NULL;
237 ret = tel_send_sat_ui_user_confirm (handle, &user_confirm_data);
238 if (ret != TAPI_API_SUCCESS) {
239 dts_fail("tel_send_sat_ui_user_confirm", "Unexpected return");
242 dts_pass("tel_send_sat_ui_user_confirm");
245 static void utc_fail_tel_send_sat_ui_user_confirm (void)
249 ret = tel_send_sat_ui_user_confirm (NULL, NULL);
250 if (ret == TAPI_API_SUCCESS) {
251 dts_fail("tel_send_sat_ui_user_confirm", "Parameter check failed");
254 ret = tel_send_sat_ui_user_confirm (handle, NULL );
255 if (ret == TAPI_API_SUCCESS) {
256 dts_fail("tel_send_sat_ui_user_confirm", "Parameter check failed");
259 dts_pass("tel_send_sat_ui_user_confirm");
263 * tel_send_sat_app_exec_result
266 static void utc_tel_send_sat_app_exec_result (void)
269 TelSatAppsRetInfo_t app_ret_info;
271 app_ret_info.commandId = 0;
272 app_ret_info.commandType = TAPI_SAT_CMD_TYPE_DISPLAY_TEXT;
273 app_ret_info.appsRet.displayText.resp = TAPI_SAT_R_SUCCESS;
274 app_ret_info.appsRet.displayText.meProblem = TAPI_SAT_ME_PROBLEM_NO_SPECIFIC_CAUSE;
276 ret = tel_send_sat_app_exec_result (handle, &app_ret_info);
277 if (ret != TAPI_API_SUCCESS) {
278 dts_fail("tel_send_sat_app_exec_result", "Unexpected return");
281 dts_pass("tel_send_sat_app_exec_result");
284 static void utc_fail_tel_send_sat_app_exec_result (void)
288 ret = tel_send_sat_app_exec_result (NULL, NULL);
289 if (ret == TAPI_API_SUCCESS) {
290 dts_fail("tel_send_sat_app_exec_result", "Parameter check failed");
293 ret = tel_send_sat_app_exec_result (handle, NULL );
294 if (ret == TAPI_API_SUCCESS) {
295 dts_fail("tel_send_sat_app_exec_result", "Parameter check failed");
298 dts_pass("tel_send_sat_app_exec_result");
301 struct tet_testlist tet_testlist[] = {
303 { utc_tel_get_sat_main_menu_info, 1 },
304 { utc_fail_tel_get_sat_main_menu_info, 2 },
305 { utc_tel_select_sat_menu, 1 },
306 { utc_fail_tel_select_sat_menu, 2 },
307 { utc_tel_download_sat_event, 1 },
308 { utc_fail_tel_download_sat_event, 2 },
309 { utc_tel_send_sat_ui_display_status, 1 },
310 { utc_fail_tel_send_sat_ui_display_status, 2 },
311 { utc_tel_send_sat_ui_user_confirm, 1 },
312 { utc_fail_tel_send_sat_ui_user_confirm, 2 },
313 { utc_tel_send_sat_app_exec_result, 1 },
314 { utc_fail_tel_send_sat_app_exec_result, 2 },
318 static void startup (void)
321 tet_printf ("\n TC start");
323 handle = tel_init (NULL);
326 static void cleanup (void)
331 tet_printf ("\n TC end");
334 void (*tet_startup) (void) = startup;
335 void (*tet_cleanup) (void) = cleanup;