2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
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.
21 POSITIVE_TC_IDX = 0x01,
25 #define MY_ASSERT( fun , test , msg ) \
28 dts_fail(fun , msg ); \
32 static void startup(void);
33 static void cleanup(void);
35 void (*tet_startup)(void) = startup;
36 void (*tet_cleanup)(void) = cleanup;
38 static void nfc_manager_set_activation_changed_cb_p(void);
39 static void nfc_manager_set_activation_changed_cb_n(void);
40 static void nfc_manager_set_activation_p(void);
41 static void nfc_manager_set_activation_n(void);
42 static void nfc_manager_initialize_p(void);
43 static void nfc_manager_initialize_n(void);
44 static void nfc_manager_deinitialize_p(void);
45 static void nfc_manager_deinitialize_n(void);
46 static void nfc_manager_set_tag_discovered_cb_p(void);
47 static void nfc_manager_set_tag_discovered_cb_n(void);
48 static void nfc_manager_set_ndef_discovered_cb_p(void);
49 static void nfc_manager_set_ndef_discovered_cb_n(void);
50 static void nfc_manager_set_p2p_target_discovered_cb_p(void);
51 static void nfc_manager_set_p2p_target_discovered_cb_n(void);
52 static void nfc_manager_set_se_event_cb_p(void);
53 static void nfc_manager_set_se_event_cb_n(void);
54 static void nfc_manager_set_se_transaction_event_cb_p(void);
55 static void nfc_manager_set_se_transaction_event_cb_n(void);
56 static void nfc_manager_set_system_handler_enable_p(void);
57 static void nfc_manager_set_system_handler_enable_n(void);
60 void _activation_changed_cb(bool activated , void *user_data);
61 void _activation_completed_cb(int error, void *user_data);
62 void utc_test_cb(void * user_data);
68 struct tet_testlist tet_testlist[] = {
69 { nfc_manager_set_activation_changed_cb_p , POSITIVE_TC_IDX },
70 { nfc_manager_set_activation_changed_cb_n , NEGATIVE_TC_IDX },
71 { nfc_manager_set_activation_p , POSITIVE_TC_IDX },
72 { nfc_manager_set_activation_n , NEGATIVE_TC_IDX },
73 { nfc_manager_initialize_p , POSITIVE_TC_IDX },
74 { nfc_manager_initialize_n , NEGATIVE_TC_IDX },
75 { nfc_manager_deinitialize_p , POSITIVE_TC_IDX },
76 { nfc_manager_deinitialize_n , NEGATIVE_TC_IDX },
77 { nfc_manager_set_tag_discovered_cb_p , POSITIVE_TC_IDX },
78 { nfc_manager_set_tag_discovered_cb_n , NEGATIVE_TC_IDX },
79 { nfc_manager_set_ndef_discovered_cb_p , POSITIVE_TC_IDX },
80 { nfc_manager_set_ndef_discovered_cb_n , NEGATIVE_TC_IDX },
81 { nfc_manager_set_p2p_target_discovered_cb_p , POSITIVE_TC_IDX },
82 { nfc_manager_set_p2p_target_discovered_cb_n , NEGATIVE_TC_IDX },
83 { nfc_manager_set_se_event_cb_p , POSITIVE_TC_IDX },
84 { nfc_manager_set_se_event_cb_n , NEGATIVE_TC_IDX },
85 { nfc_manager_set_se_transaction_event_cb_p , POSITIVE_TC_IDX },
86 { nfc_manager_set_se_transaction_event_cb_n , NEGATIVE_TC_IDX },
87 { nfc_manager_set_system_handler_enable_p , POSITIVE_TC_IDX },
88 { nfc_manager_set_system_handler_enable_n , NEGATIVE_TC_IDX },
93 //this method is called only once in start
94 static void startup(void)
99 static void cleanup(void)
104 void _activation_changed_cb(bool activated , void *user_data)
106 if( activated == true)
109 else if( activated == false)
114 void _activation_completed_cb(int error, void *user_data)
120 void utc_test_cb(void *user_data)
126 static void nfc_manager_set_activation_changed_cb_p(void)
128 int ret = NFC_ERROR_NONE;
130 ret = nfc_manager_set_activation_changed_cb(_activation_changed_cb , NULL);
132 dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_activation_changed_cb_p is faild");
135 static void nfc_manager_set_activation_changed_cb_n(void)
137 int ret = NFC_ERROR_NONE;
139 ret = nfc_manager_set_activation_changed_cb(NULL , NULL);
141 dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_activation_changed_cb_n not allow null");
144 static void nfc_manager_set_activation_p()
146 int ret = NFC_ERROR_NONE;
148 ret = nfc_manager_set_activation(1, _activation_completed_cb, NULL);
150 dts_pass(__func__, "PASS");
153 static void nfc_manager_set_activation_n()
155 int ret = NFC_ERROR_NONE;
157 ret = nfc_manager_set_activation(1, NULL, NULL);
159 dts_pass(__func__, "PASS");
162 static void nfc_manager_initialize_p()
164 int ret = NFC_ERROR_NONE;
166 ret = nfc_manager_initialize(NULL, NULL);
168 nfc_manager_deinitialize();
170 dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_initialize_p is faild");
173 static void nfc_manager_initialize_n()
175 int ret = NFC_ERROR_NONE;
177 ret = nfc_manager_initialize(NULL, NULL);
179 dts_pass(__func__, "PASS");
182 static void nfc_manager_deinitialize_p()
184 int ret = NFC_ERROR_NONE;
186 nfc_manager_initialize(NULL, NULL);
188 ret = nfc_manager_deinitialize();
190 dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_initialize_p is faild");
193 static void nfc_manager_deinitialize_n()
195 int ret = NFC_ERROR_NONE;
197 ret = nfc_manager_deinitialize();
199 dts_pass(__func__, "PASS");
202 static void nfc_manager_set_tag_discovered_cb_p()
204 int ret = NFC_ERROR_NONE;
206 ret = nfc_manager_set_tag_discovered_cb(utc_test_cb, NULL);
208 dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_tag_discovered_cb_p is faild");
211 static void nfc_manager_set_tag_discovered_cb_n()
213 int ret = NFC_ERROR_NONE;
215 ret = nfc_manager_set_tag_discovered_cb(NULL, NULL);
217 dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_tag_discovered_cb_n not allow null");
220 static void nfc_manager_set_ndef_discovered_cb_p()
222 int ret = NFC_ERROR_NONE;
224 ret = nfc_manager_set_ndef_discovered_cb(utc_test_cb , NULL);
226 dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_ndef_discovered_cb_p is faild");
229 static void nfc_manager_set_ndef_discovered_cb_n()
231 int ret = NFC_ERROR_NONE;
233 ret = nfc_manager_set_ndef_discovered_cb(NULL, NULL);
235 dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_ndef_discovered_cb_n not allow null");
238 static void nfc_manager_set_p2p_target_discovered_cb_p()
240 int ret = NFC_ERROR_NONE;
242 ret = nfc_manager_set_p2p_target_discovered_cb(utc_test_cb , NULL);
244 dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_p2p_target_discovered_cb_p is faild");
247 static void nfc_manager_set_p2p_target_discovered_cb_n()
251 ret = nfc_manager_set_p2p_target_discovered_cb(NULL, NULL);
253 dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_p2p_target_discovered_cb_n not allow null");
256 static void nfc_manager_set_se_event_cb_p()
258 int ret = NFC_ERROR_NONE;
260 ret = nfc_manager_set_se_event_cb(utc_test_cb , NULL);
262 dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_event_cb_p is faild");
265 static void nfc_manager_set_se_event_cb_n ()
267 int ret = NFC_ERROR_NONE;
269 ret = nfc_manager_set_se_event_cb(NULL, NULL);
271 dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_event_cb_n not allow null");
274 static void nfc_manager_set_se_transaction_event_cb_p()
276 int ret = NFC_ERROR_NONE;
278 ret = nfc_manager_set_se_transaction_event_cb(utc_test_cb , NULL);
280 dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_transaction_event_cb_p is faild");
283 static void nfc_manager_set_se_transaction_event_cb_n ()
285 int ret = NFC_ERROR_NONE;
287 ret = nfc_manager_set_se_transaction_event_cb(NULL, NULL);
289 dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_transaction_event_cb_n not allow null");
292 static void nfc_manager_set_system_handler_enable_p()
294 int ret = NFC_ERROR_NONE;
296 ret = nfc_manager_set_system_handler_enable(true);
298 dts_pass(__func__, "PASS");
302 static void nfc_manager_set_system_handler_enable_n ()
304 int ret = NFC_ERROR_NONE;
306 ret = nfc_manager_set_system_handler_enable(NULL);
308 dts_pass(__func__, "PASS");