# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.
import hci_packets as hci import link_layer_packets as ll import unittest from typing import List from hci_packets import ErrorCode from py.bluetooth import Address from py.controller import ControllerTest
class Test(ControllerTest): # Test parameters.
LL_advertiser_advInterval_MIN = 0x200
LL_advertiser_advInterval_MAX = 0x200
LL_advertiser_Adv_Channel_Map = 0x7
# 1. Upper Tester enables discoverable undirected advertising in the IUT using all supported # advertising channels and a selected advertising interval between the minimum and maximum # advertising.
controller.send_cmd(
hci.LeSetAdvertisingParameters(
advertising_interval_min=self.LL_advertiser_advInterval_MIN,
advertising_interval_max=self.LL_advertiser_advInterval_MAX,
advertising_type=hci.AdvertisingType.ADV_SCAN_IND,
own_address_type=hci.OwnAddressType.PUBLIC_DEVICE_ADDRESS,
advertising_channel_map=self.LL_advertiser_Adv_Channel_Map,
advertising_filter_policy=hci.AdvertisingFilterPolicy.ALL_DEVICES))
# 2. Configure Lower Tester to monitor the advertising and scan response procedures of the IUT. The # Lower Tester will send an SCAN_REQ packet on a selected supported advertising channel # (defined as an IXIT) and using a common public device address as parameter.
peer_address = Address('aa:bb:cc:dd:ee:ff')
# 3. Configure Scan Response Data in the IUT using device name length of 0 as response data.
scan_response_data = []
controller.send_cmd(hci.LeSetScanResponseData(advertising_data=scan_response_data))
# 4. Lower Tester sends a SCAN_REQ packet on the selected advertising channel after receiving an # ADV_SCAN_IND packet from IUT on the advertising channel configured in step 3. The # SCAN_REQ is sent T_IFS after the end of an ADV_SCAN_IND packet. # 5. Lower Tester receives a SCAN_RSP packet from the IUT addressed to the Lower Tester T_IFS # after the end of the request packet. # 6. Repeat steps 4–5 30 times.
await self.steps_4_6(peer_address=peer_address, scan_response_data=scan_response_data)
# 7. Configure Scan Response Data in the IUT using device name length of 31 as response data.
scan_response_data = [31] + [0] * 30
controller.send_cmd(hci.LeSetScanResponseData(advertising_data=scan_response_data))
# 9. Configure Lower Tester to monitor the advertising and scan response procedures of the IUT. The # Lower Tester will send an SCAN_REQ packet on a selected supported advertising channel # (defined as an IXIT) and using a public device address that differs from the IUT address in the # most significant octet as parameter.
peer_address = Address([
controller.address.address[0] ^ 0xff, controller.address.address[1],
controller.address.address[2], controller.address.address[3],
controller.address.address[4], controller.address.address[5]
])
# 10. Configure Scan Response Data in the IUT using device name length of 0 as response data.
scan_response_data = []
controller.send_cmd(hci.LeSetScanResponseData(advertising_data=scan_response_data))
# 12. Configure Scan Response Data in the IUT using device name length of 31 as response data.
scan_response_data = [31] + [0] * 30
controller.send_cmd(hci.LeSetScanResponseData(advertising_data=scan_response_data))
# Note: this last iteration is very redundant, not implementing it # to save on execution time.
# 14. Configure Lower Tester to monitor the advertising and scan response procedures of the IUT. The # Lower Tester will send an SCAN_REQ packet on a selected supported advertising channel # (defined as an IXIT) and using a public device address with address that differs from the IUT # address in the most and least significant octets as parameter.
# 15. Configure Scan Response Data in the IUT using device name length of 0 as response data. # 16. Repeat steps 4–6.
# 4. Lower Tester sends a SCAN_REQ packet on the selected advertising channel after receiving an # ADV_SCAN_IND packet from IUT on the advertising channel configured in step 3. The # SCAN_REQ is sent T_IFS after the end of an ADV_SCAN_IND packet. # 5. Lower Tester receives a SCAN_RSP packet from the IUT addressed to the Lower Tester T_IFS # after the end of the request packet. # 6. Repeat steps 4–5 30 times. for n in range(3):
await self.expect_ll(ll.LeLegacyAdvertisingPdu(
source_address=controller.address,
advertising_address_type=ll.AddressType.PUBLIC,
advertising_type=ll.LegacyAdvertisingType.ADV_SCAN_IND,
advertising_data=[]),
timeout=5)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.