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