1#/usr/bin/env python3.4
2#
3# Copyright (C) 2016 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License"); you may not
6# use this file except in compliance with the License. You may obtain a copy of
7# the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations under
15# the License.
16"""
17Test script to execute Bluetooth basic functionality test cases.
18This test was designed to be run in a shield box.
19"""
20
21import threading
22import time
23
24from queue import Empty
25from acts.test_decorators import test_tracker_info
26from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest
27from acts.test_utils.bt.bt_constants import bt_rfcomm_uuids
28from acts.test_utils.bt.bt_test_utils import clear_bonded_devices
29from acts.test_utils.bt.bt_test_utils import kill_bluetooth_process
30from acts.test_utils.bt.bt_test_utils import orchestrate_rfcomm_connection
31from acts.test_utils.bt.bt_test_utils import reset_bluetooth
32from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test
33from acts.test_utils.bt.bt_test_utils import take_btsnoop_logs
34from acts.test_utils.bt.bt_test_utils import write_read_verify_data
35from acts.test_utils.bt.bt_test_utils import verify_server_and_client_connected
36
37from acts.test_utils.bt.BtEnum import RfcommUuid
38
39
40class RfcommTest(BluetoothBaseTest):
41    default_timeout = 10
42    rf_client_th = 0
43    scan_discovery_time = 5
44    message = (
45        "Space: the final frontier. These are the voyages of "
46        "the starship Enterprise. Its continuing mission: to explore "
47        "strange new worlds, to seek out new life and new civilizations,"
48        " to boldly go where no man has gone before.")
49
50    def __init__(self, controllers):
51        BluetoothBaseTest.__init__(self, controllers)
52        self.client_ad = self.android_devices[0]
53        self.server_ad = self.android_devices[1]
54
55    def setup_class(self):
56        return setup_multiple_devices_for_bt_test(self.android_devices)
57
58    def teardown_test(self):
59        self.client_ad.droid.bluetoothRfcommCloseClientSocket()
60        self.server_ad.droid.bluetoothRfcommCloseServerSocket()
61        return True
62
63    def teardown_test(self):
64        if verify_server_and_client_connected(
65                self.client_ad, self.server_ad, log=False):
66            self.client_ad.droid.bluetoothRfcommStop()
67            self.server_ad.droid.bluetoothRfcommStop()
68
69    def _test_rfcomm_connection_with_uuid(self, uuid):
70        if not orchestrate_rfcomm_connection(
71                self.client_ad, self.server_ad, uuid=uuid):
72            return False
73
74        self.client_ad.droid.bluetoothRfcommStop()
75        self.server_ad.droid.bluetoothRfcommStop()
76        return True
77
78    @BluetoothBaseTest.bt_test_wrap
79    @test_tracker_info(uuid='f0bd466f-9a59-4612-8b75-ae4f691eef77')
80    def test_rfcomm_connection(self):
81        """Test Bluetooth RFCOMM connection
82
83        Test RFCOMM though establishing a basic connection.
84
85        Steps:
86        1. Get the mac address of the server device.
87        2. Establish an RFCOMM connection from the client to the server AD.
88        3. Verify that the RFCOMM connection is active from both the client and
89        server.
90
91        Expected Result:
92        RFCOMM connection is established then disconnected succcessfully.
93
94        Returns:
95          Pass if True
96          Fail if False
97
98        TAGS: Classic, RFCOMM
99        Priority: 1
100        """
101        return self._test_rfcomm_connection_with_uuid(None)
102
103    @BluetoothBaseTest.bt_test_wrap
104    @test_tracker_info(uuid='240e106a-efd0-4795-8baa-9c0ea88b8b25')
105    def test_rfcomm_connection_write_ascii(self):
106        """Test Bluetooth RFCOMM writing and reading ascii data
107
108        Test RFCOMM though establishing a connection.
109
110        Steps:
111        1. Get the mac address of the server device.
112        2. Establish an RFCOMM connection from the client to the server AD.
113        3. Verify that the RFCOMM connection is active from both the client and
114        server.
115        4. Write data from the client and read received data from the server.
116        5. Verify data matches from client and server
117        6. Disconnect the RFCOMM connection.
118
119        Expected Result:
120        RFCOMM connection is established then disconnected succcessfully.
121
122        Returns:
123          Pass if True
124          Fail if False
125
126        TAGS: Classic, RFCOMM
127        Priority: 1
128        """
129        if not orchestrate_rfcomm_connection(self.client_ad, self.server_ad):
130            return False
131        if not write_read_verify_data(self.client_ad, self.server_ad,
132                                      self.message, False):
133            return False
134        if not verify_server_and_client_connected(self.client_ad,
135                                                  self.server_ad):
136            return False
137
138        self.client_ad.droid.bluetoothRfcommStop()
139        self.server_ad.droid.bluetoothRfcommStop()
140        return True
141
142    @BluetoothBaseTest.bt_test_wrap
143    @test_tracker_info(uuid='c6ebf4aa-1ccb-415f-98c2-cbffb067d1ea')
144    def test_rfcomm_write_binary(self):
145        """Test Bluetooth RFCOMM writing and reading binary data
146
147        Test profile though establishing an RFCOMM connection.
148
149        Steps:
150        1. Get the mac address of the server device.
151        2. Establish an RFCOMM connection from the client to the server AD.
152        3. Verify that the RFCOMM connection is active from both the client and
153        server.
154        4. Write data from the client and read received data from the server.
155        5. Verify data matches from client and server
156        6. Disconnect the RFCOMM connection.
157
158        Expected Result:
159        RFCOMM connection is established then disconnected succcessfully.
160
161        Returns:
162          Pass if True
163          Fail if False
164
165        TAGS: Classic, RFCOMM
166        Priority: 1
167        """
168        if not orchestrate_rfcomm_connection(self.client_ad, self.server_ad):
169            return False
170        binary_message = "11010101"
171        if not write_read_verify_data(self.client_ad, self.server_ad,
172                                      binary_message, True):
173            return False
174
175        if not verify_server_and_client_connected(self.client_ad,
176                                                  self.server_ad):
177            return False
178
179        self.client_ad.droid.bluetoothRfcommStop()
180        self.server_ad.droid.bluetoothRfcommStop()
181        return True
182
183    @BluetoothBaseTest.bt_test_wrap
184    @test_tracker_info(uuid='2b36d71e-102b-469e-b064-e0da8cefdbfe')
185    def test_rfcomm_accept_timeout(self):
186        """Test Bluetooth RFCOMM accept socket timeout
187
188        Verify that RFCOMM connections are unsuccessful if
189        the socket timeout is exceeded.
190
191        Steps:
192        1. Get the mac address of the server device.
193        2. Establish an RFCOMM connection from the client to the server AD.
194        3. Verify that the RFCOMM connection is active from both the client and
195        server.
196
197        Expected Result:
198        RFCOMM connection is established then disconnected succcessfully.
199
200        Returns:
201          Pass if True
202          Fail if False
203
204        TAGS: Classic, RFCOMM
205        Priority: 1
206        """
207        # Socket timeout set to 999ms
208        short_socket_timeout = 999
209        # Wait time in seconds before attempting a connection
210        wait_time_before_connect_attempt = 1
211        self.server_ad.droid.bluetoothStartPairingHelper()
212        self.client_ad.droid.bluetoothStartPairingHelper()
213        self.server_ad.droid.bluetoothRfcommBeginAcceptThread(
214            bt_rfcomm_uuids['default_uuid'], short_socket_timeout)
215        time.sleep(wait_time_before_connect_attempt)
216
217        # Try to connect
218        self.client_ad.droid.bluetoothRfcommBeginConnectThread(
219            self.server_ad.droid.bluetoothGetLocalAddress())
220        # Give the connection time to fail
221        #time.sleep(self.default_timeout)
222        time.sleep(2)
223        if verify_server_and_client_connected(self.client_ad, self.server_ad):
224            return False
225        self.log.info("No active connections found as expected")
226        # AcceptThread has finished, kill hanging ConnectThread
227        self.client_ad.droid.bluetoothRfcommKillConnThread()
228        reset_bluetooth(self.android_devices)
229        return True
230
231    @BluetoothBaseTest.bt_test_wrap
232    @test_tracker_info(uuid='88c70db6-651e-4d43-ab0c-c9f584094fb2')
233    def test_rfcomm_connection_base_uuid(self):
234        """Test Bluetooth RFCOMM connection using BASE uuid
235
236        Test RFCOMM though establishing a basic connection.
237
238        Steps:
239        1. Get the mac address of the server device.
240        2. Establish an RFCOMM connection from the client to the server AD.
241        3. Verify that the RFCOMM connection is active from both the client and
242        server.
243
244        Expected Result:
245        RFCOMM connection is established then disconnected succcessfully.
246
247        Returns:
248          Pass if True
249          Fail if False
250
251        TAGS: Classic, RFCOMM
252        Priority: 3
253        """
254        return self._test_rfcomm_connection_with_uuid(
255            bt_rfcomm_uuids['base_uuid'])
256
257    @BluetoothBaseTest.bt_test_wrap
258    @test_tracker_info(uuid='42c8d861-48b3-423b-ae8c-df140ebaad9d')
259    def test_rfcomm_connection_sdp_uuid(self):
260        """Test Bluetooth RFCOMM connection using SDP uuid
261
262        Test RFCOMM though establishing a basic connection.
263
264        Steps:
265        1. Get the mac address of the server device.
266        2. Establish an RFCOMM connection from the client to the server AD.
267        3. Verify that the RFCOMM connection is active from both the client and
268        server.
269
270        Expected Result:
271        RFCOMM connection is established then disconnected succcessfully.
272
273        Returns:
274          Pass if True
275          Fail if False
276
277        TAGS: Classic, RFCOMM
278        Priority: 3
279        """
280        return self._test_rfcomm_connection_with_uuid(bt_rfcomm_uuids['sdp'])
281
282    @BluetoothBaseTest.bt_test_wrap
283    @test_tracker_info(uuid='97cc310d-4096-481e-940f-abe6811784f3')
284    def test_rfcomm_connection_udp_uuid(self):
285        """Test Bluetooth RFCOMM connection using UDP uuid
286
287        Test RFCOMM though establishing a basic connection.
288
289        Steps:
290        1. Get the mac address of the server device.
291        2. Establish an RFCOMM connection from the client to the server AD.
292        3. Verify that the RFCOMM connection is active from both the client and
293        server.
294
295        Expected Result:
296        RFCOMM connection is established then disconnected succcessfully.
297
298        Returns:
299          Pass if True
300          Fail if False
301
302        TAGS: Classic, RFCOMM
303        Priority: 3
304        """
305        return self._test_rfcomm_connection_with_uuid(bt_rfcomm_uuids['udp'])
306
307    @BluetoothBaseTest.bt_test_wrap
308    @test_tracker_info(uuid='5998a0cf-fc05-433a-abd8-c52717ea755c')
309    def test_rfcomm_connection_rfcomm_uuid(self):
310        """Test Bluetooth RFCOMM connection using RFCOMM uuid
311
312        Test RFCOMM though establishing a basic connection.
313
314        Steps:
315        1. Get the mac address of the server device.
316        2. Establish an RFCOMM connection from the client to the server AD.
317        3. Verify that the RFCOMM connection is active from both the client and
318        server.
319
320        Expected Result:
321        RFCOMM connection is established then disconnected succcessfully.
322
323        Returns:
324          Pass if True
325          Fail if False
326
327        TAGS: Classic, RFCOMM
328        Priority: 3
329        """
330        return self._test_rfcomm_connection_with_uuid(
331            bt_rfcomm_uuids['rfcomm'])
332
333    @BluetoothBaseTest.bt_test_wrap
334    @test_tracker_info(uuid='e3c05357-99ec-4819-86e4-1363e3359317')
335    def test_rfcomm_connection_tcp_uuid(self):
336        """Test Bluetooth RFCOMM connection using TCP uuid
337
338        Test RFCOMM though establishing a basic connection.
339
340        Steps:
341        1. Get the mac address of the server device.
342        2. Establish an RFCOMM connection from the client to the server AD.
343        3. Verify that the RFCOMM connection is active from both the client and
344        server.
345
346        Expected Result:
347        RFCOMM connection is established then disconnected succcessfully.
348
349        Returns:
350          Pass if True
351          Fail if False
352
353        TAGS: Classic, RFCOMM
354        Priority: 3
355        """
356        return self._test_rfcomm_connection_with_uuid(bt_rfcomm_uuids['tcp'])
357
358    @BluetoothBaseTest.bt_test_wrap
359    @test_tracker_info(uuid='7304f8dc-f568-4489-9926-0b940ba7a45b')
360    def test_rfcomm_connection_tcs_bin_uuid(self):
361        """Test Bluetooth RFCOMM connection using TCS_BIN uuid
362
363        Test RFCOMM though establishing a basic connection.
364
365        Steps:
366        1. Get the mac address of the server device.
367        2. Establish an RFCOMM connection from the client to the server AD.
368        3. Verify that the RFCOMM connection is active from both the client and
369        server.
370
371        Expected Result:
372        RFCOMM connection is established then disconnected succcessfully.
373
374        Returns:
375          Pass if True
376          Fail if False
377
378        TAGS: Classic, RFCOMM
379        Priority: 3
380        """
381        return self._test_rfcomm_connection_with_uuid(
382            bt_rfcomm_uuids['tcs_bin'])
383
384    @BluetoothBaseTest.bt_test_wrap
385    @test_tracker_info(uuid='ea1cfc32-d3f0-4420-a8e5-793c6ddf5820')
386    def test_rfcomm_connection_tcs_at_uuid(self):
387        """Test Bluetooth RFCOMM connection using TCS_AT uuid
388
389        Test RFCOMM though establishing a basic connection.
390
391        Steps:
392        1. Get the mac address of the server device.
393        2. Establish an RFCOMM connection from the client to the server AD.
394        3. Verify that the RFCOMM connection is active from both the client and
395        server.
396
397        Expected Result:
398        RFCOMM connection is established then disconnected succcessfully.
399
400        Returns:
401          Pass if True
402          Fail if False
403
404        TAGS: Classic, RFCOMM
405        Priority: 3
406        """
407        return self._test_rfcomm_connection_with_uuid(
408            bt_rfcomm_uuids['tcs_at'])
409
410    @BluetoothBaseTest.bt_test_wrap
411    @test_tracker_info(uuid='5b0d5608-38a5-48f7-b3e5-dc52a4a681dd')
412    def test_rfcomm_connection_att_uuid(self):
413        """Test Bluetooth RFCOMM connection using ATT uuid
414
415        Test RFCOMM though establishing a basic connection.
416
417        Steps:
418        1. Get the mac address of the server device.
419        2. Establish an RFCOMM connection from the client to the server AD.
420        3. Verify that the RFCOMM connection is active from both the client and
421        server.
422
423        Expected Result:
424        RFCOMM connection is established then disconnected succcessfully.
425
426        Returns:
427          Pass if True
428          Fail if False
429
430        TAGS: Classic, RFCOMM
431        Priority: 3
432        """
433        return self._test_rfcomm_connection_with_uuid(bt_rfcomm_uuids['att'])
434
435    @BluetoothBaseTest.bt_test_wrap
436    @test_tracker_info(uuid='e81f37ba-e914-4eb1-b144-b079f91c6734')
437    def test_rfcomm_connection_obex_uuid(self):
438        """Test Bluetooth RFCOMM connection using OBEX uuid
439
440        Test RFCOMM though establishing a basic connection.
441
442        Steps:
443        1. Get the mac address of the server device.
444        2. Establish an RFCOMM connection from the client to the server AD.
445        3. Verify that the RFCOMM connection is active from both the client and
446        server.
447
448        Expected Result:
449        RFCOMM connection is established then disconnected succcessfully.
450
451        Returns:
452          Pass if True
453          Fail if False
454
455        TAGS: Classic, RFCOMM
456        Priority: 3
457        """
458        return self._test_rfcomm_connection_with_uuid(bt_rfcomm_uuids['obex'])
459
460    @BluetoothBaseTest.bt_test_wrap
461    @test_tracker_info(uuid='5edd766f-17fb-459c-985e-9c21afe1b104')
462    def test_rfcomm_connection_ip_uuid(self):
463        """Test Bluetooth RFCOMM connection using IP uuid
464
465        Test RFCOMM though establishing a basic connection.
466
467        Steps:
468        1. Get the mac address of the server device.
469        2. Establish an RFCOMM connection from the client to the server AD.
470        3. Verify that the RFCOMM connection is active from both the client and
471        server.
472
473        Expected Result:
474        RFCOMM connection is established then disconnected succcessfully.
475
476        Returns:
477          Pass if True
478          Fail if False
479
480        TAGS: Classic, RFCOMM
481        Priority: 3
482        """
483        return self._test_rfcomm_connection_with_uuid(bt_rfcomm_uuids['ip'])
484
485    @BluetoothBaseTest.bt_test_wrap
486    @test_tracker_info(uuid='7a429cca-bc65-4344-8fa5-13ca0d49a351')
487    def test_rfcomm_connection_ftp_uuid(self):
488        """Test Bluetooth RFCOMM connection using FTP uuid
489
490        Test RFCOMM though establishing a basic connection.
491
492        Steps:
493        1. Get the mac address of the server device.
494        2. Establish an RFCOMM connection from the client to the server AD.
495        3. Verify that the RFCOMM connection is active from both the client and
496        server.
497
498        Expected Result:
499        RFCOMM connection is established then disconnected succcessfully.
500
501        Returns:
502          Pass if True
503          Fail if False
504
505        TAGS: Classic, RFCOMM
506        Priority: 3
507        """
508        return self._test_rfcomm_connection_with_uuid(bt_rfcomm_uuids['ftp'])
509
510    @BluetoothBaseTest.bt_test_wrap
511    @test_tracker_info(uuid='a8ecdd7b-8529-4e0b-ad18-0d0cf61f4b02')
512    def test_rfcomm_connection_http_uuid(self):
513        """Test Bluetooth RFCOMM connection using HTTP uuid
514
515        Test RFCOMM though establishing a basic connection.
516
517        Steps:
518        1. Get the mac address of the server device.
519        2. Establish an RFCOMM connection from the client to the server AD.
520        3. Verify that the RFCOMM connection is active from both the client and
521        server.
522
523        Expected Result:
524        RFCOMM connection is established then disconnected succcessfully.
525
526        Returns:
527          Pass if True
528          Fail if False
529
530        TAGS: Classic, RFCOMM
531        Priority: 3
532        """
533        return self._test_rfcomm_connection_with_uuid(bt_rfcomm_uuids['http'])
534
535    @BluetoothBaseTest.bt_test_wrap
536    @test_tracker_info(uuid='816569e6-6189-45b5-95c3-ea27b69698ff')
537    def test_rfcomm_connection_wsp_uuid(self):
538        """Test Bluetooth RFCOMM connection using WSP uuid
539
540        Test RFCOMM though establishing a basic connection.
541
542        Steps:
543        1. Get the mac address of the server device.
544        2. Establish an RFCOMM connection from the client to the server AD.
545        3. Verify that the RFCOMM connection is active from both the client and
546        server.
547
548        Expected Result:
549        RFCOMM connection is established then disconnected succcessfully.
550
551        Returns:
552          Pass if True
553          Fail if False
554
555        TAGS: Classic, RFCOMM
556        Priority: 3
557        """
558        return self._test_rfcomm_connection_with_uuid(bt_rfcomm_uuids['wsp'])
559
560    @BluetoothBaseTest.bt_test_wrap
561    @test_tracker_info(uuid='cd5e8c87-4df9-4f1d-ae0b-b47f84c75e44')
562    def test_rfcomm_connection_bnep_uuid(self):
563        """Test Bluetooth RFCOMM connection using BNEP uuid
564
565        Test RFCOMM though establishing a basic connection.
566
567        Steps:
568        1. Get the mac address of the server device.
569        2. Establish an RFCOMM connection from the client to the server AD.
570        3. Verify that the RFCOMM connection is active from both the client and
571        server.
572
573        Expected Result:
574        RFCOMM connection is established then disconnected succcessfully.
575
576        Returns:
577          Pass if True
578          Fail if False
579
580        TAGS: Classic, RFCOMM
581        Priority: 3
582        """
583        return self._test_rfcomm_connection_with_uuid(bt_rfcomm_uuids['bnep'])
584
585    @BluetoothBaseTest.bt_test_wrap
586    @test_tracker_info(uuid='fda073d3-d856-438b-b208-61cce67689dd')
587    def test_rfcomm_connection_upnp_uuid(self):
588        """Test Bluetooth RFCOMM connection using UPNP uuid
589
590        Test RFCOMM though establishing a basic connection.
591
592        Steps:
593        1. Get the mac address of the server device.
594        2. Establish an RFCOMM connection from the client to the server AD.
595        3. Verify that the RFCOMM connection is active from both the client and
596        server.
597
598        Expected Result:
599        RFCOMM connection is established then disconnected succcessfully.
600
601        Returns:
602          Pass if True
603          Fail if False
604
605        TAGS: Classic, RFCOMM
606        Priority: 3
607        """
608        return self._test_rfcomm_connection_with_uuid(bt_rfcomm_uuids['upnp'])
609
610    @BluetoothBaseTest.bt_test_wrap
611    @test_tracker_info(uuid='0ab329bb-ef61-4574-a5c1-440fb45938ff')
612    def test_rfcomm_connection_hidp_uuid(self):
613        """Test Bluetooth RFCOMM connection using HIDP uuid
614
615        Test RFCOMM though establishing a basic connection.
616
617        Steps:
618        1. Get the mac address of the server device.
619        2. Establish an RFCOMM connection from the client to the server AD.
620        3. Verify that the RFCOMM connection is active from both the client and
621        server.
622
623        Expected Result:
624        RFCOMM connection is established then disconnected succcessfully.
625
626        Returns:
627          Pass if True
628          Fail if False
629
630        TAGS: Classic, RFCOMM
631        Priority: 3
632        """
633        return self._test_rfcomm_connection_with_uuid(bt_rfcomm_uuids['hidp'])
634
635    @BluetoothBaseTest.bt_test_wrap
636    @test_tracker_info(uuid='5b1d8c64-4f92-4a22-b61b-28b1a1086b39')
637    def test_rfcomm_connection_hardcopy_control_channel_uuid(self):
638        """Test Bluetooth RFCOMM connection using HARDCOPY_CONTROL_CHANNEL uuid
639
640        Test RFCOMM though establishing a basic connection.
641
642        Steps:
643        1. Get the mac address of the server device.
644        2. Establish an RFCOMM connection from the client to the server AD.
645        3. Verify that the RFCOMM connection is active from both the client and
646        server.
647
648        Expected Result:
649        RFCOMM connection is established then disconnected succcessfully.
650
651        Returns:
652          Pass if True
653          Fail if False
654
655        TAGS: Classic, RFCOMM
656        Priority: 3
657        """
658        return self._test_rfcomm_connection_with_uuid(
659            bt_rfcomm_uuids['hardcopy_control_channel'])
660
661    @BluetoothBaseTest.bt_test_wrap
662    @test_tracker_info(uuid='1ae6ca34-87ab-48ad-8da8-98c997538af4')
663    def test_rfcomm_connection_hardcopy_data_channel_uuid(self):
664        """Test Bluetooth RFCOMM connection using HARDCOPY_DATA_CHANNEL uuid
665
666        Test RFCOMM though establishing a basic connection.
667
668        Steps:
669        1. Get the mac address of the server device.
670        2. Establish an RFCOMM connection from the client to the server AD.
671        3. Verify that the RFCOMM connection is active from both the client and
672        server.
673
674        Expected Result:
675        RFCOMM connection is established then disconnected succcessfully.
676
677        Returns:
678          Pass if True
679          Fail if False
680
681        TAGS: Classic, RFCOMM
682        Priority: 3
683        """
684        return self._test_rfcomm_connection_with_uuid(
685            bt_rfcomm_uuids['hardcopy_data_channel'])
686
687    @BluetoothBaseTest.bt_test_wrap
688    @test_tracker_info(uuid='d18ed311-a533-4306-944a-6f0f95eac141')
689    def test_rfcomm_connection_hardcopy_notification_uuid(self):
690        """Test Bluetooth RFCOMM connection using HARDCOPY_NOTIFICATION uuid
691
692        Test RFCOMM though establishing a basic connection.
693
694        Steps:
695        1. Get the mac address of the server device.
696        2. Establish an RFCOMM connection from the client to the server AD.
697        3. Verify that the RFCOMM connection is active from both the client and
698        server.
699
700        Expected Result:
701        RFCOMM connection is established then disconnected succcessfully.
702
703        Returns:
704          Pass if True
705          Fail if False
706
707        TAGS: Classic, RFCOMM
708        Priority: 3
709        """
710        return self._test_rfcomm_connection_with_uuid(
711            bt_rfcomm_uuids['hardcopy_notification'])
712
713    @BluetoothBaseTest.bt_test_wrap
714    @test_tracker_info(uuid='ab0af819-7d26-451d-8275-1119ee3c8df8')
715    def test_rfcomm_connection_avctp_uuid(self):
716        """Test Bluetooth RFCOMM connection using AVCTP uuid
717
718        Test RFCOMM though establishing a basic connection.
719
720        Steps:
721        1. Get the mac address of the server device.
722        2. Establish an RFCOMM connection from the client to the server AD.
723        3. Verify that the RFCOMM connection is active from both the client and
724        server.
725
726        Expected Result:
727        RFCOMM connection is established then disconnected succcessfully.
728
729        Returns:
730          Pass if True
731          Fail if False
732
733        TAGS: Classic, RFCOMM
734        Priority: 3
735        """
736        return self._test_rfcomm_connection_with_uuid(bt_rfcomm_uuids['avctp'])
737
738    @BluetoothBaseTest.bt_test_wrap
739    @test_tracker_info(uuid='124b545e-e842-433d-b541-9710a139c8fb')
740    def test_rfcomm_connection_avdtp_uuid(self):
741        """Test Bluetooth RFCOMM connection using AVDTP uuid
742
743        Test RFCOMM though establishing a basic connection.
744
745        Steps:
746        1. Get the mac address of the server device.
747        2. Establish an RFCOMM connection from the client to the server AD.
748        3. Verify that the RFCOMM connection is active from both the client and
749        server.
750
751        Expected Result:
752        RFCOMM connection is established then disconnected succcessfully.
753
754        Returns:
755          Pass if True
756          Fail if False
757
758        TAGS: Classic, RFCOMM
759        Priority: 3
760        """
761        return self._test_rfcomm_connection_with_uuid(bt_rfcomm_uuids['avdtp'])
762
763    @BluetoothBaseTest.bt_test_wrap
764    @test_tracker_info(uuid='aea354b9-2ba5-4d7e-90a9-b637cb2fd48c')
765    def test_rfcomm_connection_cmtp_uuid(self):
766        """Test Bluetooth RFCOMM connection using CMTP uuid
767
768        Test RFCOMM though establishing a basic connection.
769
770        Steps:
771        1. Get the mac address of the server device.
772        2. Establish an RFCOMM connection from the client to the server AD.
773        3. Verify that the RFCOMM connection is active from both the client and
774        server.
775
776        Expected Result:
777        RFCOMM connection is established then disconnected succcessfully.
778
779        Returns:
780          Pass if True
781          Fail if False
782
783        TAGS: Classic, RFCOMM
784        Priority: 3
785        """
786        return self._test_rfcomm_connection_with_uuid(bt_rfcomm_uuids['cmtp'])
787
788    @BluetoothBaseTest.bt_test_wrap
789    @test_tracker_info(uuid='b547b8d9-6453-41af-959f-8bc0d9a6c89a')
790    def test_rfcomm_connection_mcap_control_channel_uuid(self):
791        """Test Bluetooth RFCOMM connection using MCAP_CONTROL_CHANNEL uuid
792
793        Test RFCOMM though establishing a basic connection.
794
795        Steps:
796        1. Get the mac address of the server device.
797        2. Establish an RFCOMM connection from the client to the server AD.
798        3. Verify that the RFCOMM connection is active from both the client and
799        server.
800
801        Expected Result:
802        RFCOMM connection is established then disconnected succcessfully.
803
804        Returns:
805          Pass if True
806          Fail if False
807
808        TAGS: Classic, RFCOMM
809        Priority: 3
810        """
811        return self._test_rfcomm_connection_with_uuid(
812            bt_rfcomm_uuids['mcap_control_channel'])
813
814    @BluetoothBaseTest.bt_test_wrap
815    @test_tracker_info(uuid='ba3ab84c-bc61-442c-944c-af4fbca157f1')
816    def test_rfcomm_connection_mcap_data_channel_uuid(self):
817        """Test Bluetooth RFCOMM connection using MCAP_DATA_CHANNEL uuid
818
819        Test RFCOMM though establishing a basic connection.
820
821        Steps:
822        1. Get the mac address of the server device.
823        2. Establish an RFCOMM connection from the client to the server AD.
824        3. Verify that the RFCOMM connection is active from both the client and
825        server.
826
827        Expected Result:
828        RFCOMM connection is established then disconnected succcessfully.
829
830        Returns:
831          Pass if True
832          Fail if False
833
834        TAGS: Classic, RFCOMM
835        Priority: 3
836        """
837        return self._test_rfcomm_connection_with_uuid(
838            bt_rfcomm_uuids['mcap_data_channel'])
839