• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024-2025 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
16import usbManager from '@ohos.usbManager';
17import { UiDriver, BY } from '@ohos.UiTest';
18import CheckEmptyUtils from './CheckEmptyUtils.js';
19import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium';
20
21
22export default function UsbApiParamExceJsunitTest() {
23describe('UsbApiParamExceJsunitTest', function () {
24
25    const TAG = "[UsbApiParamExceJsunitTest]";
26    const PARAM_NULL = null;
27    const PARAM_UNDEFINED = undefined;
28    const PARAM_NULLSTRING = "";
29    const PARAM_NUMBEREX = 123;
30    let gDeviceList;
31    let devices;
32    let gPipe;
33    let isDeviceConnected;
34    let tmpPipe = {
35        busNum: null,
36        devAddress: null
37    };
38    function deviceConnected() {
39        if (gDeviceList.length > 0) {
40            console.info(TAG, "Test USB device is connected");
41            return true;
42        }
43        console.info(TAG, "Test USB device is not connected");
44        return false;
45    }
46
47    beforeAll(async function () {
48        console.log(TAG, '*************Usb Unit UsbApiParamExceJsunitTest Begin*************');
49        const Version = usbManager.getVersion();
50        console.info(TAG, 'usb unit begin test getversion :' + Version);
51
52        // version > 17  host currentMode = 2 device currentMode = 1
53        gDeviceList = usbManager.getDevices();
54        isDeviceConnected = deviceConnected();
55        if (isDeviceConnected) {
56            let hasRight = usbManager.hasRight(gDeviceList[0].name);
57            if (!hasRight) {
58                console.info(TAG, `beforeAll: usb requestRight start`);
59                await getPermission();
60                CheckEmptyUtils.sleep(1000);
61                await driveFn();
62                CheckEmptyUtils.sleep(1000);
63            }
64
65            tmpPipe.busNum = gDeviceList[0].busNum;
66            tmpPipe.devAddress = gDeviceList[0].devAddress;
67        }
68    })
69
70    beforeEach(function () {
71        console.info(TAG, 'beforeEach: *************Usb Unit Test CaseEx*************');
72        gDeviceList = usbManager.getDevices();
73        if (isDeviceConnected) {
74            devices = gDeviceList[0];
75            console.info(TAG, 'beforeEach return devices : ' + JSON.stringify(devices));
76        }
77    })
78
79    afterEach(function () {
80        console.info(TAG, 'afterEach: *************Usb Unit Test CaseEx*************');
81        devices = null;
82        gPipe = null;
83        console.info(TAG, 'afterEach return devices : ' + JSON.stringify(devices));
84    })
85
86    afterAll(function () {
87        console.log(TAG, '*************Usb Unit UsbApiParamExceJsunitTest End*************');
88    })
89
90    async function driveFn() {
91        console.info('**************driveFn**************');
92        try {
93            let driver = await UiDriver.create();
94            console.info(TAG, ` come in driveFn`);
95            console.info(TAG, `driver is ${JSON.stringify(driver)}`);
96            CheckEmptyUtils.sleep(1000);
97            let button = await driver.findComponent(BY.text('允许'));
98            console.info(TAG, `button is ${JSON.stringify(button)}`);
99            CheckEmptyUtils.sleep(1000);
100            await button.click();
101        } catch (err) {
102            console.info(TAG, 'err is ' + err);
103            return;
104        }
105    }
106
107    async function getPermission() {
108        console.info('**************getPermission**************');
109        try {
110            usbManager.requestRight(gDeviceList[0].name).then(hasRight => {
111                console.info(TAG, `usb requestRight success, hasRight: ${hasRight}`);
112            })
113        } catch (err) {
114            console.info(TAG, `usb getPermission to requestRight hasRight fail: `, err);
115            return
116        }
117    }
118
119    function getPipe(testCaseName) {
120        gPipe = usbManager.connectDevice(devices);
121        console.info(TAG, `usb ${testCaseName} connectDevice getPipe ret: ${JSON.stringify(gPipe)}`);
122        expect(gPipe !== null).assertTrue();
123    }
124
125    function toReleaseInterface(testCaseName, tInterface) {
126        let ret = usbManager.releaseInterface(tmpPipe, tInterface);
127        console.info(TAG, `usb ${testCaseName} releaseInterface ret: ${ret}`);
128        expect(ret).assertEqual(0);
129    }
130
131    function toClosePipe(testCaseName) {
132        let isPipClose = usbManager.closePipe(tmpPipe);
133        console.info(TAG, `usb ${testCaseName} closePipe ret: ${isPipClose}`);
134        expect(isPipClose).assertEqual(0);
135    }
136
137    /**
138     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_0100
139     * @tc.name     : testHasRightParamEx001
140     * @tc.desc     : Negative test: Param is null string
141     * @tc.size     : MediumTest
142     * @tc.type     : Function
143     * @tc.level    : Level 3
144     */
145    it('testHasRightParamEx001', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
146        console.info(TAG, 'usb testHasRightParamEx001 begin');
147        if (!isDeviceConnected) {
148            expect(isDeviceConnected).assertFalse();
149            return
150        }
151        try {
152            let isHasRight = usbManager.hasRight(PARAM_NULLSTRING);
153            console.info(TAG, 'usb case hasRight ret : ' + isHasRight);
154            expect(isHasRight).assertFalse();
155        } catch (err) {
156            console.info(TAG, 'testHasRightParamEx001 catch err code: ', err.code, ', message: ', err.message);
157            expect(err !== null).assertFalse();
158        }
159    })
160
161    /**
162     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_0200
163     * @tc.name     : testHasRightParamEx002
164     * @tc.desc     : Negative test: Param add number '123'
165     * @tc.size     : MediumTest
166     * @tc.type     : Function
167     * @tc.level    : Level 3
168     */
169    it('testHasRightParamEx002', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
170        console.info(TAG, 'usb testHasRightParamEx002 begin');
171        if (!isDeviceConnected) {
172            expect(isDeviceConnected).assertFalse();
173            return
174        }
175        try {
176            for (var i = 0; i < gDeviceList.length; i++) {
177                let deviceName = gDeviceList[i].name;
178                deviceName = deviceName + "123";
179                let isHasRight = usbManager.hasRight(deviceName);
180                console.info(TAG, 'usb [', deviceName, '] hasRight ret : ' + isHasRight);
181                expect(isHasRight).assertFalse();
182            }
183        } catch (err) {
184            console.info(TAG, 'testHasRightParamEx002 catch err code: ', err.code, ', message: ', err.message);
185            expect(err !== null).assertFalse();
186        }
187    })
188
189    /**
190     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_0300
191     * @tc.name     : testRequestRightParamEx001
192     * @tc.desc     : Negative test: Param is null string
193     * @tc.size     : MediumTest
194     * @tc.type     : Function
195     * @tc.level    : Level 3
196     */
197    it('testRequestRightParamEx001', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function () {
198        console.info(TAG, 'usb testRequestRightParamEx001 begin');
199        if (!isDeviceConnected) {
200            expect(isDeviceConnected).assertFalse();
201            return
202        }
203        try {
204            let isHasRight = await usbManager.requestRight(PARAM_NULLSTRING);
205            console.info(TAG, 'usb case requestRight ret : ' + isHasRight);
206            expect(isHasRight).assertFalse();
207        } catch (err) {
208            console.info(TAG, 'testRequestRightParamEx001 catch err code: ', err.code, ', message: ', err.message);
209            expect(err !== null).assertFalse();
210        }
211    })
212
213    /**
214     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_0400
215     * @tc.name     : testRequestRightParamEx002
216     * @tc.desc     : Negative test: Param add number 'abc'
217     * @tc.size     : MediumTest
218     * @tc.type     : Function
219     * @tc.level    : Level 3
220     */
221    it('testRequestRightParamEx002', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function () {
222        console.info(TAG, 'usb testRequestRightParamEx002 begin');
223        if (!isDeviceConnected) {
224            expect(isDeviceConnected).assertFalse();
225            return
226        }
227        try {
228            for (var i = 0; i < gDeviceList.length; i++) {
229                let deviceName = gDeviceList[i].name;
230                deviceName = deviceName + "abc";
231                let isHasRight = await usbManager.requestRight(deviceName);
232                console.info(TAG, 'usb [', deviceName, '] requestRight ret : ' + isHasRight);
233                expect(isHasRight).assertFalse();
234            }
235        } catch (err) {
236            console.info(TAG, 'testRequestRightParamEx002 catch err code: ', err.code, ', message: ', err.message);
237            expect(err !== null).assertFalse();
238        }
239    })
240
241    /**
242     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_0500
243     * @tc.name     : testRemoveRightParamEx001
244     * @tc.desc     : Negative test: Param is null string
245     * @tc.size     : MediumTest
246     * @tc.type     : Function
247     * @tc.level    : Level 3
248     */
249    it('testRemoveRightParamEx001', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
250        console.info(TAG, 'usb testRemoveRightParamEx001 begin');
251        if (!isDeviceConnected) {
252            expect(isDeviceConnected).assertFalse();
253            return
254        }
255        try {
256            let remRight = usbManager.removeRight(PARAM_NULLSTRING);
257            console.info(TAG, 'usb case removeRight ret : ' + remRight);
258            expect(remRight).assertFalse();
259        } catch (err) {
260            console.info(TAG, 'testRemoveRightParamEx001 catch err code: ', err.code, ', message: ', err.message);
261            expect(err !== null).assertFalse();
262        }
263    })
264
265    /**
266     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_0600
267     * @tc.name     : testRemoveRightParamEx002
268     * @tc.desc     : Negative test: Param add letter 'abc'
269     * @tc.size     : MediumTest
270     * @tc.type     : Function
271     * @tc.level    : Level 3
272     */
273    it('testRemoveRightParamEx002', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
274        console.info(TAG, 'usb testRemoveRightParamEx002 begin');
275        if (!isDeviceConnected) {
276            expect(isDeviceConnected).assertFalse();
277            return
278        }
279        try {
280            for (var i = 0; i < gDeviceList.length; i++) {
281                let deviceName = gDeviceList[i].name;
282                deviceName = deviceName + "abc";
283                let remRight = usbManager.removeRight(deviceName);
284                console.info(TAG, 'usb [', deviceName, '] removeRight ret : ', remRight);
285                expect(remRight).assertFalse();
286            }
287        } catch (err) {
288            console.info(TAG, 'testRemoveRightParamEx002 catch err code: ', err.code, ', message: ', err.message);
289            expect(err !== null).assertFalse();
290        }
291    })
292
293    /**
294     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_0700
295     * @tc.name     : testRemoveRightParamEx003
296     * @tc.desc     : Negative test: Param add special characters '@#'
297     * @tc.size     : MediumTest
298     * @tc.type     : Function
299     * @tc.level    : Level 3
300     */
301    it('testRemoveRightParamEx003', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
302        console.info(TAG, 'usb testRemoveRightParamEx003 begin');
303        if (!isDeviceConnected) {
304            expect(isDeviceConnected).assertFalse();
305            return
306        }
307        try {
308            for (var i = 0; i < gDeviceList.length; i++) {
309                let deviceName = gDeviceList[i].name;
310                deviceName = deviceName + "@#";
311                let remRight = usbManager.removeRight(deviceName);
312                console.info(TAG, 'usb [', deviceName, '] removeRight ret : ', remRight);
313                expect(remRight).assertFalse();
314            }
315        } catch (err) {
316            console.info(TAG, 'testRemoveRightParamEx003 catch err code: ', err.code, ', message: ', err.message);
317            expect(err !== null).assertFalse();
318        }
319    })
320
321    /**
322     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_0800
323     * @tc.name     : testRemoveRightParamEx004
324     * @tc.desc     : Negative test: Param add number '123'
325     * @tc.size     : MediumTest
326     * @tc.type     : Function
327     * @tc.level    : Level 3
328     */
329    it('testRemoveRightParamEx004', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
330        console.info(TAG, 'usb testRemoveRightParamEx004 begin');
331        if (!isDeviceConnected) {
332            expect(isDeviceConnected).assertFalse();
333            return
334        }
335        try {
336            for (var i = 0; i < gDeviceList.length; i++) {
337                let deviceName = gDeviceList[i].name;
338                deviceName = deviceName + "123";
339                let remRight = usbManager.removeRight(deviceName);
340                console.info(TAG, 'usb [', deviceName, '] removeRight ret : ', remRight);
341                expect(remRight).assertFalse();
342            }
343        } catch (err) {
344            console.info(TAG, 'testRemoveRightParamEx004 catch err code: ', err.code, ', message: ', err.message);
345            expect(err !== null).assertFalse();
346        }
347    })
348
349    /**
350     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_0900
351     * @tc.name     : testConnectDeviceParamEx001
352     * @tc.desc     : Negative test: Param add number '123'
353     * @tc.size     : MediumTest
354     * @tc.type     : Function
355     * @tc.level    : Level 3
356     */
357    it('testConnectDeviceParamEx001', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
358        console.info(TAG, 'usb testConnectDeviceParamEx001 begin');
359        if (!isDeviceConnected) {
360            expect(isDeviceConnected).assertFalse();
361            return
362        }
363        try {
364            let deviceName = devices.name + "123";
365            devices.name = deviceName;
366            let gPipe = usbManager.connectDevice(devices);
367
368            console.info(TAG, 'usb [', devices.name, '] connectDevice ret : ', JSON.stringify(gPipe));
369            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
370        } catch (err) {
371            console.info(TAG, 'testConnectDeviceParamEx001 catch err code: ', err.code, ', message: ', err.message);
372            expect(err !== null).assertFalse();
373        }
374    })
375
376    /**
377     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_1000
378     * @tc.name     : testConnectDeviceParamEx002
379     * @tc.desc     : Negative test: Param add letter 'abc'
380     * @tc.size     : MediumTest
381     * @tc.type     : Function
382     * @tc.level    : Level 3
383     */
384    it('testConnectDeviceParamEx002', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
385        console.info(TAG, 'usb testConnectDeviceParamEx002 begin');
386        if (!isDeviceConnected) {
387            expect(isDeviceConnected).assertFalse();
388            return
389        }
390        try {
391            let deviceName = devices.name + "abc";
392            devices.name = deviceName;
393            let gPipe = usbManager.connectDevice(devices);
394            console.info(TAG, 'usb [', devices.name, '] connectDevice ret : ', JSON.stringify(gPipe));
395            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
396        } catch (err) {
397            console.info(TAG, 'testConnectDeviceParamEx002 catch err code: ', err.code, ', message: ', err.message);
398            expect(err !== null).assertFalse();
399        }
400    })
401
402    /**
403     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_1100
404     * @tc.name     : testConnectDeviceParamEx003
405     * @tc.desc     : Negative test: Param add special characters '@#'
406     * @tc.size     : MediumTest
407     * @tc.type     : Function
408     * @tc.level    : Level 3
409     */
410    it('testConnectDeviceParamEx003', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
411        console.info(TAG, 'usb testConnectDeviceParamEx003 begin');
412        if (!isDeviceConnected) {
413            expect(isDeviceConnected).assertFalse();
414            return
415        }
416        try {
417            let deviceName = devices.name + "@#";
418            devices.name = deviceName;
419            let gPipe = usbManager.connectDevice(devices);
420            console.info(TAG, 'usb [', devices.name, '] connectDevice ret : ', JSON.stringify(gPipe));
421            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
422        } catch (err) {
423            console.info(TAG, 'testConnectDeviceParamEx003 catch err code: ', err.code, ', message: ', err.message);
424            expect(err !== null).assertFalse();
425        }
426    })
427
428    /**
429     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_1200
430     * @tc.name     : testConnectDeviceParamEx004
431     * @tc.desc     : Negative test: devices name is null string ""
432     * @tc.size     : MediumTest
433     * @tc.type     : Function
434     * @tc.level    : Level 3
435     */
436    it('testConnectDeviceParamEx004', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
437        console.info(TAG, 'usb testConnectDeviceParamEx004 begin');
438        if (!isDeviceConnected) {
439            expect(isDeviceConnected).assertFalse();
440            return
441        }
442        try {
443            devices.name = PARAM_NULLSTRING;
444            let gPipe = usbManager.connectDevice(devices);
445            console.info(TAG, 'usb [', devices.name, '] connectDevice ret : ', JSON.stringify(gPipe));
446            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
447        } catch (err) {
448            console.info(TAG, 'testConnectDeviceParamEx004 catch err code: ', err.code, ', message: ', err.message);
449            expect(err !== null).assertFalse();
450        }
451    })
452
453    /**
454     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_1300
455     * @tc.name     : testConnectDeviceParamEx005
456     * @tc.desc     : Negative test: devices serial is null string ""
457     * @tc.size     : MediumTest
458     * @tc.type     : Function
459     * @tc.level    : Level 3
460     */
461    it('testConnectDeviceParamEx005', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
462        console.info(TAG, 'usb testConnectDeviceParamEx005 begin');
463        if (!isDeviceConnected) {
464            expect(isDeviceConnected).assertFalse();
465            return
466        }
467        try {
468            devices.serial = PARAM_NULLSTRING;
469            let gPipe = usbManager.connectDevice(devices);
470            console.info(TAG, 'usb [', devices.serial, '] connectDevice ret : ', JSON.stringify(gPipe));
471            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
472        } catch (err) {
473            console.info(TAG, 'testConnectDeviceParamEx005 catch err code: ', err.code, ', message: ', err.message);
474            expect(err !== null).assertFalse();
475        }
476    })
477
478    /**
479     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_1400
480     * @tc.name     : testConnectDeviceParamEx006
481     * @tc.desc     : Negative test: devices serial add letter abc
482     * @tc.size     : MediumTest
483     * @tc.type     : Function
484     * @tc.level    : Level 3
485     */
486    it('testConnectDeviceParamEx006', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
487        console.info(TAG, 'usb testConnectDeviceParamEx006 begin');
488        if (!isDeviceConnected) {
489            expect(isDeviceConnected).assertFalse();
490            return
491        }
492        try {
493            let devSerial = devices.serial + "abc";
494            devices.serial = devSerial;
495            let gPipe = usbManager.connectDevice(devices);
496            console.info(TAG, 'usb [', devices.serial, '] connectDevice ret : ', JSON.stringify(gPipe));
497            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
498        } catch (err) {
499            console.info(TAG, 'testConnectDeviceParamEx006 catch err code: ', err.code, ', message: ', err.message);
500            expect(err !== null).assertFalse();
501        }
502    })
503
504    /**
505     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_1500
506     * @tc.name     : testConnectDeviceParamEx007
507     * @tc.desc     : Negative test: devices serial add number 123
508     * @tc.size     : MediumTest
509     * @tc.type     : Function
510     * @tc.level    : Level 3
511     */
512    it('testConnectDeviceParamEx007', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
513        console.info(TAG, 'usb testConnectDeviceParamEx007 begin');
514        if (!isDeviceConnected) {
515            expect(isDeviceConnected).assertFalse();
516            return
517        }
518        try {
519            let devSerial = devices.serial + "123";
520            devices.serial = devSerial;
521            let gPipe = usbManager.connectDevice(devices);
522            console.info(TAG, 'usb [', devices.serial, '] connectDevice ret : ', JSON.stringify(gPipe));
523            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
524        } catch (err) {
525            console.info(TAG, 'testConnectDeviceParamEx007 catch err code: ', err.code, ', message: ', err.message);
526            expect(err !== null).assertFalse();
527        }
528    })
529
530    /**
531     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_1600
532     * @tc.name     : testConnectDeviceParamEx008
533     * @tc.desc     : Negative test: devices serial add special characters '@#'
534     * @tc.size     : MediumTest
535     * @tc.type     : Function
536     * @tc.level    : Level 3
537     */
538    it('testConnectDeviceParamEx008', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
539        console.info(TAG, 'usb testConnectDeviceParamEx008 begin');
540        if (!isDeviceConnected) {
541            expect(isDeviceConnected).assertFalse();
542            return
543        }
544        try {
545            let devSerial = devices.serial + "@#";
546            devices.serial = devSerial;
547            let gPipe = usbManager.connectDevice(devices);
548            console.info(TAG, 'usb [', devices.serial, '] connectDevice ret : ', JSON.stringify(gPipe));
549            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
550        } catch (err) {
551            console.info(TAG, 'testConnectDeviceParamEx008 catch err code: ', err.code, ', message: ', err.message);
552            expect(err !== null).assertFalse();
553        }
554    })
555
556    /**
557     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_1700
558     * @tc.name     : testConnectDeviceParamEx009
559     * @tc.desc     : Negative test: devices manufacturerName add special characters '@#'
560     * @tc.size     : MediumTest
561     * @tc.type     : Function
562     * @tc.level    : Level 3
563     */
564    it('testConnectDeviceParamEx009', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
565        console.info(TAG, 'usb testConnectDeviceParamEx009 begin');
566        if (!isDeviceConnected) {
567            expect(isDeviceConnected).assertFalse();
568            return
569        }
570        try {
571            let devManufacturerName = devices.manufacturerName + "@#";
572            devices.manufacturerName = devManufacturerName;
573            let gPipe = usbManager.connectDevice(devices);
574            console.info(TAG, 'usb [', devices.manufacturerName, '] connectDevice ret : ', JSON.stringify(gPipe));
575            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
576        } catch (err) {
577            console.info(TAG, 'testConnectDeviceParamEx009 catch err code: ', err.code, ', message: ', err.message);
578            expect(err !== null).assertFalse();
579        }
580    })
581
582    /**
583     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_1800
584     * @tc.name     : testConnectDeviceParamEx010
585     * @tc.desc     : Negative test: devices manufacturerName add special characters 'abc'
586     * @tc.size     : MediumTest
587     * @tc.type     : Function
588     * @tc.level    : Level 3
589     */
590    it('testConnectDeviceParamEx010', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
591        console.info(TAG, 'usb testConnectDeviceParamEx010 begin');
592        if (!isDeviceConnected) {
593            expect(isDeviceConnected).assertFalse();
594            return
595        }
596        try {
597            let devManufacturerName = devices.manufacturerName + "abc";
598            devices.manufacturerName = devManufacturerName;
599            let gPipe = usbManager.connectDevice(devices);
600            console.info(TAG, 'usb [', devices.manufacturerName, '] connectDevice ret : ', JSON.stringify(gPipe));
601            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
602        } catch (err) {
603            console.info(TAG, 'testConnectDeviceParamEx010 catch err code: ', err.code, ', message: ', err.message);
604            expect(err !== null).assertFalse();
605        }
606    })
607
608    /**
609     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_1900
610     * @tc.name     : testConnectDeviceParamEx011
611     * @tc.desc     : Negative test: devices manufacturerName add special characters '123'
612     * @tc.size     : MediumTest
613     * @tc.type     : Function
614     * @tc.level    : Level 3
615     */
616    it('testConnectDeviceParamEx011', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
617        console.info(TAG, 'usb testConnectDeviceParamEx011 begin');
618        if (!isDeviceConnected) {
619            expect(isDeviceConnected).assertFalse();
620            return
621        }
622        try {
623            let devManufacturerName = devices.manufacturerName + "123";
624            devices.manufacturerName = devManufacturerName;
625            let gPipe = usbManager.connectDevice(devices);
626            console.info(TAG, 'usb [', devices.manufacturerName, '] connectDevice ret : ', JSON.stringify(gPipe));
627            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
628        } catch (err) {
629            console.info(TAG, 'testConnectDeviceParamEx011 catch err code: ', err.code, ', message: ', err.message);
630            expect(err !== null).assertFalse();
631        }
632    })
633
634    /**
635     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_2000
636     * @tc.name     : testConnectDeviceParamEx012
637     * @tc.desc     : Negative test: devices manufacturerName add special characters ""
638     * @tc.size     : MediumTest
639     * @tc.type     : Function
640     * @tc.level    : Level 3
641     */
642    it('testConnectDeviceParamEx012', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
643        console.info(TAG, 'usb testConnectDeviceParamEx012 begin');
644        if (!isDeviceConnected) {
645            expect(isDeviceConnected).assertFalse();
646            return
647        }
648        try {
649            devices.manufacturerName = PARAM_NULLSTRING;
650            let gPipe = usbManager.connectDevice(devices);
651            console.info(TAG, 'usb [', devices.manufacturerName, '] connectDevice ret : ', JSON.stringify(gPipe));
652            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
653        } catch (err) {
654            console.info(TAG, 'testConnectDeviceParamEx012 catch err code: ', err.code, ', message: ', err.message);
655            expect(err !== null).assertFalse();
656        }
657    })
658
659    /**
660     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_2100
661     * @tc.name     : testConnectDeviceParamEx013
662     * @tc.desc     : Negative test: devices productName add special characters '@#'
663     * @tc.size     : MediumTest
664     * @tc.type     : Function
665     * @tc.level    : Level 3
666     */
667    it('testConnectDeviceParamEx013', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
668        console.info(TAG, 'usb testConnectDeviceParamEx013 begin');
669        if (!isDeviceConnected) {
670            expect(isDeviceConnected).assertFalse();
671            return
672        }
673        try {
674            let devProductName = devices.productName + "@#";
675            devices.productName = devProductName;
676            let gPipe = usbManager.connectDevice(devices);
677            console.info(TAG, 'usb [', devices.productName, '] connectDevice ret : ', JSON.stringify(gPipe));
678            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
679        } catch (err) {
680            console.info(TAG, 'testConnectDeviceParamEx013 catch err code: ', err.code, ', message: ', err.message);
681            expect(err !== null).assertFalse();
682        }
683    })
684
685    /**
686     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_2200
687     * @tc.name     : testConnectDeviceParamEx014
688     * @tc.desc     : Negative test: devices productName add special characters 'abc'
689     * @tc.size     : MediumTest
690     * @tc.type     : Function
691     * @tc.level    : Level 3
692     */
693    it('testConnectDeviceParamEx014', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
694        console.info(TAG, 'usb testConnectDeviceParamEx014 begin');
695        if (!isDeviceConnected) {
696            expect(isDeviceConnected).assertFalse();
697            return
698        }
699        try {
700            let devProductName = devices.productName + "abc";
701            devices.productName = devProductName;
702            let gPipe = usbManager.connectDevice(devices);
703            console.info(TAG, 'usb [', devices.productName, '] connectDevice ret : ', JSON.stringify(gPipe));
704            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
705        } catch (err) {
706            console.info(TAG, 'testConnectDeviceParamEx014 catch err code: ', err.code, ', message: ', err.message);
707            expect(err !== null).assertFalse();
708        }
709    })
710
711    /**
712     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_2300
713     * @tc.name     : testConnectDeviceParamEx015
714     * @tc.desc     : Negative test: devices productName add special characters '123'
715     * @tc.size     : MediumTest
716     * @tc.type     : Function
717     * @tc.level    : Level 3
718     */
719    it('testConnectDeviceParamEx015', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
720        console.info(TAG, 'usb testConnectDeviceParamEx015 begin');
721        if (!isDeviceConnected) {
722            expect(isDeviceConnected).assertFalse();
723            return
724        }
725        try {
726            let devProductName = devices.productName + "123";
727            devices.productName = devProductName;
728            let gPipe = usbManager.connectDevice(devices);
729            console.info(TAG, 'usb [', devices.productName, '] connectDevice ret : ', JSON.stringify(gPipe));
730            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
731        } catch (err) {
732            console.info(TAG, 'testConnectDeviceParamEx015 catch err code: ', err.code, ', message: ', err.message);
733            expect(err !== null).assertFalse();
734        }
735    })
736
737    /**
738     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_2400
739     * @tc.name     : testConnectDeviceParamEx016
740     * @tc.desc     : Negative test: devices productName is null string ""
741     * @tc.size     : MediumTest
742     * @tc.type     : Function
743     * @tc.level    : Level 3
744     */
745    it('testConnectDeviceParamEx016', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
746        console.info(TAG, 'usb testConnectDeviceParamEx016 begin');
747        if (!isDeviceConnected) {
748            expect(isDeviceConnected).assertFalse();
749            return
750        }
751        try {
752            devices.productName = PARAM_NULLSTRING;
753            let gPipe = usbManager.connectDevice(devices);
754            console.info(TAG, 'usb [', devices.productName, '] connectDevice ret : ', JSON.stringify(gPipe));
755            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
756        } catch (err) {
757            console.info(TAG, 'testConnectDeviceParamEx016 catch err code: ', err.code, ', message: ', err.message);
758            expect(err !== null).assertFalse();
759        }
760    })
761
762    /**
763     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_2500
764     * @tc.name     : testConnectDeviceParamEx017
765     * @tc.desc     : Negative test: devices version add special characters '@#'
766     * @tc.size     : MediumTest
767     * @tc.type     : Function
768     * @tc.level    : Level 3
769     */
770    it('testConnectDeviceParamEx017', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
771        console.info(TAG, 'usb testConnectDeviceParamEx017 begin');
772        if (!isDeviceConnected) {
773            expect(isDeviceConnected).assertFalse();
774            return
775        }
776        try {
777            let devVersion = devices.version + "@#";
778            devices.version = devVersion;
779            let gPipe = usbManager.connectDevice(devices);
780            console.info(TAG, 'usb [', devices.version, '] connectDevice ret : ', JSON.stringify(gPipe));
781            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
782        } catch (err) {
783            console.info(TAG, 'testConnectDeviceParamEx017 catch err code: ', err.code, ', message: ', err.message);
784            expect(err !== null).assertFalse();
785        }
786    })
787
788    /**
789     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_2600
790     * @tc.name     : testConnectDeviceParamEx018
791     * @tc.desc     : Negative test: devices version add special characters 'abc'
792     * @tc.size     : MediumTest
793     * @tc.type     : Function
794     * @tc.level    : Level 3
795     */
796    it('testConnectDeviceParamEx018', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
797        console.info(TAG, 'usb testConnectDeviceParamEx018 begin');
798        if (!isDeviceConnected) {
799            expect(isDeviceConnected).assertFalse();
800            return
801        }
802        try {
803            let devVersion = devices.version + "abc";
804            devices.version = devVersion;
805            let gPipe = usbManager.connectDevice(devices);
806            console.info(TAG, 'usb [', devices.version, '] connectDevice ret : ', JSON.stringify(gPipe));
807            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
808        } catch (err) {
809            console.info(TAG, 'testConnectDeviceParamEx018 catch err code: ', err.code, ', message: ', err.message);
810            expect(err !== null).assertFalse();
811        }
812    })
813
814    /**
815     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_2700
816     * @tc.name     : testConnectDeviceParamEx019
817     * @tc.desc     : Negative test: devices version add special characters '123'
818     * @tc.size     : MediumTest
819     * @tc.type     : Function
820     * @tc.level    : Level 3
821     */
822    it('testConnectDeviceParamEx019', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
823        console.info(TAG, 'usb testConnectDeviceParamEx019 begin');
824        if (!isDeviceConnected) {
825            expect(isDeviceConnected).assertFalse();
826            return
827        }
828        try {
829            let devVersion = devices.version + "123";
830            devices.version = devVersion;
831            let gPipe = usbManager.connectDevice(devices);
832            console.info(TAG, 'usb [', devices.version, '] connectDevice ret : ', JSON.stringify(gPipe));
833            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
834        } catch (err) {
835            console.info(TAG, 'testConnectDeviceParamEx019 catch err code: ', err.code, ', message: ', err.message);
836            expect(err !== null).assertFalse();
837        }
838    })
839
840    /**
841     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_2800
842     * @tc.name     : testConnectDeviceParamEx020
843     * @tc.desc     : Negative test: devices version is null string ""
844     * @tc.size     : MediumTest
845     * @tc.type     : Function
846     * @tc.level    : Level 3
847     */
848    it('testConnectDeviceParamEx020', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
849        console.info(TAG, 'usb testConnectDeviceParamEx020 begin');
850        if (!isDeviceConnected) {
851            expect(isDeviceConnected).assertFalse();
852            return
853        }
854        try {
855            devices.version = PARAM_NULLSTRING;
856            let gPipe = usbManager.connectDevice(devices);
857            console.info(TAG, 'usb [', devices.version, '] connectDevice ret : ', JSON.stringify(gPipe));
858            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
859        } catch (err) {
860            console.info(TAG, 'testConnectDeviceParamEx020 catch err code: ', err.code, ', message: ', err.message);
861            expect(err !== null).assertFalse();
862        }
863    })
864
865    /**
866     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_2900
867     * @tc.name     : testConnectDeviceParamEx021
868     * @tc.desc     : Negative test: devices vendorId is add number 1000
869     * @tc.size     : MediumTest
870     * @tc.type     : Function
871     * @tc.level    : Level 3
872     */
873    it('testConnectDeviceParamEx021', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
874        console.info(TAG, 'usb testConnectDeviceParamEx021 begin');
875        if (!isDeviceConnected) {
876            expect(isDeviceConnected).assertFalse();
877            return
878        }
879        try {
880            let devVendorId = devices.vendorId + 1000;
881            devices.vendorId = devVendorId;
882            let gPipe = usbManager.connectDevice(devices);
883            console.info(TAG, 'usb [', devices.vendorId, '] connectDevice ret : ', JSON.stringify(gPipe));
884            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
885        } catch (err) {
886            console.info(TAG, 'testConnectDeviceParamEx021 catch err code: ', err.code, ', message: ', err.message);
887            expect(err !== null).assertFalse();
888        }
889    })
890
891    /**
892     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_3000
893     * @tc.name     : testConnectDeviceParamEx022
894     * @tc.desc     : Negative test: devices productId is add number 1000
895     * @tc.size     : MediumTest
896     * @tc.type     : Function
897     * @tc.level    : Level 3
898     */
899    it('testConnectDeviceParamEx022', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
900        console.info(TAG, 'usb testConnectDeviceParamEx022 begin');
901        if (!isDeviceConnected) {
902            expect(isDeviceConnected).assertFalse();
903            return
904        }
905        try {
906            let devProductId = devices.productId + 1000;
907            devices.productId = devProductId;
908            let gPipe = usbManager.connectDevice(devices);
909            console.info(TAG, 'usb [', devices.productId, '] connectDevice ret : ', JSON.stringify(gPipe));
910            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
911        } catch (err) {
912            console.info(TAG, 'testConnectDeviceParamEx022 catch err code: ', err.code, ', message: ', err.message);
913            expect(err !== null).assertFalse();
914        }
915    })
916
917    /**
918     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_3100
919     * @tc.name     : testConnectDeviceParamEx023
920     * @tc.desc     : Negative test: devices clazz is add number 1000
921     * @tc.size     : MediumTest
922     * @tc.type     : Function
923     * @tc.level    : Level 3
924     */
925    it('testConnectDeviceParamEx023', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
926        console.info(TAG, 'usb testConnectDeviceParamEx023 begin');
927        if (!isDeviceConnected) {
928            expect(isDeviceConnected).assertFalse();
929            return
930        }
931        try {
932            let devClazz = devices.clazz + 1000;
933            devices.clazz = devClazz;
934            let gPipe = usbManager.connectDevice(devices);
935            console.info(TAG, 'usb [', devices.clazz, '] connectDevice ret : ', JSON.stringify(gPipe));
936            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
937        } catch (err) {
938            console.info(TAG, 'testConnectDeviceParamEx023 catch err code: ', err.code, ', message: ', err.message);
939            expect(err !== null).assertFalse();
940        }
941    })
942
943    /**
944     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_3200
945     * @tc.name     : testConnectDeviceParamEx024
946     * @tc.desc     : Negative test: devices subClass is add number 1000
947     * @tc.size     : MediumTest
948     * @tc.type     : Function
949     * @tc.level    : Level 3
950     */
951    it('testConnectDeviceParamEx024', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
952        console.info(TAG, 'usb testConnectDeviceParamEx024 begin');
953        if (!isDeviceConnected) {
954            expect(isDeviceConnected).assertFalse();
955            return
956        }
957        try {
958            let devSubClass = devices.subClass + 1000;
959            devices.subClass = devSubClass;
960            let gPipe = usbManager.connectDevice(devices);
961            console.info(TAG, 'usb [', devices.subClass, '] connectDevice ret : ', JSON.stringify(gPipe));
962            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
963        } catch (err) {
964            console.info(TAG, 'testConnectDeviceParamEx024 catch err code: ', err.code, ', message: ', err.message);
965            expect(err !== null).assertFalse();
966        }
967    })
968
969    /**
970     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_3300
971     * @tc.name     : testConnectDeviceParamEx025
972     * @tc.desc     : Negative test: devices protocol is add number 1000
973     * @tc.size     : MediumTest
974     * @tc.type     : Function
975     * @tc.level    : Level 3
976     */
977    it('testConnectDeviceParamEx025', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
978        console.info(TAG, 'usb testConnectDeviceParamEx025 begin');
979        if (!isDeviceConnected) {
980            expect(isDeviceConnected).assertFalse();
981            return
982        }
983        try {
984            let devProtocol = devices.protocol + 1000;
985            devices.protocol = devProtocol;
986            let gPipe = usbManager.connectDevice(devices);
987            console.info(TAG, 'usb [', devices.protocol, '] connectDevice ret : ', JSON.stringify(gPipe));
988            expect(CheckEmptyUtils.isEmpty(gPipe)).assertFalse();
989        } catch (err) {
990            console.info(TAG, 'testConnectDeviceParamEx025 catch err code: ', err.code, ', message: ', err.message);
991            expect(err !== null).assertFalse();
992        }
993    })
994
995    /**
996     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_3400
997     * @tc.name     : testConnectDeviceParamEx026
998     * @tc.desc     : Negative test: devices busNum is add number 1000
999     * @tc.size     : MediumTest
1000     * @tc.type     : Function
1001     * @tc.level    : Level 3
1002     */
1003    it('testConnectDeviceParamEx026', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1004        console.info(TAG, 'usb testConnectDeviceParamEx026 begin');
1005        if (!isDeviceConnected) {
1006            expect(isDeviceConnected).assertFalse();
1007            return
1008        }
1009        try {
1010            let devBusNum = devices.busNum + 1000;
1011            devices.busNum = devBusNum;
1012            let gPipe = usbManager.connectDevice(devices);
1013            console.info(TAG, 'usb [', devices.busNum, '] connectDevice ret : ', JSON.stringify(gPipe));
1014            expect(gPipe !== null).assertFalse();
1015        } catch (err) {
1016            console.info(TAG, 'testConnectDeviceParamEx026 catch err code: ', err.code, ', message: ', err.message);
1017            expect(err.code).assertEqual(14400001);
1018        }
1019    })
1020
1021    /**
1022     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_3500
1023     * @tc.name     : testConnectDeviceParamEx027
1024     * @tc.desc     : Negative test: devices devAddress is add number 10000
1025     * @tc.size     : MediumTest
1026     * @tc.type     : Function
1027     * @tc.level    : Level 3
1028     */
1029    it('testConnectDeviceParamEx027', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1030        console.info(TAG, 'usb testConnectDeviceParamEx027 begin');
1031        if (!isDeviceConnected) {
1032            expect(isDeviceConnected).assertFalse();
1033            return
1034        }
1035        try {
1036            let devDevAddress = devices.devAddress + 1000;
1037            devices.devAddress = devDevAddress;
1038            let gPipe = usbManager.connectDevice(devices);
1039            console.info(TAG, 'usb [', devices.devAddress, '] connectDevice ret : ', JSON.stringify(gPipe));
1040            expect(gPipe !== null).assertFalse();
1041        } catch (err) {
1042            console.info(TAG, 'testConnectDeviceParamEx027 catch err code: ', err.code, ', message: ', err.message);
1043            expect(err.code).assertEqual(14400001);
1044        }
1045    })
1046
1047    /**
1048     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_3600
1049     * @tc.name     : testClosePipeParamEx001
1050     * @tc.desc     : Negative test: pipe busNum add number 1000
1051     * @tc.size     : MediumTest
1052     * @tc.type     : Function
1053     * @tc.level    : Level 3
1054     */
1055    it('testClosePipeParamEx001', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1056        console.info(TAG, 'usb testClosePipeParamEx001 begin');
1057        if (!isDeviceConnected) {
1058            expect(isDeviceConnected).assertFalse();
1059            return
1060        }
1061        getPipe("testClosePipeParamEx001");
1062        try {
1063            gPipe.busNum = gPipe.busNum + 1000;
1064            let ret = usbManager.closePipe(gPipe);
1065            console.info(TAG, 'usb [', gPipe.busNum, '] closePipe ret : ', ret);
1066            expect(ret !== 0).assertTrue();
1067        } catch (err) {
1068            console.info(TAG, 'testClosePipeParamEx001 catch err code: ', err);
1069            expect(err !== null).assertFalse();
1070        }
1071        toClosePipe("testClosePipeParamEx001");
1072    })
1073
1074    /**
1075     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_3700
1076     * @tc.name     : testClosePipeParamEx002
1077     * @tc.desc     : Negative test: pipe devAddress add number 10000
1078     * @tc.size     : MediumTest
1079     * @tc.type     : Function
1080     * @tc.level    : Level 3
1081     */
1082    it('testClosePipeParamEx002', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1083        console.info(TAG, 'usb testClosePipeParamEx002 begin');
1084        if (!isDeviceConnected) {
1085            expect(isDeviceConnected).assertFalse();
1086            return
1087        }
1088        getPipe("testClosePipeParamEx002");
1089        try {
1090            let pipDevAdd = gPipe.devAddress + 10000;
1091            gPipe.devAddress = pipDevAdd;
1092            let ret = usbManager.closePipe(gPipe);
1093            console.info(TAG, 'usb [', gPipe.devAddress, '] closePipe ret : ', ret);
1094            expect(ret !== 0).assertTrue();
1095        } catch (err) {
1096            console.info(TAG, 'testClosePipeParamEx002 catch err code: ', err);
1097            expect(err !== null).assertFalse();
1098        }
1099        toClosePipe("testClosePipeParamEx002");
1100    })
1101
1102    /**
1103     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_3800
1104     * @tc.name     : testGetRawDescriptorParamEx001
1105     * @tc.desc     : Negative test: pipe busNum add number 1000
1106     * @tc.size     : MediumTest
1107     * @tc.type     : Function
1108     * @tc.level    : Level 3
1109     */
1110    it('testGetRawDescriptorParamEx001', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1111        console.info(TAG, 'usb testGetRawDescriptorParamEx001 begin');
1112        if (!isDeviceConnected) {
1113            expect(isDeviceConnected).assertFalse();
1114            return
1115        }
1116        getPipe("testGetRawDescriptorParamEx001");
1117        try {
1118            let pipBusNum = gPipe.busNum + 1000;
1119            gPipe.busNum = pipBusNum;
1120            let ret = usbManager.getRawDescriptor(gPipe);
1121            console.info(TAG, 'usb [', gPipe.busNum, '] getRawDescriptor ret : ', ret);
1122            expect(ret).assertEqual(undefined);
1123        } catch (err) {
1124            console.info(TAG, 'testGetRawDescriptorParamEx001 catch err code: ', err);
1125            expect(err !== null).assertFalse();
1126        }
1127        toClosePipe("testGetRawDescriptorParamEx001");
1128    })
1129
1130    /**
1131     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_3900
1132     * @tc.name     : testGetRawDescriptorParamEx002
1133     * @tc.desc     : Negative test: pipe devAddress add number 10000
1134     * @tc.size     : MediumTest
1135     * @tc.type     : Function
1136     * @tc.level    : Level 3
1137     */
1138    it('testGetRawDescriptorParamEx002', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1139        console.info(TAG, 'usb testGetRawDescriptorParamEx002 begin');
1140        if (!isDeviceConnected) {
1141            expect(isDeviceConnected).assertFalse();
1142            return
1143        }
1144        getPipe("testGetRawDescriptorParamEx002");
1145        try {
1146            let pipDevAdd = gPipe.devAddress + 10000;
1147            gPipe.devAddress = pipDevAdd;
1148            let ret = usbManager.getRawDescriptor(gPipe);
1149            console.info(TAG, 'usb [', gPipe.devAddress, '] getRawDescriptor ret : ', ret);
1150            expect(ret).assertEqual(undefined);
1151        } catch (err) {
1152            console.info(TAG, 'testGetRawDescriptorParamEx002 catch err code: ', err);
1153            expect(err !== null).assertFalse();
1154        }
1155        toClosePipe("testGetRawDescriptorParamEx002");
1156    })
1157
1158    /**
1159     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_4000
1160     * @tc.name     : testGetRawDescriptorParamEx003
1161     * @tc.desc     : Negative test: pipe busNum -23
1162     * @tc.size     : MediumTest
1163     * @tc.type     : Function
1164     * @tc.level    : Level 3
1165     */
1166    it('testGetRawDescriptorParamEx003', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1167        console.info(TAG, 'usb testGetRawDescriptorParamEx003 begin');
1168        if (!isDeviceConnected) {
1169            expect(isDeviceConnected).assertFalse();
1170            return
1171        }
1172        getPipe("testGetRawDescriptorParamEx003");
1173        try {
1174            gPipe.busNum = -23;
1175            let ret = usbManager.getRawDescriptor(gPipe);
1176            console.info(TAG, 'usb [', gPipe.busNum, '] getRawDescriptor ret : ', ret);
1177            expect(ret).assertEqual(undefined);
1178        } catch (err) {
1179            console.info(TAG, 'testGetRawDescriptorParamEx003 catch err code: ', err);
1180            expect(err !== null).assertFalse();
1181        }
1182        toClosePipe("testGetRawDescriptorParamEx003");
1183    })
1184
1185    /**
1186     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_4100
1187     * @tc.name     : testGetRawDescriptorParamEx004
1188     * @tc.desc     : Negative test: pipe devAddress -23
1189     * @tc.size     : MediumTest
1190     * @tc.type     : Function
1191     * @tc.level    : Level 3
1192     */
1193    it('testGetRawDescriptorParamEx004', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1194        console.info(TAG, 'usb testGetRawDescriptorParamEx004 begin');
1195        if (!isDeviceConnected) {
1196            expect(isDeviceConnected).assertFalse();
1197            return
1198        }
1199        getPipe("testGetRawDescriptorParamEx004");
1200        try {
1201            gPipe.devAddress = -23;
1202            let ret = usbManager.getRawDescriptor(gPipe);
1203            console.info(TAG, 'usb [', gPipe.devAddress, '] getRawDescriptor ret : ', ret);
1204            expect(ret).assertEqual(undefined);
1205        } catch (err) {
1206            console.info(TAG, 'testGetRawDescriptorParamEx004 catch err code: ', err);
1207            expect(err !== null).assertFalse();
1208        }
1209        toClosePipe("testGetRawDescriptorParamEx004");
1210    })
1211
1212    /**
1213     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_4200
1214     * @tc.name     : testGetRawDescriptorParamEx005
1215     * @tc.desc     : Negative test: pipe busNum -23, devAddress -23
1216     * @tc.size     : MediumTest
1217     * @tc.type     : Function
1218     * @tc.level    : Level 3
1219     */
1220    it('testGetRawDescriptorParamEx005', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1221        console.info(TAG, 'usb testGetRawDescriptorParamEx005 begin');
1222        if (!isDeviceConnected) {
1223            expect(isDeviceConnected).assertFalse();
1224            return
1225        }
1226        getPipe("testGetRawDescriptorParamEx005");
1227        try {
1228            gPipe.busNum = -23;
1229            gPipe.devAddress = -23;
1230            let ret = usbManager.getRawDescriptor(gPipe);
1231            console.info(TAG, 'usb [', gPipe.devAddress, '] getRawDescriptor ret : ', ret);
1232            expect(ret).assertEqual(undefined);
1233        } catch (err) {
1234            console.info(TAG, 'testGetRawDescriptorParamEx005 catch err code: ', err);
1235            expect(err !== null).assertFalse();
1236        }
1237        toClosePipe("testGetRawDescriptorParamEx005");
1238    })
1239
1240    /**
1241     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_4300
1242     * @tc.name     : testGetFileDescriptorParamEx001
1243     * @tc.desc     : Negative test: pipe busNum add number 1000
1244     * @tc.size     : MediumTest
1245     * @tc.type     : Function
1246     * @tc.level    : Level 3
1247     */
1248    it('testGetFileDescriptorParamEx001', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1249        console.info(TAG, 'usb testGetFileDescriptorParamEx001 begin');
1250        if (!isDeviceConnected) {
1251            expect(isDeviceConnected).assertFalse();
1252            return
1253        }
1254        getPipe("testGetFileDescriptorParamEx001");
1255        try {
1256            let pipBusNum = gPipe.busNum + 1000;
1257            gPipe.busNum = pipBusNum;
1258            let ret = usbManager.getFileDescriptor(gPipe);
1259            console.info(TAG, 'usb [', gPipe.busNum, '] getFileDescriptor ret : ', ret);
1260            expect(ret).assertEqual(-1);
1261        } catch (err) {
1262            console.info(TAG, 'testGetFileDescriptorParamEx001 catch err code: ', err);
1263            expect(err !== null).assertFalse();
1264        }
1265        toClosePipe("testGetFileDescriptorParamEx001");
1266    })
1267
1268    /**
1269     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_4400
1270     * @tc.name     : testGetFileDescriptorParamEx002
1271     * @tc.desc     : Negative test: pipe devAddress add number 10000
1272     * @tc.size     : MediumTest
1273     * @tc.type     : Function
1274     * @tc.level    : Level 3
1275     */
1276    it('testGetFileDescriptorParamEx002', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1277        console.info(TAG, 'usb testGetFileDescriptorParamEx002 begin');
1278        if (!isDeviceConnected) {
1279            expect(isDeviceConnected).assertFalse();
1280            return
1281        }
1282        getPipe("testGetFileDescriptorParamEx002");
1283        try {
1284            let pipDevAdd = gPipe.devAddress + 10000;
1285            gPipe.devAddress = pipDevAdd;
1286            let ret = usbManager.getFileDescriptor(gPipe);
1287            console.info(TAG, 'usb [', gPipe.devAddress, '] getFileDescriptor ret : ', ret);
1288            expect(ret).assertEqual(-1);
1289        } catch (err) {
1290            console.info(TAG, 'testGetFileDescriptorParamEx002 catch err code: ', err);
1291            expect(err !== null).assertFalse();
1292        }
1293        toClosePipe("testGetFileDescriptorParamEx002");
1294    })
1295
1296    /**
1297     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_4500
1298     * @tc.name     : testGetFileDescriptorParamEx003
1299     * @tc.desc     : Negative test: pipe busNum -23
1300     * @tc.size     : MediumTest
1301     * @tc.type     : Function
1302     * @tc.level    : Level 3
1303     */
1304    it('testGetFileDescriptorParamEx003', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1305        console.info(TAG, 'usb testGetFileDescriptorParamEx003 begin');
1306        if (!isDeviceConnected) {
1307            expect(isDeviceConnected).assertFalse();
1308            return
1309        }
1310        getPipe("testGetFileDescriptorParamEx003");
1311        try {
1312            gPipe.busNum = -23;
1313            let ret = usbManager.getFileDescriptor(gPipe);
1314            console.info(TAG, 'usb [', gPipe.busNum, '] getFileDescriptor ret : ', ret);
1315            expect(ret).assertEqual(-1);
1316        } catch (err) {
1317            console.info(TAG, 'testGetFileDescriptorParamEx003 catch err code: ', err);
1318            expect(err !== null).assertFalse();
1319        }
1320        toClosePipe("testGetFileDescriptorParamEx003");
1321    })
1322
1323    /**
1324     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_4600
1325     * @tc.name     : testGetFileDescriptorParamEx004
1326     * @tc.desc     : Negative test: pipe devAddress -23
1327     * @tc.size     : MediumTest
1328     * @tc.type     : Function
1329     * @tc.level    : Level 3
1330     */
1331    it('testGetFileDescriptorParamEx004', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1332        console.info(TAG, 'usb testGetFileDescriptorParamEx004 begin');
1333        if (!isDeviceConnected) {
1334            expect(isDeviceConnected).assertFalse();
1335            return
1336        }
1337        getPipe("testGetFileDescriptorParamEx004");
1338        try {
1339            gPipe.devAddress = -23;
1340            let ret = usbManager.getFileDescriptor(gPipe);
1341            console.info(TAG, 'usb [', gPipe.devAddress, '] getFileDescriptor ret : ', ret);
1342            expect(ret).assertEqual(-1);
1343        } catch (err) {
1344            console.info(TAG, 'testGetFileDescriptorParamEx004 catch err code: ', err);
1345            expect(err !== null).assertFalse();
1346        }
1347        toClosePipe("testGetFileDescriptorParamEx004");
1348    })
1349
1350    /**
1351     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_4700
1352     * @tc.name     : testGetFileDescriptorParamEx005
1353     * @tc.desc     : Negative test: pipe busNum -23, devAddress -23
1354     * @tc.size     : MediumTest
1355     * @tc.type     : Function
1356     * @tc.level    : Level 3
1357     */
1358    it('testGetFileDescriptorParamEx005', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1359        console.info(TAG, 'usb testGetFileDescriptorParamEx005 begin');
1360        if (!isDeviceConnected) {
1361            expect(isDeviceConnected).assertFalse();
1362            return
1363        }
1364        getPipe("testGetFileDescriptorParamEx005");
1365        try {
1366            gPipe.busNum = -23;
1367            gPipe.devAddress = -23;
1368            let ret = usbManager.getFileDescriptor(gPipe);
1369            console.info(TAG, 'usb [', gPipe.devAddress, '] getFileDescriptor ret : ', ret);
1370            expect(ret).assertEqual(-1);
1371        } catch (err) {
1372            console.info(TAG, 'testGetFileDescriptorParamEx005 catch err code: ', err);
1373            expect(err !== null).assertFalse();
1374        }
1375        toClosePipe("testGetFileDescriptorParamEx005");
1376    })
1377
1378    /**
1379     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_4800
1380     * @tc.name     : testClaimInterfaceParamEx001
1381     * @tc.desc     : Negative test: interfaces id add 123
1382     * @tc.size     : MediumTest
1383     * @tc.type     : Function
1384     * @tc.level    : Level 3
1385     */
1386    it('testClaimInterfaceParamEx001', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1387        console.info(TAG, 'usb testClaimInterfaceParamEx001 begin');
1388        if (!isDeviceConnected) {
1389            expect(isDeviceConnected).assertFalse();
1390            return
1391        }
1392        getPipe("testClaimInterfaceParamEx001");
1393        try {
1394            let tmpInterface = devices.configs[0].interfaces[0];
1395            tmpInterface.id = tmpInterface.id + 123;
1396            let ret = usbManager.claimInterface(gPipe, tmpInterface);
1397            console.info(TAG, 'usb [', tmpInterface.id, '] claimInterface ret : ', ret);
1398            expect(ret !== 0).assertTrue();
1399        } catch (err) {
1400            console.info(TAG, 'testClaimInterfaceParamEx001 catch err code: ', err);
1401            expect(err !== null).assertFalse();
1402        }
1403        toClosePipe("testClaimInterfaceParamEx001");
1404    })
1405
1406    /**
1407     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_4900
1408     * @tc.name     : testClaimInterfaceParamEx002
1409     * @tc.desc     : Negative test: interfaces id -1
1410     * @tc.size     : MediumTest
1411     * @tc.type     : Function
1412     * @tc.level    : Level 3
1413     */
1414    it('testClaimInterfaceParamEx002', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1415        console.info(TAG, 'usb testClaimInterfaceParamEx002 begin');
1416        if (!isDeviceConnected) {
1417            expect(isDeviceConnected).assertFalse();
1418            return
1419        }
1420        getPipe("testClaimInterfaceParamEx002");
1421        try {
1422            let tmpInterface = devices.configs[0].interfaces[0];
1423            tmpInterface.id = -1;
1424            let ret = usbManager.claimInterface(gPipe, tmpInterface);
1425            console.info(TAG, 'usb [', tmpInterface.id, '] claimInterface ret : ', ret);
1426            expect(ret !== 0).assertTrue();
1427        } catch (err) {
1428            console.info(TAG, 'testClaimInterfaceParamEx002 catch err code: ', err);
1429            expect(err !== null).assertFalse();
1430        }
1431        toClosePipe("testClaimInterfaceParamEx002");
1432    })
1433
1434    /**
1435     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_5000
1436     * @tc.name     : testClaimInterfaceParamEx003
1437     * @tc.desc     : Negative test: pipe busNum add 1000
1438     * @tc.size     : MediumTest
1439     * @tc.type     : Function
1440     * @tc.level    : Level 3
1441     */
1442    it('testClaimInterfaceParamEx003', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1443        console.info(TAG, 'usb testClaimInterfaceParamEx003 begin');
1444        if (!isDeviceConnected) {
1445            expect(isDeviceConnected).assertFalse();
1446            return
1447        }
1448        getPipe("testClaimInterfaceParamEx003");
1449        try {
1450            gPipe.busNum = gPipe.busNum + 1000;
1451            let tmpInterface = devices.configs[0].interfaces[0];
1452            let ret = usbManager.claimInterface(gPipe, tmpInterface);
1453            console.info(TAG, 'usb [', gPipe.busNum, '] claimInterface ret : ', ret);
1454            expect(ret !== 0).assertTrue();
1455        } catch (err) {
1456            console.info(TAG, 'testClaimInterfaceParamEx003 catch err code: ', err);
1457            expect(err !== null).assertFalse();
1458        }
1459        toClosePipe("testClaimInterfaceParamEx003");
1460    })
1461
1462    /**
1463     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_5100
1464     * @tc.name     : testClaimInterfaceParamEx004
1465     * @tc.desc     : Negative test: pipe busNum -1
1466     * @tc.size     : MediumTest
1467     * @tc.type     : Function
1468     * @tc.level    : Level 3
1469     */
1470    it('testClaimInterfaceParamEx004', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1471        console.info(TAG, 'usb testClaimInterfaceParamEx004 begin');
1472        if (!isDeviceConnected) {
1473            expect(isDeviceConnected).assertFalse();
1474            return
1475        }
1476        getPipe("testClaimInterfaceParamEx004");
1477        try {
1478            gPipe.busNum = -1;
1479            let tmpInterface = devices.configs[0].interfaces[0];
1480            let ret = usbManager.claimInterface(gPipe, tmpInterface);
1481            console.info(TAG, 'usb [', gPipe.busNum, '] claimInterface ret : ', ret);
1482            expect(ret !== 0).assertTrue();
1483        } catch (err) {
1484            console.info(TAG, 'testClaimInterfaceParamEx004 catch err code: ', err);
1485            expect(err !== null).assertFalse();
1486        }
1487        toClosePipe("testClaimInterfaceParamEx004");
1488    })
1489
1490    /**
1491     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_5200
1492     * @tc.name     : testClaimInterfaceParamEx005
1493     * @tc.desc     : Negative test: pipe devAddress add 10000
1494     * @tc.size     : MediumTest
1495     * @tc.type     : Function
1496     * @tc.level    : Level 3
1497     */
1498    it('testClaimInterfaceParamEx005', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1499        console.info(TAG, 'usb testClaimInterfaceParamEx005 begin');
1500        if (!isDeviceConnected) {
1501            expect(isDeviceConnected).assertFalse();
1502            return
1503        }
1504        getPipe("testClaimInterfaceParamEx005");
1505        try {
1506            gPipe.devAddress = gPipe.devAddress + 10000;
1507            let tmpInterface = devices.configs[0].interfaces[0];
1508            let ret = usbManager.claimInterface(gPipe, tmpInterface);
1509            console.info(TAG, 'usb [', gPipe.devAddress, '] claimInterface ret : ', ret);
1510            expect(ret !== 0).assertTrue();
1511        } catch (err) {
1512            console.info(TAG, 'testClaimInterfaceParamEx005 catch err code: ', err);
1513            expect(err !== null).assertFalse();
1514        }
1515        toClosePipe("testClaimInterfaceParamEx005");
1516    })
1517
1518    /**
1519     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_5300
1520     * @tc.name     : testClaimInterfaceParamEx006
1521     * @tc.desc     : Negative test: pipe devAddress -1
1522     * @tc.size     : MediumTest
1523     * @tc.type     : Function
1524     * @tc.level    : Level 3
1525     */
1526    it('testClaimInterfaceParamEx006', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1527        console.info(TAG, 'usb testClaimInterfaceParamEx006 begin');
1528        if (!isDeviceConnected) {
1529            expect(isDeviceConnected).assertFalse();
1530            return
1531        }
1532        getPipe("testClaimInterfaceParamEx006");
1533        try {
1534            gPipe.devAddress = -1;
1535            let tmpInterface = devices.configs[0].interfaces[0];
1536            let ret = usbManager.claimInterface(gPipe, tmpInterface);
1537            console.info(TAG, 'usb [', gPipe.devAddress, '] claimInterface ret : ', ret);
1538            expect(ret !== 0).assertTrue();
1539        } catch (err) {
1540            console.info(TAG, 'testClaimInterfaceParamEx006 catch err code: ', err);
1541            expect(err !== null).assertFalse();
1542        }
1543        toClosePipe("testClaimInterfaceParamEx006");
1544    })
1545
1546    /**
1547     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_5400
1548     * @tc.name     : testClaimInterfaceParamEx007
1549     * @tc.desc     : Negative test: pipe devAddress -1, busNum -1
1550     * @tc.size     : MediumTest
1551     * @tc.type     : Function
1552     * @tc.level    : Level 3
1553     */
1554    it('testClaimInterfaceParamEx007', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1555        console.info(TAG, 'usb testClaimInterfaceParamEx007 begin');
1556        if (!isDeviceConnected) {
1557            expect(isDeviceConnected).assertFalse();
1558            return
1559        }
1560        getPipe("testClaimInterfaceParamEx007");
1561        try {
1562            gPipe.busNum = -1;
1563            gPipe.devAddress = -1;
1564            let tmpInterface = devices.configs[0].interfaces[0];
1565            let ret = usbManager.claimInterface(gPipe, tmpInterface);
1566            console.info(TAG, 'usb [', gPipe.busNum , ", ",gPipe.devAddress, '] claimInterface ret : ', ret);
1567            expect(ret !== 0).assertTrue();
1568        } catch (err) {
1569            console.info(TAG, 'testClaimInterfaceParamEx007 catch err code: ', err);
1570            expect(err !== null).assertFalse();
1571        }
1572        toClosePipe("testClaimInterfaceParamEx007");
1573    })
1574
1575    /**
1576     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_5500
1577     * @tc.name     : testClaimInterfaceParamEx008
1578     * @tc.desc     : Negative test: interfaces protocol add 100
1579     * @tc.size     : MediumTest
1580     * @tc.type     : Function
1581     * @tc.level    : Level 3
1582     */
1583    it('testClaimInterfaceParamEx008', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1584        console.info(TAG, 'usb testClaimInterfaceParamEx008 begin');
1585        if (!isDeviceConnected) {
1586            expect(isDeviceConnected).assertFalse();
1587            return
1588        }
1589        getPipe("testClaimInterfaceParamEx008");
1590        try {
1591            let tmpInterface = devices.configs[0].interfaces[0];
1592            tmpInterface.protocol = tmpInterface.protocol + 100;
1593            let ret = usbManager.claimInterface(gPipe, tmpInterface);
1594            console.info(TAG, 'usb [', tmpInterface.protocol, '] claimInterface ret : ', ret);
1595            expect(ret).assertEqual(0);
1596        } catch (err) {
1597            console.info(TAG, 'testClaimInterfaceParamEx008 catch err code: ', err);
1598            expect(err !== null).assertFalse();
1599        }
1600        toClosePipe("testClaimInterfaceParamEx008");
1601    })
1602
1603    /**
1604     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_5600
1605     * @tc.name     : testClaimInterfaceParamEx009
1606     * @tc.desc     : Negative test: interfaces clazz add 100
1607     * @tc.size     : MediumTest
1608     * @tc.type     : Function
1609     * @tc.level    : Level 3
1610     */
1611    it('testClaimInterfaceParamEx009', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1612        console.info(TAG, 'usb testClaimInterfaceParamEx009 begin');
1613        if (!isDeviceConnected) {
1614            expect(isDeviceConnected).assertFalse();
1615            return
1616        }
1617        getPipe("testClaimInterfaceParamEx009");
1618        try {
1619            let tmpInterface = devices.configs[0].interfaces[0];
1620            tmpInterface.clazz = tmpInterface.clazz + 100;
1621            let ret = usbManager.claimInterface(gPipe, tmpInterface);
1622            console.info(TAG, 'usb [', tmpInterface.clazz, '] claimInterface ret : ', ret);
1623            expect(ret).assertEqual(0);
1624        } catch (err) {
1625            console.info(TAG, 'testClaimInterfaceParamEx009 catch err code: ', err);
1626            expect(err !== null).assertFalse();
1627        }
1628        toClosePipe("testClaimInterfaceParamEx009");
1629    })
1630
1631    /**
1632     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_5700
1633     * @tc.name     : testClaimInterfaceParamEx010
1634     * @tc.desc     : Negative test: interfaces name add 123
1635     * @tc.size     : MediumTest
1636     * @tc.type     : Function
1637     * @tc.level    : Level 3
1638     */
1639    it('testClaimInterfaceParamEx010', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1640        console.info(TAG, 'usb testClaimInterfaceParamEx010 begin');
1641        if (!isDeviceConnected) {
1642            expect(isDeviceConnected).assertFalse();
1643            return
1644        }
1645        getPipe("testClaimInterfaceParamEx010");
1646        try {
1647            let tmpInterface = devices.configs[0].interfaces[0];
1648            tmpInterface.name = tmpInterface.name + '123';
1649            let ret = usbManager.claimInterface(gPipe, tmpInterface);
1650            console.info(TAG, 'usb [', tmpInterface.name, '] claimInterface ret : ', ret);
1651            expect(ret).assertEqual(0);
1652        } catch (err) {
1653            console.info(TAG, 'testClaimInterfaceParamEx010 catch err code: ', err);
1654            expect(err !== null).assertFalse();
1655        }
1656        toClosePipe("testClaimInterfaceParamEx010");
1657    })
1658
1659    /**
1660     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_5800
1661     * @tc.name     : testClaimInterfaceParamEx011
1662     * @tc.desc     : Negative test: interfaces name add @#
1663     * @tc.size     : MediumTest
1664     * @tc.type     : Function
1665     * @tc.level    : Level 3
1666     */
1667    it('testClaimInterfaceParamEx011', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1668        console.info(TAG, 'usb testClaimInterfaceParamEx011 begin');
1669        if (!isDeviceConnected) {
1670            expect(isDeviceConnected).assertFalse();
1671            return
1672        }
1673        getPipe("testClaimInterfaceParamEx011");
1674        try {
1675            let tmpInterface = devices.configs[0].interfaces[0];
1676            tmpInterface.name = tmpInterface.name + '@#';
1677            let ret = usbManager.claimInterface(gPipe, tmpInterface);
1678            console.info(TAG, 'usb [', tmpInterface.name, '] claimInterface ret : ', ret);
1679            expect(ret).assertEqual(0);
1680        } catch (err) {
1681            console.info(TAG, 'testClaimInterfaceParamEx011 catch err code: ', err);
1682            expect(err !== null).assertFalse();
1683        }
1684        toClosePipe("testClaimInterfaceParamEx011");
1685    })
1686
1687    /**
1688     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_5900
1689     * @tc.name     : testClaimInterfaceParamEx012
1690     * @tc.desc     : Negative test: interfaces name add abc
1691     * @tc.size     : MediumTest
1692     * @tc.type     : Function
1693     * @tc.level    : Level 3
1694     */
1695    it('testClaimInterfaceParamEx012', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1696        console.info(TAG, 'usb testClaimInterfaceParamEx012 begin');
1697        if (!isDeviceConnected) {
1698            expect(isDeviceConnected).assertFalse();
1699            return
1700        }
1701        getPipe("testClaimInterfaceParamEx012");
1702        try {
1703            let tmpInterface = devices.configs[0].interfaces[0];
1704            tmpInterface.name = tmpInterface.name + 'abc';
1705            let ret = usbManager.claimInterface(gPipe, tmpInterface);
1706            console.info(TAG, 'usb [', tmpInterface.name, '] claimInterface ret : ', ret);
1707            expect(ret).assertEqual(0);
1708        } catch (err) {
1709            console.info(TAG, 'testClaimInterfaceParamEx012 catch err code: ', err);
1710            expect(err !== null).assertFalse();
1711        }
1712        toClosePipe("testClaimInterfaceParamEx012");
1713    })
1714
1715    /**
1716     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_6000
1717     * @tc.name     : testClaimInterfaceParamEx013
1718     * @tc.desc     : Negative test: interfaces name is ""
1719     * @tc.size     : MediumTest
1720     * @tc.type     : Function
1721     * @tc.level    : Level 3
1722     */
1723    it('testClaimInterfaceParamEx013', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1724        console.info(TAG, 'usb testClaimInterfaceParamEx013 begin');
1725        if (!isDeviceConnected) {
1726            expect(isDeviceConnected).assertFalse();
1727            return
1728        }
1729        getPipe("testClaimInterfaceParamEx013");
1730        try {
1731            let tmpInterface = devices.configs[0].interfaces[0];
1732            tmpInterface.name = PARAM_NULLSTRING;
1733            let ret = usbManager.claimInterface(gPipe, tmpInterface);
1734            console.info(TAG, 'usb [', tmpInterface.name, '] claimInterface ret : ', ret);
1735            expect(ret).assertEqual(0);
1736        } catch (err) {
1737            console.info(TAG, 'testClaimInterfaceParamEx013 catch err code: ', err);
1738            expect(err !== null).assertFalse();
1739        }
1740        toClosePipe("testClaimInterfaceParamEx013");
1741    })
1742
1743    /**
1744     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_6100
1745     * @tc.name     : testClaimInterfaceParamEx014
1746     * @tc.desc     : Negative test: interfaces alternateSetting add 100
1747     * @tc.size     : MediumTest
1748     * @tc.type     : Function
1749     * @tc.level    : Level 3
1750     */
1751    it('testClaimInterfaceParamEx014', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1752        console.info(TAG, 'usb testClaimInterfaceParamEx014 begin');
1753        if (!isDeviceConnected) {
1754            expect(isDeviceConnected).assertFalse();
1755            return
1756        }
1757        getPipe("testClaimInterfaceParamEx014");
1758        try {
1759            let tmpInterface = devices.configs[0].interfaces[0];
1760            tmpInterface.alternateSetting = tmpInterface.alternateSetting + 100;
1761            let ret = usbManager.claimInterface(gPipe, tmpInterface);
1762            console.info(TAG, 'usb [', tmpInterface.alternateSetting, '] claimInterface ret : ', ret);
1763            expect(ret).assertEqual(0);
1764        } catch (err) {
1765            console.info(TAG, 'testClaimInterfaceParamEx014 catch err code: ', err);
1766            expect(err !== null).assertFalse();
1767        }
1768        toClosePipe("testClaimInterfaceParamEx014");
1769    })
1770
1771    /**
1772     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_6200
1773     * @tc.name     : testClaimInterfaceParamEx015
1774     * @tc.desc     : Negative test: interfaces subClass add 100
1775     * @tc.size     : MediumTest
1776     * @tc.type     : Function
1777     * @tc.level    : Level 3
1778     */
1779    it('testClaimInterfaceParamEx015', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1780        console.info(TAG, 'usb testClaimInterfaceParamEx015 begin');
1781        if (!isDeviceConnected) {
1782            expect(isDeviceConnected).assertFalse();
1783            return
1784        }
1785        getPipe("testClaimInterfaceParamEx015");
1786        try {
1787            let tmpInterface = devices.configs[0].interfaces[0];
1788            tmpInterface.subClass = tmpInterface.subClass + 100;
1789            let ret = usbManager.claimInterface(gPipe, tmpInterface);
1790            console.info(TAG, 'usb [', tmpInterface.subClass, '] claimInterface ret : ', ret);
1791            expect(ret).assertEqual(0);
1792        } catch (err) {
1793            console.info(TAG, 'testClaimInterfaceParamEx015 catch err code: ', err);
1794            expect(err !== null).assertFalse();
1795        }
1796        toClosePipe("testClaimInterfaceParamEx015");
1797    })
1798
1799    /**
1800     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_6300
1801     * @tc.name     : testSetConfigurationParamEx001
1802     * @tc.desc     : Negative test: configs id add 100
1803     * @tc.size     : MediumTest
1804     * @tc.type     : Function
1805     * @tc.level    : Level 3
1806     */
1807    it('testSetConfigurationParamEx001', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1808        console.info(TAG, 'usb testSetConfigurationParamEx001 begin');
1809        if (!isDeviceConnected) {
1810            expect(isDeviceConnected).assertFalse();
1811            return
1812        }
1813        getPipe("testSetConfigurationParamEx001");
1814        try {
1815            let tmpConfig = devices.configs[0];
1816            tmpConfig.id = tmpConfig.id + 100;
1817            let ret = usbManager.setConfiguration(gPipe, tmpConfig);
1818            console.info(TAG, 'usb [', tmpConfig.id, '] setConfiguration ret : ', ret);
1819            expect(ret !== 0).assertTrue();
1820        } catch (err) {
1821            console.info(TAG, 'testSetConfigurationParamEx001 catch err code: ', err);
1822            expect(err !== null).assertFalse();
1823        }
1824        toClosePipe("testSetConfigurationParamEx001");
1825    })
1826
1827    /**
1828     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_6400
1829     * @tc.name     : testSetConfigurationParamEx002
1830     * @tc.desc     : Negative test: configs id is -1
1831     * @tc.size     : MediumTest
1832     * @tc.type     : Function
1833     * @tc.level    : Level 3
1834     */
1835    it('testSetConfigurationParamEx002', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1836        console.info(TAG, 'usb testSetConfigurationParamEx002 begin');
1837        if (!isDeviceConnected) {
1838            expect(isDeviceConnected).assertFalse();
1839            return
1840        }
1841        getPipe("testSetConfigurationParamEx002");
1842        try {
1843            let tmpConfig = devices.configs[0];
1844            tmpConfig.id = -1;
1845            let ret = usbManager.setConfiguration(gPipe, tmpConfig);
1846            console.info(TAG, 'usb [', tmpConfig.id, '] setConfiguration ret : ', ret);
1847            expect(ret !== 0).assertTrue();
1848        } catch (err) {
1849            console.info(TAG, 'testSetConfigurationParamEx002 catch err code: ', err);
1850            expect(err !== null).assertFalse();
1851        }
1852        toClosePipe("testSetConfigurationParamEx002");
1853    })
1854
1855    /**
1856     * @tc.number   : SUB_USB_HostManager_JS_ParamExCon_6300
1857     * @tc.name     : testSetConfigurationParam801Err002
1858     * @tc.desc     : Negative test: configs id add 100
1859     * @tc.size     : MediumTest
1860     * @tc.type     : Function
1861     * @tc.level    : Level 3
1862     */
1863    it('testSetConfigurationParam801Err002', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1864        console.info(TAG, 'usb testSetConfigurationParam801Err002 begin');
1865        if (!isDeviceConnected) {
1866            expect(isDeviceConnected).assertFalse();
1867            return
1868        }
1869        getPipe("testSetConfigurationParam801Err002");
1870        try {
1871            let tmpConfig = devices.configs[0];
1872            tmpConfig.id = tmpConfig.id + 100;
1873            let ret = usbManager.setConfiguration(gPipe, tmpConfig);
1874            console.info(TAG, 'usb [', tmpConfig.id, '] setConfiguration ret : ', ret);
1875            expect(ret !== 0).assertTrue();
1876        } catch (err) {
1877            console.info(TAG, 'testSetConfigurationParam801Err002 catch err code: ', err);
1878            expect(err.code).assertEqual(801);
1879        }
1880        toClosePipe("testSetConfigurationParam801Err0021");
1881    })
1882
1883    /**
1884     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_6500
1885     * @tc.name     : testSetConfigurationParamEx003
1886     * @tc.desc     : Negative test: configs name is ""
1887     * @tc.size     : MediumTest
1888     * @tc.type     : Function
1889     * @tc.level    : Level 3
1890     */
1891    it('testSetConfigurationParamEx003', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1892        console.info(TAG, 'usb testSetConfigurationParamEx003 begin');
1893        if (!isDeviceConnected) {
1894            expect(isDeviceConnected).assertFalse();
1895            return
1896        }
1897        getPipe("testSetConfigurationParamEx003");
1898        try {
1899            let tmpConfig = devices.configs[0];
1900            tmpConfig.name = PARAM_NULLSTRING;
1901            let ret = usbManager.setConfiguration(gPipe, tmpConfig);
1902            console.info(TAG, 'usb [', tmpConfig.name, '] setConfiguration ret : ', ret);
1903            expect(ret).assertEqual(0);
1904        } catch (err) {
1905            console.info(TAG, 'testSetConfigurationParamEx003 catch err code: ', err);
1906            expect(err !== null).assertFalse();
1907        }
1908        toClosePipe("testSetConfigurationParamEx003");
1909    })
1910
1911    /**
1912     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_6600
1913     * @tc.name     : testSetConfigurationParamEx004
1914     * @tc.desc     : Negative test: configs name add "123"
1915     * @tc.size     : MediumTest
1916     * @tc.type     : Function
1917     * @tc.level    : Level 3
1918     */
1919    it('testSetConfigurationParamEx004', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1920        console.info(TAG, 'usb testSetConfigurationParamEx004 begin');
1921        if (!isDeviceConnected) {
1922            expect(isDeviceConnected).assertFalse();
1923            return
1924        }
1925        getPipe("testSetConfigurationParamEx004");
1926        try {
1927            let tmpConfig = devices.configs[0];
1928            tmpConfig.name = tmpConfig.name + "123";
1929            let ret = usbManager.setConfiguration(gPipe, tmpConfig);
1930            console.info(TAG, 'usb [', tmpConfig.name, '] setConfiguration ret : ', ret);
1931            expect(ret).assertEqual(0);
1932        } catch (err) {
1933            console.info(TAG, 'testSetConfigurationParamEx004 catch err code: ', err);
1934            expect(err !== null).assertFalse();
1935        }
1936        toClosePipe("testSetConfigurationParamEx004");
1937    })
1938
1939    /**
1940     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_6700
1941     * @tc.name     : testSetConfigurationParamEx005
1942     * @tc.desc     : Negative test: configs name add "abc"
1943     * @tc.size     : MediumTest
1944     * @tc.type     : Function
1945     * @tc.level    : Level 3
1946     */
1947    it('testSetConfigurationParamEx005', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1948        console.info(TAG, 'usb testSetConfigurationParamEx005 begin');
1949        if (!isDeviceConnected) {
1950            expect(isDeviceConnected).assertFalse();
1951            return
1952        }
1953        getPipe("testSetConfigurationParamEx005");
1954        try {
1955            let tmpConfig = devices.configs[0];
1956            tmpConfig.name = tmpConfig.name + "abc";
1957            let ret = usbManager.setConfiguration(gPipe, tmpConfig);
1958            console.info(TAG, 'usb [', tmpConfig.name, '] setConfiguration ret : ', ret);
1959            expect(ret).assertEqual(0);
1960        } catch (err) {
1961            console.info(TAG, 'testSetConfigurationParamEx005 catch err code: ', err);
1962            expect(err !== null).assertFalse();
1963        }
1964        toClosePipe("testSetConfigurationParamEx005");
1965    })
1966
1967    /**
1968     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_6800
1969     * @tc.name     : testSetConfigurationParamEx006
1970     * @tc.desc     : Negative test: configs name add "@#"
1971     * @tc.size     : MediumTest
1972     * @tc.type     : Function
1973     * @tc.level    : Level 3
1974     */
1975    it('testSetConfigurationParamEx006', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
1976        console.info(TAG, 'usb testSetConfigurationParamEx006 begin');
1977        if (!isDeviceConnected) {
1978            expect(isDeviceConnected).assertFalse();
1979            return
1980        }
1981        getPipe("testSetConfigurationParamEx006");
1982        try {
1983            let tmpConfig = devices.configs[0];
1984            tmpConfig.name = tmpConfig.name + "@#";
1985            let ret = usbManager.setConfiguration(gPipe, tmpConfig);
1986            console.info(TAG, 'usb [', tmpConfig.name, '] setConfiguration ret : ', ret);
1987            expect(ret).assertEqual(0);
1988        } catch (err) {
1989            console.info(TAG, 'testSetConfigurationParamEx006 catch err code: ', err);
1990            expect(err !== null).assertFalse();
1991        }
1992        toClosePipe("testSetConfigurationParamEx006");
1993    })
1994
1995    /**
1996     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_6900
1997     * @tc.name     : testSetConfigurationParamEx007
1998     * @tc.desc     : Negative test: configs maxPower add 100
1999     * @tc.size     : MediumTest
2000     * @tc.type     : Function
2001     * @tc.level    : Level 3
2002     */
2003    it('testSetConfigurationParamEx007', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2004        console.info(TAG, 'usb testSetConfigurationParamEx007 begin');
2005        if (!isDeviceConnected) {
2006            expect(isDeviceConnected).assertFalse();
2007            return
2008        }
2009        getPipe("testSetConfigurationParamEx007");
2010        try {
2011            let tmpConfig = devices.configs[0];
2012            tmpConfig.maxPower = tmpConfig.maxPower + 100;
2013            let ret = usbManager.setConfiguration(gPipe, tmpConfig);
2014            console.info(TAG, 'usb [', tmpConfig.maxPower, '] setConfiguration ret : ', ret);
2015            expect(ret).assertEqual(0);
2016        } catch (err) {
2017            console.info(TAG, 'testSetConfigurationParamEx007 catch err code: ', err);
2018            expect(err !== null).assertFalse();
2019        }
2020        toClosePipe("testSetConfigurationParamEx007");
2021    })
2022
2023    /**
2024     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_7000
2025     * @tc.name     : testSetConfigurationParamEx008
2026     * @tc.desc     : Negative test: configs isRemoteWakeup is true
2027     * @tc.size     : MediumTest
2028     * @tc.type     : Function
2029     * @tc.level    : Level 3
2030     */
2031    it('testSetConfigurationParamEx008', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2032        console.info(TAG, 'usb testSetConfigurationParamEx008 begin');
2033        if (!isDeviceConnected) {
2034            expect(isDeviceConnected).assertFalse();
2035            return
2036        }
2037        getPipe("testSetConfigurationParamEx008");
2038        try {
2039            let tmpConfig = devices.configs[0];
2040            tmpConfig.isRemoteWakeup = true;
2041            let ret = usbManager.setConfiguration(gPipe, tmpConfig);
2042            console.info(TAG, 'usb [', tmpConfig.isRemoteWakeup, '] setConfiguration ret : ', ret);
2043            expect(ret).assertEqual(0);
2044        } catch (err) {
2045            console.info(TAG, 'testSetConfigurationParamEx008 catch err code: ', err);
2046            expect(err !== null).assertFalse();
2047        }
2048        toClosePipe("testSetConfigurationParamEx008");
2049    })
2050
2051    /**
2052     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_7100
2053     * @tc.name     : testSetConfigurationParamEx009
2054     * @tc.desc     : Negative test: configs isRemoteWakeup is false
2055     * @tc.size     : MediumTest
2056     * @tc.type     : Function
2057     * @tc.level    : Level 3
2058     */
2059    it('testSetConfigurationParamEx009', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2060        console.info(TAG, 'usb testSetConfigurationParamEx009 begin');
2061        if (!isDeviceConnected) {
2062            expect(isDeviceConnected).assertFalse();
2063            return
2064        }
2065        getPipe("testSetConfigurationParamEx009");
2066        try {
2067            let tmpConfig = devices.configs[0];
2068            tmpConfig.isRemoteWakeup = false;
2069            let ret = usbManager.setConfiguration(gPipe, tmpConfig);
2070            console.info(TAG, 'usb [', tmpConfig.isRemoteWakeup, '] setConfiguration ret : ', ret);
2071            expect(ret).assertEqual(0);
2072        } catch (err) {
2073            console.info(TAG, 'testSetConfigurationParamEx009 catch err code: ', err);
2074            expect(err !== null).assertFalse();
2075        }
2076        toClosePipe("testSetConfigurationParamEx009");
2077    })
2078
2079    /**
2080     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_7200
2081     * @tc.name     : testSetConfigurationParamEx010
2082     * @tc.desc     : Negative test: configs isSelfPowered is true
2083     * @tc.size     : MediumTest
2084     * @tc.type     : Function
2085     * @tc.level    : Level 3
2086     */
2087    it('testSetConfigurationParamEx010', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2088        console.info(TAG, 'usb testSetConfigurationParamEx010 begin');
2089        if (!isDeviceConnected) {
2090            expect(isDeviceConnected).assertFalse();
2091            return
2092        }
2093        getPipe("testSetConfigurationParamEx010");
2094        try {
2095            let tmpConfig = devices.configs[0];
2096            tmpConfig.isSelfPowered = true;
2097            let ret = usbManager.setConfiguration(gPipe, tmpConfig);
2098            console.info(TAG, 'usb [', tmpConfig.isSelfPowered, '] setConfiguration ret : ', ret);
2099            expect(ret).assertEqual(0);
2100        } catch (err) {
2101            console.info(TAG, 'testSetConfigurationParamEx010 catch err code: ', err);
2102            expect(err !== null).assertFalse();
2103        }
2104        toClosePipe("testSetConfigurationParamEx010");
2105    })
2106
2107    /**
2108     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_7300
2109     * @tc.name     : testSetConfigurationParamEx011
2110     * @tc.desc     : Negative test: configs isSelfPowered is false
2111     * @tc.size     : MediumTest
2112     * @tc.type     : Function
2113     * @tc.level    : Level 3
2114     */
2115    it('testSetConfigurationParamEx011', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2116        console.info(TAG, 'usb testSetConfigurationParamEx011 begin');
2117        if (!isDeviceConnected) {
2118            expect(isDeviceConnected).assertFalse();
2119            return
2120        }
2121        getPipe("testSetConfigurationParamEx011");
2122        try {
2123            let tmpConfig = devices.configs[0];
2124            tmpConfig.isSelfPowered = false;
2125            let ret = usbManager.setConfiguration(gPipe, tmpConfig);
2126            console.info(TAG, 'usb [', tmpConfig.isSelfPowered, '] setConfiguration ret : ', ret);
2127            expect(ret).assertEqual(0);
2128        } catch (err) {
2129            console.info(TAG, 'testSetConfigurationParamEx011 catch err code: ', err);
2130            expect(err !== null).assertFalse();
2131        }
2132        toClosePipe("testSetConfigurationParamEx011");
2133    })
2134
2135    /**
2136     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_7400
2137     * @tc.name     : testSetInterfaceParamEx001
2138     * @tc.desc     : Negative test: pipe busNum add 1000
2139     * @tc.size     : MediumTest
2140     * @tc.type     : Function
2141     * @tc.level    : Level 3
2142     */
2143    it('testSetInterfaceParamEx001', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2144        console.info(TAG, 'usb testSetInterfaceParamEx001 begin');
2145        if (!isDeviceConnected) {
2146            expect(isDeviceConnected).assertFalse();
2147            return
2148        }
2149        getPipe("testSetInterfaceParamEx001");
2150        let tmpInterface = devices.configs[0].interfaces[0];
2151        try {
2152            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2153            expect(isClaim).assertEqual(0);
2154            gPipe.busNum = gPipe.busNum + 1000;
2155            let ret = usbManager.setInterface(gPipe, tmpInterface);
2156            console.info(TAG, 'usb [', gPipe.busNum, '] setInterface ret : ', ret);
2157            expect(ret !== 0).assertTrue();
2158        } catch (err) {
2159            console.info(TAG, 'testSetInterfaceParamEx001 catch err code: ', err);
2160            expect(err !== null).assertFalse();
2161        }
2162        toReleaseInterface("testSetInterfaceParamEx001", tmpInterface);
2163        toClosePipe("testSetInterfaceParamEx001");
2164    })
2165
2166    /**
2167     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_7500
2168     * @tc.name     : testSetInterfaceParamEx002
2169     * @tc.desc     : Negative test: pipe devAddress add 10000
2170     * @tc.size     : MediumTest
2171     * @tc.type     : Function
2172     * @tc.level    : Level 3
2173     */
2174    it('testSetInterfaceParamEx002', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2175        console.info(TAG, 'usb testSetInterfaceParamEx002 begin');
2176        if (!isDeviceConnected) {
2177            expect(isDeviceConnected).assertFalse();
2178            return
2179        }
2180        getPipe("testSetInterfaceParamEx002");
2181        let tmpInterface = devices.configs[0].interfaces[0];
2182        try {
2183            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2184            expect(isClaim).assertEqual(0);
2185            gPipe.devAddress = gPipe.devAddress + 10000;
2186            let ret = usbManager.setInterface(gPipe, tmpInterface);
2187            console.info(TAG, 'usb [', gPipe.devAddress, '] setInterface ret : ', ret);
2188            expect(ret !== 0).assertTrue();
2189        } catch (err) {
2190            console.info(TAG, 'testSetInterfaceParamEx002 catch err code: ', err);
2191            expect(err !== null).assertFalse();
2192        }
2193        toReleaseInterface("testSetInterfaceParamEx002", tmpInterface);
2194        toClosePipe("testSetInterfaceParamEx002");
2195    })
2196
2197    /**
2198     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_7600
2199     * @tc.name     : testSetInterfaceParamEx003
2200     * @tc.desc     : Negative test: pipe busNum is -1
2201     * @tc.size     : MediumTest
2202     * @tc.type     : Function
2203     * @tc.level    : Level 3
2204     */
2205    it('testSetInterfaceParamEx003', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2206        console.info(TAG, 'usb testSetInterfaceParamEx003 begin');
2207        if (!isDeviceConnected) {
2208            expect(isDeviceConnected).assertFalse();
2209            return
2210        }
2211        getPipe("testSetInterfaceParamEx003");
2212        let tmpInterface = devices.configs[0].interfaces[0];
2213        try {
2214            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2215            expect(isClaim).assertEqual(0);
2216            gPipe.busNum = -1;
2217            let ret = usbManager.setInterface(gPipe, tmpInterface);
2218            console.info(TAG, 'usb [', gPipe.busNum, '] setInterface ret : ', ret);
2219            expect(ret !== 0).assertTrue();
2220        } catch (err) {
2221            console.info(TAG, 'testSetInterfaceParamEx003 catch err code: ', err);
2222            expect(err !== null).assertFalse();
2223        }
2224        toReleaseInterface("testSetInterfaceParamEx003", tmpInterface);
2225        toClosePipe("testSetInterfaceParamEx003");
2226    })
2227
2228    /**
2229     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_7700
2230     * @tc.name     : testSetInterfaceParamEx004
2231     * @tc.desc     : Negative test: pipe devAddress is -1
2232     * @tc.size     : MediumTest
2233     * @tc.type     : Function
2234     * @tc.level    : Level 3
2235     */
2236    it('testSetInterfaceParamEx004', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2237        console.info(TAG, 'usb testSetInterfaceParamEx004 begin');
2238        if (!isDeviceConnected) {
2239            expect(isDeviceConnected).assertFalse();
2240            return
2241        }
2242        getPipe("testSetInterfaceParamEx004");
2243        let tmpInterface = devices.configs[0].interfaces[0];
2244        try {
2245            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2246            expect(isClaim).assertEqual(0);
2247            gPipe.devAddress = -1;
2248            let ret = usbManager.setInterface(gPipe, tmpInterface);
2249            console.info(TAG, 'usb [', gPipe.devAddress, '] setInterface ret : ', ret);
2250            expect(ret !== 0).assertTrue();
2251        } catch (err) {
2252            console.info(TAG, 'testSetInterfaceParamEx004 catch err code: ', err);
2253            expect(err !== null).assertFalse();
2254        }
2255        toReleaseInterface("testSetInterfaceParamEx001", tmpInterface);
2256        toClosePipe("testSetInterfaceParamEx004");
2257    })
2258
2259    /**
2260     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_7800
2261     * @tc.name     : testSetInterfaceParamEx005
2262     * @tc.desc     : Negative test: pipe devAddress -1, busNum -1
2263     * @tc.size     : MediumTest
2264     * @tc.type     : Function
2265     * @tc.level    : Level 3
2266     */
2267    it('testSetInterfaceParamEx005', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2268        console.info(TAG, 'usb testSetInterfaceParamEx005 begin');
2269        if (!isDeviceConnected) {
2270            expect(isDeviceConnected).assertFalse();
2271            return
2272        }
2273        getPipe("testSetInterfaceParamEx005");
2274        let tmpInterface = devices.configs[0].interfaces[0];
2275        try {
2276            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2277            expect(isClaim).assertEqual(0);
2278            gPipe.busNum = -1;
2279            gPipe.devAddress = -1;
2280            let ret = usbManager.setInterface(gPipe, tmpInterface);
2281            console.info(TAG, 'usb [', gPipe.busNum,', ', gPipe.devAddress, '] setInterface ret : ', ret);
2282            expect(ret !== 0).assertTrue();
2283        } catch (err) {
2284            console.info(TAG, 'testSetInterfaceParamEx005 catch err code: ', err);
2285            expect(err !== null).assertFalse();
2286        }
2287        toReleaseInterface("testSetInterfaceParamEx005", tmpInterface);
2288        toClosePipe("testSetInterfaceParamEx005");
2289    })
2290
2291    /**
2292     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_7900
2293     * @tc.name     : testSetInterfaceParamEx006
2294     * @tc.desc     : Negative test: interface id +100
2295     * @tc.size     : MediumTest
2296     * @tc.type     : Function
2297     * @tc.level    : Level 3
2298     */
2299    it('testSetInterfaceParamEx006', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2300        console.info(TAG, 'usb testSetInterfaceParamEx006 begin');
2301        if (!isDeviceConnected) {
2302            expect(isDeviceConnected).assertFalse();
2303            return
2304        }
2305        getPipe("testSetInterfaceParamEx006");
2306        let tmpInterface = devices.configs[0].interfaces[0];
2307        try {
2308            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2309            expect(isClaim).assertEqual(0);
2310            tmpInterface.id = tmpInterface.id + 100;
2311            let ret = usbManager.setInterface(gPipe, tmpInterface);
2312            console.info(TAG, 'usb [', tmpInterface.id, '] setInterface ret : ', ret);
2313            expect(ret !== 0).assertTrue();
2314        } catch (err) {
2315            console.info(TAG, 'testSetInterfaceParamEx006 catch err code: ', err);
2316            expect(err !== null).assertFalse();
2317        }
2318        gDeviceList = usbManager.getDevices();
2319        tmpInterface = gDeviceList[0].configs[0].interfaces[0];
2320        toReleaseInterface("testSetInterfaceParamEx006", tmpInterface);
2321        toClosePipe("testSetInterfaceParamEx006");
2322    })
2323
2324    /**
2325     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_8000
2326     * @tc.name     : testSetInterfaceParamEx007
2327     * @tc.desc     : Negative test: interface id -1
2328     * @tc.size     : MediumTest
2329     * @tc.type     : Function
2330     * @tc.level    : Level 3
2331     */
2332    it('testSetInterfaceParamEx007', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2333        console.info(TAG, 'usb testSetInterfaceParamEx007 begin');
2334        if (!isDeviceConnected) {
2335            expect(isDeviceConnected).assertFalse();
2336            return
2337        }
2338        getPipe("testSetInterfaceParamEx007");
2339        let tmpInterface = devices.configs[0].interfaces[0];
2340        try {
2341            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2342            expect(isClaim).assertEqual(0);
2343            tmpInterface.id = -1;
2344            let ret = usbManager.setInterface(gPipe, tmpInterface);
2345            console.info(TAG, 'usb [', tmpInterface.id, '] setInterface ret : ', ret);
2346            expect(ret !== 0).assertTrue();
2347        } catch (err) {
2348            console.info(TAG, 'testSetInterfaceParamEx007 catch err code: ', err);
2349            expect(err !== null).assertFalse();
2350        }
2351        gDeviceList = usbManager.getDevices();
2352        tmpInterface = gDeviceList[0].configs[0].interfaces[0];
2353        toReleaseInterface("testSetInterfaceParamEx007", tmpInterface);
2354        toClosePipe("testSetInterfaceParamEx007");
2355    })
2356
2357    /**
2358     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_8100
2359     * @tc.name     : testSetInterfaceParamEx008
2360     * @tc.desc     : Negative test: interface protocol +100
2361     * @tc.size     : MediumTest
2362     * @tc.type     : Function
2363     * @tc.level    : Level 3
2364     */
2365    it('testSetInterfaceParamEx008', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2366        console.info(TAG, 'usb testSetInterfaceParamEx008 begin');
2367        if (!isDeviceConnected) {
2368            expect(isDeviceConnected).assertFalse();
2369            return
2370        }
2371        getPipe("testSetInterfaceParamEx008");
2372        let tmpInterface = devices.configs[0].interfaces[0];
2373        try {
2374            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2375            expect(isClaim).assertEqual(0);
2376            tmpInterface.protocol = tmpInterface.protocol + 100;
2377            let ret = usbManager.setInterface(gPipe, tmpInterface);
2378            console.info(TAG, 'usb [', tmpInterface.protocol, '] setInterface ret : ', ret);
2379            expect(ret).assertEqual(0);
2380        } catch (err) {
2381            console.info(TAG, 'testSetInterfaceParamEx008 catch err code: ', err);
2382            expect(err !== null).assertFalse();
2383        }
2384        gDeviceList = usbManager.getDevices();
2385        tmpInterface = gDeviceList[0].configs[0].interfaces[0];
2386        toReleaseInterface("testSetInterfaceParamEx008", tmpInterface);
2387        toClosePipe("testSetInterfaceParamEx008");
2388    })
2389
2390    /**
2391     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_8200
2392     * @tc.name     : testSetInterfaceParamEx009
2393     * @tc.desc     : Negative test: interface protocol +100
2394     * @tc.size     : MediumTest
2395     * @tc.type     : Function
2396     * @tc.level    : Level 3
2397     */
2398    it('testSetInterfaceParamEx009', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2399        console.info(TAG, 'usb testSetInterfaceParamEx009 begin');
2400        if (!isDeviceConnected) {
2401            expect(isDeviceConnected).assertFalse();
2402            return
2403        }
2404        getPipe("testSetInterfaceParamEx009");
2405        let tmpInterface = devices.configs[0].interfaces[0];
2406        try {
2407            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2408            expect(isClaim).assertEqual(0);
2409            tmpInterface.protocol = tmpInterface.protocol + 100;
2410            let ret = usbManager.setInterface(gPipe, tmpInterface);
2411            console.info(TAG, 'usb [', tmpInterface.protocol, '] setInterface ret : ', ret);
2412            expect(ret).assertEqual(0);
2413        } catch (err) {
2414            console.info(TAG, 'testSetInterfaceParamEx009 catch err code: ', err);
2415            expect(err !== null).assertFalse();
2416        }
2417        gDeviceList = usbManager.getDevices();
2418        tmpInterface = gDeviceList[0].configs[0].interfaces[0];
2419        toReleaseInterface("testSetInterfaceParamEx009", tmpInterface);
2420        toClosePipe("testSetInterfaceParamEx009");
2421    })
2422
2423    /**
2424     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_8300
2425     * @tc.name     : testSetInterfaceParamEx010
2426     * @tc.desc     : Negative test: interface clazz +100
2427     * @tc.size     : MediumTest
2428     * @tc.type     : Function
2429     * @tc.level    : Level 3
2430     */
2431    it('testSetInterfaceParamEx010', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2432        console.info(TAG, 'usb testSetInterfaceParamEx010 begin');
2433        if (!isDeviceConnected) {
2434            expect(isDeviceConnected).assertFalse();
2435            return
2436        }
2437        getPipe("testSetInterfaceParamEx010");
2438        let tmpInterface = devices.configs[0].interfaces[0];
2439        try {
2440            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2441            expect(isClaim).assertEqual(0);
2442            tmpInterface.clazz = tmpInterface.clazz + 100;
2443            let ret = usbManager.setInterface(gPipe, tmpInterface);
2444            console.info(TAG, 'usb [', tmpInterface.clazz, '] setInterface ret : ', ret);
2445            expect(ret).assertEqual(0);
2446        } catch (err) {
2447            console.info(TAG, 'testSetInterfaceParamEx010 catch err code: ', err);
2448            expect(err !== null).assertFalse();
2449        }
2450        gDeviceList = usbManager.getDevices();
2451        tmpInterface = gDeviceList[0].configs[0].interfaces[0];
2452        toReleaseInterface("testSetInterfaceParamEx010", tmpInterface);
2453        toClosePipe("testSetInterfaceParamEx010");
2454    })
2455
2456    /**
2457     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_8400
2458     * @tc.name     : testSetInterfaceParamEx011
2459     * @tc.desc     : Negative test: interface subClass +100
2460     * @tc.size     : MediumTest
2461     * @tc.type     : Function
2462     * @tc.level    : Level 3
2463     */
2464    it('testSetInterfaceParamEx011', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2465        console.info(TAG, 'usb testSetInterfaceParamEx011 begin');
2466        if (!isDeviceConnected) {
2467            expect(isDeviceConnected).assertFalse();
2468            return
2469        }
2470        getPipe("testSetInterfaceParamEx011");
2471        let tmpInterface = devices.configs[0].interfaces[0];
2472        try {
2473            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2474            expect(isClaim).assertEqual(0);
2475            tmpInterface.subClass = tmpInterface.subClass + 100;
2476            let ret = usbManager.setInterface(gPipe, tmpInterface);
2477            console.info(TAG, 'usb [', tmpInterface.subClass, '] setInterface ret : ', ret);
2478            expect(ret).assertEqual(0);
2479        } catch (err) {
2480            console.info(TAG, 'testSetInterfaceParamEx011 catch err code: ', err);
2481            expect(err !== null).assertFalse();
2482        }
2483        gDeviceList = usbManager.getDevices();
2484        tmpInterface = gDeviceList[0].configs[0].interfaces[0];
2485        toReleaseInterface("testSetInterfaceParamEx011", tmpInterface);
2486        toClosePipe("testSetInterfaceParamEx011");
2487    })
2488
2489    /**
2490     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_8500
2491     * @tc.name     : testSetInterfaceParamEx012
2492     * @tc.desc     : Negative test: interface alternateSetting +100
2493     * @tc.size     : MediumTest
2494     * @tc.type     : Function
2495     * @tc.level    : Level 3
2496     */
2497    it('testSetInterfaceParamEx012', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2498        console.info(TAG, 'usb testSetInterfaceParamEx012 begin');
2499        if (!isDeviceConnected) {
2500            expect(isDeviceConnected).assertFalse();
2501            return
2502        }
2503        getPipe("testSetInterfaceParamEx012");
2504        let tmpInterface = devices.configs[0].interfaces[0];
2505        try {
2506            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2507            expect(isClaim).assertEqual(0);
2508            tmpInterface.alternateSetting = tmpInterface.alternateSetting + 100;
2509            let ret = usbManager.setInterface(gPipe, tmpInterface);
2510            console.info(TAG, 'usb [', tmpInterface.alternateSetting, '] setInterface ret : ', ret);
2511            expect(ret !== 0).assertTrue();
2512        } catch (err) {
2513            console.info(TAG, 'testSetInterfaceParamEx012 catch err code: ', err);
2514            expect(err !== null).assertFalse();
2515        }
2516        gDeviceList = usbManager.getDevices();
2517        tmpInterface = gDeviceList[0].configs[0].interfaces[0];
2518        toReleaseInterface("testSetInterfaceParamEx012", tmpInterface);
2519        toClosePipe("testSetInterfaceParamEx012");
2520    })
2521
2522    /**
2523     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_8600
2524     * @tc.name     : testSetInterfaceParamEx013
2525     * @tc.desc     : Negative test: interface name ""
2526     * @tc.size     : MediumTest
2527     * @tc.type     : Function
2528     * @tc.level    : Level 3
2529     */
2530    it('testSetInterfaceParamEx013', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2531        console.info(TAG, 'usb testSetInterfaceParamEx013 begin');
2532        if (!isDeviceConnected) {
2533            expect(isDeviceConnected).assertFalse();
2534            return
2535        }
2536        getPipe("testSetInterfaceParamEx013");
2537        let tmpInterface = devices.configs[0].interfaces[0];
2538        try {
2539            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2540            expect(isClaim).assertEqual(0);
2541            tmpInterface.name = PARAM_NULLSTRING;
2542            let ret = usbManager.setInterface(gPipe, tmpInterface);
2543            console.info(TAG, 'usb [', tmpInterface.name, '] setInterface ret : ', ret);
2544            expect(ret).assertEqual(0);
2545        } catch (err) {
2546            console.info(TAG, 'testSetInterfaceParamEx013 catch err code: ', err);
2547            expect(err !== null).assertFalse();
2548        }
2549        gDeviceList = usbManager.getDevices();
2550        tmpInterface = gDeviceList[0].configs[0].interfaces[0];
2551        toReleaseInterface("testSetInterfaceParamEx013", tmpInterface);
2552        toClosePipe("testSetInterfaceParamEx013");
2553    })
2554
2555    /**
2556     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_8700
2557     * @tc.name     : testSetInterfaceParamEx014
2558     * @tc.desc     : Negative test: interface name +@#
2559     * @tc.size     : MediumTest
2560     * @tc.type     : Function
2561     * @tc.level    : Level 3
2562     */
2563    it('testSetInterfaceParamEx014', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2564        console.info(TAG, 'usb testSetInterfaceParamEx014 begin');
2565        if (!isDeviceConnected) {
2566            expect(isDeviceConnected).assertFalse();
2567            return
2568        }
2569        getPipe("testSetInterfaceParamEx014");
2570        let tmpInterface = devices.configs[0].interfaces[0];
2571        try {
2572            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2573            expect(isClaim).assertEqual(0);
2574            tmpInterface.name = tmpInterface.name + "@#";
2575            let ret = usbManager.setInterface(gPipe, tmpInterface);
2576            console.info(TAG, 'usb [', tmpInterface.name, '] setInterface ret : ', ret);
2577            expect(ret).assertEqual(0);
2578        } catch (err) {
2579            console.info(TAG, 'testSetInterfaceParamEx014 catch err code: ', err);
2580            expect(err !== null).assertFalse();
2581        }
2582        gDeviceList = usbManager.getDevices();
2583        tmpInterface = gDeviceList[0].configs[0].interfaces[0];
2584        toReleaseInterface("testSetInterfaceParamEx014", tmpInterface);
2585        toClosePipe("testSetInterfaceParamEx014");
2586    })
2587
2588    /**
2589     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_8800
2590     * @tc.name     : testSetInterfaceParamEx015
2591     * @tc.desc     : Negative test: interface name +123
2592     * @tc.size     : MediumTest
2593     * @tc.type     : Function
2594     * @tc.level    : Level 3
2595     */
2596    it('testSetInterfaceParamEx015', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2597        console.info(TAG, 'usb testSetInterfaceParamEx015 begin');
2598        if (!isDeviceConnected) {
2599            expect(isDeviceConnected).assertFalse();
2600            return
2601        }
2602        getPipe("testSetInterfaceParamEx015");
2603        let tmpInterface = devices.configs[0].interfaces[0];
2604        try {
2605            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2606            expect(isClaim).assertEqual(0);
2607            tmpInterface.name = tmpInterface.name + "123";
2608            let ret = usbManager.setInterface(gPipe, tmpInterface);
2609            console.info(TAG, 'usb [', tmpInterface.name, '] setInterface ret : ', ret);
2610            expect(ret).assertEqual(0);
2611        } catch (err) {
2612            console.info(TAG, 'testSetInterfaceParamEx015 catch err code: ', err);
2613            expect(err !== null).assertFalse();
2614        }
2615        gDeviceList = usbManager.getDevices();
2616        tmpInterface = gDeviceList[0].configs[0].interfaces[0];
2617        toReleaseInterface("testSetInterfaceParamEx015", tmpInterface);
2618        toClosePipe("testSetInterfaceParamEx015");
2619    })
2620
2621    /**
2622     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_8900
2623     * @tc.name     : testSetInterfaceParamEx016
2624     * @tc.desc     : Negative test: interface name +abc
2625     * @tc.size     : MediumTest
2626     * @tc.type     : Function
2627     * @tc.level    : Level 3
2628     */
2629    it('testSetInterfaceParamEx016', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2630        console.info(TAG, 'usb testSetInterfaceParamEx016 begin');
2631        if (!isDeviceConnected) {
2632            expect(isDeviceConnected).assertFalse();
2633            return
2634        }
2635        getPipe("testSetInterfaceParamEx016");
2636        let tmpInterface = devices.configs[0].interfaces[0];
2637        try {
2638            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2639            expect(isClaim).assertEqual(0);
2640            tmpInterface.name = tmpInterface.name + "123";
2641            let ret = usbManager.setInterface(gPipe, tmpInterface);
2642            console.info(TAG, 'usb [', tmpInterface.name, '] setInterface ret : ', ret);
2643            expect(ret).assertEqual(0);
2644        } catch (err) {
2645            console.info(TAG, 'testSetInterfaceParamEx016 catch err code: ', err);
2646            expect(err !== null).assertFalse();
2647        }
2648        gDeviceList = usbManager.getDevices();
2649        tmpInterface = gDeviceList[0].configs[0].interfaces[0];
2650        toReleaseInterface("testSetInterfaceParamEx016", tmpInterface);
2651        toClosePipe("testSetInterfaceParamEx016");
2652    })
2653
2654    /**
2655     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_9000
2656     * @tc.name     : testReleaseInterfaceParamEx001
2657     * @tc.desc     : Negative test: pipe busNum +1000
2658     * @tc.size     : MediumTest
2659     * @tc.type     : Function
2660     * @tc.level    : Level 3
2661     */
2662    it('testReleaseInterfaceParamEx001', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2663        console.info(TAG, 'usb testReleaseInterfaceParamEx001 begin');
2664        if (!isDeviceConnected) {
2665            expect(isDeviceConnected).assertFalse();
2666            return
2667        }
2668        getPipe("testReleaseInterfaceParamEx001");
2669        let tmpInterface = devices.configs[0].interfaces[0];
2670        try {
2671            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2672            expect(isClaim).assertEqual(0);
2673            gPipe.busNum = gPipe.busNum + 1000;
2674            let ret = usbManager.releaseInterface(gPipe, tmpInterface);
2675            console.info(TAG, 'usb [', gPipe.busNum, '] releaseInterface ret : ', ret);
2676            expect(ret !== 0).assertTrue();
2677        } catch (err) {
2678            console.info(TAG, 'testReleaseInterfaceParamEx001 catch err code: ', err);
2679            expect(err !== null).assertFalse();
2680        }
2681        toReleaseInterface("testReleaseInterfaceParamEx001", tmpInterface);
2682        toClosePipe("testReleaseInterfaceParamEx001");
2683    })
2684
2685    /**
2686     * @tc.number   : SUB_USB_HostManager_JS_ParamExRel_0100
2687     * @tc.name     : testReleaseInterfaceParam801Err001
2688     * @tc.desc     : Negative test: pipe busNum +1000
2689     * @tc.size     : MediumTest
2690     * @tc.type     : Function
2691     * @tc.level    : Level 3
2692     */
2693    it('testReleaseInterfaceParamEx801Err001', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2694        console.info(TAG, 'usb testReleaseInterfaceParamEx801Err001 begin');
2695        if (!isDeviceConnected) {
2696            expect(isDeviceConnected).assertFalse();
2697            return
2698        }
2699        getPipe("testReleaseInterfaceParamEx801Err001");
2700        let tmpInterface = devices.configs[0].interfaces[0];
2701        try {
2702            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2703            expect(isClaim).assertEqual(0);
2704            gPipe.busNum = gPipe.busNum + 1000;
2705            let ret = usbManager.releaseInterface(gPipe, tmpInterface);
2706            console.info(TAG, 'usb [', gPipe.busNum, '] releaseInterface ret : ', ret);
2707            expect(ret !== 0).assertTrue();
2708        } catch (err) {
2709            console.info(TAG, 'testReleaseInterfaceParamEx801Err001 catch err code: ', err);
2710            expect(err.code).assertEqual(801);
2711        }
2712        toReleaseInterface("testReleaseInterfaceParamEx801Err001", tmpInterface);
2713        toClosePipe("testReleaseInterfaceParamEx801Err001");
2714    })
2715
2716    /**
2717     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_9100
2718     * @tc.name     : testReleaseInterfaceParamEx002
2719     * @tc.desc     : Negative test: pipe devAddress +10000
2720     * @tc.size     : MediumTest
2721     * @tc.type     : Function
2722     * @tc.level    : Level 3
2723     */
2724    it('testReleaseInterfaceParamEx002', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2725        console.info(TAG, 'usb testReleaseInterfaceParamEx002 begin');
2726        if (!isDeviceConnected) {
2727            expect(isDeviceConnected).assertFalse();
2728            return
2729        }
2730        getPipe("testReleaseInterfaceParamEx002");
2731        let tmpInterface = devices.configs[0].interfaces[0];
2732        try {
2733            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2734            expect(isClaim).assertEqual(0);
2735            gPipe.devAddress = gPipe.devAddress + 10000;
2736            let ret = usbManager.releaseInterface(gPipe, tmpInterface);
2737            console.info(TAG, 'usb [', gPipe.devAddress, '] releaseInterface ret : ', ret);
2738            expect(ret !== 0).assertTrue();
2739        } catch (err) {
2740            console.info(TAG, 'testReleaseInterfaceParamEx002 catch err code: ', err);
2741            expect(err !== null).assertFalse();
2742        }
2743        toReleaseInterface("testReleaseInterfaceParamEx002", tmpInterface);
2744        toClosePipe("testReleaseInterfaceParamEx002");
2745    })
2746
2747    /**
2748     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_9200
2749     * @tc.name     : testReleaseInterfaceParamEx003
2750     * @tc.desc     : Negative test: pipe busNum -1
2751     * @tc.size     : MediumTest
2752     * @tc.type     : Function
2753     * @tc.level    : Level 3
2754     */
2755    it('testReleaseInterfaceParamEx003', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2756        console.info(TAG, 'usb testReleaseInterfaceParamEx003 begin');
2757        if (!isDeviceConnected) {
2758            expect(isDeviceConnected).assertFalse();
2759            return
2760        }
2761        getPipe("testReleaseInterfaceParamEx003");
2762        let tmpInterface = devices.configs[0].interfaces[0];
2763        try {
2764            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2765            expect(isClaim).assertEqual(0);
2766            gPipe.busNum = -1;
2767            let ret = usbManager.releaseInterface(gPipe, tmpInterface);
2768            console.info(TAG, 'usb [', gPipe.busNum, '] releaseInterface ret : ', ret);
2769            expect(ret !== 0).assertTrue();
2770        } catch (err) {
2771            console.info(TAG, 'testReleaseInterfaceParamEx003 catch err code: ', err);
2772            expect(err !== null).assertFalse();
2773        }
2774        toReleaseInterface("testReleaseInterfaceParamEx003", tmpInterface);
2775        toClosePipe("testReleaseInterfaceParamEx003");
2776    })
2777
2778    /**
2779     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_9300
2780     * @tc.name     : testReleaseInterfaceParamEx004
2781     * @tc.desc     : Negative test: pipe devAddress +10000
2782     * @tc.size     : MediumTest
2783     * @tc.type     : Function
2784     * @tc.level    : Level 3
2785     */
2786    it('testReleaseInterfaceParamEx004', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2787        console.info(TAG, 'usb testReleaseInterfaceParamEx004 begin');
2788        if (!isDeviceConnected) {
2789            expect(isDeviceConnected).assertFalse();
2790            return
2791        }
2792        getPipe("testReleaseInterfaceParamEx004");
2793        let tmpInterface = devices.configs[0].interfaces[0];
2794        try {
2795            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2796            expect(isClaim).assertEqual(0);
2797            gPipe.devAddress = -1;
2798            let ret = usbManager.releaseInterface(gPipe, tmpInterface);
2799            console.info(TAG, 'usb [', gPipe.devAddress, '] releaseInterface ret : ', ret);
2800            expect(ret !== 0).assertTrue();
2801        } catch (err) {
2802            console.info(TAG, 'testReleaseInterfaceParamEx004 catch err code: ', err);
2803            expect(err !== null).assertFalse();
2804        }
2805        toReleaseInterface("testReleaseInterfaceParamEx004", tmpInterface);
2806        toClosePipe("testReleaseInterfaceParamEx004");
2807    })
2808
2809    /**
2810     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_9400
2811     * @tc.name     : testReleaseInterfaceParamEx005
2812     * @tc.desc     : Negative test: interface id +100
2813     * @tc.size     : MediumTest
2814     * @tc.type     : Function
2815     * @tc.level    : Level 3
2816     */
2817    it('testReleaseInterfaceParamEx005', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2818        console.info(TAG, 'usb testReleaseInterfaceParamEx005 begin');
2819        if (!isDeviceConnected) {
2820            expect(isDeviceConnected).assertFalse();
2821            return
2822        }
2823        getPipe("testReleaseInterfaceParamEx005");
2824        let tmpInterface = devices.configs[0].interfaces[0];
2825        try {
2826            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2827            expect(isClaim).assertEqual(0);
2828            tmpInterface.id = tmpInterface.id + 100;
2829            let ret = usbManager.releaseInterface(gPipe, tmpInterface);
2830            console.info(TAG, 'usb [', tmpInterface.id, '] releaseInterface ret : ', ret);
2831            expect(ret !== 0).assertTrue();
2832        } catch (err) {
2833            console.info(TAG, 'testReleaseInterfaceParamEx005 catch err code: ', err);
2834            expect(err !== null).assertFalse();
2835        }
2836        gDeviceList = usbManager.getDevices();
2837        tmpInterface = gDeviceList[0].configs[0].interfaces[0];
2838        toReleaseInterface("testReleaseInterfaceParamEx005", tmpInterface);
2839        toClosePipe("testReleaseInterfaceParamEx005");
2840    })
2841
2842    /**
2843     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_9500
2844     * @tc.name     : testReleaseInterfaceParamEx006
2845     * @tc.desc     : Negative test: interface id -1
2846     * @tc.size     : MediumTest
2847     * @tc.type     : Function
2848     * @tc.level    : Level 3
2849     */
2850    it('testReleaseInterfaceParamEx006', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2851        console.info(TAG, 'usb testReleaseInterfaceParamEx006 begin');
2852        if (!isDeviceConnected) {
2853            expect(isDeviceConnected).assertFalse();
2854            return
2855        }
2856        getPipe("testReleaseInterfaceParamEx006");
2857        let tmpInterface = devices.configs[0].interfaces[0];
2858        try {
2859            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2860            expect(isClaim).assertEqual(0);
2861            tmpInterface.id = -1;
2862            let ret = usbManager.releaseInterface(gPipe, tmpInterface);
2863            console.info(TAG, 'usb [', tmpInterface.id, '] releaseInterface ret : ', ret);
2864            expect(ret !== 0).assertTrue();
2865        } catch (err) {
2866            console.info(TAG, 'testReleaseInterfaceParamEx006 catch err code: ', err);
2867            expect(err !== null).assertFalse();
2868        }
2869        gDeviceList = usbManager.getDevices();
2870        tmpInterface = gDeviceList[0].configs[0].interfaces[0];
2871        toReleaseInterface("testReleaseInterfaceParamEx006", tmpInterface);
2872        toClosePipe("testReleaseInterfaceParamEx006");
2873    })
2874
2875    /**
2876     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_9600
2877     * @tc.name     : testReleaseInterfaceParamEx007
2878     * @tc.desc     : Negative test: interface name ""
2879     * @tc.size     : MediumTest
2880     * @tc.type     : Function
2881     * @tc.level    : Level 3
2882     */
2883    it('testReleaseInterfaceParamEx007', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2884        console.info(TAG, 'usb testReleaseInterfaceParamEx007 begin');
2885        if (!isDeviceConnected) {
2886            expect(isDeviceConnected).assertFalse();
2887            return
2888        }
2889        getPipe("testReleaseInterfaceParamEx007");
2890        let tmpInterface = devices.configs[0].interfaces[0];
2891        try {
2892            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2893            expect(isClaim).assertEqual(0);
2894            tmpInterface.name = PARAM_NULLSTRING;
2895            let ret = usbManager.releaseInterface(gPipe, tmpInterface);
2896            console.info(TAG, 'usb [', tmpInterface.name, '] releaseInterface ret : ', ret);
2897            expect(ret).assertEqual(0);
2898        } catch (err) {
2899            console.info(TAG, 'testReleaseInterfaceParamEx007 catch err code: ', err);
2900            expect(err !== null).assertFalse();
2901        }
2902        toClosePipe("testReleaseInterfaceParamEx007");
2903    })
2904
2905    /**
2906     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_9700
2907     * @tc.name     : testReleaseInterfaceParamEx008
2908     * @tc.desc     : Negative test: interface name +123
2909     * @tc.size     : MediumTest
2910     * @tc.type     : Function
2911     * @tc.level    : Level 3
2912     */
2913    it('testReleaseInterfaceParamEx008', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2914        console.info(TAG, 'usb testReleaseInterfaceParamEx008 begin');
2915        if (!isDeviceConnected) {
2916            expect(isDeviceConnected).assertFalse();
2917            return
2918        }
2919        getPipe("testReleaseInterfaceParamEx008");
2920        let tmpInterface = devices.configs[0].interfaces[0];
2921        try {
2922            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2923            expect(isClaim).assertEqual(0);
2924            tmpInterface.name = tmpInterface.name + "123";
2925            let ret = usbManager.releaseInterface(gPipe, tmpInterface);
2926            console.info(TAG, 'usb [', tmpInterface.name, '] releaseInterface ret : ', ret);
2927            expect(ret).assertEqual(0);
2928        } catch (err) {
2929            console.info(TAG, 'testReleaseInterfaceParamEx008 catch err code: ', err);
2930            expect(err !== null).assertFalse();
2931        }
2932        toClosePipe("testReleaseInterfaceParamEx008");
2933    })
2934
2935    /**
2936     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_9800
2937     * @tc.name     : testReleaseInterfaceParamEx009
2938     * @tc.desc     : Negative test: interface name +abc
2939     * @tc.size     : MediumTest
2940     * @tc.type     : Function
2941     * @tc.level    : Level 3
2942     */
2943    it('testReleaseInterfaceParamEx009', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2944        console.info(TAG, 'usb testReleaseInterfaceParamEx009 begin');
2945        if (!isDeviceConnected) {
2946            expect(isDeviceConnected).assertFalse();
2947            return
2948        }
2949        getPipe("testReleaseInterfaceParamEx009");
2950        let tmpInterface = devices.configs[0].interfaces[0];
2951        try {
2952            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2953            expect(isClaim).assertEqual(0);
2954            tmpInterface.name = tmpInterface.name + "abc";
2955            let ret = usbManager.releaseInterface(gPipe, tmpInterface);
2956            console.info(TAG, 'usb [', tmpInterface.name, '] releaseInterface ret : ', ret);
2957            expect(ret).assertEqual(0);
2958        } catch (err) {
2959            console.info(TAG, 'testReleaseInterfaceParamEx009 catch err code: ', err);
2960            expect(err !== null).assertFalse();
2961        }
2962        toClosePipe("testReleaseInterfaceParamEx009");
2963    })
2964
2965    /**
2966     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_9900
2967     * @tc.name     : testReleaseInterfaceParamEx010
2968     * @tc.desc     : Negative test: interface name +@#
2969     * @tc.size     : MediumTest
2970     * @tc.type     : Function
2971     * @tc.level    : Level 3
2972     */
2973    it('testReleaseInterfaceParamEx010', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
2974        console.info(TAG, 'usb testReleaseInterfaceParamEx010 begin');
2975        if (!isDeviceConnected) {
2976            expect(isDeviceConnected).assertFalse();
2977            return
2978        }
2979        getPipe("testReleaseInterfaceParamEx010");
2980        let tmpInterface = devices.configs[0].interfaces[0];
2981        try {
2982            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
2983            expect(isClaim).assertEqual(0);
2984            tmpInterface.name = tmpInterface.name + "@#";
2985            let ret = usbManager.releaseInterface(gPipe, tmpInterface);
2986            console.info(TAG, 'usb [', tmpInterface.name, '] releaseInterface ret : ', ret);
2987            expect(ret).assertEqual(0);
2988        } catch (err) {
2989            console.info(TAG, 'testReleaseInterfaceParamEx010 catch err code: ', err);
2990            expect(err !== null).assertFalse();
2991        }
2992        toClosePipe("testReleaseInterfaceParamEx010");
2993    })
2994
2995    /**
2996     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_0110
2997     * @tc.name     : testReleaseInterfaceParamEx011
2998     * @tc.desc     : Negative test: interface clazz +100
2999     * @tc.size     : MediumTest
3000     * @tc.type     : Function
3001     * @tc.level    : Level 3
3002     */
3003    it('testReleaseInterfaceParamEx011', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
3004        console.info(TAG, 'usb testReleaseInterfaceParamEx011 begin');
3005        if (!isDeviceConnected) {
3006            expect(isDeviceConnected).assertFalse();
3007            return
3008        }
3009        getPipe("testReleaseInterfaceParamEx011");
3010        let tmpInterface = devices.configs[0].interfaces[0];
3011        try {
3012            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
3013            expect(isClaim).assertEqual(0);
3014            tmpInterface.clazz = tmpInterface.clazz + 100;
3015            let ret = usbManager.releaseInterface(gPipe, tmpInterface);
3016            console.info(TAG, 'usb [', tmpInterface.clazz, '] releaseInterface ret : ', ret);
3017            expect(ret).assertEqual(0);
3018        } catch (err) {
3019            console.info(TAG, 'testReleaseInterfaceParamEx011 catch err code: ', err);
3020            expect(err !== null).assertFalse();
3021        }
3022        toClosePipe("testReleaseInterfaceParamEx011");
3023    })
3024
3025    /**
3026     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_0120
3027     * @tc.name     : testReleaseInterfaceParamEx012
3028     * @tc.desc     : Negative test: interface protocol +100
3029     * @tc.size     : MediumTest
3030     * @tc.type     : Function
3031     * @tc.level    : Level 3
3032     */
3033    it('testReleaseInterfaceParamEx012', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
3034        console.info(TAG, 'usb testReleaseInterfaceParamEx012 begin');
3035        if (!isDeviceConnected) {
3036            expect(isDeviceConnected).assertFalse();
3037            return
3038        }
3039        getPipe("testReleaseInterfaceParamEx012");
3040        let tmpInterface = devices.configs[0].interfaces[0];
3041        try {
3042            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
3043            expect(isClaim).assertEqual(0);
3044            tmpInterface.protocol = tmpInterface.protocol + 100;
3045            let ret = usbManager.releaseInterface(gPipe, tmpInterface);
3046            console.info(TAG, 'usb [', tmpInterface.protocol, '] releaseInterface ret : ', ret);
3047            expect(ret).assertEqual(0);
3048        } catch (err) {
3049            console.info(TAG, 'testReleaseInterfaceParamEx012 catch err code: ', err);
3050            expect(err !== null).assertFalse();
3051        }
3052        toClosePipe("testReleaseInterfaceParamEx012");
3053    })
3054
3055    /**
3056     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_0130
3057     * @tc.name     : testReleaseInterfaceParamEx013
3058     * @tc.desc     : Negative test: interface subClass +100
3059     * @tc.size     : MediumTest
3060     * @tc.type     : Function
3061     * @tc.level    : Level 3
3062     */
3063    it('testReleaseInterfaceParamEx013', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
3064        console.info(TAG, 'usb testReleaseInterfaceParamEx013 begin');
3065        if (!isDeviceConnected) {
3066            expect(isDeviceConnected).assertFalse();
3067            return
3068        }
3069        getPipe("testReleaseInterfaceParamEx013");
3070        let tmpInterface = devices.configs[0].interfaces[0];
3071        try {
3072            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
3073            expect(isClaim).assertEqual(0);
3074            tmpInterface.subClass = tmpInterface.subClass + 100;
3075            let ret = usbManager.releaseInterface(gPipe, tmpInterface);
3076            console.info(TAG, 'usb [', tmpInterface.subClass, '] releaseInterface ret : ', ret);
3077            expect(ret).assertEqual(0);
3078        } catch (err) {
3079            console.info(TAG, 'testReleaseInterfaceParamEx013 catch err code: ', err);
3080            expect(err !== null).assertFalse();
3081        }
3082        toClosePipe("testReleaseInterfaceParamEx013");
3083    })
3084
3085    /**
3086     * @tc.number   : SUB_USB_HostManager_JS_ParamEx_0140
3087     * @tc.name     : testReleaseInterfaceParamEx014
3088     * @tc.desc     : Negative test: interface alternateSetting +100
3089     * @tc.size     : MediumTest
3090     * @tc.type     : Function
3091     * @tc.level    : Level 3
3092     */
3093    it('testReleaseInterfaceParamEx014', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function () {
3094        console.info(TAG, 'usb testReleaseInterfaceParamEx014 begin');
3095        if (!isDeviceConnected) {
3096            expect(isDeviceConnected).assertFalse();
3097            return
3098        }
3099        getPipe("testReleaseInterfaceParamEx014");
3100        let tmpInterface = devices.configs[0].interfaces[0];
3101        try {
3102            let isClaim = usbManager.claimInterface(gPipe, tmpInterface, true);
3103            expect(isClaim).assertEqual(0);
3104            tmpInterface.alternateSetting = tmpInterface.alternateSetting + 100;
3105            let ret = usbManager.releaseInterface(gPipe, tmpInterface);
3106            console.info(TAG, 'usb [', tmpInterface.alternateSetting, '] releaseInterface ret : ', ret);
3107            expect(ret).assertEqual(0);
3108        } catch (err) {
3109            console.info(TAG, 'testReleaseInterfaceParamEx014 catch err code: ', err);
3110            expect(err !== null).assertFalse();
3111        }
3112        toClosePipe("testReleaseInterfaceParamEx014");
3113    })
3114
3115})
3116}
3117