Skip to content

Commit

Permalink
Add Unique ID read
Browse files Browse the repository at this point in the history
  • Loading branch information
joonhaengHeo committed Feb 14, 2023
1 parent 3d9bc88 commit ca9d265
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 @@ -124,6 +124,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 @@ -147,6 +148,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 @@ -441,6 +443,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 ca9d265

Please sign in to comment.