mirror of
https://github.com/google/bumble.git
synced 2026-05-08 03:58:01 +00:00
Merge pull request #709 from zxzxwu/hci3
Move return_parameters_fields to member
This commit is contained in:
@@ -94,23 +94,23 @@ hci.HCI_Command.register_commands(globals())
|
|||||||
fields=[
|
fields=[
|
||||||
("param0", 1),
|
("param0", 1),
|
||||||
],
|
],
|
||||||
return_parameters_fields=[
|
|
||||||
("status", hci.STATUS_SPEC),
|
|
||||||
("tlv", "*"),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
class HCI_Intel_Read_Version_Command(hci.HCI_Command):
|
class HCI_Intel_Read_Version_Command(hci.HCI_Command):
|
||||||
pass
|
|
||||||
|
return_parameters_fields = [
|
||||||
|
("status", hci.STATUS_SPEC),
|
||||||
|
("tlv", "*"),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
@hci.HCI_Command.command(
|
@hci.HCI_Command.command(
|
||||||
fields=[("data_type", 1), ("data", "*")],
|
fields=[("data_type", 1), ("data", "*")],
|
||||||
return_parameters_fields=[
|
|
||||||
("status", 1),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
class Hci_Intel_Secure_Send_Command(hci.HCI_Command):
|
class Hci_Intel_Secure_Send_Command(hci.HCI_Command):
|
||||||
pass
|
|
||||||
|
return_parameters_fields = [
|
||||||
|
("status", 1),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
@hci.HCI_Command.command(
|
@hci.HCI_Command.command(
|
||||||
@@ -121,23 +121,22 @@ class Hci_Intel_Secure_Send_Command(hci.HCI_Command):
|
|||||||
("boot_option", 1),
|
("boot_option", 1),
|
||||||
("boot_address", 4),
|
("boot_address", 4),
|
||||||
],
|
],
|
||||||
return_parameters_fields=[
|
|
||||||
("data", "*"),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
class HCI_Intel_Reset_Command(hci.HCI_Command):
|
class HCI_Intel_Reset_Command(hci.HCI_Command):
|
||||||
pass
|
return_parameters_fields = [
|
||||||
|
("data", "*"),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
@hci.HCI_Command.command(
|
@hci.HCI_Command.command(
|
||||||
fields=[("data", "*")],
|
fields=[("data", "*")],
|
||||||
return_parameters_fields=[
|
|
||||||
("status", hci.STATUS_SPEC),
|
|
||||||
("params", "*"),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
class Hci_Intel_Write_Device_Config_Command(hci.HCI_Command):
|
class Hci_Intel_Write_Device_Config_Command(hci.HCI_Command):
|
||||||
pass
|
|
||||||
|
return_parameters_fields = [
|
||||||
|
("status", hci.STATUS_SPEC),
|
||||||
|
("params", "*"),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -188,17 +188,16 @@ HCI_RTK_DROP_FIRMWARE_COMMAND = hci_vendor_command_op_code(0x66)
|
|||||||
HCI_Command.register_commands(globals())
|
HCI_Command.register_commands(globals())
|
||||||
|
|
||||||
|
|
||||||
@HCI_Command.command(return_parameters_fields=[("status", STATUS_SPEC), ("version", 1)])
|
@HCI_Command.command()
|
||||||
class HCI_RTK_Read_ROM_Version_Command(HCI_Command):
|
class HCI_RTK_Read_ROM_Version_Command(HCI_Command):
|
||||||
pass
|
return_parameters_fields = [("status", STATUS_SPEC), ("version", 1)]
|
||||||
|
|
||||||
|
|
||||||
@HCI_Command.command(
|
@HCI_Command.command(
|
||||||
fields=[("index", 1), ("payload", RTK_FRAGMENT_LENGTH)],
|
fields=[("index", 1), ("payload", RTK_FRAGMENT_LENGTH)],
|
||||||
return_parameters_fields=[("status", STATUS_SPEC), ("index", 1)],
|
|
||||||
)
|
)
|
||||||
class HCI_RTK_Download_Command(HCI_Command):
|
class HCI_RTK_Download_Command(HCI_Command):
|
||||||
pass
|
return_parameters_fields = [("status", STATUS_SPEC), ("index", 1)]
|
||||||
|
|
||||||
|
|
||||||
@HCI_Command.command()
|
@HCI_Command.command()
|
||||||
|
|||||||
707
bumble/hci.py
707
bumble/hci.py
File diff suppressed because it is too large
Load Diff
98
bumble/vendor/android/hci.py
vendored
98
bumble/vendor/android/hci.py
vendored
@@ -54,8 +54,13 @@ HCI_Command.register_commands(globals())
|
|||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@HCI_Command.command(
|
@HCI_Command.command()
|
||||||
return_parameters_fields=[
|
class HCI_LE_Get_Vendor_Capabilities_Command(HCI_Command):
|
||||||
|
# pylint: disable=line-too-long
|
||||||
|
'''
|
||||||
|
See https://source.android.com/docs/core/connect/bluetooth/hci_requirements#vendor-specific-capabilities
|
||||||
|
'''
|
||||||
|
return_parameters_fields = [
|
||||||
('status', STATUS_SPEC),
|
('status', STATUS_SPEC),
|
||||||
('max_advt_instances', 1),
|
('max_advt_instances', 1),
|
||||||
('offloaded_resolution_of_private_address', 1),
|
('offloaded_resolution_of_private_address', 1),
|
||||||
@@ -73,12 +78,6 @@ HCI_Command.register_commands(globals())
|
|||||||
('bluetooth_quality_report_support', 1),
|
('bluetooth_quality_report_support', 1),
|
||||||
('dynamic_audio_buffer_support', 4),
|
('dynamic_audio_buffer_support', 4),
|
||||||
]
|
]
|
||||||
)
|
|
||||||
class HCI_LE_Get_Vendor_Capabilities_Command(HCI_Command):
|
|
||||||
# pylint: disable=line-too-long
|
|
||||||
'''
|
|
||||||
See https://source.android.com/docs/core/connect/bluetooth/hci_requirements#vendor-specific-capabilities
|
|
||||||
'''
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def parse_return_parameters(cls, parameters):
|
def parse_return_parameters(cls, parameters):
|
||||||
@@ -115,17 +114,6 @@ class HCI_LE_Get_Vendor_Capabilities_Command(HCI_Command):
|
|||||||
),
|
),
|
||||||
('payload', '*'),
|
('payload', '*'),
|
||||||
],
|
],
|
||||||
return_parameters_fields=[
|
|
||||||
('status', STATUS_SPEC),
|
|
||||||
(
|
|
||||||
'opcode',
|
|
||||||
{
|
|
||||||
'size': 1,
|
|
||||||
'mapper': lambda x: HCI_LE_APCF_Command.opcode_name(x),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
('payload', '*'),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
class HCI_LE_APCF_Command(HCI_Command):
|
class HCI_LE_APCF_Command(HCI_Command):
|
||||||
# pylint: disable=line-too-long
|
# pylint: disable=line-too-long
|
||||||
@@ -135,6 +123,17 @@ class HCI_LE_APCF_Command(HCI_Command):
|
|||||||
NOTE: the subcommand-specific payloads are left as opaque byte arrays in this
|
NOTE: the subcommand-specific payloads are left as opaque byte arrays in this
|
||||||
implementation. A future enhancement may define subcommand-specific data structures.
|
implementation. A future enhancement may define subcommand-specific data structures.
|
||||||
'''
|
'''
|
||||||
|
return_parameters_fields = [
|
||||||
|
('status', STATUS_SPEC),
|
||||||
|
(
|
||||||
|
'opcode',
|
||||||
|
{
|
||||||
|
'size': 1,
|
||||||
|
'mapper': lambda x: HCI_LE_APCF_Command.opcode_name(x),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
('payload', '*'),
|
||||||
|
]
|
||||||
|
|
||||||
# APCF Subcommands
|
# APCF Subcommands
|
||||||
# TODO: use the OpenIntEnum class (when upcoming PR is merged)
|
# TODO: use the OpenIntEnum class (when upcoming PR is merged)
|
||||||
@@ -170,20 +169,19 @@ class HCI_LE_APCF_Command(HCI_Command):
|
|||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@HCI_Command.command(
|
@HCI_Command.command()
|
||||||
return_parameters_fields=[
|
|
||||||
('status', STATUS_SPEC),
|
|
||||||
('total_tx_time_ms', 4),
|
|
||||||
('total_rx_time_ms', 4),
|
|
||||||
('total_idle_time_ms', 4),
|
|
||||||
('total_energy_used', 4),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
class HCI_Get_Controller_Activity_Energy_Info_Command(HCI_Command):
|
class HCI_Get_Controller_Activity_Energy_Info_Command(HCI_Command):
|
||||||
# pylint: disable=line-too-long
|
# pylint: disable=line-too-long
|
||||||
'''
|
'''
|
||||||
See https://source.android.com/docs/core/connect/bluetooth/hci_requirements#le_get_controller_activity_energy_info
|
See https://source.android.com/docs/core/connect/bluetooth/hci_requirements#le_get_controller_activity_energy_info
|
||||||
'''
|
'''
|
||||||
|
return_parameters_fields = [
|
||||||
|
('status', STATUS_SPEC),
|
||||||
|
('total_tx_time_ms', 4),
|
||||||
|
('total_rx_time_ms', 4),
|
||||||
|
('total_idle_time_ms', 4),
|
||||||
|
('total_energy_used', 4),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@@ -198,17 +196,6 @@ class HCI_Get_Controller_Activity_Energy_Info_Command(HCI_Command):
|
|||||||
),
|
),
|
||||||
('payload', '*'),
|
('payload', '*'),
|
||||||
],
|
],
|
||||||
return_parameters_fields=[
|
|
||||||
('status', STATUS_SPEC),
|
|
||||||
(
|
|
||||||
'opcode',
|
|
||||||
{
|
|
||||||
'size': 1,
|
|
||||||
'mapper': lambda x: HCI_A2DP_Hardware_Offload_Command.opcode_name(x),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
('payload', '*'),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
class HCI_A2DP_Hardware_Offload_Command(HCI_Command):
|
class HCI_A2DP_Hardware_Offload_Command(HCI_Command):
|
||||||
# pylint: disable=line-too-long
|
# pylint: disable=line-too-long
|
||||||
@@ -218,6 +205,17 @@ class HCI_A2DP_Hardware_Offload_Command(HCI_Command):
|
|||||||
NOTE: the subcommand-specific payloads are left as opaque byte arrays in this
|
NOTE: the subcommand-specific payloads are left as opaque byte arrays in this
|
||||||
implementation. A future enhancement may define subcommand-specific data structures.
|
implementation. A future enhancement may define subcommand-specific data structures.
|
||||||
'''
|
'''
|
||||||
|
return_parameters_fields = [
|
||||||
|
('status', STATUS_SPEC),
|
||||||
|
(
|
||||||
|
'opcode',
|
||||||
|
{
|
||||||
|
'size': 1,
|
||||||
|
'mapper': lambda x: HCI_A2DP_Hardware_Offload_Command.opcode_name(x),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
('payload', '*'),
|
||||||
|
]
|
||||||
|
|
||||||
# A2DP Hardware Offload Subcommands
|
# A2DP Hardware Offload Subcommands
|
||||||
# TODO: use the OpenIntEnum class (when upcoming PR is merged)
|
# TODO: use the OpenIntEnum class (when upcoming PR is merged)
|
||||||
@@ -246,17 +244,6 @@ class HCI_A2DP_Hardware_Offload_Command(HCI_Command):
|
|||||||
),
|
),
|
||||||
('payload', '*'),
|
('payload', '*'),
|
||||||
],
|
],
|
||||||
return_parameters_fields=[
|
|
||||||
('status', STATUS_SPEC),
|
|
||||||
(
|
|
||||||
'opcode',
|
|
||||||
{
|
|
||||||
'size': 1,
|
|
||||||
'mapper': lambda x: HCI_Dynamic_Audio_Buffer_Command.opcode_name(x),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
('payload', '*'),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
class HCI_Dynamic_Audio_Buffer_Command(HCI_Command):
|
class HCI_Dynamic_Audio_Buffer_Command(HCI_Command):
|
||||||
# pylint: disable=line-too-long
|
# pylint: disable=line-too-long
|
||||||
@@ -266,6 +253,17 @@ class HCI_Dynamic_Audio_Buffer_Command(HCI_Command):
|
|||||||
NOTE: the subcommand-specific payloads are left as opaque byte arrays in this
|
NOTE: the subcommand-specific payloads are left as opaque byte arrays in this
|
||||||
implementation. A future enhancement may define subcommand-specific data structures.
|
implementation. A future enhancement may define subcommand-specific data structures.
|
||||||
'''
|
'''
|
||||||
|
return_parameters_fields = [
|
||||||
|
('status', STATUS_SPEC),
|
||||||
|
(
|
||||||
|
'opcode',
|
||||||
|
{
|
||||||
|
'size': 1,
|
||||||
|
'mapper': lambda x: HCI_Dynamic_Audio_Buffer_Command.opcode_name(x),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
('payload', '*'),
|
||||||
|
]
|
||||||
|
|
||||||
# Dynamic Audio Buffer Subcommands
|
# Dynamic Audio Buffer Subcommands
|
||||||
# TODO: use the OpenIntEnum class (when upcoming PR is merged)
|
# TODO: use the OpenIntEnum class (when upcoming PR is merged)
|
||||||
|
|||||||
26
bumble/vendor/zephyr/hci.py
vendored
26
bumble/vendor/zephyr/hci.py
vendored
@@ -51,12 +51,6 @@ class TX_Power_Level_Command:
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@HCI_Command.command(
|
@HCI_Command.command(
|
||||||
fields=[('handle_type', 1), ('connection_handle', 2), ('tx_power_level', -1)],
|
fields=[('handle_type', 1), ('connection_handle', 2), ('tx_power_level', -1)],
|
||||||
return_parameters_fields=[
|
|
||||||
('status', STATUS_SPEC),
|
|
||||||
('handle_type', 1),
|
|
||||||
('connection_handle', 2),
|
|
||||||
('selected_tx_power_level', -1),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
class HCI_Write_Tx_Power_Level_Command(HCI_Command, TX_Power_Level_Command):
|
class HCI_Write_Tx_Power_Level_Command(HCI_Command, TX_Power_Level_Command):
|
||||||
'''
|
'''
|
||||||
@@ -67,16 +61,17 @@ class HCI_Write_Tx_Power_Level_Command(HCI_Command, TX_Power_Level_Command):
|
|||||||
TX_POWER_HANDLE_TYPE_SCAN should be zero.
|
TX_POWER_HANDLE_TYPE_SCAN should be zero.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
return_parameters_fields = [
|
||||||
|
('status', STATUS_SPEC),
|
||||||
|
('handle_type', 1),
|
||||||
|
('connection_handle', 2),
|
||||||
|
('selected_tx_power_level', -1),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@HCI_Command.command(
|
@HCI_Command.command(
|
||||||
fields=[('handle_type', 1), ('connection_handle', 2)],
|
fields=[('handle_type', 1), ('connection_handle', 2)],
|
||||||
return_parameters_fields=[
|
|
||||||
('status', STATUS_SPEC),
|
|
||||||
('handle_type', 1),
|
|
||||||
('connection_handle', 2),
|
|
||||||
('tx_power_level', -1),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
class HCI_Read_Tx_Power_Level_Command(HCI_Command, TX_Power_Level_Command):
|
class HCI_Read_Tx_Power_Level_Command(HCI_Command, TX_Power_Level_Command):
|
||||||
'''
|
'''
|
||||||
@@ -86,3 +81,10 @@ class HCI_Read_Tx_Power_Level_Command(HCI_Command, TX_Power_Level_Command):
|
|||||||
Power level is in dB. Connection handle for TX_POWER_HANDLE_TYPE_ADV and
|
Power level is in dB. Connection handle for TX_POWER_HANDLE_TYPE_ADV and
|
||||||
TX_POWER_HANDLE_TYPE_SCAN should be zero.
|
TX_POWER_HANDLE_TYPE_SCAN should be zero.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
return_parameters_fields = [
|
||||||
|
('status', STATUS_SPEC),
|
||||||
|
('handle_type', 1),
|
||||||
|
('connection_handle', 2),
|
||||||
|
('tx_power_level', -1),
|
||||||
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user