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