Skip to content

Commit

Permalink
[android] Exit to the main screen after commissioning (#9371)
Browse files Browse the repository at this point in the history
* [android] Exit to the main screen after commissioning

Currently, Android CHIPTool automatically switches to
the Light On/Off screen after commissioning a device
reglardless of its device type, which is not optimal
for devices such as sensors. Exit to the main screen,
instead, so a user may select a suitable screen.

* Restyled by prettier-markdown

* Print a message on commissioning completion

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Sep 30, 2021
1 parent bffb66b commit 2197957
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
17 changes: 9 additions & 8 deletions docs/guides/nrfconnect_android_commissioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,22 +185,23 @@ device successfully joins the Thread network.

## Sending CHIP commands

Once the device is commissioned, the following screen appears:
Once the device is commissioned, the main application screen appears.

![CHIPTool device control screen](./images/CHIPTool_device_commissioned.jpg)
Check the IPv6 connectivity with the device using the following steps:

The two textboxes at the top contain **Fabric ID** and **Node ID** of the last
commissioned device.
1. Tap **LIGHT ON/OFF & LEVEL CLUSTER**. The following screen appears:

Check the IPv6 connectivity with the device using the following steps:
![CHIPTool device control screen](./images/CHIPTool_device_commissioned.jpg)

1. Tap **UPDATE ADDRESS** to learn or refresh the IPv6 address of the device.
The two textboxes at the top contain **Fabric ID** and **Node ID** of the
last commissioned device.

2. Tap **UPDATE ADDRESS** to learn or refresh the IPv6 address of the device.
CHIPTool will use a built-in DNS-SD client to resolve **Fabric ID** and
**Node ID** of the device to its IPv6 address. The result of the operation,
be it the address or an error message, will be displayed at the bottom of the
screen.

2. Tap the following buttons to change the lock state of the nRF Connect door
3. Tap the following buttons to change the lock state of the nRF Connect door
lock example application referenced in this guide:

- **ON** and **OFF** buttons lock and unlock the door, respectively.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ class CHIPToolActivity :
}

override fun onCommissioningComplete(code: Int) {
ChipClient.getDeviceController(this).close()
if (code == 0) {
showFragment(OnOffClientFragment.newInstance(), false)
} else {
showFragment(SelectActionFragment.newInstance(), false)
runOnUiThread {
Toast.makeText(
this,
getString(R.string.commissioning_completed, code),
Toast.LENGTH_SHORT).show()
}
ChipClient.getDeviceController(this).close()
showFragment(SelectActionFragment.newInstance(), false)
}

override fun handleScanQrCodeClicked() {
Expand Down
1 change: 1 addition & 0 deletions src/android/CHIPTool/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<string name="rendezvous_over_ble_pairing_failure_text">Pairing failed</string>
<string name="rendezvous_over_ble_commissioning_success_text">Network commissioning completed</string>
<string name="rendezvous_over_ble_commissioning_failure_text">Network commissioning failed</string>
<string name="commissioning_completed">Commissioning completed with result: %1$d</string>

<string name="attestation_test_btn_text">Attestation Test</string>
<string name="attestation_fetching_status">Fetching…</string>
Expand Down

0 comments on commit 2197957

Please sign in to comment.