1# -*- coding: utf-8 -*- 2# Copyright 2021 Oticon A/S 3# SPDX-License-Identifier: Apache-2.0 4 5import numpy 6import random 7import math 8from components.addata import * 9from components.address import * 10from components.advertiser import * 11from components.basic_commands import * 12from components.initiator import * 13from components.pairing import * 14from components.preambles import * 15from components.resolvable import * 16from components.scanner import * 17from components.test_spec import TestSpec 18from components.utils import * 19from collections import namedtuple 20 21from tests.test_utils import * 22 23global lowerIRK, upperIRK, lowerRandomAddress, upperRandomAddress 24 25 26def peripheral_send_single_sdu_cis(transport, peripheral, central, trace, params): 27 success, initiator, (cis_conn_handle,), _ = \ 28 state_connected_isochronous_stream(transport, peripheral, central, trace, params) 29 if not initiator: 30 return success 31 32 # Test procedure 33 # 1.The Upper Tester sends an HCI ISO Data Packet to the IUT with data length less than or equal to 34 # the Max Data Length 35 # 2.The IUT sends a single ISO Data PDU to the Lower Tester with the specified LLID 36 # and Payload Data identical to the data in step 1. Framing shall be 0 if LLID is 0b00 37 # and shall be 1 if LLID is 0b10 38 39 # Maximum data size to fit into a single PDU/SDU 40 if params.Framing == 1: 41 max_data_size = params.Max_SDU_P_To_C[0] - 5 42 else: 43 max_data_size = params.Max_SDU_P_To_C[0] 44 45 success = iso_send_payload_pdu(transport, peripheral, central, trace, cis_conn_handle, 46 max_data_size, params.SDU_Interval_P_To_C, 1) and success 47 48 ### TERMINATION ### 49 success = initiator.disconnect(0x13) and success 50 51 return success 52 53 54def central_receive_single_sdu_cis(transport, central, peripheral, trace, params): 55 return peripheral_send_single_sdu_cis(transport, peripheral, central, trace, params) 56 57 58def peripheral_receive_single_sdu_cis(transport, peripheral, central, trace, params): 59 success, initiator, _, (cis_conn_handle,) = \ 60 state_connected_isochronous_stream(transport, peripheral, central, trace, params) 61 if not initiator: 62 return success 63 64 # Maximum data size to fit into a single PDU/SDU 65 if params.Framing == 1: 66 max_data_size = params.Max_SDU_C_To_P[0] - 5 67 else: 68 max_data_size = params.Max_SDU_C_To_P[0] 69 70 success = iso_send_payload_pdu(transport, central, peripheral, trace, cis_conn_handle, 71 max_data_size, params.SDU_Interval_C_To_P, 1) and success 72 73 ### TERMINATION ### 74 success = initiator.disconnect(0x13) and success 75 76 return success 77 78 79def central_send_single_sdu_cis(transport, central, peripheral, trace, params): 80 return peripheral_receive_single_sdu_cis(transport, peripheral, central, trace, params) 81 82 83def peripheral_simultanous_sending_and_receiving_sdus(transport, peripheral, central, trace, params): 84 success, initiator, (peripheral_cis_handle,), (central_cis_handle,) = \ 85 state_connected_isochronous_stream(transport, peripheral, central, trace, params) 86 if not initiator: 87 return success 88 89 # Test procedure 90 # 1. The Upper Tester sends HCI ISO Data Packets to the IUT. 91 # 2. The IUT sends ISO Data PDUs to the Lower Tester. 92 # 3. At the same time, the Lower Tester sends ISO Data PDUs to the IUT. 93 # 4. The IUT sends Isochronous Data SDUs to the Upper Tester. 94 95 # Maximum data size to fit into a single PDU/SDU 96 if params.Framing == 1: 97 max_data_size = params.Max_SDU_C_To_P[0] - 5 98 else: 99 max_data_size = params.Max_SDU_C_To_P[0] 100 101 success = iso_send_payload_pdu_parallel(transport, central, peripheral, trace, central_cis_handle, 102 peripheral_cis_handle, max_data_size, 103 params.SDU_Interval_C_To_P, 1) and success 104 105 ### TERMINATION ### 106 success = initiator.disconnect(0x13) and success 107 108 return success 109 110 111def central_simultanous_sending_and_receiving_sdus(transport, central, peripheral, trace, params): 112 return peripheral_simultanous_sending_and_receiving_sdus(transport, peripheral, central, trace, params) 113 114 115def send_multiple_small_sdu_cis(transport, transmitter, receiver, trace, cis_handle, iso_interval, sdu_interval): 116 # Create a ISO_SDUs of TS defined size 117 tx_sdu_1 = tuple([0] * 20) 118 tx_sdu_2 = tuple([1] * 25) 119 120 # Pack the ISO_Data_Load (no Time_Stamp) of an HCI ISO Data packet 121 # <Packet_Sequence_Number, ISO_SDU_Length, ISO_SDU> 122 iso_data_pkt_1 = struct.pack(f'<HH{len(tx_sdu_1)}B', 1, len(tx_sdu_1), *tx_sdu_1) 123 iso_data_pkt_2 = struct.pack(f'<HH{len(tx_sdu_2)}B', 2, len(tx_sdu_2), *tx_sdu_2) 124 125 # Test procedure 126 # 1. The Upper Tester sends to the IUT a small SDU1 with data length of 20 bytes. 127 # 2. The Upper Tester sends to the IUT a small SDU2 with data length of 25 bytes. 128 # 3. The IUT sends a single PDU with SDU1 followed by SDU2 to the Lower Tester. Each SDU 129 # header has SC = 0 and CMPT = 1. 130 success, _, _, iso_buffer_len, _ = readBufferSizeV2(transport, transmitter, trace) 131 s, fragments_1 = le_iso_data_write_fragments(transport, transmitter, trace, cis_handle, iso_data_pkt_1, iso_buffer_len) 132 success = s and success 133 s, fragments_2 = le_iso_data_write_fragments(transport, transmitter, trace, cis_handle, iso_data_pkt_2, iso_buffer_len) 134 success = s and success 135 136 # Wait for data to be sent; fetch EDTT command response and Number of Completed packets event 137 success = le_iso_data_write_complete(transport, transmitter, trace, fragments_1 + fragments_2, 100) and success 138 139 # The ISO interval is significant in those test cases (few seconds) thus we wait here long enough to be sure the 140 # packet has been sent. The timeout equal to four ISO Intervals is determined experimentally. 141 transport.wait(int(4 * iso_interval * 1.25)) 142 143 success = verifyAndShowEvent(transport, transmitter, Events.BT_HCI_EVT_NUM_COMPLETED_PACKETS, trace) and success 144 145 # Shall receive only one Number of Completed Packets event 146 success = not has_event(transport, transmitter, 100)[0] and success 147 148 # Check the data received 149 s, _, rx_sdu = iso_receive_sdu(transport, receiver, trace, sdu_interval) 150 success = s and tx_sdu_1 == rx_sdu and success 151 152 s, _, rx_sdu = iso_receive_sdu(transport, receiver, trace, sdu_interval) 153 success = s and tx_sdu_2 == rx_sdu and success 154 155 return success 156 157 158def peripheral_send_multiple_small_sdu_cis(transport, peripheral, central, trace, params): 159 success, initiator, (cis_handle,), _ = \ 160 state_connected_isochronous_stream(transport, peripheral, central, trace, params) 161 if not initiator: 162 return success 163 164 success = send_multiple_small_sdu_cis(transport, peripheral, central, trace, cis_handle, params.ISO_Interval, 165 params.SDU_Interval_P_To_C) and success 166 167 ### TERMINATION ### 168 success = initiator.disconnect(0x13) and success 169 170 return success 171 172 173def central_receive_multiple_small_sdu_cis(transport, central, peripheral, trace, params): 174 return peripheral_send_multiple_small_sdu_cis(transport, peripheral, central, trace, params) 175 176 177def peripheral_receive_multiple_small_sdu_cis(transport, peripheral, central, trace, params): 178 success, initiator, _, (cis_handle,) = \ 179 state_connected_isochronous_stream(transport, peripheral, central, trace, params) 180 if not initiator: 181 return success 182 183 success = send_multiple_small_sdu_cis(transport, central, peripheral, trace, cis_handle, params.ISO_Interval, 184 params.SDU_Interval_C_To_P) and success 185 186 ### TERMINATION ### 187 success = initiator.disconnect(0x13) and success 188 189 return success 190 191 192def central_send_multiple_small_sdu_cis(transport, central, peripheral, trace, params): 193 return peripheral_receive_multiple_small_sdu_cis(transport, peripheral, central, trace, params) 194 195 196def central_send_large_sdu_cis(transport, central, peripheral, trace, params): 197 # As per TS: 198 # "Max_SDU is set to 503 when the corresponding BN is not 0. Max_SDU is set to 0 when the corresponding BN is 0." 199 # "Max_PDU is set to 251 when the corresponding BN is not 0. Max_PDU is set to 0 when the corresponding BN is 0." 200 for i in range(params.CIS_Count): 201 if params.BN_C_To_P[i] == 0: 202 params.Max_SDU_C_To_P[i] = 0 203 params.Max_PDU_C_To_P[i] = 0 204 else: 205 params.Max_SDU_C_To_P[i] = 503 206 params.Max_PDU_C_To_P[i] = 251 207 208 if params.BN_P_To_C[i] == 0: 209 params.Max_SDU_P_To_C[i] = 0 210 params.Max_PDU_P_To_C[i] = 0 211 else: 212 params.Max_SDU_P_To_C[i] = 503 213 params.Max_PDU_P_To_C[i] = 251 214 215 success, initiator, _, (cis_handle,) = \ 216 state_connected_isochronous_stream(transport, peripheral, central, trace, params) 217 if not initiator: 218 return success 219 220 # Test procedure 221 # 1.The Upper Tester sends an HCI ISO Data Packet to the IUT with specified data length 222 # 2.The IUT sends the specified number of Start/Continuation packets 223 # of ISO Data PDUs to the Lower Tester with the LLID=0b01 for unframed data and LLID=0b10 for 224 # framed data. Payload Data every 251 bytes offset in step 1. If the BN value is not 0 in the 225 # direction from the Lower Tester to the IUT, then the Lower Tester sends payloads as configured 226 # 3. The IUT sends the last ISO Data PDU to the Lower Tester with the LLID=0b00 for unframed data 227 # and LLID=0b10 for framed data with the remaining Payload Data. 228 testData = namedtuple('testData', 'SDU_Data_Length, Start_Continuation_Packets') 229 rounds = { 230 '1': testData(495, 1), 231 '2': testData(503, 2), 232 } 233 234 for _, (sdu_data_len, start_cont_pkts) in rounds.items(): 235 success = iso_send_payload_pdu(transport, central, peripheral, trace, cis_handle, sdu_data_len, 236 params.SDU_Interval_C_To_P, 1) and success 237 # TODO: Verify Start/Continuation Packets 238 239 ### TERMINATION ### 240 success = initiator.disconnect(0x13) and success 241 242 return success 243 244 245def peripheral_send_large_sdu_cis(transport, peripheral, central, trace, params): 246 # As per TS: 247 # "Max_SDU is set to 503 when the corresponding BN is not 0. Max_SDU is set to 0 when the corresponding BN is 0." 248 # "Max_PDU is set to 251 when the corresponding BN is not 0. Max_PDU is set to 0 when the corresponding BN is 0." 249 for i in range(params.CIS_Count): 250 if params.BN_C_To_P[i] == 0: 251 params.Max_SDU_C_To_P[i] = 0 252 params.Max_PDU_C_To_P[i] = 0 253 else: 254 params.Max_SDU_C_To_P[i] = 503 255 params.Max_PDU_C_To_P[i] = 251 256 257 if params.BN_P_To_C[i] == 0: 258 params.Max_SDU_P_To_C[i] = 0 259 params.Max_PDU_P_To_C[i] = 0 260 else: 261 params.Max_SDU_P_To_C[i] = 503 262 params.Max_PDU_P_To_C[i] = 251 263 264 success, initiator, (cis_conn_handle,), _ = \ 265 state_connected_isochronous_stream(transport, peripheral, central, trace, params) 266 if not initiator: 267 return success 268 269 # Test procedure 270 # 1.The Upper Tester sends an HCI ISO Data Packet to the IUT with specified data length 271 # 2.The IUT sends the specified number of Start/Continuation packets 272 # of ISO Data PDUs to the Lower Tester with the LLID=0b01 for unframed data and LLID=0b10 for 273 # framed data. Payload Data every 251 bytes offset in step 1. If the BN value is not 0 in the 274 # direction from the Lower Tester to the IUT, then the Lower Tester sends payloads as configured 275 # 3. The IUT sends the last ISO Data PDU to the Lower Tester with the LLID=0b00 for unframed data 276 # and LLID=0b10 for framed data with the remaining Payload Data. 277 testData = namedtuple('testData', 'SDU_Data_Length, Start_Continuation_Packets') 278 rounds = { 279 '1': testData(495, 1), 280 '2': testData(503, 2), 281 } 282 283 for _, (sdu_data_len, start_cont_pkts) in rounds.items(): 284 success = iso_send_payload_pdu(transport, peripheral, central, trace, cis_conn_handle, sdu_data_len, 285 params.SDU_Interval_P_To_C, 1) and success 286 # TODO: Verify Start/Continuation Packets 287 288 ### TERMINATION ### 289 success = initiator.disconnect(0x13) and success 290 291 return success 292 293 294def central_receive_large_sdu_cis_framed(transport, central, peripheral, trace, params, adjust_conn_interval=False): 295 # As per TS: 296 # "If the corresponding BN is not 0, then Max_SDU is set to 251 and Max_PDU is set to 251." 297 # "If the corresponding BN is 0, then Max_SDU is set to 0 and Max_PDU is set to 0." 298 for i in range(params.CIS_Count): 299 if params.BN_C_To_P[i] == 0: 300 params.Max_SDU_C_To_P[i] = 0 301 params.Max_PDU_C_To_P[i] = 0 302 else: 303 params.Max_SDU_C_To_P[i] = 251 304 params.Max_PDU_C_To_P[i] = 251 305 306 if params.BN_P_To_C[i] == 0: 307 params.Max_SDU_P_To_C[i] = 0 308 params.Max_PDU_P_To_C[i] = 0 309 else: 310 params.Max_SDU_P_To_C[i] = 251 311 params.Max_PDU_P_To_C[i] = 251 312 313 success, initiator, (cis_handle,), _ = \ 314 state_connected_isochronous_stream(transport, peripheral, central, trace, params, 315 adjust_conn_interval=adjust_conn_interval) 316 if not initiator: 317 return success 318 319 # Test procedure 320 # 1.The Upper Tester sends an HCI ISO Data Packet to the IUT with specified data length 321 # 2.The IUT sends the specified number of Start/Continuation packets 322 # of ISO Data PDUs to the Lower Tester with the LLID=0b01 for unframed data and LLID=0b10 for 323 # framed data. Payload Data every 251 bytes offset in step 1. If the BN value is not 0 in the 324 # direction from the Lower Tester to the IUT, then the Lower Tester sends payloads as configured 325 # 3. The IUT sends the last ISO Data PDU to the Lower Tester with the LLID=0b00 for unframed data 326 # and LLID=0b10 for framed data with the remaining Payload Data. 327 testData = namedtuple('testData', 'SDU_Data_Length, Number_of_Fragments') 328 rounds = { 329 '1': testData(744, 3), 330 '2': testData(745, 4), 331 } 332 333 for _, (sdu_data_len, num_of_fragments) in rounds.items(): 334 success = iso_send_payload_pdu(transport, peripheral, central, trace, cis_handle, sdu_data_len, 335 params.SDU_Interval_C_To_P, 1) and success 336 # TODO: Verify Number of Fragments 337 338 ### TERMINATION ### 339 success = initiator.disconnect(0x13) and success 340 341 return success 342 343 344def peripheral_receive_large_sdu_cis_framed(transport, peripheral, central, trace, params): 345 # As per TS: 346 # "If the corresponding BN is not 0, then Max_SDU is set to 251 and Max_PDU is set to 251." 347 # "If the corresponding BN is 0, then Max_SDU is set to 0 and Max_PDU is set to 0." 348 for i in range(params.CIS_Count): 349 if params.BN_C_To_P[i] == 0: 350 params.Max_SDU_C_To_P[i] = 0 351 params.Max_PDU_C_To_P[i] = 0 352 else: 353 params.Max_SDU_C_To_P[i] = 251 354 params.Max_PDU_C_To_P[i] = 251 355 356 if params.BN_P_To_C[i] == 0: 357 params.Max_SDU_P_To_C[i] = 0 358 params.Max_PDU_P_To_C[i] = 0 359 else: 360 params.Max_SDU_P_To_C[i] = 251 361 params.Max_PDU_P_To_C[i] = 251 362 363 success, initiator, _, (cis_conn_handle,) = \ 364 state_connected_isochronous_stream(transport, peripheral, central, trace, params) 365 if not initiator: 366 return success 367 368 # Test procedure 369 # 1.The Upper Tester sends an HCI ISO Data Packet to the IUT with specified data length 370 # 2.The IUT sends the specified number of Start/Continuation packets 371 # of ISO Data PDUs to the Lower Tester with the LLID=0b01 for unframed data and LLID=0b10 for 372 # framed data. Payload Data every 251 bytes offset in step 1. If the BN value is not 0 in the 373 # direction from the Lower Tester to the IUT, then the Lower Tester sends payloads as configured 374 # 3. The IUT sends the last ISO Data PDU to the Lower Tester with the LLID=0b00 for unframed data 375 # and LLID=0b10 for framed data with the remaining Payload Data. 376 testData = namedtuple('testData', 'SDU_Data_Length, Number_of_Fragments') 377 rounds = { 378 '1': testData(744, 3), 379 '2': testData(745, 4), 380 } 381 382 for _, (sdu_data_len, num_of_fragments) in rounds.items(): 383 success = iso_send_payload_pdu(transport, central, peripheral, trace, cis_conn_handle, sdu_data_len, 384 params.SDU_Interval_C_To_P, 1) and success 385 # TODO: Verify Number of Fragments 386 387 ### TERMINATION ### 388 success = initiator.disconnect(0x13) and success 389 390 return success 391 392 393def central_receive_large_sdu_cis_unframed(transport, central, peripheral, trace, params): 394 # As per TS: 395 # "If the corresponding BN is not 0, then Max_SDU is set to 251 and Max_PDU is set to 251." 396 # "If the corresponding BN is 0, then Max_SDU is set to 0 and Max_PDU is set to 0." 397 for i in range(params.CIS_Count): 398 if params.BN_C_To_P[i] == 0: 399 params.Max_SDU_C_To_P[i] = 0 400 params.Max_PDU_C_To_P[i] = 0 401 else: 402 params.Max_SDU_C_To_P[i] = 754 403 params.Max_PDU_C_To_P[i] = 251 404 405 if params.BN_P_To_C[i] == 0: 406 params.Max_SDU_P_To_C[i] = 0 407 params.Max_PDU_P_To_C[i] = 0 408 else: 409 params.Max_SDU_P_To_C[i] = 754 410 params.Max_PDU_P_To_C[i] = 251 411 412 success, initiator, (cis_handle,), _, = \ 413 state_connected_isochronous_stream(transport, peripheral, central, trace, params) 414 if not initiator: 415 return success 416 417 testData = namedtuple('testData', 'SDU_Data_Length, Start_Continutation_Packets') 418 rounds = { 419 '1': testData(753, 2), 420 '2': testData(754, 3), 421 } 422 423 for _, (sdu_data_len, start_cont_pkts) in rounds.items(): 424 success = iso_send_payload_pdu(transport, peripheral, central, trace, cis_handle, sdu_data_len, 425 params.SDU_Interval_P_To_C, 1) and success 426 # TODO: Verify Start/Continutation Packets 427 428 ### TERMINATION ### 429 success = initiator.disconnect(0x13) and success 430 431 return success 432 433 434def peripheral_receive_large_sdu_cis_unframed(transport, peripheral, central, trace, params): 435 # As per TS: 436 # "If the corresponding BN is not 0, then Max_SDU is set to 251 and Max_PDU is set to 251." 437 # "If the corresponding BN is 0, then Max_SDU is set to 0 and Max_PDU is set to 0." 438 for i in range(params.CIS_Count): 439 if params.BN_C_To_P[i] == 0: 440 params.Max_SDU_C_To_P[i] = 0 441 params.Max_PDU_C_To_P[i] = 0 442 else: 443 params.Max_SDU_C_To_P[i] = 754 444 params.Max_PDU_C_To_P[i] = 251 445 446 if params.BN_P_To_C[i] == 0: 447 params.Max_SDU_P_To_C[i] = 0 448 params.Max_PDU_P_To_C[i] = 0 449 else: 450 params.Max_SDU_P_To_C[i] = 754 451 params.Max_PDU_P_To_C[i] = 251 452 453 success, initiator, _, (cis_conn_handle,) = \ 454 state_connected_isochronous_stream(transport, peripheral, central, trace, params) 455 if not initiator: 456 return success 457 458 testData = namedtuple('testData', 'SDU_Data_Length, Start_Continutation_Packets') 459 rounds = { 460 '1': testData(753, 2), 461 '2': testData(754, 3), 462 } 463 464 for _, (sdu_data_len, start_cont_pkts) in rounds.items(): 465 success = iso_send_payload_pdu(transport, central, peripheral, trace, cis_conn_handle, sdu_data_len, 466 params.SDU_Interval_C_To_P, 1) and success 467 # TODO: Verify Start/Continutation Packets 468 469 ### TERMINATION ### 470 success = initiator.disconnect(0x13) and success 471 472 return success 473 474 475def peripheral_send_zero_length_sdu_cis(transport, peripheral, central, trace, params): 476 success, initiator, (cis_conn_handle,), _ = \ 477 state_connected_isochronous_stream(transport, peripheral, central, trace, params) 478 if not initiator: 479 return success 480 481 # Test procedure 482 # 1. The Upper Tester sends an HCI ISO Data Packet to the IUT with zero data length. 483 # 2. The IUT sends a single ISO Data PDU to the Lower Tester with the specidied LLID, segmentation header 484 # and time offset. 485 success = iso_send_payload_pdu(transport, peripheral, central, trace, cis_conn_handle, 0, 486 params.SDU_Interval_P_To_C, 1) and success 487 488 ### TERMINATION ### 489 success = initiator.disconnect(0x13) and success 490 491 return success 492 493 494def central_receive_zero_length_sdu_cis(transport, central, peripheral, trace, params): 495 return peripheral_send_zero_length_sdu_cis(transport, peripheral, central, trace, params) 496 497 498def peripheral_receive_zero_length_sdu_cis(transport, peripheral, central, trace, params): 499 success, initiator, _, (cis_conn_handle,) = \ 500 state_connected_isochronous_stream(transport, peripheral, central, trace, params) 501 if not initiator: 502 return success 503 504 success = iso_send_payload_pdu(transport, central, peripheral, trace, cis_conn_handle, 0, 505 params.SDU_Interval_C_To_P, 1) and success 506 507 ### TERMINATION ### 508 success = initiator.disconnect(0x13) and success 509 510 return success 511 512 513def central_send_zero_length_sdu_cis(transport, central, peripheral, trace, params): 514 return peripheral_receive_zero_length_sdu_cis(transport, peripheral, central, trace, params) 515 516 517def peripheral_sending_and_receiving_unframed_empty_pdu_llid_0b01_cis(transport, peripheral, central, trace, bn, nse): 518 params = SetCIGParameters( 519 SDU_Interval_C_To_P = 0x186A0, # 100 ms 520 SDU_Interval_P_To_C = 0x186A0, # 100 ms 521 FT_C_To_P = 1, 522 FT_P_To_C = 1, 523 ISO_Interval = 0x50, # 100 ms 524 Packing = 0, # Sequential 525 Framing = 0, # Unframed 526 CIS_Count = 1, 527 NSE = nse, 528 Max_SDU_Supported = 128, # Force Max SDU to be 128 bytes 529 Max_PDU_C_To_P = 128, 530 Max_PDU_P_To_C = 128, 531 PHY_C_To_P = 1, 532 PHY_P_To_C = 1, 533 BN_P_To_C = bn, 534 BN_C_To_P = bn, 535 ) 536 537 success, initiator, (peripheral_cis_handle,), (central_cis_handle,) = \ 538 state_connected_isochronous_stream(transport, peripheral, central, trace, params, adjust_conn_interval=True) 539 if not initiator: 540 return success 541 542 # Packet sequence numbers require an offset so that the first SDU doesn't get flushed. 543 # The original implementation reused the SDU length ranging from 4 to 128 as the packet 544 # sequence number. The same starting offset is reused below. 545 start_pkt_seq_num_P_To_C = 4 546 start_pkt_seq_num_C_To_P = 4 547 548 # Although the packet sequence number is intialized to 0 it will be reset in the loop below by the outcome of max() 549 pkt_seq_num_P_To_C = 0 550 pkt_seq_num_C_To_P = 0 551 552 SDU_Interval_C_To_P_ms = params.SDU_Interval_C_To_P / 1000 553 SDU_Interval_P_To_C_ms = params.SDU_Interval_P_To_C / 1000 554 555 # Log start time 556 start_time = transport.get_time() 557 558 for sdu_len in range(4, 128 + 1): 559 # Update packet sequence number according to the number of SDU intervals being delayed 560 now = transport.get_time() 561 pkt_seq_num_P_To_C = max(pkt_seq_num_P_To_C + 1, 562 start_pkt_seq_num_P_To_C + math.ceil((now - start_time) / SDU_Interval_P_To_C_ms)) 563 564 # Test procedure 565 # 1.The Upper Tester submits an SDU at its SDU interval of variable length, ranging from 4 to 128 octets. 566 # 2.The Lower Tester receives PDUs from the IUT. When the required number of PDUs to transmit 567 # the SDU is less than BN PDUs, the remainder of BN PDUs are empty PDUs with LLID=0b01 568 success = iso_send_payload_pdu(transport, peripheral, central, trace, peripheral_cis_handle, 569 sdu_len, params.SDU_Interval_P_To_C, pkt_seq_num_P_To_C) and success 570 571 # Update packet sequence number according to the number of SDU intervals being delayed 572 now = transport.get_time() 573 pkt_seq_num_C_To_P = max(pkt_seq_num_C_To_P + 1, 574 start_pkt_seq_num_C_To_P + math.ceil((now - start_time) / SDU_Interval_C_To_P_ms)) 575 576 # 3.The Lower Tester sends PDUs based on an SDU of variable length, ranging from 4 to 128 577 # octets. When the required number of PDUs to transmit the SDU is less than BN PDUs, the 578 # remainder of BN PDUs are empty PDUs with LLID=0b01. 579 # 4. The IUT sends the variable length SDUs from the Lower Tester to the Upper Tester. 580 success = iso_send_payload_pdu(transport, central, peripheral, trace, central_cis_handle, 581 sdu_len, params.SDU_Interval_C_To_P, pkt_seq_num_C_To_P) and success 582 583 ### TERMINATION ### 584 success = initiator.disconnect(0x13) and success 585 586 return success 587 588 589def central_sending_and_receiving_unframed_empty_pdu_llid_0b01_cis(transport, central, peripheral, trace, bn, nse): 590 return peripheral_sending_and_receiving_unframed_empty_pdu_llid_0b01_cis(transport, peripheral, central, trace, bn, 591 nse) 592 593 594def ial_cis_unf_per_bv_01_c(transport, upper_tester, lower_tester, trace): 595 """IAL/CIS/UNF/PER/BV-01-C""" 596 params = SetCIGParameters( 597 Framing = 0, 598 NSE = 3, 599 BN_P_To_C = 2, 600 FT_P_To_C = 1, 601 # Max_PDU_P_To_C = default, 602 BN_C_To_P = 0, 603 # FT_C_To_P = N/A, 604 # Max_PDU_C_To_P = N/A, 605 SDU_Interval_P_To_C = 0x186A, # 6.25 ms 606 # SDU_Interval_C_To_P = N/A, 607 ISO_Interval = 0x0A, # 12,5 ms 608 Max_SDU_Supported = 100, # Force Max SDU to be 100 bytes 609 ) 610 611 return peripheral_send_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 612 613 614def ial_cis_unf_per_bv_04_c(transport, upper_tester, lower_tester, trace): 615 """IAL/CIS/UNF/PER/BV-04-C""" 616 params = SetCIGParameters( 617 NSE = 4, 618 Framing = 0, 619 BN_P_To_C = 3, 620 FT_P_To_C = 2, 621 BN_C_To_P = 0, 622 SDU_Interval_P_To_C = 0x61A8, # 25 ms 623 ISO_Interval = 0x14, # 25 ms 624 ) 625 626 return peripheral_send_large_sdu_cis(transport, upper_tester, lower_tester, trace, params) 627 628 629def ial_cis_unf_per_bv_17_c(transport, upper_tester, lower_tester, trace): 630 """IAL/CIS/UNF/PER/BV-17-C""" 631 params = SetCIGParameters( 632 Framing = 0, 633 NSE = 7, 634 BN_P_To_C = 3, 635 FT_P_To_C = 4, 636 BN_C_To_P = 0, 637 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 638 SDU_Interval_C_To_P = 10000, 639 SDU_Interval_P_To_C = 10000, 640 ISO_Interval = int(10 // 1.25), 641 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 642 # and to 0 when BN in the corresponding direction is 0. 643 Max_PDU_C_To_P = 0, 644 Max_PDU_P_To_C = 20, 645 ) 646 647 return peripheral_send_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 648 649 650def ial_cis_unf_per_bv_21_c(transport, upper_tester, lower_tester, trace): 651 """IAL/CIS/UNF/PER/BV-21-C""" 652 params = SetCIGParameters( 653 NSE = 2, 654 Framing = 0, 655 FT_P_To_C = 1, 656 BN_P_To_C = 1, 657 FT_C_To_P = 1, 658 BN_C_To_P = 1, 659 ) 660 661 return peripheral_simultanous_sending_and_receiving_sdus(transport, upper_tester, lower_tester, trace, params) 662 663 664def ial_cis_fra_per_bv_22_c(transport, upper_tester, lower_tester, trace): 665 """IAL/CIS/FRA/PER/BV-22-C""" 666 params = SetCIGParameters( 667 NSE = 5, 668 Framing = 1, 669 BN_P_To_C = 1, 670 FT_P_To_C = 2, 671 BN_C_To_P = 3, 672 FT_C_To_P = 3, 673 ) 674 675 return peripheral_simultanous_sending_and_receiving_sdus(transport, upper_tester, lower_tester, trace, params) 676 677 678def ial_cis_unf_per_bv_24_c(transport, upper_tester, lower_tester, trace): 679 """IAL/CIS/UNF/PER/BV-24-C""" 680 params = SetCIGParameters( 681 NSE = 3, 682 Framing = 0, 683 BN_P_To_C = 1, 684 FT_P_To_C = 2, 685 BN_C_To_P = 2, 686 FT_C_To_P = 3, 687 ) 688 689 return peripheral_simultanous_sending_and_receiving_sdus(transport, upper_tester, lower_tester, trace, params) 690 691 692def ial_cis_unf_per_bv_25_c(transport, upper_tester, lower_tester, trace): 693 """IAL/CIS/UNF/PER/BV-25-C""" 694 params = SetCIGParameters( 695 Framing = 0, 696 NSE = 5, 697 BN_P_To_C = 1, 698 FT_P_To_C = 2, 699 # Max_PDU_P_To_C = default, 700 BN_C_To_P = 3, 701 FT_C_To_P = 3, 702 # Max_PDU_C_To_P = default, 703 SDU_Interval_C_To_P = 0x7530, # 30 ms 704 SDU_Interval_P_To_C = 0x7530, # 30 ms 705 ISO_Interval = 0x18, # 30 ms 706 Max_SDU_Supported = 125, # Force Max SDU to be 125 bytes 707 ) 708 709 return peripheral_send_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 710 711 712def ial_cis_unf_per_bv_28_c(transport, upper_tester, lower_tester, trace): 713 """IAL/CIS/UNF/PER/BV-28-C""" 714 params = SetCIGParameters( 715 NSE = 5, 716 Framing = 0, 717 BN_P_To_C = 3, 718 FT_P_To_C = 3, 719 BN_C_To_P = 0, 720 SDU_Interval_P_To_C = 0x88B8, # 35 ms 721 ISO_Interval = 0x1C, # 35 ms 722 ) 723 724 return peripheral_send_large_sdu_cis(transport, upper_tester, lower_tester, trace, params) 725 726 727def ial_cis_unf_per_bv_41_c(transport, upper_tester, lower_tester, trace): 728 """IAL/CIS/UNF/PER/BV-41-C""" 729 params = SetCIGParameters( 730 Framing = 0, 731 NSE = 2, 732 BN_P_To_C = 1, 733 FT_P_To_C = 3, 734 BN_C_To_P = 1, 735 FT_C_To_P = 2, 736 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 737 SDU_Interval_C_To_P = 10000, 738 SDU_Interval_P_To_C = 10000, 739 ISO_Interval = int(10 // 1.25), 740 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 741 # and to 0 when BN in the corresponding direction is 0. 742 Max_PDU_C_To_P = 20, 743 Max_PDU_P_To_C = 20, 744 ) 745 746 return peripheral_send_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 747 748 749def ial_cis_unf_per_bv_45_c(transport, upper_tester, lower_tester, trace): 750 """IAL/CIS/UNF/PER/BV-45-C""" 751 return peripheral_sending_and_receiving_unframed_empty_pdu_llid_0b01_cis(transport, upper_tester, lower_tester, 752 trace, 0x04, 0x08) 753 754 755def ial_cis_unf_per_bv_46_c(transport, upper_tester, lower_tester, trace): 756 """IAL/CIS/UNF/PER/BV-46-C""" 757 return peripheral_sending_and_receiving_unframed_empty_pdu_llid_0b01_cis(transport, upper_tester, lower_tester, 758 trace, 0x06, 0x0c) 759 760 761def ial_cis_unf_per_bv_47_c(transport, upper_tester, lower_tester, trace): 762 """IAL/CIS/UNF/PER/BV-47-C""" 763 params = SetCIGParameters( 764 Framing = 0, 765 NSE = 1, 766 BN_P_To_C = 1, 767 FT_P_To_C = 1, 768 # Max_PDU_P_To_C = default, 769 BN_C_To_P = 1, 770 FT_C_To_P = 1, 771 # Max_PDU_C_To_P = default, 772 SDU_Interval_P_To_C = 0x4E20, # 20 ms 773 SDU_Interval_C_To_P = 0x4E20, # 20 ms 774 ISO_Interval = 0x10, # 20 ms 775 Max_SDU_Supported = 251, # Force Max SDU to be 251 bytes 776 ) 777 778 return peripheral_send_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 779 780 781def ial_cis_unf_per_bv_49_c(transport, upper_tester, lower_tester, trace): 782 """IAL/CIS/UNF/PER/BV-49-C""" 783 params = SetCIGParameters( 784 Framing = 0, 785 NSE = 1, 786 BN_P_To_C = 1, 787 FT_P_To_C = 1, 788 BN_C_To_P = 1, 789 FT_C_To_P = 1, 790 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 791 SDU_Interval_C_To_P = 10000, 792 SDU_Interval_P_To_C = 10000, 793 ISO_Interval = int(10 // 1.25), 794 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 795 # and to 0 when BN in the corresponding direction is 0. 796 Max_PDU_C_To_P = 20, 797 Max_PDU_P_To_C = 20, 798 ) 799 800 return peripheral_send_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 801 802 803def ial_cis_fra_per_bv_03_c(transport, upper_tester, lower_tester, trace): 804 """IAL/CIS/FRA/PER/BV-03-C""" 805 params = SetCIGParameters( 806 Framing = 1, 807 NSE = 4, 808 BN_P_To_C = 2, 809 FT_P_To_C = 2, 810 # Max_PDU_P_To_C = default, 811 BN_C_To_P = 0, 812 # FT_C_To_P = N/A, 813 # Max_PDU_C_To_P = N/A, 814 SDU_Interval_P_To_C = 0x4E20, # 20 ms 815 # SDU_Interval_C_To_P = N/A, 816 ISO_Interval = 0x14, # 25 ms 817 Max_SDU_Supported = 192, # Force Max SDU to be 192 bytes 818 ) 819 820 return peripheral_send_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 821 822 823def ial_cis_fra_per_bv_05_c(transport, upper_tester, lower_tester, trace): 824 """IAL/CIS/FRA/PER/BV-05-C""" 825 params = SetCIGParameters ( 826 NSE = 8, 827 Framing = 1, 828 BN_P_To_C = 5, 829 FT_P_To_C = 2, 830 BN_C_To_P = 0, 831 SDU_Interval_P_To_C = 0x61A8, # 25 ms 832 ISO_Interval = 0x28, # 50 ms 833 ) 834 835 return peripheral_send_large_sdu_cis(transport, upper_tester, lower_tester, trace, params) 836 837 838def ial_cis_fra_per_bv_07_c(transport, upper_tester, lower_tester, trace): 839 """IAL/CIS/FRA/PER/BV-07-C""" 840 params = SetCIGParameters( 841 Framing = 1, 842 NSE = 2, 843 BN_P_To_C = 1, 844 FT_P_To_C = 1, 845 BN_C_To_P = 0, 846 SDU_Interval_C_To_P = 0x7A120, # 500 ms 847 SDU_Interval_P_To_C = 0x7A120, # 500 ms 848 ISO_Interval = 0x320, # 1000 ms 849 Max_PDU_C_To_P = 0, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 850 Max_PDU_P_To_C = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 851 Max_SDU_Supported = 25, # NOTE: Max_SDU is set to 25 when the corresponding BN is not 0 852 ) 853 854 return peripheral_send_multiple_small_sdu_cis(transport, upper_tester, lower_tester, trace, params) 855 856 857def ial_cis_fra_per_bv_18_c(transport, upper_tester, lower_tester, trace): 858 """IAL/CIS/FRA/PER/BV-18-C""" 859 params = SetCIGParameters( 860 Framing = 1, 861 NSE = 2, 862 BN_P_To_C = 1, 863 FT_P_To_C = 4, 864 BN_C_To_P = 0, 865 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 866 SDU_Interval_C_To_P = 10000, 867 SDU_Interval_P_To_C = 10000, 868 ISO_Interval = int(10 // 1.25), 869 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 870 # and to 0 when BN in the corresponding direction is 0. 871 Max_PDU_C_To_P = 0, 872 Max_PDU_P_To_C = 20, 873 ) 874 875 return peripheral_send_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 876 877 878def ial_cis_fra_per_bv_26_c(transport, upper_tester, lower_tester, trace): 879 """IAL/CIS/FRA/PER/BV-26-C""" 880 params = SetCIGParameters( 881 Framing = 1, 882 NSE = 2, 883 BN_P_To_C = 1, 884 FT_P_To_C = 1, 885 Max_PDU_P_To_C = 208, 886 BN_C_To_P = 1, 887 FT_C_To_P = 1, 888 Max_PDU_C_To_P = 208, 889 SDU_Interval_P_To_C = 0x14D5, # 5.333 ms 890 SDU_Interval_C_To_P = 0x14D5, # 5.333 ms 891 ISO_Interval = 0x08, # 10 ms 892 Max_SDU_Supported = 102, # Force Max SDU to be 102 bytes 893 ) 894 895 return peripheral_send_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 896 897 898def ial_cis_fra_per_bv_29_c(transport, upper_tester, lower_tester, trace): 899 """IAL/CIS/FRA/PER/BV-29-C""" 900 params = SetCIGParameters( 901 NSE = 6, 902 Framing = 1, 903 BN_P_To_C = 4, 904 FT_P_To_C = 2, 905 BN_C_To_P = 4, 906 FT_C_To_P = 3, 907 SDU_Interval_C_To_P = 0x55F0, # 22 ms 908 SDU_Interval_P_To_C = 0x55F0, # 22 ms 909 ISO_Interval = 0x1C, # 35 ms 910 ) 911 912 return peripheral_send_large_sdu_cis(transport, upper_tester, lower_tester, trace, params) 913 914 915def ial_cis_fra_per_bv_31_c(transport, upper_tester, lower_tester, trace): 916 """IAL/CIS/FRA/PER/BV-31-C""" 917 params = SetCIGParameters( 918 Framing = 1, 919 NSE = 4, 920 BN_P_To_C = 2, 921 FT_P_To_C = 1, 922 BN_C_To_P = 2, 923 FT_C_To_P = 2, 924 SDU_Interval_C_To_P = 0xF4240, # 1000 ms 925 SDU_Interval_P_To_C = 0xF4240, # 1000 ms 926 ISO_Interval = 0x640, # 2000 ms 927 Max_PDU_C_To_P = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 928 Max_PDU_P_To_C = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 929 Max_SDU_Supported = 25, # NOTE: Max_SDU is set to 25 when the corresponding BN is not 0 930 ) 931 932 return peripheral_send_multiple_small_sdu_cis(transport, upper_tester, lower_tester, trace, params) 933 934 935def ial_cis_fra_per_bv_42_c(transport, upper_tester, lower_tester, trace): 936 """IAL/CIS/FRA/PER/BV-42-C""" 937 params = SetCIGParameters( 938 Framing = 1, 939 NSE = 5, 940 BN_P_To_C = 1, 941 FT_P_To_C = 2, 942 BN_C_To_P = 3, 943 FT_C_To_P = 3, 944 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 945 SDU_Interval_C_To_P = 10000, 946 SDU_Interval_P_To_C = 10000, 947 ISO_Interval = int(10 // 1.25), 948 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 949 # and to 0 when BN in the corresponding direction is 0. 950 Max_PDU_C_To_P = 20, 951 Max_PDU_P_To_C = 20, 952 ) 953 954 return peripheral_send_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 955 956 957def ial_cis_fra_per_bv_45_c(transport, upper_tester, lower_tester, trace): 958 """IAL/CIS/FRA/PER/BV-45-C""" 959 params = SetCIGParameters( 960 Framing = 1, 961 NSE = 1, 962 BN_P_To_C = 1, 963 FT_P_To_C = 1, 964 # Max_PDU_P_To_C = default, 965 BN_C_To_P = 1, 966 FT_C_To_P = 1, 967 # Max_PDU_C_To_P = default, 968 SDU_Interval_P_To_C = 0x2710, # 10 ms 969 SDU_Interval_C_To_P = 0x2710, # 10 ms 970 ISO_Interval = 0x08, # 10 ms 971 Max_SDU_Supported = 192, # Force Max SDU to be 192 bytes 972 ) 973 974 return peripheral_send_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 975 976 977def ial_cis_fra_per_bv_46_c(transport, upper_tester, lower_tester, trace): 978 """IAL/CIS/FRA/PER/BV-46-C""" 979 params = SetCIGParameters( 980 NSE = 1, 981 Framing = 1, 982 BN_P_To_C = 1, 983 FT_P_To_C = 1, 984 BN_C_To_P = 1, 985 FT_C_To_P = 1, 986 SDU_Interval_C_To_P = 0x7530, # 30 ms 987 SDU_Interval_P_To_C = 0x7530, # 30 ms 988 ISO_Interval = 0x08, # 10 ms 989 ) 990 991 return peripheral_send_large_sdu_cis(transport, upper_tester, lower_tester, trace, params) 992 993 994def ial_cis_fra_per_bv_47_c(transport, upper_tester, lower_tester, trace): 995 """IAL/CIS/FRA/PER/BV-47-C""" 996 params = SetCIGParameters( 997 Framing = 1, 998 NSE = 1, 999 BN_P_To_C = 1, 1000 FT_P_To_C = 1, 1001 BN_C_To_P = 1, 1002 FT_C_To_P = 1, 1003 SDU_Interval_C_To_P = 0x7A120, # 500 ms 1004 SDU_Interval_P_To_C = 0x7A120, # 500 ms 1005 ISO_Interval = 0x320, # 1000 ms 1006 Max_PDU_C_To_P = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1007 Max_PDU_P_To_C = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1008 Max_SDU_Supported = 25, # NOTE: Max_SDU is set to 25 when the corresponding BN is not 0 1009 ) 1010 1011 return peripheral_send_multiple_small_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1012 1013 1014def ial_cis_fra_per_bv_51_c(transport, upper_tester, lower_tester, trace): 1015 """IAL/CIS/FRA/PER/BV-51-C""" 1016 params = SetCIGParameters( 1017 Framing = 1, 1018 NSE = 1, 1019 BN_P_To_C = 1, 1020 FT_P_To_C = 1, 1021 BN_C_To_P = 1, 1022 FT_C_To_P = 1, 1023 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 1024 SDU_Interval_C_To_P = 10000, 1025 SDU_Interval_P_To_C = 10000, 1026 ISO_Interval = int(10 // 1.25), 1027 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 1028 # and to 0 when BN in the corresponding direction is 0. 1029 Max_PDU_C_To_P = 20, 1030 Max_PDU_P_To_C = 20, 1031 ) 1032 1033 return peripheral_send_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1034 1035 1036def ial_cis_fra_per_bv_10_c(transport, upper_tester, lower_tester, trace): 1037 """IAL/CIS/FRA/PER/BV-10-C""" 1038 params = SetCIGParameters( 1039 Framing = 1, 1040 NSE = 7, 1041 BN_P_To_C = 0, 1042 # FT_P_To_C = N/A, 1043 BN_C_To_P = 3, 1044 FT_C_To_P = 4, 1045 SDU_Interval_P_To_C = 0x9C40, # 40 ms 1046 SDU_Interval_C_To_P = 0x9C40, # 40 ms 1047 ISO_Interval = 0x20, # 40 ms 1048 Max_PDU_P_To_C = 0, 1049 Max_PDU_C_To_P = 251, 1050 Max_SDU_Supported = 251, # Force Max SDU to be 251 bytes 1051 ) 1052 1053 return peripheral_receive_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1054 1055 1056def ial_cis_fra_per_bv_35_c(transport, upper_tester, lower_tester, trace): 1057 """IAL/CIS/FRA/PER/BV-35-C""" 1058 params = SetCIGParameters( 1059 Framing = 1, 1060 NSE = 4, 1061 BN_P_To_C = 0, 1062 # FT_P_To_C = N/A, 1063 BN_C_To_P = 3, 1064 FT_C_To_P = 3, 1065 SDU_Interval_P_To_C = 0x2710, # 10 ms 1066 SDU_Interval_C_To_P = 0x2710, # 10 ms 1067 ISO_Interval = 0x10, # 20 ms 1068 Max_PDU_P_To_C = 0, 1069 Max_PDU_C_To_P = 251, 1070 Max_SDU_Supported = 251, # Force Max SDU to be 251 bytes 1071 ) 1072 1073 return peripheral_receive_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1074 1075 1076def ial_cis_fra_per_bv_48_c(transport, upper_tester, lower_tester, trace): 1077 """IAL/CIS/FRA/PER/BV-48-C""" 1078 params = SetCIGParameters( 1079 Framing = 1, 1080 NSE = 1, 1081 BN_P_To_C = 1, 1082 FT_P_To_C = 1, 1083 BN_C_To_P = 1, 1084 FT_C_To_P = 1, 1085 SDU_Interval_P_To_C = 0x7530, # 30 ms 1086 SDU_Interval_C_To_P = 0x7530, # 30 ms 1087 ISO_Interval = 0x18, # 30 ms 1088 Max_PDU_P_To_C = 251, 1089 Max_PDU_C_To_P = 251, 1090 Max_SDU_Supported = 251, # Force Max SDU to be 251 bytes 1091 ) 1092 1093 return peripheral_receive_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1094 1095 1096def ial_cis_fra_per_bv_13_c(transport, upper_tester, lower_tester, trace): 1097 """IAL/CIS/FRA/PER/BV-13-C""" 1098 params = SetCIGParameters ( 1099 NSE = 6, 1100 Framing = 1, 1101 BN_P_To_C = 0, 1102 # FT_P_To_C = N/A, 1103 BN_C_To_P = 4, 1104 FT_C_To_P = 1, 1105 # SDU_Interval_P_To_C = N/A, 1106 SDU_Interval_C_To_P = 0x4E20, # 20 ms 1107 ISO_Interval = 0x14, # 25 ms 1108 ) 1109 1110 return peripheral_receive_large_sdu_cis_framed(transport, upper_tester, lower_tester, trace, params) 1111 1112 1113def ial_cis_fra_per_bv_38_c(transport, upper_tester, lower_tester, trace): 1114 """IAL/CIS/FRA/PER/BV-38-C""" 1115 params = SetCIGParameters ( 1116 NSE = 7, 1117 Framing = 1, 1118 BN_P_To_C = 4, 1119 FT_P_To_C = 1, 1120 BN_C_To_P = 4, 1121 FT_C_To_P = 2, 1122 SDU_Interval_P_To_C = 0x9C40, # 40 ms 1123 SDU_Interval_C_To_P = 0x9C40, # 40 ms 1124 ISO_Interval = 0x20, # 40 ms 1125 ) 1126 1127 return peripheral_receive_large_sdu_cis_framed(transport, upper_tester, lower_tester, trace, params) 1128 1129 1130def ial_cis_fra_per_bv_49_c(transport, upper_tester, lower_tester, trace): 1131 """IAL/CIS/FRA/PER/BV-49-C""" 1132 params = SetCIGParameters ( 1133 NSE = 1, 1134 Framing = 1, 1135 BN_P_To_C = 1, 1136 FT_P_To_C = 1, 1137 BN_C_To_P = 1, 1138 FT_C_To_P = 1, 1139 SDU_Interval_P_To_C = 0x30D40, # 200 ms 1140 SDU_Interval_C_To_P = 0x30D40, # 200 ms 1141 ISO_Interval = 0x28, # 50 ms 1142 ) 1143 1144 return peripheral_receive_large_sdu_cis_framed(transport, upper_tester, lower_tester, trace, params) 1145 1146 1147def ial_cis_fra_per_bv_15_c(transport, upper_tester, lower_tester, trace): 1148 """IAL/CIS/FRA/PER/BV-15-C""" 1149 params = SetCIGParameters( 1150 Framing = 1, 1151 NSE = 2, 1152 BN_P_To_C = 0, 1153 # FT_P_To_C = N/A, 1154 BN_C_To_P = 1, 1155 FT_C_To_P = 4, 1156 SDU_Interval_C_To_P = 0x2710, # 10 ms 1157 SDU_Interval_P_To_C = 0x2710, # 10 ms 1158 ISO_Interval = 0x04, # 5 ms 1159 Max_PDU_C_To_P = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1160 Max_PDU_P_To_C = 0, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1161 Max_SDU_Supported = 25, # NOTE: Max_SDU is set to 25 when the corresponding BN is not 0 1162 ) 1163 1164 return peripheral_receive_multiple_small_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1165 1166 1167def ial_cis_fra_per_bv_39_c(transport, upper_tester, lower_tester, trace): 1168 """IAL/CIS/FRA/PER/BV-39-C""" 1169 params = SetCIGParameters( 1170 Framing = 1, 1171 NSE = 7, 1172 BN_P_To_C = 0, 1173 # FT_P_To_C = N/A, 1174 BN_C_To_P = 3, 1175 FT_C_To_P = 4, 1176 SDU_Interval_C_To_P = 0x2710, # 10 ms 1177 SDU_Interval_P_To_C = 0x2710, # 10 ms 1178 ISO_Interval = 0x08, # 10 ms 1179 Max_PDU_C_To_P = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1180 Max_PDU_P_To_C = 0, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1181 Max_SDU_Supported = 25, # NOTE: Max_SDU is set to 25 when the corresponding BN is not 0 1182 ) 1183 1184 return peripheral_receive_multiple_small_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1185 1186 1187def ial_cis_fra_per_bv_50_c(transport, upper_tester, lower_tester, trace): 1188 """IAL/CIS/FRA/PER/BV-50-C""" 1189 params = SetCIGParameters( 1190 Framing = 1, 1191 NSE = 1, 1192 BN_P_To_C = 1, 1193 FT_P_To_C = 1, 1194 BN_C_To_P = 1, 1195 FT_C_To_P = 1, 1196 SDU_Interval_C_To_P = 0x2710, # 10 ms 1197 SDU_Interval_P_To_C = 0x2710, # 10 ms 1198 ISO_Interval = 0x10, # 20 ms 1199 Max_PDU_C_To_P = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1200 Max_PDU_P_To_C = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1201 Max_SDU_Supported = 25, # NOTE: Max_SDU is set to 25 when the corresponding BN is not 0 1202 ) 1203 1204 return peripheral_receive_multiple_small_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1205 1206 1207def ial_cis_fra_per_bv_20_c(transport, upper_tester, lower_tester, trace): 1208 """IAL/CIS/FRA/PER/BV-20-C""" 1209 params = SetCIGParameters( 1210 Framing = 1, 1211 NSE = 5, 1212 BN_P_To_C = 0, 1213 # FT_P_To_C = N/A, 1214 BN_C_To_P = 2, 1215 FT_C_To_P = 2, 1216 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 1217 SDU_Interval_C_To_P = 10000, 1218 SDU_Interval_P_To_C = 10000, 1219 ISO_Interval = int(10 // 1.25), 1220 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 1221 # and to 0 when BN in the corresponding direction is 0. 1222 Max_PDU_C_To_P = 20, 1223 Max_PDU_P_To_C = 0, 1224 ) 1225 1226 return peripheral_receive_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1227 1228 1229def ial_cis_fra_per_bv_44_c(transport, upper_tester, lower_tester, trace): 1230 """IAL/CIS/FRA/PER/BV-44-C""" 1231 params = SetCIGParameters( 1232 Framing = 0x01, 1233 NSE = 2, 1234 BN_P_To_C = 1, 1235 FT_P_To_C = 1, 1236 BN_C_To_P = 1, 1237 FT_C_To_P = 1, 1238 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 1239 SDU_Interval_C_To_P = 10000, 1240 SDU_Interval_P_To_C = 10000, 1241 ISO_Interval = int(10 // 1.25), 1242 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 1243 # and to 0 when BN in the corresponding direction is 0. 1244 Max_PDU_C_To_P = 20, 1245 Max_PDU_P_To_C = 20, 1246 ) 1247 1248 return peripheral_receive_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1249 1250 1251def ial_cis_fra_per_bv_52_c(transport, upper_tester, lower_tester, trace): 1252 """IAL/CIS/FRA/PER/BV-52-C""" 1253 params = SetCIGParameters( 1254 Framing = 0x01, 1255 NSE = 1, 1256 BN_P_To_C = 1, 1257 FT_P_To_C = 1, 1258 BN_C_To_P = 1, 1259 FT_C_To_P = 1, 1260 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 1261 SDU_Interval_C_To_P = 10000, 1262 SDU_Interval_P_To_C = 10000, 1263 ISO_Interval = int(10 // 1.25), 1264 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 1265 # and to 0 when BN in the corresponding direction is 0. 1266 Max_PDU_C_To_P = 20, 1267 Max_PDU_P_To_C = 20, 1268 ) 1269 1270 return peripheral_receive_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1271 1272 1273def ial_cis_unf_per_bv_09_c(transport, upper_tester, lower_tester, trace): 1274 """IAL/CIS/UNF/PER/BV-09-C""" 1275 params = SetCIGParameters( 1276 Framing = 0, 1277 NSE = 2, 1278 BN_P_To_C = 0, 1279 # FT_P_To_C = N/A, 1280 BN_C_To_P = 1, 1281 FT_C_To_P = 1, 1282 SDU_Interval_P_To_C = 0x3A98, # 15 ms 1283 SDU_Interval_C_To_P = 0x3A98, # 15 ms 1284 ISO_Interval = 0x0C, # 15 ms 1285 Max_PDU_P_To_C = 0, 1286 Max_PDU_C_To_P = 251, 1287 Max_SDU_Supported = 251, # Force Max SDU to be 251 bytes 1288 ) 1289 1290 return peripheral_receive_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1291 1292 1293def ial_cis_unf_per_bv_33_c(transport, upper_tester, lower_tester, trace): 1294 """IAL/CIS/UNF/PER/BV-33-C""" 1295 params = SetCIGParameters( 1296 Framing = 0, 1297 NSE = 4, 1298 BN_P_To_C = 3, 1299 FT_P_To_C = 1, 1300 BN_C_To_P = 3, 1301 FT_C_To_P = 1, 1302 SDU_Interval_P_To_C = 0x2710, # 10 ms 1303 SDU_Interval_C_To_P = 0x2710, # 10 ms 1304 ISO_Interval = 0x18, # 30 ms 1305 Max_PDU_P_To_C = 251, 1306 Max_PDU_C_To_P = 251, 1307 Max_SDU_Supported = 251, # Force Max SDU to be 251 bytes 1308 ) 1309 1310 return peripheral_receive_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1311 1312 1313def ial_cis_unf_per_bv_48_c(transport, upper_tester, lower_tester, trace): 1314 """IAL/CIS/UNF/PER/BV-48-C""" 1315 params = SetCIGParameters( 1316 Framing = 0, 1317 NSE = 1, 1318 BN_P_To_C = 1, 1319 FT_P_To_C = 1, 1320 BN_C_To_P = 1, 1321 FT_C_To_P = 1, 1322 SDU_Interval_P_To_C = 0x2710, # 10 ms 1323 SDU_Interval_C_To_P = 0x2710, # 10 ms 1324 ISO_Interval = 0x08, # 10 ms 1325 Max_PDU_P_To_C = 251, 1326 Max_PDU_C_To_P = 251, 1327 Max_SDU_Supported = 251, # Force Max SDU to be 251 bytes 1328 ) 1329 1330 return peripheral_receive_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1331 1332 1333def ial_cis_unf_per_bv_12_c(transport, upper_tester, lower_tester, trace): 1334 """IAL/CIS/UNF/PER/BV-12-C""" 1335 params = SetCIGParameters ( 1336 NSE = 10, 1337 Framing = 0, 1338 BN_P_To_C = 0, 1339 # FT_P_To_C = N/A, 1340 BN_C_To_P = 8, 1341 FT_C_To_P = 2, 1342 # SDU_Interval_P_To_C = N/A, 1343 SDU_Interval_C_To_P = 0x4E20, # 20 ms 1344 ISO_Interval = 0x20, # 40 ms 1345 ) 1346 1347 return peripheral_receive_large_sdu_cis_unframed(transport, upper_tester, lower_tester, trace, params) 1348 1349 1350def ial_cis_unf_per_bv_36_c(transport, upper_tester, lower_tester, trace): 1351 """IAL/CIS/UNF/PER/BV-36-C""" 1352 params = SetCIGParameters ( 1353 NSE = 6, 1354 Framing = 0, 1355 BN_P_To_C = 0, 1356 # FT_P_To_C = N/A, 1357 BN_C_To_P = 4, 1358 FT_C_To_P = 3, 1359 # SDU_Interval_P_To_C = N/A, 1360 SDU_Interval_C_To_P = 0x61A8, # 25 ms 1361 ISO_Interval = 0x14, # 25 ms 1362 ) 1363 1364 return peripheral_receive_large_sdu_cis_unframed(transport, upper_tester, lower_tester, trace, params) 1365 1366 1367def ial_cis_unf_per_bv_19_c(transport, upper_tester, lower_tester, trace): 1368 """IAL/CIS/UNF/PER/BV-19-C""" 1369 params = SetCIGParameters( 1370 Framing = 0, 1371 NSE = 4, 1372 BN_P_To_C = 0, 1373 # FT_P_To_C = N/A, 1374 BN_C_To_P = 2, 1375 FT_C_To_P = 2, 1376 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 1377 SDU_Interval_C_To_P = 10000, 1378 SDU_Interval_P_To_C = 10000, 1379 ISO_Interval = int(10 // 1.25), 1380 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 1381 # and to 0 when BN in the corresponding direction is 0. 1382 Max_PDU_C_To_P = 20, 1383 Max_PDU_P_To_C = 0, 1384 ) 1385 1386 return peripheral_receive_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1387 1388 1389def ial_cis_unf_per_bv_43_c(transport, upper_tester, lower_tester, trace): 1390 """IAL/CIS/UNF/PER/BV-43-C""" 1391 params = SetCIGParameters( 1392 Framing = 0, 1393 NSE = 1, 1394 BN_P_To_C = 0, 1395 # FT_P_To_C = N/A, 1396 BN_C_To_P = 1, 1397 FT_C_To_P = 1, 1398 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 1399 SDU_Interval_C_To_P = 10000, 1400 SDU_Interval_P_To_C = 10000, 1401 ISO_Interval = int(10 // 1.25), 1402 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 1403 # and to 0 when BN in the corresponding direction is 0. 1404 Max_PDU_C_To_P = 20, 1405 Max_PDU_P_To_C = 0, 1406 ) 1407 1408 return peripheral_receive_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1409 1410 1411def ial_cis_unf_cen_bv_01_c(transport, upper_tester, lower_tester, trace): 1412 """IAL/CIS/UNF/CEN/BV-01-C""" 1413 params = SetCIGParameters( 1414 Framing = 0, 1415 NSE = 2, 1416 BN_P_To_C = 0, 1417 # FT_P_To_C = N/A, 1418 # Max_PDU_P_To_C = N/A, 1419 BN_C_To_P = 1, 1420 FT_C_To_P = 1, 1421 # Max_PDU_C_To_P = default, 1422 # SDU_Interval_P_To_C = N/A, 1423 SDU_Interval_C_To_P = 0x3A98, # 15 ms 1424 ISO_Interval = 0x0C, # 15 ms 1425 Max_SDU_Supported = 251, # Force Max SDU to be 251 bytes 1426 ) 1427 1428 return central_send_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1429 1430 1431def ial_cis_unf_cen_bv_25_c(transport, upper_tester, lower_tester, trace): 1432 """IAL/CIS/UNF/CEN/BV-25-C""" 1433 params = SetCIGParameters( 1434 Framing = 0, 1435 NSE = 4, 1436 BN_P_To_C = 3, 1437 FT_P_To_C = 1, 1438 Max_PDU_P_To_C = 180, 1439 BN_C_To_P = 1, 1440 FT_C_To_P = 1, 1441 Max_PDU_C_To_P = 180, 1442 SDU_Interval_P_To_C = 0x1388, # 5 ms 1443 SDU_Interval_C_To_P = 0x3A98, # 15 ms 1444 ISO_Interval = 0x0C, # 15 ms 1445 Max_SDU_Supported = 83, # Force Max SDU to be 83 bytes 1446 ) 1447 1448 return central_send_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1449 1450 1451def ial_cis_fra_cen_bv_03_c(transport, upper_tester, lower_tester, trace): 1452 """IAL/CIS/FRA/CEN/BV-03-C""" 1453 params = SetCIGParameters( 1454 Framing = 1, 1455 NSE = 7, 1456 BN_P_To_C = 0, 1457 # FT_P_To_C = N/A, 1458 # Max_PDU_P_To_C = N/A, 1459 BN_C_To_P = 3, 1460 FT_C_To_P = 4, 1461 # Max_PDU_C_To_P = default, 1462 # SDU_Interval_P_To_C = N/A, 1463 SDU_Interval_C_To_P = 0x9C40, # 40 ms 1464 ISO_Interval = 0x20, # 40 ms 1465 Max_SDU_Supported = 180, # Force Max SDU to be 180 bytes 1466 ) 1467 1468 return central_send_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1469 1470 1471def ial_cis_fra_cen_bv_26_c(transport, upper_tester, lower_tester, trace): 1472 """IAL/CIS/FRA/CEN/BV-26-C""" 1473 params = SetCIGParameters( 1474 Framing = 1, 1475 NSE = 3, 1476 BN_P_To_C = 1, 1477 FT_P_To_C = 2, 1478 # Max_PDU_P_To_C = default, 1479 BN_C_To_P = 2, 1480 FT_C_To_P = 3, 1481 # Max_PDU_C_To_P = default, 1482 SDU_Interval_P_To_C = 0x4E20, # 20 ms 1483 SDU_Interval_C_To_P = 0x2710, # 10 ms 1484 ISO_Interval = 0x10, # 20 ms 1485 Max_SDU_Supported = 78, # Force Max SDU to be 78 bytes 1486 ) 1487 1488 return central_send_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1489 1490 1491def ial_cis_unf_cen_bv_46_c(transport, upper_tester, lower_tester, trace): 1492 """IAL/CIS/UNF/CEN/BV-46-C""" 1493 params = SetCIGParameters( 1494 Framing = 0, 1495 NSE = 1, 1496 BN_P_To_C = 1, 1497 FT_P_To_C = 1, 1498 # Max_PDU_P_To_C = default, 1499 BN_C_To_P = 1, 1500 FT_C_To_P = 1, 1501 # Max_PDU_C_To_P = default, 1502 SDU_Interval_P_To_C = 0x2710, # 10 ms 1503 SDU_Interval_C_To_P = 0x2710, # 10 ms 1504 ISO_Interval = 0x08, # 10 ms 1505 Max_SDU_Supported = 192, # Force Max SDU to be 192 bytes 1506 ) 1507 1508 return central_send_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1509 1510 1511def ial_cis_fra_cen_bv_45_c(transport, upper_tester, lower_tester, trace): 1512 """IAL/CIS/FRA/CEN/BV-45-C""" 1513 params = SetCIGParameters( 1514 Framing = 1, 1515 NSE = 1, 1516 BN_P_To_C = 1, 1517 FT_P_To_C = 1, 1518 # Max_PDU_P_To_C = default, 1519 BN_C_To_P = 1, 1520 FT_C_To_P = 1, 1521 # Max_PDU_C_To_P = default, 1522 SDU_Interval_P_To_C = 0x4E20, # 20 ms 1523 SDU_Interval_C_To_P = 0x4E20, # 20 ms 1524 ISO_Interval = 0x10, # 20 ms 1525 Max_SDU_Supported = 180, # Force Max SDU to be 180 bytes 1526 ) 1527 1528 return central_send_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1529 1530 1531def ial_cis_unf_cen_bv_04_c(transport, upper_tester, lower_tester, trace): 1532 """IAL/CIS/UNF/CEN/BV-04-C""" 1533 params = SetCIGParameters( 1534 NSE = 8, 1535 Framing = 0, 1536 BN_P_To_C = 0, 1537 # FT_P_To_C = N/A, 1538 BN_C_To_P = 6, 1539 FT_C_To_P = 2, 1540 SDU_Interval_P_To_C = 0x4E20, # 20 ms 1541 SDU_Interval_C_To_P = 0x4E20, # 20 ms 1542 ISO_Interval = 0x20, # 40 ms 1543 ) 1544 1545 return central_send_large_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1546 1547 1548def ial_cis_unf_cen_bv_28_c(transport, upper_tester, lower_tester, trace): 1549 """IAL/CIS/UNF/CEN/BV-28-C""" 1550 params = SetCIGParameters( 1551 NSE = 4, 1552 Framing = 0, 1553 BN_P_To_C = 3, 1554 FT_P_To_C = 3, 1555 BN_C_To_P = 3, 1556 FT_C_To_P = 2, 1557 SDU_Interval_P_To_C = 0x61A8, # 25 ms 1558 SDU_Interval_C_To_P = 0x61A8, # 25 ms 1559 ISO_Interval = 0x14, # 25 ms 1560 ) 1561 1562 return central_send_large_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1563 1564 1565def ial_cis_fra_cen_bv_05_c(transport, upper_tester, lower_tester, trace): 1566 """IAL/CIS/FRA/CEN/BV-05-C""" 1567 params = SetCIGParameters( 1568 NSE = 5, 1569 Framing = 1, 1570 BN_P_To_C = 0, 1571 # FT_P_To_C = N/A, 1572 BN_C_To_P = 3, 1573 FT_C_To_P = 1, 1574 SDU_Interval_P_To_C = 0x4E20, # 20 ms 1575 SDU_Interval_C_To_P = 0x4E20, # 20 ms 1576 ISO_Interval = 0x14, # 25 ms 1577 ) 1578 1579 return central_send_large_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1580 1581 1582def ial_cis_fra_cen_bv_29_c(transport, upper_tester, lower_tester, trace): 1583 """IAL/CIS/FRA/CEN/BV-29-C""" 1584 params = SetCIGParameters( 1585 NSE = 4, 1586 Framing = 1, 1587 BN_P_To_C = 3, 1588 FT_P_To_C = 1, 1589 BN_C_To_P = 3, 1590 FT_C_To_P = 2, 1591 SDU_Interval_P_To_C = 0x9C40, # 40 ms 1592 SDU_Interval_C_To_P = 0x9C40, # 40 ms 1593 ISO_Interval = 0x20, # 40 ms 1594 ) 1595 1596 return central_send_large_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1597 1598 1599def ial_cis_fra_cen_bv_46_c(transport, upper_tester, lower_tester, trace): 1600 """IAL/CIS/FRA/CEN/BV-46-C""" 1601 params = SetCIGParameters( 1602 NSE = 1, 1603 Framing = 1, 1604 BN_P_To_C = 1, 1605 FT_P_To_C = 1, 1606 BN_C_To_P = 1, 1607 FT_C_To_P = 1, 1608 SDU_Interval_P_To_C = 0x7530, # 30 ms 1609 SDU_Interval_C_To_P = 0x7530, # 30 ms 1610 ISO_Interval = 0x08, # 10 ms 1611 ) 1612 1613 return central_send_large_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1614 1615 1616def ial_cis_fra_cen_bv_07_c(transport, upper_tester, lower_tester, trace): 1617 """IAL/CIS/FRA/CEN/BV-07-C""" 1618 params = SetCIGParameters( 1619 Framing = 1, 1620 NSE = 2, 1621 BN_P_To_C = 0, 1622 # FT_P_To_C = N/A, 1623 BN_C_To_P = 1, 1624 FT_C_To_P = 4, 1625 SDU_Interval_C_To_P = 0x7A120, # 500 ms 1626 SDU_Interval_P_To_C = 0x7A120, # 500 ms 1627 ISO_Interval = 0x320, # 1000 ms 1628 Max_PDU_C_To_P = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1629 Max_PDU_P_To_C = 0, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1630 Max_SDU_Supported = 25, # NOTE: Max_SDU is set to 25 when the corresponding BN is not 0 1631 ) 1632 1633 return central_send_multiple_small_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1634 1635 1636def ial_cis_fra_cen_bv_31_c(transport, upper_tester, lower_tester, trace): 1637 """IAL/CIS/FRA/CEN/BV-31-C""" 1638 params = SetCIGParameters( 1639 Framing = 1, 1640 NSE = 7, 1641 BN_P_To_C = 0, 1642 # FT_P_To_C = N/A, 1643 BN_C_To_P = 2, 1644 FT_C_To_P = 4, 1645 SDU_Interval_C_To_P = 0xF4240, # 1000 ms 1646 SDU_Interval_P_To_C = 0xF4240, # 1000 ms 1647 ISO_Interval = 0x640, # 2000 ms 1648 Max_PDU_C_To_P = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1649 Max_PDU_P_To_C = 0, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1650 Max_SDU_Supported = 25, # NOTE: Max_SDU is set to 25 when the corresponding BN is not 0 1651 ) 1652 1653 return central_send_multiple_small_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1654 1655 1656def ial_cis_fra_cen_bv_47_c(transport, upper_tester, lower_tester, trace): 1657 """IAL/CIS/FRA/CEN/BV-47-C""" 1658 params = SetCIGParameters( 1659 Framing = 1, 1660 NSE = 1, 1661 BN_P_To_C = 1, 1662 FT_P_To_C = 1, 1663 BN_C_To_P = 1, 1664 FT_C_To_P = 1, 1665 SDU_Interval_C_To_P = 0x7A120, # 500 ms 1666 SDU_Interval_P_To_C = 0x7A120, # 500 ms 1667 ISO_Interval = 0x320, # 1000 ms 1668 Max_PDU_C_To_P = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1669 Max_PDU_P_To_C = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1670 Max_SDU_Supported = 25, # NOTE: Max_SDU is set to 25 when the corresponding BN is not 0 1671 ) 1672 1673 return central_send_multiple_small_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1674 1675 1676def ial_cis_unf_cen_bv_09_c(transport, upper_tester, lower_tester, trace): 1677 """IAL/CIS/UNF/CEN/BV-09-C""" 1678 params = SetCIGParameters( 1679 Framing = 0, 1680 NSE = 4, 1681 BN_P_To_C = 3, 1682 FT_P_To_C = 1, 1683 BN_C_To_P = 0, 1684 # FT_C_To_P = N/A, 1685 SDU_Interval_P_To_C = 0x1388, # 5 ms 1686 SDU_Interval_C_To_P = 0x1388, # 5 ms 1687 ISO_Interval = 0x0C, # 15 ms 1688 Max_PDU_P_To_C = 251, 1689 Max_PDU_C_To_P = 0, 1690 Max_SDU_Supported = 251, # Force Max SDU to be 251 bytes 1691 ) 1692 1693 return central_receive_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1694 1695 1696def ial_cis_unf_cen_bv_33_c(transport, upper_tester, lower_tester, trace): 1697 """IAL/CIS/UNF/CEN/BV-33-C""" 1698 params = SetCIGParameters( 1699 Framing = 0, 1700 NSE = 5, 1701 BN_P_To_C = 3, 1702 FT_P_To_C = 3, 1703 BN_C_To_P = 3, 1704 FT_C_To_P = 2, 1705 SDU_Interval_P_To_C = 0x7530, # 30 ms 1706 SDU_Interval_C_To_P = 0x7530, # 30 ms 1707 ISO_Interval = 0x18, # 30 ms 1708 Max_PDU_P_To_C = 251, 1709 Max_PDU_C_To_P = 251, 1710 Max_SDU_Supported = 251, # Force Max SDU to be 251 bytes 1711 ) 1712 1713 return central_receive_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1714 1715 1716def ial_cis_fra_cen_bv_10_c(transport, upper_tester, lower_tester, trace): 1717 """IAL/CIS/FRA/CEN/BV-10-C""" 1718 params = SetCIGParameters( 1719 Framing = 1, 1720 NSE = 4, 1721 BN_P_To_C = 2, 1722 FT_P_To_C = 2, 1723 BN_C_To_P = 0, 1724 # FT_C_To_P = N/A, 1725 SDU_Interval_P_To_C = 0x4E20, # 20 ms 1726 SDU_Interval_C_To_P = 0x4E20, # 20 ms 1727 ISO_Interval = 0x14, # 25 ms 1728 Max_PDU_P_To_C = 251, 1729 Max_PDU_C_To_P = 0, 1730 Max_SDU_Supported = 251, # Force Max SDU to be 251 bytes 1731 ) 1732 1733 return central_receive_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1734 1735 1736def ial_cis_fra_cen_bv_35_c(transport, upper_tester, lower_tester, trace): 1737 """IAL/CIS/FRA/CEN/BV-35-C""" 1738 params = SetCIGParameters( 1739 Framing = 1, 1740 NSE = 3, 1741 BN_P_To_C = 2, 1742 FT_P_To_C = 1, 1743 BN_C_To_P = 0, 1744 # FT_C_To_P = N/A, 1745 SDU_Interval_P_To_C = 0x14D5, # 5.333 ms 1746 SDU_Interval_C_To_P = 0x14D5, # 5.333 ms 1747 ISO_Interval = 0x08, # 10 ms 1748 Max_PDU_P_To_C = 251, 1749 Max_PDU_C_To_P = 0, 1750 Max_SDU_Supported = 251, # Force Max SDU to be 251 bytes 1751 ) 1752 1753 return central_receive_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1754 1755 1756def ial_cis_unf_cen_bv_47_c(transport, upper_tester, lower_tester, trace): 1757 """IAL/CIS/UNF/CEN/BV-47-C""" 1758 params = SetCIGParameters( 1759 Framing = 0, 1760 NSE = 1, 1761 BN_P_To_C = 1, 1762 FT_P_To_C = 1, 1763 BN_C_To_P = 1, 1764 FT_C_To_P = 1, 1765 SDU_Interval_P_To_C = 0x3A98, # 15 ms 1766 SDU_Interval_C_To_P = 0x3A98, # 15 ms 1767 ISO_Interval = 0x0C, # 15 ms 1768 Max_PDU_P_To_C = 251, 1769 Max_PDU_C_To_P = 251, 1770 Max_SDU_Supported = 251, # Force Max SDU to be 251 bytes 1771 ) 1772 1773 return central_receive_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1774 1775 1776def ial_cis_fra_cen_bv_48_c(transport, upper_tester, lower_tester, trace): 1777 """IAL/CIS/FRA/CEN/BV-48-C""" 1778 params = SetCIGParameters( 1779 Framing = 1, 1780 NSE = 1, 1781 BN_P_To_C = 1, 1782 FT_P_To_C = 1, 1783 BN_C_To_P = 1, 1784 FT_C_To_P = 1, 1785 SDU_Interval_P_To_C = 0x4E20, # 20 ms 1786 SDU_Interval_C_To_P = 0x4E20, # 20 ms 1787 ISO_Interval = 0x10, # 20 ms 1788 Max_PDU_P_To_C = 251, 1789 Max_PDU_C_To_P = 251, 1790 Max_SDU_Supported = 251, # Force Max SDU to be 251 bytes 1791 ) 1792 1793 return central_receive_single_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1794 1795 1796def ial_cis_unf_cen_bv_12_c(transport, upper_tester, lower_tester, trace): 1797 """IAL/CIS/UNF/CEN/BV-12-C""" 1798 params = SetCIGParameters ( 1799 NSE = 6, 1800 Framing = 0, 1801 BN_P_To_C = 4, 1802 FT_P_To_C = 2, 1803 BN_C_To_P = 0, 1804 # FT_C_To_P = N/A, 1805 SDU_Interval_P_To_C = 0x61A8, # 25 ms 1806 SDU_Interval_C_To_P = 0x61A8, # 25 ms 1807 ISO_Interval = 0x14, # 25 ms 1808 ) 1809 1810 return central_receive_large_sdu_cis_unframed(transport, upper_tester, lower_tester, trace, params) 1811 1812 1813def ial_cis_unf_cen_bv_36_c(transport, upper_tester, lower_tester, trace): 1814 """IAL/CIS/UNF/CEN/BV-36-C""" 1815 params = SetCIGParameters ( 1816 NSE = 12, 1817 Framing = 0, 1818 BN_P_To_C = 8, 1819 FT_P_To_C = 3, 1820 BN_C_To_P = 0, 1821 # FT_C_To_P = N/A, 1822 SDU_Interval_P_To_C = 0x61A8, # 25 ms 1823 SDU_Interval_C_To_P = 0x61A8, # 25 ms 1824 ISO_Interval = 0x28, # 50 ms 1825 ) 1826 1827 return central_receive_large_sdu_cis_unframed(transport, upper_tester, lower_tester, trace, params) 1828 1829 1830def ial_cis_fra_cen_bv_13_c(transport, upper_tester, lower_tester, trace): 1831 """IAL/CIS/FRA/CEN/BV-13-C""" 1832 params = SetCIGParameters ( 1833 NSE = 12, 1834 Framing = 1, 1835 BN_P_To_C = 7, 1836 FT_P_To_C = 2, 1837 BN_C_To_P = 0, 1838 # FT_C_To_P = N/A, 1839 SDU_Interval_P_To_C = 0x61A8, # 25 ms 1840 SDU_Interval_C_To_P = 0x61A8, # 25 ms 1841 ISO_Interval = 0x28, # 50 ms 1842 ) 1843 1844 return central_receive_large_sdu_cis_framed(transport, upper_tester, lower_tester, trace, params, True) 1845 1846 1847def ial_cis_fra_cen_bv_38_c(transport, upper_tester, lower_tester, trace): 1848 """IAL/CIS/FRA/CEN/BV-38-C""" 1849 params = SetCIGParameters ( 1850 NSE = 8, 1851 Framing = 1, 1852 BN_P_To_C = 5, 1853 FT_P_To_C = 2, 1854 BN_C_To_P = 0, 1855 # FT_C_To_P = N/A, 1856 SDU_Interval_P_To_C = 0x55F0, # 22 ms 1857 SDU_Interval_C_To_P = 0x55F0, # 22 ms 1858 ISO_Interval = 0x1C, # 35 ms 1859 ) 1860 1861 return central_receive_large_sdu_cis_framed(transport, upper_tester, lower_tester, trace, params) 1862 1863 1864def ial_cis_fra_cen_bv_49_c(transport, upper_tester, lower_tester, trace): 1865 """IAL/CIS/FRA/CEN/BV-49-C""" 1866 params = SetCIGParameters ( 1867 NSE = 1, 1868 Framing = 1, 1869 BN_P_To_C = 1, 1870 FT_P_To_C = 1, 1871 BN_C_To_P = 1, 1872 FT_C_To_P = 1, 1873 SDU_Interval_P_To_C = 0x30D40, # 200 ms 1874 SDU_Interval_C_To_P = 0x30D40, # 200 ms 1875 ISO_Interval = 0x28, # 50 ms 1876 ) 1877 1878 return central_receive_large_sdu_cis_framed(transport, upper_tester, lower_tester, trace, params) 1879 1880 1881def ial_cis_fra_cen_bv_15_c(transport, upper_tester, lower_tester, trace): 1882 """IAL/CIS/FRA/CEN/BV-15-C""" 1883 params = SetCIGParameters( 1884 Framing = 1, 1885 NSE = 2, 1886 BN_P_To_C = 1, 1887 FT_P_To_C = 1, 1888 BN_C_To_P = 0, 1889 # FT_C_To_P = N/A, 1890 SDU_Interval_C_To_P = 0x2710, # 10 ms 1891 SDU_Interval_P_To_C = 0x2710, # 10 ms 1892 ISO_Interval = 0x04, # 5 ms 1893 Max_PDU_C_To_P = 0, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1894 Max_PDU_P_To_C = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1895 Max_SDU_Supported = 25, # NOTE: Max_SDU is set to 25 when the corresponding BN is not 0 1896 ) 1897 1898 return central_receive_multiple_small_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1899 1900 1901def ial_cis_fra_cen_bv_39_c(transport, upper_tester, lower_tester, trace): 1902 """IAL/CIS/FRA/CEN/BV-39-C""" 1903 params = SetCIGParameters( 1904 Framing = 1, 1905 NSE = 4, 1906 BN_P_To_C = 2, 1907 FT_P_To_C = 1, 1908 BN_C_To_P = 2, 1909 FT_C_To_P = 2, 1910 SDU_Interval_C_To_P = 0x4E20, # 20 ms 1911 SDU_Interval_P_To_C = 0x4E20, # 20 ms 1912 ISO_Interval = 0x08, # 10 ms 1913 Max_PDU_C_To_P = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1914 Max_PDU_P_To_C = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1915 Max_SDU_Supported = 25, # NOTE: Max_SDU is set to 25 when the corresponding BN is not 0 1916 ) 1917 1918 return central_receive_multiple_small_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1919 1920 1921def ial_cis_fra_cen_bv_50_c(transport, upper_tester, lower_tester, trace): 1922 """IAL/CIS/FRA/CEN/BV-50-C""" 1923 params = SetCIGParameters( 1924 Framing = 1, 1925 NSE = 1, 1926 BN_P_To_C = 1, 1927 FT_P_To_C = 1, 1928 BN_C_To_P = 1, 1929 FT_C_To_P = 1, 1930 SDU_Interval_C_To_P = 0x4E20, # 20 ms 1931 SDU_Interval_P_To_C = 0x4E20, # 20 ms 1932 ISO_Interval = 0x20, # 40 ms 1933 Max_PDU_C_To_P = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1934 Max_PDU_P_To_C = 63, # NOTE: Max_PDU is set to 63 when the corresponding BN is not 0 1935 Max_SDU_Supported = 25, # NOTE: Max_SDU is set to 25 when the corresponding BN is not 0 1936 ) 1937 1938 return central_receive_multiple_small_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1939 1940 1941def ial_cis_unf_cen_bv_17_c(transport, upper_tester, lower_tester, trace): 1942 """IAL/CIS/UNF/CEN/BV-17-C""" 1943 params = SetCIGParameters( 1944 Framing = 0, 1945 NSE = 4, 1946 BN_P_To_C = 0, 1947 # FT_P_To_C = N/A, 1948 BN_C_To_P = 2, 1949 FT_C_To_P = 2, 1950 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 1951 SDU_Interval_C_To_P = 10000, 1952 SDU_Interval_P_To_C = 10000, 1953 ISO_Interval = int(10 // 1.25), 1954 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 1955 # and to 0 when BN in the corresponding direction is 0. 1956 Max_PDU_P_To_C = 0, 1957 Max_PDU_C_To_P = 20, 1958 ) 1959 1960 return central_send_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1961 1962 1963def ial_cis_unf_cen_bv_41_c(transport, upper_tester, lower_tester, trace): 1964 """IAL/CIS/UNF/CEN/BV-41-C""" 1965 params = SetCIGParameters( 1966 Framing = 0, 1967 NSE = 1, 1968 BN_P_To_C = 0, 1969 # FT_P_To_C = N/A, 1970 BN_C_To_P = 1, 1971 FT_C_To_P = 1, 1972 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 1973 SDU_Interval_C_To_P = 10000, 1974 SDU_Interval_P_To_C = 10000, 1975 ISO_Interval = int(10 // 1.25), 1976 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 1977 # and to 0 when BN in the corresponding direction is 0. 1978 Max_PDU_P_To_C = 0, 1979 Max_PDU_C_To_P = 20, 1980 ) 1981 1982 return central_send_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 1983 1984 1985def ial_cis_fra_cen_bv_18_c(transport, upper_tester, lower_tester, trace): 1986 """IAL/CIS/FRA/CEN/BV-18-C""" 1987 params = SetCIGParameters( 1988 Framing = 1, 1989 NSE = 5, 1990 BN_P_To_C = 0, 1991 # FT_P_To_C = N/A, 1992 BN_C_To_P = 2, 1993 FT_C_To_P = 2, 1994 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 1995 SDU_Interval_C_To_P = 10000, 1996 SDU_Interval_P_To_C = 10000, 1997 ISO_Interval = int(10 // 1.25), 1998 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 1999 # and to 0 when BN in the corresponding direction is 0. 2000 Max_PDU_P_To_C = 0, 2001 Max_PDU_C_To_P = 20, 2002 ) 2003 2004 return central_send_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 2005 2006 2007def ial_cis_fra_cen_bv_42_c(transport, upper_tester, lower_tester, trace): 2008 """IAL/CIS/FRA/CEN/BV-42-C""" 2009 params = SetCIGParameters( 2010 Framing = 1, 2011 NSE = 2, 2012 BN_P_To_C = 1, 2013 FT_P_To_C = 1, 2014 BN_C_To_P = 1, 2015 FT_C_To_P = 1, 2016 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 2017 SDU_Interval_C_To_P = 10000, 2018 SDU_Interval_P_To_C = 10000, 2019 ISO_Interval = int(10 // 1.25), 2020 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 2021 # and to 0 when BN in the corresponding direction is 0. 2022 Max_PDU_P_To_C = 20, 2023 Max_PDU_C_To_P = 20, 2024 ) 2025 2026 return central_send_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 2027 2028 2029def ial_cis_fra_cen_bv_51_c(transport, upper_tester, lower_tester, trace): 2030 """IAL/CIS/FRA/CEN/BV-51-C""" 2031 params = SetCIGParameters( 2032 Framing = 1, 2033 NSE = 1, 2034 BN_P_To_C = 1, 2035 FT_P_To_C = 1, 2036 BN_C_To_P = 1, 2037 FT_C_To_P = 1, 2038 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 2039 SDU_Interval_C_To_P = 10000, 2040 SDU_Interval_P_To_C = 10000, 2041 ISO_Interval = int(10 // 1.25), 2042 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 2043 # and to 0 when BN in the corresponding direction is 0. 2044 Max_PDU_P_To_C = 20, 2045 Max_PDU_C_To_P = 20, 2046 ) 2047 2048 return central_send_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 2049 2050 2051def ial_cis_unf_cen_bv_19_c(transport, upper_tester, lower_tester, trace): 2052 """IAL/CIS/UNF/CEN/BV-19-C""" 2053 params = SetCIGParameters( 2054 Framing = 0, 2055 NSE = 7, 2056 BN_P_To_C = 3, 2057 FT_P_To_C = 4, 2058 BN_C_To_P = 0, 2059 # FT_C_To_P = N/A, 2060 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 2061 SDU_Interval_C_To_P = 10000, 2062 SDU_Interval_P_To_C = 10000, 2063 ISO_Interval = int(10 // 1.25), 2064 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 2065 # and to 0 when BN in the corresponding direction is 0. 2066 Max_PDU_P_To_C = 20, 2067 Max_PDU_C_To_P = 0, 2068 ) 2069 2070 return central_receive_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 2071 2072 2073def ial_cis_unf_cen_bv_43_c(transport, upper_tester, lower_tester, trace): 2074 """IAL/CIS/UNF/CEN/BV-43-C""" 2075 params = SetCIGParameters( 2076 Framing = 0, 2077 NSE = 2, 2078 BN_P_To_C = 1, 2079 FT_P_To_C = 3, 2080 BN_C_To_P = 1, 2081 FT_C_To_P = 2, 2082 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 2083 SDU_Interval_C_To_P = 10000, 2084 SDU_Interval_P_To_C = 10000, 2085 ISO_Interval = int(10 // 1.25), 2086 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 2087 # and to 0 when BN in the corresponding direction is 0. 2088 Max_PDU_P_To_C = 20, 2089 Max_PDU_C_To_P = 20, 2090 ) 2091 2092 return central_receive_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 2093 2094 2095def ial_cis_fra_cen_bv_20_c(transport, upper_tester, lower_tester, trace): 2096 """IAL/CIS/FRA/CEN/BV-20-C""" 2097 params = SetCIGParameters( 2098 Framing = 1, 2099 NSE = 2, 2100 BN_P_To_C = 1, 2101 FT_P_To_C = 4, 2102 BN_C_To_P = 0, 2103 # FT_C_To_P = N/A, 2104 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 2105 SDU_Interval_C_To_P = 10000, 2106 SDU_Interval_P_To_C = 10000, 2107 ISO_Interval = int(10 // 1.25), 2108 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 2109 # and to 0 when BN in the corresponding direction is 0. 2110 Max_PDU_P_To_C = 20, 2111 Max_PDU_C_To_P = 0, 2112 ) 2113 2114 return central_receive_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 2115 2116 2117def ial_cis_fra_cen_bv_44_c(transport, upper_tester, lower_tester, trace): 2118 """IAL/CIS/FRA/CEN/BV-44-C""" 2119 params = SetCIGParameters( 2120 Framing = 1, 2121 NSE = 5, 2122 BN_P_To_C = 1, 2123 FT_P_To_C = 2, 2124 BN_C_To_P = 3, 2125 FT_C_To_P = 3, 2126 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 2127 SDU_Interval_C_To_P = 10000, 2128 SDU_Interval_P_To_C = 10000, 2129 ISO_Interval = int(10 // 1.25), 2130 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 2131 # and to 0 when BN in the corresponding direction is 0. 2132 Max_PDU_P_To_C = 20, 2133 Max_PDU_C_To_P = 20, 2134 ) 2135 2136 return central_receive_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 2137 2138 2139def ial_cis_unf_cen_bv_48_c(transport, upper_tester, lower_tester, trace): 2140 """IAL/CIS/UNF/CEN/BV-48-C""" 2141 params = SetCIGParameters( 2142 Framing = 0, 2143 NSE = 1, 2144 BN_P_To_C = 1, 2145 FT_P_To_C = 1, 2146 BN_C_To_P = 1, 2147 FT_C_To_P = 1, 2148 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 2149 SDU_Interval_C_To_P = 10000, 2150 SDU_Interval_P_To_C = 10000, 2151 ISO_Interval = int(10 // 1.25), 2152 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 2153 # and to 0 when BN in the corresponding direction is 0. 2154 Max_PDU_P_To_C = 20, 2155 Max_PDU_C_To_P = 20, 2156 ) 2157 2158 return central_receive_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 2159 2160 2161def ial_cis_fra_cen_bv_52_c(transport, upper_tester, lower_tester, trace): 2162 """IAL/CIS/FRA/CEN/BV-52-C""" 2163 params = SetCIGParameters( 2164 Framing = 1, 2165 NSE = 1, 2166 BN_P_To_C = 1, 2167 FT_P_To_C = 1, 2168 BN_C_To_P = 1, 2169 FT_C_To_P = 1, 2170 # NOTE: ISO_Interval and SDU_Interval are both set to 10 milliseconds. 2171 SDU_Interval_C_To_P = 10000, 2172 SDU_Interval_P_To_C = 10000, 2173 ISO_Interval = int(10 // 1.25), 2174 # NOTE: Max_PDU_C_to_P and Max_PDU_P_to_C are both set to 20 when BN in the corresponding direction is not 0, 2175 # and to 0 when BN in the corresponding direction is 0. 2176 Max_PDU_P_To_C = 20, 2177 Max_PDU_C_To_P = 20, 2178 ) 2179 2180 return central_receive_zero_length_sdu_cis(transport, upper_tester, lower_tester, trace, params) 2181 2182 2183def ial_cis_unf_cen_bv_21_c(transport, upper_tester, lower_tester, trace): 2184 """IAL/CIS/UNF/CEN/BV-21-C""" 2185 params = SetCIGParameters( 2186 NSE = 2, 2187 Framing = 0, 2188 BN_P_To_C = 1, 2189 FT_P_To_C = 1, 2190 BN_C_To_P = 1, 2191 FT_C_To_P = 1, 2192 ) 2193 2194 return central_simultanous_sending_and_receiving_sdus(transport, upper_tester, lower_tester, trace, params) 2195 2196 2197def ial_cis_unf_cen_bv_24_c(transport, upper_tester, lower_tester, trace): 2198 """IAL/CIS/UNF/CEN/BV-24-C""" 2199 params = SetCIGParameters( 2200 NSE = 3, 2201 Framing = 0, 2202 BN_P_To_C = 1, 2203 FT_P_To_C = 2, 2204 BN_C_To_P = 2, 2205 FT_C_To_P = 3, 2206 ) 2207 2208 return central_simultanous_sending_and_receiving_sdus(transport, upper_tester, lower_tester, trace, params) 2209 2210 2211def ial_cis_fra_cen_bv_22_c(transport, upper_tester, lower_tester, trace): 2212 """IAL/CIS/FRA/CEN/BV-22-C""" 2213 params = SetCIGParameters( 2214 NSE = 5, 2215 Framing = 1, 2216 BN_P_To_C = 1, 2217 FT_P_To_C = 2, 2218 BN_C_To_P = 3, 2219 FT_C_To_P = 3, 2220 ) 2221 2222 return central_simultanous_sending_and_receiving_sdus(transport, upper_tester, lower_tester, trace, params) 2223 2224 2225def ial_cis_unf_cen_bv_45_c(transport, upper_tester, lower_tester, trace): 2226 """IAL/CIS/UNF/CEN/BV-45-C""" 2227 return central_sending_and_receiving_unframed_empty_pdu_llid_0b01_cis(transport, upper_tester, lower_tester, 2228 trace, 0x04, 0x08) 2229 2230 2231__tests__ = { 2232 "IAL/CIS/UNF/CEN/BV-01-C": [ial_cis_unf_cen_bv_01_c, "Send Single SDU, CIS"], 2233 "IAL/CIS/UNF/PER/BV-01-C": [ial_cis_unf_per_bv_01_c, "Send Single SDU, CIS"], 2234 # "IAL/CIS/UNF/CEN/BV-25-C": [ial_cis_unf_cen_bv_25_c, "Send Single SDU, CIS"], # https://github.com/EDTTool/EDTT-le-audio/issues/117 2235 "IAL/CIS/UNF/PER/BV-25-C": [ial_cis_unf_per_bv_25_c, "Send Single SDU, CIS"], 2236 "IAL/CIS/FRA/CEN/BV-03-C": [ial_cis_fra_cen_bv_03_c, "Send Single SDU, CIS"], 2237 "IAL/CIS/FRA/PER/BV-03-C": [ial_cis_fra_per_bv_03_c, "Send Single SDU, CIS"], 2238 "IAL/CIS/FRA/CEN/BV-26-C": [ial_cis_fra_cen_bv_26_c, "Send Single SDU, CIS"], 2239 "IAL/CIS/FRA/PER/BV-26-C": [ial_cis_fra_per_bv_26_c, "Send Single SDU, CIS"], 2240 "IAL/CIS/UNF/CEN/BV-46-C": [ial_cis_unf_cen_bv_46_c, "Send Single SDU, CIS"], 2241 "IAL/CIS/UNF/PER/BV-47-C": [ial_cis_unf_per_bv_47_c, "Send Single SDU, CIS"], 2242 "IAL/CIS/FRA/CEN/BV-45-C": [ial_cis_fra_cen_bv_45_c, "Send Single SDU, CIS"], 2243 "IAL/CIS/FRA/PER/BV-45-C": [ial_cis_fra_per_bv_45_c, "Send Single SDU, CIS"], 2244 "IAL/CIS/UNF/CEN/BV-04-C": [ial_cis_unf_cen_bv_04_c, "Send Large SDU, CIS"], 2245 "IAL/CIS/UNF/PER/BV-04-C": [ial_cis_unf_per_bv_04_c, "Send Large SDU, CIS"], 2246 "IAL/CIS/UNF/CEN/BV-28-C": [ial_cis_unf_cen_bv_28_c, "Send Large SDU, CIS"], 2247 "IAL/CIS/UNF/PER/BV-28-C": [ial_cis_unf_per_bv_28_c, "Send Large SDU, CIS"], 2248 "IAL/CIS/FRA/CEN/BV-05-C": [ial_cis_fra_cen_bv_05_c, "Send Large SDU, CIS"], 2249 "IAL/CIS/FRA/PER/BV-05-C": [ial_cis_fra_per_bv_05_c, "Send Large SDU, CIS"], 2250 "IAL/CIS/FRA/CEN/BV-29-C": [ial_cis_fra_cen_bv_29_c, "Send Large SDU, CIS"], 2251 "IAL/CIS/FRA/PER/BV-29-C": [ial_cis_fra_per_bv_29_c, "Send Large SDU, CIS"], 2252 "IAL/CIS/FRA/CEN/BV-46-C": [ial_cis_fra_cen_bv_46_c, "Send Large SDU, CIS"], 2253 "IAL/CIS/FRA/PER/BV-46-C": [ial_cis_fra_per_bv_46_c, "Send Large SDU, CIS"], 2254 "IAL/CIS/FRA/CEN/BV-07-C": [ial_cis_fra_cen_bv_07_c, "Send Multiple, Small SDUs, CIS"], 2255 "IAL/CIS/FRA/PER/BV-07-C": [ial_cis_fra_per_bv_07_c, "Send Multiple, Small SDUs, CIS"], 2256 "IAL/CIS/FRA/CEN/BV-31-C": [ial_cis_fra_cen_bv_31_c, "Send Multiple, Small SDUs, CIS"], 2257 "IAL/CIS/FRA/PER/BV-31-C": [ial_cis_fra_per_bv_31_c, "Send Multiple, Small SDUs, CIS"], 2258 "IAL/CIS/FRA/CEN/BV-47-C": [ial_cis_fra_cen_bv_47_c, "Send Multiple, Small SDUs, CIS"], 2259 "IAL/CIS/FRA/PER/BV-47-C": [ial_cis_fra_per_bv_47_c, "Send Multiple, Small SDUs, CIS"], 2260 "IAL/CIS/UNF/CEN/BV-09-C": [ial_cis_unf_cen_bv_09_c, "Receive Single SDU, CIS"], 2261 "IAL/CIS/UNF/PER/BV-09-C": [ial_cis_unf_per_bv_09_c, "Receive Single SDU, CIS"], 2262 "IAL/CIS/UNF/CEN/BV-33-C": [ial_cis_unf_cen_bv_33_c, "Receive Single SDU, CIS"], 2263 "IAL/CIS/UNF/PER/BV-33-C": [ial_cis_unf_per_bv_33_c, "Receive Single SDU, CIS"], 2264 "IAL/CIS/FRA/CEN/BV-10-C": [ial_cis_fra_cen_bv_10_c, "Receive Single SDU, CIS"], 2265 "IAL/CIS/FRA/PER/BV-10-C": [ial_cis_fra_per_bv_10_c, "Receive Single SDU, CIS"], 2266 "IAL/CIS/FRA/CEN/BV-35-C": [ial_cis_fra_cen_bv_35_c, "Receive Single SDU, CIS"], 2267 "IAL/CIS/FRA/PER/BV-35-C": [ial_cis_fra_per_bv_35_c, "Receive Single SDU, CIS"], 2268 "IAL/CIS/UNF/CEN/BV-47-C": [ial_cis_unf_cen_bv_47_c, "Receive Single SDU, CIS"], 2269 "IAL/CIS/UNF/PER/BV-48-C": [ial_cis_unf_per_bv_48_c, "Receive Single SDU, CIS"], 2270 "IAL/CIS/FRA/CEN/BV-48-C": [ial_cis_fra_cen_bv_48_c, "Receive Single SDU, CIS"], 2271 "IAL/CIS/FRA/PER/BV-48-C": [ial_cis_fra_per_bv_48_c, "Receive Single SDU, CIS"], 2272 "IAL/CIS/UNF/CEN/BV-12-C": [ial_cis_unf_cen_bv_12_c, "Receive Large SDU, CIS, Unframed"], 2273 "IAL/CIS/UNF/PER/BV-12-C": [ial_cis_unf_per_bv_12_c, "Receive Large SDU, CIS, Unframed"], 2274 "IAL/CIS/UNF/CEN/BV-36-C": [ial_cis_unf_cen_bv_36_c, "Receive Large SDU, CIS, Unframed"], 2275 "IAL/CIS/UNF/PER/BV-36-C": [ial_cis_unf_per_bv_36_c, "Receive Large SDU, CIS, Unframed"], 2276 "IAL/CIS/FRA/CEN/BV-13-C": [ial_cis_fra_cen_bv_13_c, "Receive Large SDU, CIS, Framed"], 2277 "IAL/CIS/FRA/PER/BV-13-C": [ial_cis_fra_per_bv_13_c, "Receive Large SDU, CIS, Framed"], 2278 "IAL/CIS/FRA/CEN/BV-38-C": [ial_cis_fra_cen_bv_38_c, "Receive Large SDU, CIS, Framed"], 2279 "IAL/CIS/FRA/PER/BV-38-C": [ial_cis_fra_per_bv_38_c, "Receive Large SDU, CIS, Framed"], 2280 "IAL/CIS/FRA/CEN/BV-49-C": [ial_cis_fra_cen_bv_49_c, "Receive Large SDU, CIS, Framed"], 2281 "IAL/CIS/FRA/PER/BV-49-C": [ial_cis_fra_per_bv_49_c, "Receive Large SDU, CIS, Framed"], 2282 "IAL/CIS/FRA/CEN/BV-15-C": [ial_cis_fra_cen_bv_15_c, "Receive Multiple Small SDUs, CIS"], 2283 "IAL/CIS/FRA/PER/BV-15-C": [ial_cis_fra_per_bv_15_c, "Receive Multiple Small SDUs, CIS"], 2284 "IAL/CIS/FRA/CEN/BV-39-C": [ial_cis_fra_cen_bv_39_c, "Receive Multiple Small SDUs, CIS"], 2285 "IAL/CIS/FRA/PER/BV-39-C": [ial_cis_fra_per_bv_39_c, "Receive Multiple Small SDUs, CIS"], 2286 "IAL/CIS/FRA/CEN/BV-50-C": [ial_cis_fra_cen_bv_50_c, "Receive Multiple Small SDUs, CIS"], 2287 "IAL/CIS/FRA/PER/BV-50-C": [ial_cis_fra_per_bv_50_c, "Receive Multiple Small SDUs, CIS"], 2288 "IAL/CIS/UNF/CEN/BV-17-C": [ial_cis_unf_cen_bv_17_c, "Send a Zero-Length SDU, CIS"], 2289 "IAL/CIS/UNF/PER/BV-17-C": [ial_cis_unf_per_bv_17_c, "Send a Zero-Length SDU, CIS"], 2290 "IAL/CIS/UNF/CEN/BV-41-C": [ial_cis_unf_cen_bv_41_c, "Send a Zero-Length SDU, CIS"], 2291 "IAL/CIS/UNF/PER/BV-41-C": [ial_cis_unf_per_bv_41_c, "Send a Zero-Length SDU, CIS"], 2292 "IAL/CIS/FRA/CEN/BV-18-C": [ial_cis_fra_cen_bv_18_c, "Send a Zero-Length SDU, CIS"], 2293 "IAL/CIS/FRA/PER/BV-18-C": [ial_cis_fra_per_bv_18_c, "Send a Zero-Length SDU, CIS"], 2294 "IAL/CIS/FRA/CEN/BV-42-C": [ial_cis_fra_cen_bv_42_c, "Send a Zero-Length SDU, CIS"], 2295 "IAL/CIS/FRA/PER/BV-42-C": [ial_cis_fra_per_bv_42_c, "Send a Zero-Length SDU, CIS"], 2296 "IAL/CIS/UNF/PER/BV-49-C": [ial_cis_unf_per_bv_49_c, "Send a Zero-Length SDU, CIS"], 2297 "IAL/CIS/FRA/CEN/BV-51-C": [ial_cis_fra_cen_bv_51_c, "Send a Zero-Length SDU, CIS"], 2298 "IAL/CIS/FRA/PER/BV-51-C": [ial_cis_fra_per_bv_51_c, "Send a Zero-Length SDU, CIS"], 2299 "IAL/CIS/UNF/CEN/BV-19-C": [ial_cis_unf_cen_bv_19_c, "Receive a Zero-Length SDUs CIS"], 2300 "IAL/CIS/UNF/PER/BV-19-C": [ial_cis_unf_per_bv_19_c, "Receive a Zero-Length SDUs CIS"], 2301 "IAL/CIS/UNF/CEN/BV-43-C": [ial_cis_unf_cen_bv_43_c, "Receive a Zero-Length SDUs CIS"], 2302 "IAL/CIS/UNF/PER/BV-43-C": [ial_cis_unf_per_bv_43_c, "Receive a Zero-Length SDUs CIS"], 2303 "IAL/CIS/FRA/CEN/BV-20-C": [ial_cis_fra_cen_bv_20_c, "Receive a Zero-Length SDUs CIS"], 2304 "IAL/CIS/FRA/PER/BV-20-C": [ial_cis_fra_per_bv_20_c, "Receive a Zero-Length SDUs CIS"], 2305 "IAL/CIS/FRA/CEN/BV-44-C": [ial_cis_fra_cen_bv_44_c, "Receive a Zero-Length SDUs CIS"], 2306 "IAL/CIS/FRA/PER/BV-44-C": [ial_cis_fra_per_bv_44_c, "Receive a Zero-Length SDUs CIS"], 2307 "IAL/CIS/UNF/CEN/BV-48-C": [ial_cis_unf_cen_bv_48_c, "Receive a Zero-Length SDUs CIS"], 2308 "IAL/CIS/FRA/CEN/BV-52-C": [ial_cis_fra_cen_bv_52_c, "Receive a Zero-Length SDUs CIS"], 2309 "IAL/CIS/FRA/PER/BV-52-C": [ial_cis_fra_per_bv_52_c, "Receive a Zero-Length SDUs CIS"], 2310 "IAL/CIS/UNF/CEN/BV-21-C": [ial_cis_unf_cen_bv_21_c, "Simultaneous Sending and Receiving SDUs, CIS"], 2311 "IAL/CIS/UNF/PER/BV-21-C": [ial_cis_unf_per_bv_21_c, "Simultaneous Sending and Receiving SDUs, CIS"], 2312 "IAL/CIS/UNF/CEN/BV-24-C": [ial_cis_unf_cen_bv_24_c, "Simultaneous Sending and Receiving SDUs, CIS"], 2313 "IAL/CIS/UNF/PER/BV-24-C": [ial_cis_unf_per_bv_24_c, "Simultaneous Sending and Receiving SDUs, CIS"], 2314 # "IAL/CIS/FRA/CEN/BV-22-C": [ial_cis_fra_cen_bv_22_c, "Simultaneous Sending and Receiving SDUs, CIS"], # https://github.com/EDTTool/EDTT-le-audio/issues/117 2315 # "IAL/CIS/FRA/PER/BV-22-C": [ial_cis_fra_per_bv_22_c, "Simultaneous Sending and Receiving SDUs, CIS"], # https://github.com/EDTTool/EDTT-le-audio/issues/117 2316 "IAL/CIS/UNF/CEN/BV-45-C": [ial_cis_unf_cen_bv_45_c, "Sending and Receiving Unframed Empty PDUs with LLID=0b01, CIS"], 2317 "IAL/CIS/UNF/PER/BV-45-C": [ial_cis_unf_per_bv_45_c, "Sending and Receiving Unframed Empty PDUs with LLID=0b01, CIS"], 2318 "IAL/CIS/UNF/PER/BV-46-C": [ial_cis_unf_per_bv_46_c, "Sending and Receiving Unframed Empty PDUs with LLID=0b01, CIS"], 2319} 2320 2321 2322_maxNameLength = max([len(key) for key in __tests__]) 2323 2324_spec = {key: TestSpec(name=key, number_devices=2, description="#[" + __tests__[key][1] + "]", 2325 test_private=__tests__[key][0]) for key in __tests__} 2326 2327""" 2328 Return the test spec which contains info about all the tests 2329 this test module provides 2330""" 2331def get_tests_specs(): 2332 return _spec 2333 2334 2335def preamble(transport, trace): 2336 global lowerIRK, upperIRK, lowerRandomAddress, upperRandomAddress 2337 2338 ok = success = preamble_standby(transport, 0, trace) 2339 trace.trace(4, "preamble Standby " + ("PASS" if success else "FAIL")) 2340 success = preamble_standby(transport, 1, trace) 2341 ok = ok and success 2342 trace.trace(4, "preamble Standby " + ("PASS" if success else "FAIL")) 2343 success, upperIRK, upperRandomAddress = preamble_device_address_set(transport, 0, trace) 2344 trace.trace(4, "preamble Device Address Set " + 2345 ("PASS" if success else "FAIL")) 2346 ok = ok and success 2347 success, lowerIRK, lowerRandomAddress = preamble_device_address_set(transport, 1, trace) 2348 trace.trace(4, "preamble Device Address Set " + 2349 ("PASS" if success else "FAIL")) 2350 2351 return ok and success 2352 2353 2354""" 2355 Run a test given its test_spec 2356""" 2357def run_a_test(args, transport, trace, test_spec, device_dumps): 2358 try: 2359 success = preamble(transport, trace) 2360 except Exception as e: 2361 trace.trace(3, "Preamble generated exception: %s" % str(e)) 2362 success = False 2363 2364 trace.trace(2, "%-*s %s test started..." % (_maxNameLength, test_spec.name, test_spec.description[1:])) 2365 test_f = test_spec.test_private 2366 try: 2367 if test_f.__code__.co_argcount > 4: 2368 success = success and test_f(transport, 0, 1, trace, device_dumps) 2369 elif test_f.__code__.co_argcount > 3: 2370 success = success and test_f(transport, 0, 1, trace) 2371 else: 2372 success = success and test_f(transport, 0, trace) 2373 except Exception as e: 2374 import traceback 2375 traceback.print_exc() 2376 trace.trace(3, "Test generated exception: %s" % str(e)) 2377 success = False 2378 2379 return not success 2380