diff --git a/subsys/bluetooth/shell/bt.c b/subsys/bluetooth/shell/bt.c index f55226238f9..0fea5d5d028 100644 --- a/subsys/bluetooth/shell/bt.c +++ b/subsys/bluetooth/shell/bt.c @@ -2016,6 +2016,8 @@ static const struct shell_cmd bt_commands[] = { #endif /* CONFIG_BLUETOOTH_GATT_CLIENT */ { "gatt-register-service", cmd_gatt_register_test_svc, "register pre-predefined test service" }, + { "gatt-unregister-service", cmd_gatt_unregister_test_svc, + "unregister pre-predefined test service" }, { "gatt-metrics", cmd_gatt_write_cmd_metrics, "register vendr char and measure rx [value on, off]" }, #if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL) diff --git a/subsys/bluetooth/shell/gatt.c b/subsys/bluetooth/shell/gatt.c index 9356ab9c9ec..936a71b141b 100644 --- a/subsys/bluetooth/shell/gatt.c +++ b/subsys/bluetooth/shell/gatt.c @@ -596,6 +596,15 @@ int cmd_gatt_register_test_svc(int argc, char *argv[]) return 0; } +int cmd_gatt_unregister_test_svc(int argc, char *argv[]) +{ + bt_gatt_unregister_service(&vnd_svc); + + printk("Unregistering test vendor service\n"); + + return 0; +} + static struct bt_uuid_128 met_svc_uuid = BT_UUID_INIT_128( 0x01, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12); diff --git a/subsys/bluetooth/shell/gatt.h b/subsys/bluetooth/shell/gatt.h index a12b84ef30a..bbd32a91087 100644 --- a/subsys/bluetooth/shell/gatt.h +++ b/subsys/bluetooth/shell/gatt.h @@ -22,6 +22,7 @@ int cmd_gatt_write_without_rsp(int argc, char *argv[]); int cmd_gatt_subscribe(int argc, char *argv[]); int cmd_gatt_unsubscribe(int argc, char *argv[]); int cmd_gatt_register_test_svc(int argc, char *argv[]); +int cmd_gatt_unregister_test_svc(int argc, char *argv[]); int cmd_gatt_write_cmd_metrics(int argc, char *argv[]); #endif /* __GATT_H */