Skip to content

Commit

Permalink
Add CC13xx Factory Reset to allclusters/lock app (#22141)
Browse files Browse the repository at this point in the history
* Add CC13xx Factory Reset to allclusters/lock app

* Apply formatting

* Revert args.gni

* Restyled by prettier-markdown

Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Andrei Litvin <[email protected]>
  • Loading branch information
3 people authored Aug 31, 2022
1 parent 4e01cee commit 8873a20
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 30 deletions.
6 changes: 3 additions & 3 deletions examples/all-clusters-app/cc13x2x7_26x2x7/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 8 additions & 7 deletions examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions examples/all-clusters-minimal-app/cc13x2x7_26x2x7/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions examples/lock-app/cc13x2x7_26x2x7/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 8 additions & 7 deletions examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down

0 comments on commit 8873a20

Please sign in to comment.