From b1a77006882dac84cfe0af34798f648a0882f95a Mon Sep 17 00:00:00 2001
From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com>
Date: Thu, 16 Feb 2023 23:09:45 +0900
Subject: [PATCH] Add Unique ID read (#25070)
---
.../clusterclient/BasicClientFragment.kt | 16 ++++++++++++++++
.../CHIPTool/app/src/main/res/values/strings.xml | 1 +
2 files changed, 17 insertions(+)
diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/BasicClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/BasicClientFragment.kt
index d98147eb97dbf7..ee9cf567aeb54b 100644
--- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/BasicClientFragment.kt
+++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/BasicClientFragment.kt
@@ -125,6 +125,7 @@ class BasicClientFragment : Fragment() {
getString(R.string.basic_cluster_serial_number_text) -> sendReadSerialNumberAttribute()
getString(R.string.basic_cluster_local_config_disabled_text) -> sendReadLocalConfigDisabledAttribute()
getString(R.string.basic_cluster_reachable_text) -> sendReadReachableAttribute()
+ getString(R.string.basic_cluster_unique_id_text) -> sendReadUniqueIDAttribute()
getString(R.string.basic_cluster_cluster_revision_text) -> sendReadClusterRevisionAttribute()
}
}
@@ -148,6 +149,7 @@ class BasicClientFragment : Fragment() {
ATTRIBUTES.add(getString(R.string.basic_cluster_serial_number_text))
ATTRIBUTES.add(getString(R.string.basic_cluster_local_config_disabled_text))
ATTRIBUTES.add(getString(R.string.basic_cluster_reachable_text))
+ ATTRIBUTES.add(getString(R.string.basic_cluster_unique_id_text))
ATTRIBUTES.add(getString(R.string.basic_cluster_cluster_revision_text))
}
@@ -442,6 +444,20 @@ class BasicClientFragment : Fragment() {
})
}
+ private suspend fun sendReadUniqueIDAttribute() {
+ getBasicClusterForDevice().readUniqueIDAttribute(object : ChipClusters.CharStringAttributeCallback {
+ override fun onSuccess(value: String) {
+ Log.i(TAG,"[Read Success] UniqueID $value")
+ showMessage("[Read Success] UniqueID: $value")
+ }
+
+ override fun onError(ex: Exception) {
+ showMessage("Read UniqueID failure $ex")
+ Log.e(TAG, "Read UniqueID failure", ex)
+ }
+ })
+ }
+
private suspend fun sendReadClusterRevisionAttribute() {
getBasicClusterForDevice().readClusterRevisionAttribute(object : ChipClusters.IntegerAttributeCallback {
override fun onSuccess(value: Int) {
diff --git a/examples/android/CHIPTool/app/src/main/res/values/strings.xml b/examples/android/CHIPTool/app/src/main/res/values/strings.xml
index 4bc4263821bbaa..b1df988ff6722d 100644
--- a/examples/android/CHIPTool/app/src/main/res/values/strings.xml
+++ b/examples/android/CHIPTool/app/src/main/res/values/strings.xml
@@ -131,6 +131,7 @@
SerialNumber
LocalConfigDisabled
Reachable
+ UniqueID
ClusterRevision
Read