Skip to content

Commit

Permalink
Add Unique ID read (#25070)
Browse files Browse the repository at this point in the history
  • Loading branch information
joonhaengHeo authored and pull[bot] committed Mar 27, 2023
1 parent 28d55fd commit b1a7700
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand All @@ -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))
}

Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
<string name="basic_cluster_serial_number_text">SerialNumber</string>
<string name="basic_cluster_local_config_disabled_text">LocalConfigDisabled</string>
<string name="basic_cluster_reachable_text">Reachable</string>
<string name="basic_cluster_unique_id_text">UniqueID</string>
<string name="basic_cluster_cluster_revision_text">ClusterRevision</string>

<string name="read_dialog_title_text">Read</string>
Expand Down

0 comments on commit b1a7700

Please sign in to comment.