Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 796c44cb authored by Henri Chataing's avatar Henri Chataing Committed by Gerrit Code Review
Browse files

Merge "gd: Rename some of the declarations for HCI packets"

parents c8e95e47 d28c8431
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -30,11 +30,11 @@ from bluetooth_packets_python3.hci_packets import BroadcastFlag
from bluetooth_packets_python3.hci_packets import PacketBoundaryFlag
from bluetooth_packets_python3 import hci_packets
from blueberry.tests.gd.cert.matchers import HciMatchers
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingLegacyParametersBuilder
from bluetooth_packets_python3.hci_packets import LegacyAdvertisingProperties
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingParametersLegacyBuilder
from bluetooth_packets_python3.hci_packets import LegacyAdvertisingEventProperties
from bluetooth_packets_python3.hci_packets import PeerAddressType
from bluetooth_packets_python3.hci_packets import AdvertisingFilterPolicy
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingRandomAddressBuilder
from bluetooth_packets_python3.hci_packets import LeSetAdvertisingSetRandomAddressBuilder
from bluetooth_packets_python3.hci_packets import GapData
from bluetooth_packets_python3.hci_packets import GapDataType
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingDataBuilder
@@ -42,7 +42,7 @@ from bluetooth_packets_python3.hci_packets import Operation
from bluetooth_packets_python3.hci_packets import OwnAddressType
from bluetooth_packets_python3.hci_packets import Enable
from bluetooth_packets_python3.hci_packets import FragmentPreference
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingScanResponseBuilder
from bluetooth_packets_python3.hci_packets import LeSetExtendedScanResponseDataBuilder
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingEnableBuilder
from bluetooth_packets_python3.hci_packets import EnabledSet
from bluetooth_packets_python3.hci_packets import OpCode
@@ -87,9 +87,9 @@ class PyHalAdvertisement(object):
        data.data_type = GapDataType.SHORTENED_LOCAL_NAME
        data.data = list(bytes(shortened_name))
        self.py_hal.send_hci_command(
            LeSetExtendedAdvertisingScanResponseBuilder(self.handle, Operation.COMPLETE_ADVERTISEMENT,
            LeSetExtendedScanResponseDataBuilder(self.handle, Operation.COMPLETE_ADVERTISEMENT,
                                                 FragmentPreference.CONTROLLER_SHOULD_NOT, [data]))
        self.py_hal.wait_for_complete(OpCode.LE_SET_EXTENDED_ADVERTISING_SCAN_RESPONSE)
        self.py_hal.wait_for_complete(OpCode.LE_SET_EXTENDED_SCAN_RESPONSE_DATA)

    def start(self):
        enabled_set = EnabledSet()
@@ -265,7 +265,7 @@ class PyHal(Closable):
    def create_advertisement(self,
                             handle,
                             own_address,
                             properties=LegacyAdvertisingProperties.ADV_IND,
                             properties=LegacyAdvertisingEventProperties.ADV_IND,
                             min_interval=400,
                             max_interval=450,
                             channel_map=7,
@@ -278,12 +278,12 @@ class PyHal(Closable):
                             scan_request_notification=Enable.DISABLED):

        self.send_hci_command(
            LeSetExtendedAdvertisingLegacyParametersBuilder(handle, properties, min_interval, max_interval, channel_map,
            LeSetExtendedAdvertisingParametersLegacyBuilder(handle, properties, min_interval, max_interval, channel_map,
                                                            own_address_type, peer_address_type, peer_address,
                                                            filter_policy, tx_power, sid, scan_request_notification))
        self.wait_for_complete(OpCode.LE_SET_EXTENDED_ADVERTISING_PARAMETERS)

        self.send_hci_command(LeSetExtendedAdvertisingRandomAddressBuilder(handle, own_address))
        self.wait_for_complete(OpCode.LE_SET_EXTENDED_ADVERTISING_RANDOM_ADDRESS)
        self.send_hci_command(LeSetAdvertisingSetRandomAddressBuilder(handle, own_address))
        self.wait_for_complete(OpCode.LE_SET_ADVERTISING_SET_RANDOM_ADDRESS)

        return PyHalAdvertisement(handle, self)
+9 −9
Original line number Diff line number Diff line
@@ -27,11 +27,11 @@ from blueberry.tests.gd.cert.truth import assertThat
from blueberry.facade.hci import hci_facade_pb2 as hci_facade
from blueberry.facade import common_pb2 as common
from blueberry.tests.gd.cert.matchers import HciMatchers
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingLegacyParametersBuilder
from bluetooth_packets_python3.hci_packets import LegacyAdvertisingProperties
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingParametersLegacyBuilder
from bluetooth_packets_python3.hci_packets import LegacyAdvertisingEventProperties
from bluetooth_packets_python3.hci_packets import PeerAddressType
from bluetooth_packets_python3.hci_packets import AdvertisingFilterPolicy
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingRandomAddressBuilder
from bluetooth_packets_python3.hci_packets import LeSetAdvertisingSetRandomAddressBuilder
from bluetooth_packets_python3.hci_packets import GapData
from bluetooth_packets_python3.hci_packets import GapDataType
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingDataBuilder
@@ -39,7 +39,7 @@ from bluetooth_packets_python3.hci_packets import Operation
from bluetooth_packets_python3.hci_packets import OwnAddressType
from bluetooth_packets_python3.hci_packets import Enable
from bluetooth_packets_python3.hci_packets import FragmentPreference
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingScanResponseBuilder
from bluetooth_packets_python3.hci_packets import LeSetExtendedScanResponseDataBuilder
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingEnableBuilder
from bluetooth_packets_python3.hci_packets import EnabledSet
from bluetooth_packets_python3.hci_packets import OpCode
@@ -127,7 +127,7 @@ class PyHciAdvertisement(object):
        data.data_type = GapDataType.SHORTENED_LOCAL_NAME
        data.data = list(shortened_name)
        self.py_hci.send_command(
            LeSetExtendedAdvertisingScanResponseBuilder(self.handle, Operation.COMPLETE_ADVERTISEMENT,
            LeSetExtendedScanResponseDataBuilder(self.handle, Operation.COMPLETE_ADVERTISEMENT,
                                                 FragmentPreference.CONTROLLER_SHOULD_NOT, [data]))

    def start(self):
@@ -271,7 +271,7 @@ class PyHci(Closable):
    def create_advertisement(self,
                             handle,
                             own_address,
                             properties=LegacyAdvertisingProperties.ADV_IND,
                             properties=LegacyAdvertisingEventProperties.ADV_IND,
                             min_interval=400,
                             max_interval=450,
                             channel_map=7,
@@ -284,9 +284,9 @@ class PyHci(Closable):
                             scan_request_notification=Enable.DISABLED):

        self.send_command(
            LeSetExtendedAdvertisingLegacyParametersBuilder(handle, properties, min_interval, max_interval, channel_map,
            LeSetExtendedAdvertisingParametersLegacyBuilder(handle, properties, min_interval, max_interval, channel_map,
                                                            own_address_type, peer_address_type, peer_address,
                                                            filter_policy, tx_power, sid, scan_request_notification))

        self.send_command(LeSetExtendedAdvertisingRandomAddressBuilder(handle, own_address))
        self.send_command(LeSetAdvertisingSetRandomAddressBuilder(handle, own_address))
        return PyHciAdvertisement(handle, self)
+9 −10
Original line number Diff line number Diff line
@@ -39,17 +39,17 @@ from bluetooth_packets_python3.hci_packets import OwnAddressType
from bluetooth_packets_python3.hci_packets import LeScanningFilterPolicy
from bluetooth_packets_python3.hci_packets import Enable
from bluetooth_packets_python3.hci_packets import FilterDuplicates
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingLegacyParametersBuilder
from bluetooth_packets_python3.hci_packets import LegacyAdvertisingProperties
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingParametersLegacyBuilder
from bluetooth_packets_python3.hci_packets import LegacyAdvertisingEventProperties
from bluetooth_packets_python3.hci_packets import PeerAddressType
from bluetooth_packets_python3.hci_packets import AdvertisingFilterPolicy
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingRandomAddressBuilder
from bluetooth_packets_python3.hci_packets import LeSetAdvertisingSetRandomAddressBuilder
from bluetooth_packets_python3.hci_packets import GapData
from bluetooth_packets_python3.hci_packets import GapDataType
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingDataBuilder
from bluetooth_packets_python3.hci_packets import Operation
from bluetooth_packets_python3.hci_packets import FragmentPreference
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingScanResponseBuilder
from bluetooth_packets_python3.hci_packets import LeSetExtendedScanResponseDataBuilder
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingEnableBuilder
from bluetooth_packets_python3.hci_packets import LeSetExtendedScanEnableBuilder
from bluetooth_packets_python3.hci_packets import EnabledSet
@@ -135,9 +135,9 @@ class DirectHciTest(gd_base_test.GdBaseTestClass):
        # CERT Advertises
        advertising_handle = 0
        self.cert_hal.send_hci_command(
            LeSetExtendedAdvertisingLegacyParametersBuilder(
            LeSetExtendedAdvertisingParametersLegacyBuilder(
                advertising_handle,
                LegacyAdvertisingProperties.ADV_IND,
                LegacyAdvertisingEventProperties.ADV_IND,
                512,
                768,
                7,
@@ -150,8 +150,7 @@ class DirectHciTest(gd_base_test.GdBaseTestClass):
                Enable.DISABLED  # Scan request notification
            ))

        self.cert_hal.send_hci_command(
            LeSetExtendedAdvertisingRandomAddressBuilder(advertising_handle, '0C:05:04:03:02:01'))
        self.cert_hal.send_hci_command(LeSetAdvertisingSetRandomAddressBuilder(advertising_handle, '0C:05:04:03:02:01'))
        gap_name = GapData()
        gap_name.data_type = GapDataType.COMPLETE_LOCAL_NAME
        gap_name.data = list(bytes(b'Im_A_Cert'))
@@ -165,7 +164,7 @@ class DirectHciTest(gd_base_test.GdBaseTestClass):
        gap_short_name.data = list(bytes(b'Im_A_C'))

        self.cert_hal.send_hci_command(
            LeSetExtendedAdvertisingScanResponseBuilder(advertising_handle, Operation.COMPLETE_ADVERTISEMENT,
            LeSetExtendedScanResponseDataBuilder(advertising_handle, Operation.COMPLETE_ADVERTISEMENT,
                                                 FragmentPreference.CONTROLLER_SHOULD_NOT, [gap_short_name]))

        enabled_set = EnabledSet()
+7 −7
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ class LeAclManagerTest(gd_base_test.GdBaseTestClass):
        self.cert_hci.create_advertisement(
            advertising_handle,
            self.cert_random_address,
            hci_packets.LegacyAdvertisingProperties.ADV_IND,
            hci_packets.LegacyAdvertisingEventProperties.ADV_IND,
        )

        py_hci_adv.set_data(b'Im_A_Cert')
@@ -109,7 +109,7 @@ class LeAclManagerTest(gd_base_test.GdBaseTestClass):
        self.cert_hci.create_advertisement(
            advertising_handle,
            self.cert_random_address,
            hci_packets.LegacyAdvertisingProperties.ADV_IND,
            hci_packets.LegacyAdvertisingEventProperties.ADV_IND,
            own_address_type=hci_packets.OwnAddressType.RESOLVABLE_OR_PUBLIC_ADDRESS,
            peer_address=self.dut_public_address,
            peer_address_type=hci_packets.PeerAddressType.PUBLIC_DEVICE_OR_IDENTITY_ADDRESS)
@@ -331,7 +331,7 @@ class LeAclManagerTest(gd_base_test.GdBaseTestClass):
        advertising_handle = 0

        py_hci_adv = self.cert_hci.create_advertisement(advertising_handle, self.cert_random_address,
                                                        hci_packets.LegacyAdvertisingProperties.ADV_IND, 155, 165)
                                                        hci_packets.LegacyAdvertisingEventProperties.ADV_IND, 155, 165)

        py_hci_adv.set_data(b'Im_A_Cert')
        py_hci_adv.set_scan_response(b'Im_A_C')
@@ -360,7 +360,7 @@ class LeAclManagerTest(gd_base_test.GdBaseTestClass):
        advertising_handle = 0

        py_hci_adv = self.cert_hci.create_advertisement(advertising_handle, self.cert_random_address,
                                                        hci_packets.LegacyAdvertisingProperties.ADV_IND, 155, 165)
                                                        hci_packets.LegacyAdvertisingEventProperties.ADV_IND, 155, 165)

        py_hci_adv.set_data(b'Im_A_Cert')
        py_hci_adv.set_scan_response(b'Im_A_C')
@@ -374,7 +374,7 @@ class LeAclManagerTest(gd_base_test.GdBaseTestClass):
        advertising_handle = 0

        py_hci_adv = self.cert_hci.create_advertisement(advertising_handle, '0C:05:04:03:02:02',
                                                        hci_packets.LegacyAdvertisingProperties.ADV_IND, 155, 165)
                                                        hci_packets.LegacyAdvertisingEventProperties.ADV_IND, 155, 165)

        py_hci_adv.set_data(b'Im_A_Cert')
        py_hci_adv.set_scan_response(b'Im_A_C')
@@ -389,7 +389,7 @@ class LeAclManagerTest(gd_base_test.GdBaseTestClass):

        advertising_handle = 0
        py_hci_adv = self.cert_hci.create_advertisement(advertising_handle, self.cert_random_address,
                                                        hci_packets.LegacyAdvertisingProperties.ADV_IND, 155, 165)
                                                        hci_packets.LegacyAdvertisingEventProperties.ADV_IND, 155, 165)

        py_hci_adv.set_data(b'Im_A_Cert')
        py_hci_adv.set_scan_response(b'Im_A_C')
@@ -417,7 +417,7 @@ class LeAclManagerTest(gd_base_test.GdBaseTestClass):
        advertising_handle = 0

        py_hci_adv = self.cert_hci.create_advertisement(advertising_handle, self.cert_random_address,
                                                        hci_packets.LegacyAdvertisingProperties.ADV_IND, 155, 165)
                                                        hci_packets.LegacyAdvertisingEventProperties.ADV_IND, 155, 165)

        py_hci_adv.set_data(b'Im_A_Cert')
        py_hci_adv.set_scan_response(b'Im_A_C')
+2 −2
Original line number Diff line number Diff line
@@ -268,7 +268,7 @@ CmdEvtActivityClassification lookup_cmd(hci::OpCode opcode) {
    case hci::OpCode::LE_SET_SCAN_RESPONSE_DATA:
    case hci::OpCode::LE_SET_ADVERTISING_ENABLE:
    case hci::OpCode::LE_SET_EXTENDED_ADVERTISING_DATA:
    case hci::OpCode::LE_SET_EXTENDED_ADVERTISING_SCAN_RESPONSE:
    case hci::OpCode::LE_SET_EXTENDED_SCAN_RESPONSE_DATA:
    case hci::OpCode::LE_SET_EXTENDED_ADVERTISING_ENABLE:
    case hci::OpCode::LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH:
    case hci::OpCode::LE_READ_NUMBER_OF_SUPPORTED_ADVERTISING_SETS:
@@ -277,7 +277,7 @@ CmdEvtActivityClassification lookup_cmd(hci::OpCode opcode) {
    case hci::OpCode::LE_SET_PERIODIC_ADVERTISING_PARAM:
    case hci::OpCode::LE_SET_PERIODIC_ADVERTISING_DATA:
    case hci::OpCode::LE_SET_PERIODIC_ADVERTISING_ENABLE:
    case hci::OpCode::LE_SET_EXTENDED_ADVERTISING_RANDOM_ADDRESS:
    case hci::OpCode::LE_SET_ADVERTISING_SET_RANDOM_ADDRESS:
      classification = {.activity = Activity::ADVERTISE, .connection_handle_pos = 0, .address_pos = 0};
      break;

Loading