# Copyright 2026 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 from hci_packets import ErrorCode import link_layer_packets as ll from py.bluetooth import Address from py.controller import ControllerTest
# LL/CS/CEN/INI/BV-01-C [CS Procedure Start and Stop, Central, Initiator]
async def test(self): """
Test the CS Procedure Start and Stop initiated by the local controller. """ # Test parameters.
peer_address = Address("aa:bb:cc:dd:ee:ff")
controller = self.controller
# Initial Conditions: Establish an ACL connection with the IUT, set capabilities/FAE, # encrypt, and complete CS Security Start.
acl_connection_handle = await self.establish_le_connection_central(peer_address)
# 15. The Lower Tester sends an LL_CS_RSP PDU Rootcanal doesn't # explicitly validate these for the response, but they must match the # REQ in a real trace. Since this is sent BY the test, we'll just use 0, # except where we want to pass specific values.
controller.send_ll(
ll.LlCsRsp(
source_address=peer_address,
destination_address=controller.address,
status=ErrorCode.SUCCESS,
config_id=2,
conn_event_count=0,
offset_min=0,
offset_max=0,
event_interval=0,
subevents_per_event=1,
subevent_interval=0,
subevent_len=2500,
aci=0,
phy=1,
pwr_delta=0,
)
)
# 18. The Lower Tester and the IUT execute the Mode-0 and Mode-1 channel # sounding procedures. # 19. The IUT sends one HCI_LE_CS_Subevent_Result # event to the Upper Tester (RootCanal does not currently generate # Subevent_Result events, skipping)
# 20. The Upper Tester sends an HCI_LE_CS_Security_Enable command
controller.send_cmd(
hci.LeCsSecurityEnable(connection_handle=acl_connection_handle)
)
# 21A.1 The IUT sends a successful HCI_Command_Status
await self.expect_evt(
hci.LeCsSecurityEnableStatus(
status=ErrorCode.SUCCESS, num_hci_command_packets=1
)
)
# 25. The IUT sends an LL_CS_SEC_REQ PDU to the Lower Tester. # (Due to Rootcanal implementation, it immediately sends LL_CS_SEC_REQ without queueing)
await self.expect_ll(
ll.LlCsSecurityEnableReq(
source_address=controller.address,
destination_address=peer_address,
cs_iv_c=self.Any,
cs_in_c=self.Any,
cs_pv_c=self.Any,
)
)
# 22. The Lower Tester sends an LL_CS_TERMINATE_REQ PDU
controller.send_ll(
ll.LlCsTerminateReq(
source_address=peer_address,
destination_address=controller.address,
config_id=2,
procedure_count=0,
error_code=ErrorCode.SUCCESS,
)
)
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.