1/* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 17import secureElement from '@ohos.secureElement'; 18import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, Level} from '@ohos/hypium'; 19 20function sleep(delay) { 21 return new Promise(resovle => setTimeout(resovle, delay)) 22} 23 24async function getSEService() { 25 return new Promise((resolve, reject) => { 26 Service = secureElement.newSEService("serviceState", (state) => { 27 if (state == secureElement.ServiceState.DISCONNECTED) { 28 console.info("[nfc_test] getSEService newService state is Disconnected"); 29 let err = null; 30 err.code = -1; 31 err.message = "newSEService failed, service is not connected" 32 reject(err); 33 } else { 34 console.info("[nfc_test] getSEService newService state is Connected"); 35 resolve(Service); 36 } 37 }); 38 }); 39} 40 41let Service = null; 42let Reader = null; 43let Session = null; 44let getReader = null; 45let nfcSEService = null; 46let aidArray = [160, 0, 0, 1, 81, 0, 0, 0]; 47let p2 = 0x00; 48let command = [128, 202, 159, 127, 0]; 49let readerIsPresent = null; 50 51export default function channelCallbacktest() { 52 describe('channelCallbacktest', function () { 53 beforeAll(async function (done) { 54 await getSEService().then(async (data) => { 55 Service = data; 56 let seIsConnected = Service.isConnected(); 57 console.info("[NFC_test] Logical SEService isConnected The connection status is: " + seIsConnected); 58 if (seIsConnected) { 59 getReader = Service.getReaders(); 60 console.info("[NFC_test] newSEService channelCallbacktest getReader value is: " + getReader); 61 for (let i = 0; i < getReader.length; i++) { 62 if (!getReader[i].isSecureElementPresent()) { 63 console.info("[NFC_test] se not present : " + i); 64 continue; 65 } 66 if (getReader[i].getName() != "eSE") { 67 console.info("[NFC_test] se reader not ese."); 68 continue; 69 } 70 Reader = getReader[i]; 71 console.info("[NFC_test] newSEService channelCallbacktest getReader name is: " + Reader.getName()); 72 let readerIsPresent = Reader.isSecureElementPresent(); 73 console.info("[NFC_test] isSecureElementPresent status is: " + readerIsPresent); 74 if (readerIsPresent) { 75 Session = Reader.openSession(); 76 let sessionIsClosed = Session.isClosed(); 77 console.info("[NFC_test] Logical Session isConnected The connection status is: " + sessionIsClosed); 78 } 79 } 80 } 81 }).catch((err) =>{ 82 console.info("[NFC_test] getSEService err.code " + err.code + "err.message " + err.message); 83 }) 84 done(); 85 console.info('beforeAll called'); 86 }) 87 88 beforeEach(function() { 89 console.info('beforeEach called'); 90 }) 91 92 afterEach(function () { 93 94 console.info('afterEach success'); 95 }) 96 97 afterAll(async function (done) { 98 nfcSEService.shutdown(); 99 sleep(900); 100 console.info('[nfc_test] afterAll channelcallback shutdown success'); 101 done(); 102 }) 103 104 /** 105 * @tc.number SUB_Communication_Ese_LogicalChannel_js_0900 106 * @tc.name Test isBasicChannel 107 * @tc.desc open BasicChannel Check whether the channel is a basic channel. 108 * @tc.type Function 109 * @tc.level Level 0 110 */ 111 it('SUB_Communication_Ese_LogicalChannel_js_0900', Level.LEVEL0, async function (done) { 112 try { 113 if (getReader == undefined) { 114 console.info("[NFC_test]09 This function is not supported because the phone NFC chip is ST chip."); 115 } else { 116 function P2BasicChannel_callback(){ 117 return new Promise((resolve, reject) => { 118 Session.openBasicChannel(aidArray, p2, 119 (err, result) => { 120 if(err) { 121 console.info("[NFC_test]09 openBasicChannel data == null" + err.code + "---" + err); 122 reject(err.code); 123 } else { 124 console.info("[NFC_test]09 openBasicChannel data != null " + result); 125 let P2BasicChannel = result; 126 let isBasic = P2BasicChannel.isBasicChannel(); 127 console.info("[NFC_test]09 Check whether the channel is a basic channel: " + isBasic); 128 expect(isBasic).assertTrue(); 129 P2BasicChannel.close(); 130 console.info("[NFC_test]09 Data received by the application select command: " ); 131 resolve(); 132 } 133 }); 134 }); 135 } 136 await P2BasicChannel_callback().then((data) => { 137 console.info("[NFC_test]09 openBasicChannel done"); 138 }) 139 .catch(error => { 140 if (error == 401) { 141 console.info("[NFC_test]09 openBasicChannel_p2_callback occurs exception:" + error.code + "---" + error); 142 expect(true).assertTrue(); 143 } else if (error == 3300101) { 144 console.info("[NFC_test]09 openBasicChannel_p2_callback occurs exception:" + error); 145 expect(true).assertTrue(); 146 } else if (error == 3300102) { 147 console.info("[NFC_test]09 openBasicChannel_p2_callback occurs exception:" + error); 148 expect(true).assertTrue(); 149 } else if (error == 3300103) { 150 console.info("[NFC_test]09 openBasicChannel_p2_callback occurs exception:" + error); 151 expect(3300103).assertEqual(error); 152 } else if (error == 3300104) { 153 console.info("[NFC_test]09 openBasicChannel_p2_callback occurs exception:" + error); 154 expect(true).assertTrue(); 155 } else { 156 console.info("[NFC_test]09 openBasicChannel_p2_callback occurs exception:" + error); 157 expect().assertFail(); 158 } 159 }) 160 } 161 } catch (error) { 162 console.info("[NFC_test]09 openBasicChannel_p2_callback occurs exception:" + error.code + "---" + error); 163 expect(801).assertEqual(error.code); 164 } 165 sleep(900); 166 done(); 167 }) 168 169 /** 170 * @tc.number SUB_Communication_Ese_LogicalChannel_js_1000 171 * @tc.name Test isClosed 172 * @tc.desc open LogicalChannel Check whether the channel is closed. 173 * @tc.type Function 174 * @tc.level Level 0 175 */ 176 it('SUB_Communication_Ese_LogicalChannel_js_1000', Level.LEVEL0, async function (done) { 177 try { 178 if (getReader == undefined) { 179 console.info("[NFC_test]10 This function is not supported because the phone NFC chip is ST chip."); 180 } else { 181 function LogicalChannel_callback(){ 182 return new Promise((resolve, reject) => { 183 Session.openLogicalChannel(aidArray, p2, 184 (err, result) => { 185 if(err) { 186 console.info("[NFC_test]10 openLogicalChannel data == null" + err); 187 reject(err.code); 188 } else { 189 console.info("[NFC_test]10 openLogicalChannel data == null" + result); 190 let P2LogicalChannel = result; 191 P2LogicalChannel.close(); 192 console.info("[NFC_test]10 Data received by the application select command: " ); 193 let isChannelClosed = P2LogicalChannel.isClosed(); 194 console.info("[NFC_test]10 Check whether the channel is closed: " + isChannelClosed); 195 expect(isChannelClosed).assertTrue(); 196 } 197 resolve(); 198 }); 199 }); 200 } 201 await LogicalChannel_callback().then((data) => { 202 console.info("[NFC_test]10 openBasicChannel done"); 203 let seChannel = data 204 let seSession = seChannel.getSession(); 205 expect(true).assertEqual(seSession!=null); 206 }) 207 .catch(error => { 208 console.info("[NFC_test]10 openBasicChannel failed" + error + "--error.code--" + error.code); 209 if (error == 401) { 210 console.info("[NFC_test]10 openBasicChannel failed" + error); 211 expect(true).assertTrue(); 212 } else if (error == 3300101) { 213 console.info("[NFC_test]10 openLogicalChannel occurs exception:"+ error); 214 expect(true).assertTrue(); 215 } else if (error == 3300102) { 216 console.info("[NFC_test]10 openLogicalChannel occurs exception:" + error); 217 expect(true).assertTrue(); 218 } else if (error == 3300103) { 219 console.info("[NFC_test]10 openLogicalChannel occurs exception:" + error); 220 expect(true).assertTrue(); 221 } else if (error == 3300104) { 222 console.info("[NFC_test]10 openLogicalChannel occurs exception:" + error); 223 expect(true).assertTrue(); 224 } else { 225 console.info("[NFC_test]10 openLogicalChannel occurs exception:" + error); 226 expect().assertFail(); 227 } 228 done(); 229 }) 230 } 231 } catch (error) { 232 console.info("[NFC_test]10 openLogicalChannel_P2_callback occurs exception:" + error.code + "---" + error); 233 expect(801).assertEqual(error.code); 234 } 235 sleep(900); 236 done(); 237 }) 238 239 240 /** 241 * @tc.number SUB_Communication_Ese_LogicalChannel_js_1100 242 * @tc.name Test getSelectResponse 243 * @tc.desc open BasicChannel Returns the data received from the application selection command. 244 * @tc.type Function 245 * @tc.level Level 0 246 */ 247 it('SUB_Communication_Ese_LogicalChannel_js_1100', Level.LEVEL0, async function (done) { 248 try { 249 if (getReader == undefined) { 250 console.info("[NFC_test]11 This function is not supported because the phone NFC chip is ST chip."); 251 } else { 252 function BasicChannel_callback(){ 253 return new Promise((resolve, reject) => { 254 Session.openBasicChannel(aidArray, 255 (err, result) => { 256 if(err) { 257 console.info("[NFC_test]11 to get openBasicChannel:" + JSON.stringify(err)); 258 reject(err.code); 259 } else { 260 console.info("[NFC_test]11 openBasicChannel data != null " + result); 261 let nfcBasicChannel = result; 262 let getResponse = nfcBasicChannel.getSelectResponse(); 263 console.info("[NFC_test]11 getSelectResponse data: " + getResponse); 264 nfcBasicChannel.close(); 265 console.info("[NFC_test]11 Data received by the application select command: " ); 266 expect(getResponse).assertInstanceOf('Array'); 267 } 268 resolve(); 269 }); 270 }); 271 } 272 await BasicChannel_callback().then((data) => { 273 console.info("[NFC_test]11 openBasicChannel done"); 274 }) 275 .catch(e => { 276 console.info("[NFC_test]11 openBasicChannel failed" + e); 277 expect(3300103).assertEqual(e); 278 }) 279 } 280 } catch (error) { 281 console.info("[NFC_test]11 openBasicChannel_callback occurs exception:" + error.code + "---" + error); 282 expect(801).assertEqual(error.code); 283 } 284 sleep(900); 285 done(); 286 }) 287 288 /** 289 * @tc.number SUB_Communication_Ese_LogicalChannel_js_1200 290 * @tc.name Test transmit 291 * @tc.desc open LogicalChannel Send an APDU command to the SE 292 * @tc.type Function 293 * @tc.level Level 0 294 */ 295 it('SUB_Communication_Ese_LogicalChannel_js_1200', Level.LEVEL0, async function (done) { 296 try { 297 if (getReader == undefined) { 298 console.info("[NFC_test]12 This function is not supported because the phone NFC chip is ST chip."); 299 } else { 300 function LogicalChannel_callback(){ 301 return new Promise((resolve, reject) => { 302 Session.openLogicalChannel(aidArray, 303 (err, result) => { 304 if(err) { 305 console.info("[NFC_test]12 failed to get openLogicalChannel:" + JSON.stringify(err)); 306 reject(err.code); 307 } else { 308 console.info("[NFC_test]12 openLogicalChannel data != null " + result); 309 let nfcLogicalChannel = result; 310 nfcLogicalChannel.transmit(command, (err, data) => { 311 if (err) { 312 console.info("[NFC_test]12 Send error an APDU command to the SE: " + err); 313 expect().assertFail(); 314 } else { 315 console.info("[NFC_test]12 Send an APDU command to the SE: " + data); 316 expect(data).assertInstanceOf('Array'); 317 } 318 }); 319 sleep(900); 320 nfcLogicalChannel.close(); 321 console.info("[NFC_test]12 Data received by the application select command: " ); 322 } 323 resolve(); 324 }); 325 }); 326 } 327 await LogicalChannel_callback().then((data) => { 328 console.info("[NFC_test]12 openBasicChannel done"); 329 }) 330 .catch(e => { 331 console.info("[NFC_test]12 openBasicChannel failed" + e); 332 expect(3300103).assertEqual(e); 333 }) 334 } 335 } catch (error) { 336 console.info("[NFC_test]12 openLogicalChannel_callback occurs exception:" + error.code + "---" + error); 337 expect(801).assertEqual(error.code); 338 } 339 sleep(900); 340 done(); 341 }) 342 343 /** 344 * @tc.number SUB_Communication_Ese_LogicalChannel_js_1300 345 * @tc.name Test transmit 346 * @tc.desc open LogicalChannel Send an APDU command to the SE 347 * @tc.type Function 348 * @tc.level Level 0 349 */ 350 it('SUB_Communication_Ese_LogicalChannel_js_1300', Level.LEVEL0, async function (done) { 351 try { 352 if (getReader == undefined) { 353 console.info("[NFC_test]13 This function is not supported because the phone NFC chip is ST chip."); 354 } else { 355 let getPromise = Session.openBasicChannel(aidArray); 356 await getPromise.then((data) => { 357 console.info("[NFC_test]13 openBasicChannel openBasicChannel data: " + data); 358 if ( data != undefined && data != null){ 359 console.info("[NFC_test]13 openBasicChannel data != null"); 360 let OmaBasicChannel = data; 361 OmaBasicChannel.close(); 362 console.info("[NFC_test]13 Data received by the application select command: " ); 363 } 364 else { 365 console.info("[NFC_test]13 openBasicChannel data == null"); 366 } 367 }).catch((error)=> { 368 console.info("[NFC_test]13 openBasicChannel catch error" + error); 369 expect(3300103).assertEqual(error.code) 370 }); 371 sleep(5000); 372 } 373 } catch (error) { 374 console.info("[NFC_test]13 openBasicChannel_Promise occurs exception:" + error.code + "---" + error); 375 expect(801).assertEqual(error.code); 376 } 377 done(); 378 }) 379 380 /** 381 * @tc.number SUB_Communication_Ese_LogicalChannel_js_1400 382 * @tc.name Test isClosed 383 * @tc.desc open LogicalChannel Check whether the channel is a basic channel. 384 * @tc.type Function 385 * @tc.level Level 0 386 */ 387 it('SUB_Communication_Ese_LogicalChannel_js_1400', Level.LEVEL0, async function (done) { 388 try { 389 if (getReader == undefined) { 390 console.info("[NFC_test]14 This function is not supported because the phone NFC chip is ST chip."); 391 } else { 392 let getPromise = Session.openLogicalChannel(aidArray); 393 await getPromise.then((data) => { 394 console.info("[NFC_test]14 openLogicalChannel data: " + data); 395 if ( data != undefined && data != null){ 396 console.info("[NFC_test]14 openLogicalChannel data != null"); 397 let OmaLogicalChannel = data; 398 OmaLogicalChannel.close(); 399 let isChannelClosed = OmaLogicalChannel.isClosed(); 400 console.info("[NFC_test]14 Check whether the channel is disabled: " + isChannelClosed); 401 expect(isChannelClosed).assertTrue(); 402 } 403 else { 404 console.info("[NFC_test]14 openLogicalChannel data == null"); 405 } 406 }).catch((error)=> { 407 console.info("[NFC_test]14 openLogicalChannel catch error" + error.code + "---" + error); 408 expect(3300103).assertEqual(error.code) 409 }); 410 sleep(5000); 411 } 412 } catch (error) { 413 console.info("[NFC_test]14 openLogicalChannel_Promise occurs exception:" + error.code + "---" + error); 414 expect(801).assertEqual(error.code); 415 } 416 done(); 417 }) 418 419 /** 420 * @tc.number SUB_Communication_Ese_LogicalChannel_js_1500 421 * @tc.name Test isClosed 422 * @tc.desc open BasicChannel Check whether the channel is a basic channel. 423 * @tc.type Function 424 * @tc.level Level 0 425 */ 426 it('SUB_Communication_Ese_LogicalChannel_js_1500', Level.LEVEL0, async function (done) { 427 try { 428 if (getReader == undefined) { 429 console.info("[NFC_test]15 This function is not supported because the phone NFC chip is ST chip."); 430 } else { 431 let getPromise = Session.openBasicChannel(aidArray,p2); 432 await getPromise.then((data) => { 433 console.info("[NFC_test]15 openBasicChannel data: " + data); 434 if ( data != undefined && data != null){ 435 console.info("[NFC_test]15 openBasicChannel data != null"); 436 let OmaLogicalChannel = data; 437 OmaLogicalChannel.close(); 438 let isChannelClosed = OmaLogicalChannel.isClosed(); 439 console.info("[NFC_test]15 Check whether the channel is disabled: " + isChannelClosed); 440 expect(isChannelClosed).assertTrue(); 441 } 442 else { 443 console.info("[NFC_test]15 openBasicChannel data == null"); 444 } 445 }).catch((error)=> { 446 console.info("[NFC_test]15 openBasicChannel catch error" + error.code + "---" + error); 447 expect(3300103).assertEqual(error.code) 448 }); 449 sleep(5000); 450 } 451 } catch (error) { 452 console.info("[NFC_test]15 openBasicChannel occurs exception:" + error.code + "---" + error); 453 expect(801).assertEqual(error.code); 454 } 455 done(); 456 }) 457 458 /** 459 * @tc.number SUB_Communication_Ese_LogicalChannel_js_1600 460 * @tc.name Test isClosed 461 * @tc.desc Check whether the channel is closed. 462 * @tc.type Function 463 * @tc.level Level 0 464 */ 465 it('SUB_Communication_Ese_LogicalChannel_js_1600', Level.LEVEL0, async function (done) { 466 try { 467 if (getReader == undefined) { 468 console.info("[NFC_test]16 This function is not supported because the phone NFC chip is ST chip."); 469 } else { 470 let getPromise = Session.openLogicalChannel(aidArray,p2); 471 await getPromise.then((data) => { 472 console.info("[NFC_test]16 openLogicalChannel data: " + data); 473 if ( data != undefined && data != null){ 474 console.info("[NFC_test]16 openLogicalChannel data != null"); 475 let OmaLogicalChannel = data; 476 OmaLogicalChannel.close(); 477 let isChannelClosed = OmaLogicalChannel.isClosed(); 478 console.info("[NFC_test]16 Check whether the channel is disabled: " + isChannelClosed); 479 expect(isChannelClosed).assertTrue(); 480 } 481 else { 482 console.info("[NFC_test]16 openLogicalChannel data == null"); 483 } 484 }).catch((error)=> { 485 console.info("[NFC_test]16 openLogicalChannel catch error" + error.code + "---" + error); 486 expect(3300103).assertEqual(error.code) 487 }); 488 sleep(5000); 489 } 490 } catch (error) { 491 console.info("[NFC_test]16 openLogicalChannel_Promise occurs exception:" + error.code + "---" + error); 492 expect(801).assertEqual(error.code); 493 } 494 done(); 495 }) 496 497 /** 498 * @tc.number SUB_Communication_Ese_LogicalChannel_js_1700 499 * @tc.name Test closeChannels 500 * @tc.desc hasHceCapability to support a certain type of card emulation. 501 * @tc.size since 9 502 * @tc.type Function 503 * @tc.level Level 0 504 */ 505 it('SUB_Communication_Ese_LogicalChannel_js_1700', Level.LEVEL0, function () { 506 try{ 507 if (getReader == undefined){ 508 console.info("[NFC_test]17 This Function is not support because the phone NFC chip is ST chip"); 509 }else{ 510 let closeChannels = Session.closeChannels(); 511 console.info("[NFC_test]17 Session.closeChannels success" + closeChannels); 512 } 513 }catch(error){ 514 console.info("[NFC_test]17 closeChannels error" + error.code + "---" + JSON.stringify(error)); 515 expect(801).assertEqual(error.code) 516 } 517 }) 518 519 /** 520 * @tc.number SUB_Communication_Ese_LogicalChannel_js_1900 521 * @tc.name Test isBasicChannel 522 * @tc.desc open asicChannel Check whether the channel is a basic channel 523 * @tc.type Function 524 * @tc.level Level 0 525 */ 526 it('SUB_Communication_Ese_LogicalChannel_js_1900', Level.LEVEL0, async function (done) { 527 try{ 528 function getServiceStateFunc(ServiceState){console.info("[NFC_js] get ServiceState result:" + JSON.stringify(ServiceState));} 529 let seService = secureElement.newSEService("serviceState", getServiceStateFunc); 530 expect(true).assertEqual(seService != null); 531 done(); 532 }catch(error){ 533 console.info("[NFC_test]1900 openBasicChannel error result:" + JSON.stringify(error) + "error_code:" + error.code); 534 if (error.code == 401){ 535 expect(true).assertTrue(); 536 }else if (error.code == 801){ 537 expect(true).assertTrue(); 538 }else{ 539 expect().assertFail(); 540 } 541 done(); 542 } 543 }) 544 545 /** 546 * @tc.number SUB_Communication_Ese_LogicalChannel_js_2500 547 * @tc.name Test transmit 548 * @tc.desc createService 549 * @tc.type Function 550 * @tc.level Level 0 551 */ 552 it('SUB_Communication_Ese_LogicalChannel_js_2500', Level.LEVEL0, async function (done) { 553 try{ 554 await secureElemente.createService().then( (data) => { 555 console.info("[NFC_test]25 SecureElementDemo createService data ="+data); 556 Service = data; 557 let connect = Service.isConnected(); 558 console.info("[NFC_test]25 SecureElementDemo createService connect = " + connect); 559 return Service; 560 }) 561 .catch ((err) => { 562 console.info("[NFC_test]25 createService createService err = " + err); 563 }) 564 } catch (error) { 565 console.info("[NFC_test]25 createService occurs exception:" + error.code + "---" + JSON.stringify(error)); 566 if (error.code == 801){ 567 expect(true).assertTrue(); 568 }else{ 569 expect().assertFail; 570 } 571 } 572 done(); 573 }) 574 575 /** 576 * @tc.number SUB_Communication_Ese_LogicalChannel_js_2600 577 * @tc.name Test transmit 578 * @tc.desc open LogicalChannel Send an APDU command to the SE 579 * @tc.type Function 580 * @tc.level Level 0 581 */ 582 it('SUB_Communication_Ese_LogicalChannel_js_2600', Level.LEVEL0, async function (done) { 583 try { 584 if (getReader == undefined) { 585 console.info("[NFC_test]26 This function is not supported because the phone NFC chip is ST chip."); 586 } else { 587 function LogicalChannel_callback(){ 588 return new Promise((resolve, reject) => { 589 Session.openLogicalChannel(aidArray, 590 (err, result) => { 591 if(err) { 592 console.info("[NFC_test]26 failed to get openLogicalChannel:" + JSON.stringify(err)); 593 reject(err.code); 594 } else { 595 let cmdData = [0x01, 0x02, 0x03, 0x04]; 596 console.info("[NFC_test]26 openLogicalChannel data != null " + result); 597 let nfcLogicalChannel = result; 598 nfcLogicalChannel.transmit(cmdData).then((data) => { 599 console.info("[NFC_test]26 Send an APDU command to the SE: " + data); 600 }).catch((error) => { 601 if (error.code == 401) { 602 console.info("[NFC_test]26 transmit failed" + error + "--error.code--" + error.code); 603 expect(true).assertTrue(); 604 } else if (error.code == 3300101) { 605 console.info("[NFC_test]26 transmit failed" + error + "--error.code--" + error.code); 606 expect(true).assertTrue(); 607 } else if (error.code == 3300103) { 608 console.info("[NFC_test]26 transmit failed" + error + "--error.code--" + error.code); 609 expect(true).assertTrue(); 610 } else if (error.code == 3300104) { 611 console.info("[NFC_test]26 transmit failed" + error + "--error.code--" + error.code); 612 expect(true).assertTrue(); 613 } else { 614 console.info("[NFC_test]26 transmit failed" + error + "--error.code--" + error.code); 615 expect().assertFail(); 616 } 617 }); 618 sleep(900); 619 nfcLogicalChannel.close(); 620 console.info("[NFC_test]26 Data received by the application select command: " ); 621 } 622 resolve(); 623 }); 624 }); 625 } 626 await LogicalChannel_callback().then((data) => { 627 console.info("[NFC_test]26 openBasicChannel done"); 628 }) 629 .catch(e => { 630 console.info("[NFC_test]26 openBasicChannel failed" + e); 631 expect(3300103).assertEqual(e); 632 }) 633 } 634 } catch (error) { 635 console.info("[NFC_test]26 openLogicalChannel_callback occurs exception:" + error.code + "---" + error); 636 expect(801).assertEqual(error.code); 637 } 638 sleep(900); 639 done(); 640 }) 641 642 console.info("*************[nfc_test] start nfc js unit test end*************"); 643 }) 644}