mirror of
https://github.com/google/bumble.git
synced 2026-04-18 00:45:32 +00:00
Make DeviceConfiguration loadable from a dict
This commit is contained in:
@@ -260,10 +260,7 @@ class DeviceConfiguration:
|
||||
self.irk = bytes(16) # This really must be changed for any level of security
|
||||
self.keystore = None
|
||||
|
||||
def load_from_file(self, filename):
|
||||
with open(filename, 'r') as file:
|
||||
config = json.load(file)
|
||||
|
||||
def load_from_dict(self, config):
|
||||
# Load simple properties
|
||||
self.name = config.get('name', self.name)
|
||||
self.address = Address(config.get('address', self.address))
|
||||
@@ -287,6 +284,9 @@ class DeviceConfiguration:
|
||||
if advertising_data:
|
||||
self.advertising_data = bytes.fromhex(advertising_data)
|
||||
|
||||
def load_from_file(self, filename):
|
||||
with open(filename, 'r') as file:
|
||||
self.load_from_dict(json.load(file))
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Decorators used with the following Device class
|
||||
|
||||
Reference in New Issue
Block a user