Pandora: Configure identity address type

This commit is contained in:
Josh Wu
2023-08-02 17:46:32 +08:00
committed by Lucas Abel
parent 3ab2cd5e71
commit 0301b1a999
2 changed files with 9 additions and 1 deletions

View File

@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from bumble.pairing import PairingDelegate from bumble.pairing import PairingConfig, PairingDelegate
from dataclasses import dataclass from dataclasses import dataclass
from typing import Any, Dict from typing import Any, Dict
@@ -20,6 +20,7 @@ from typing import Any, Dict
@dataclass @dataclass
class Config: class Config:
io_capability: PairingDelegate.IoCapability = PairingDelegate.NO_OUTPUT_NO_INPUT io_capability: PairingDelegate.IoCapability = PairingDelegate.NO_OUTPUT_NO_INPUT
identity_address_type: PairingConfig.AddressType = PairingConfig.AddressType.RANDOM
pairing_sc_enable: bool = True pairing_sc_enable: bool = True
pairing_mitm_enable: bool = True pairing_mitm_enable: bool = True
pairing_bonding_enable: bool = True pairing_bonding_enable: bool = True
@@ -35,6 +36,12 @@ class Config:
'io_capability', 'no_output_no_input' 'io_capability', 'no_output_no_input'
).upper() ).upper()
self.io_capability = getattr(PairingDelegate, io_capability_name) self.io_capability = getattr(PairingDelegate, io_capability_name)
identity_address_type_name: str = config.get(
'identity_address_type', 'random'
).upper()
self.identity_address_type = getattr(
PairingConfig.AddressType, identity_address_type_name
)
self.pairing_sc_enable = config.get('pairing_sc_enable', True) self.pairing_sc_enable = config.get('pairing_sc_enable', True)
self.pairing_mitm_enable = config.get('pairing_mitm_enable', True) self.pairing_mitm_enable = config.get('pairing_mitm_enable', True)
self.pairing_bonding_enable = config.get('pairing_bonding_enable', True) self.pairing_bonding_enable = config.get('pairing_bonding_enable', True)

View File

@@ -232,6 +232,7 @@ class SecurityService(SecurityServicer):
sc=config.pairing_sc_enable, sc=config.pairing_sc_enable,
mitm=config.pairing_mitm_enable, mitm=config.pairing_mitm_enable,
bonding=config.pairing_bonding_enable, bonding=config.pairing_bonding_enable,
identity_address_type=config.identity_address_type,
delegate=PairingDelegate( delegate=PairingDelegate(
connection, connection,
self, self,