• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2#
3#   Copyright 2022 - The Android Open Source Project
4#
5#   Licensed under the Apache License, Version 2.0 (the "License");
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of 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,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16
17import binascii
18import io
19import logging
20import os
21import queue
22
23from blueberry.tests.gd.cert.context import get_current_context
24
25from blueberry.tests.sl4a_sl4a.lib import sl4a_sl4a_base_test
26from blueberry.tests.gd_sl4a.lib.bt_constants import ble_address_types
27
28
29class LeAdvertisingTest(sl4a_sl4a_base_test.Sl4aSl4aBaseTestClass):
30
31    def setup_class(self):
32        super().setup_class()
33
34    def setup_test(self):
35        super().setup_test()
36
37    def teardown_test(self):
38        super().teardown_test()
39
40    def test_advertise_name(self):
41        rpa_address = self.cert_advertiser_.advertise_public_extended_pdu()
42        self.dut_scanner_.scan_for_name(self.cert_advertiser_.get_local_advertising_name())
43        self.dut_scanner_.stop_scanning()
44        self.cert_advertiser_.stop_advertising()
45
46    def test_advertise_name_stress(self):
47        for i in range(0, 10):
48            self.test_advertise_name()
49
50    def test_advertise_name_twice_no_stop(self):
51        rpa_address = self.cert_advertiser_.advertise_public_extended_pdu()
52        self.dut_scanner_.scan_for_name(self.cert_advertiser_.get_local_advertising_name())
53        self.dut_scanner_.stop_scanning()
54        rpa_address = self.cert_advertiser_.advertise_public_extended_pdu()
55        self.dut_scanner_.scan_for_name(self.cert_advertiser_.get_local_advertising_name())
56        self.dut_scanner_.stop_scanning()
57        self.cert_advertiser_.stop_advertising()
58