diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/README.md b/examples/all-clusters-app/cc13x2x7_26x2x7/README.md index fd2d0ee9c07cbb..8513b32723fabc 100644 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/README.md +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/README.md @@ -52,9 +52,9 @@ Short presses (less than 1000ms) of the user buttons are used currently unused in the all-clusters application, but stubs are provided. Long presses (greater than 1000ms) of the user buttons are used for controlling -BLE advertisements. The left button (`BTN-1`) is used to disable advertisements -if they are enabled. The Right button (`BTN-2`) is used to enable -advertisements. +BLE advertisements and resets. The left button (`BTN-1`) is used to perform a +factory reset of the device. The Right button (`BTN-2`) is used to disable BLE +advertisements (if enabled) or enable advertisements (if disabled). ## Building diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp index 09762791f4cf1a..14645f267a43db 100644 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -347,12 +347,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) } else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type) { - // Disable BLE advertisements - if (ConnectivityMgr().IsBLEAdvertisingEnabled()) - { - ConnectivityMgr().SetBLEAdvertisingEnabled(false); - PLAT_LOG("Disabled BLE Advertisements"); - } + chip::Server::GetInstance().ScheduleFactoryReset(); } break; @@ -367,13 +362,19 @@ void AppTask::DispatchEvent(AppEvent * aEvent) { if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR) { - PLAT_LOG("Enabled BLE Advertisement"); + PLAT_LOG("Enabled BLE Advertisements"); } else { PLAT_LOG("OpenBasicCommissioningWindow() failed"); } } + else + { + // Disable BLE advertisements + ConnectivityMgr().SetBLEAdvertisingEnabled(false); + PLAT_LOG("Disabled BLE Advertisements"); + } } break; diff --git a/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/README.md b/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/README.md index c23cf324afe8af..102a48b67bdf46 100644 --- a/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/README.md +++ b/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/README.md @@ -52,9 +52,9 @@ Short presses (less than 1000ms) of the user buttons are used currently unused in the all-clusters application, but stubs are provided. Long presses (greater than 1000ms) of the user buttons are used for controlling -BLE advertisements. The left button (`BTN-1`) is used to disable advertisements -if they are enabled. The Right button (`BTN-2`) is used to enable -advertisements. +BLE advertisements and resets. The left button (`BTN-1`) is used to perform a +factory reset of the device. The Right button (`BTN-2`) is used to disable BLE +advertisements (if enabled) or enable advertisements (if disabled). ## Building diff --git a/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/AppTask.cpp index 09762791f4cf1a..14645f267a43db 100644 --- a/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -347,12 +347,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) } else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type) { - // Disable BLE advertisements - if (ConnectivityMgr().IsBLEAdvertisingEnabled()) - { - ConnectivityMgr().SetBLEAdvertisingEnabled(false); - PLAT_LOG("Disabled BLE Advertisements"); - } + chip::Server::GetInstance().ScheduleFactoryReset(); } break; @@ -367,13 +362,19 @@ void AppTask::DispatchEvent(AppEvent * aEvent) { if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR) { - PLAT_LOG("Enabled BLE Advertisement"); + PLAT_LOG("Enabled BLE Advertisements"); } else { PLAT_LOG("OpenBasicCommissioningWindow() failed"); } } + else + { + // Disable BLE advertisements + ConnectivityMgr().SetBLEAdvertisingEnabled(false); + PLAT_LOG("Disabled BLE Advertisements"); + } } break; diff --git a/examples/lock-app/cc13x2x7_26x2x7/README.md b/examples/lock-app/cc13x2x7_26x2x7/README.md index 6c457b0fabe281..b9160bf082c5fb 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/README.md +++ b/examples/lock-app/cc13x2x7_26x2x7/README.md @@ -50,9 +50,9 @@ lock and unlock of the door lock. The left button (`BTN-1`) is used to request locking. The right button (`BTN-2`) is used to request unlocking. Long presses (greater than 1000ms) of the user buttons are used for controlling -BLE advertisements. The left button (`BTN-1`) is used to disable advertisements -if they are enabled. The Right button (`BTN-2`) is used to enable -advertisements. +BLE advertisements and resets. The left button (`BTN-1`) is used to perform a +factory reset of the device. The Right button (`BTN-2`) is used to disable BLE +advertisements (if enabled) or enable advertisements (if disabled). ## Building diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp index 4854eb4c5af0d8..55bf86deeedecc 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -345,12 +345,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) } else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type) { - // Disable BLE advertisements - if (ConnectivityMgr().IsBLEAdvertisingEnabled()) - { - ConnectivityMgr().SetBLEAdvertisingEnabled(false); - PLAT_LOG("Disabled BLE Advertisements"); - } + chip::Server::GetInstance().ScheduleFactoryReset(); } break; @@ -369,13 +364,19 @@ void AppTask::DispatchEvent(AppEvent * aEvent) { if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR) { - PLAT_LOG("Enabled BLE Advertisement"); + PLAT_LOG("Enabled BLE Advertisements"); } else { PLAT_LOG("OpenBasicCommissioningWindow() failed"); } } + else + { + // Disable BLE advertisements + ConnectivityMgr().SetBLEAdvertisingEnabled(false); + PLAT_LOG("Disabled BLE Advertisements"); + } } break;