diff --git a/tools/tcat_ble_client/cli/dataset_commands.py b/tools/tcat_ble_client/cli/dataset_commands.py index aa54c82d7..bac050ddf 100644 --- a/tools/tcat_ble_client/cli/dataset_commands.py +++ b/tools/tcat_ble_client/cli/dataset_commands.py @@ -42,6 +42,17 @@ def handle_dataset_entry_command(type: MeshcopTlvType, args, context): return CommandResultNone() +class DatasetClearCommand(Command): + + def get_help_string(self) -> str: + return 'Clear dataset.' + + async def execute_default(self, args, context): + ds: ThreadDataset = context['dataset'] + ds.clear() + return CommandResultNone() + + class DatasetHelpCommand(Command): def get_help_string(self) -> str: @@ -194,6 +205,7 @@ class DatasetCommand(Command): def __init__(self): self._subcommands = { + 'clear': DatasetClearCommand(), 'help': DatasetHelpCommand(), 'hex': PrintDatasetHexCommand(), 'reload': ReloadDatasetCommand(), diff --git a/tools/tcat_ble_client/dataset/dataset.py b/tools/tcat_ble_client/dataset/dataset.py index 2ec4cdda8..384bd2652 100644 --- a/tools/tcat_ble_client/dataset/dataset.py +++ b/tools/tcat_ble_client/dataset/dataset.py @@ -62,3 +62,6 @@ class ThreadDataset: self.entries[type].set(args) return raise KeyError(f'Key {type} not available in the dataset.') + + def clear(self): + self.entries.clear()