From 18c35583bb255194ae5af84ad12425c05f3c601a Mon Sep 17 00:00:00 2001 From: JasonLiuZhuoCheng Date: Thu, 18 Nov 2021 14:09:19 -0500 Subject: [PATCH] use encodeToByteArray and decodeToString --- .../clusterinteraction/ClusterDetailFragment.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt index 2900cf47d9be54..dbcef06a253a43 100644 --- a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt +++ b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt @@ -24,9 +24,6 @@ import chip.devicecontroller.ClusterInfoMapping import com.google.chip.chiptool.ChipClient import com.google.chip.chiptool.GenericChipDeviceListener import com.google.chip.chiptool.R -import java.nio.charset.Charset -import java.nio.charset.StandardCharsets.UTF_16 -import java.nio.charset.StandardCharsets.UTF_8 import kotlinx.android.synthetic.main.cluster_callback_item.view.clusterCallbackDataTv import kotlinx.android.synthetic.main.cluster_callback_item.view.clusterCallbackNameTv import kotlinx.android.synthetic.main.cluster_callback_item.view.clusterCallbackTypeTv @@ -98,7 +95,7 @@ class ClusterDetailFragment : Fragment() { return when (type) { Int::class.java -> data.toInt() Boolean::class.java -> data.toBoolean() - ByteArray::class.java -> data.toByteArray() + ByteArray::class.java -> data.encodeToByteArray() Long::class.java -> data.toLong() else -> data } @@ -210,7 +207,7 @@ class ClusterDetailFragment : Fragment() { inflater.inflate(R.layout.cluster_callback_item, null, false) as ConstraintLayout callbackItem.clusterCallbackNameTv.text = variableNameType.name callbackItem.clusterCallbackDataTv.text = if (response.javaClass == ByteArray::class.java) { - (response as ByteArray).contentToString() + (response as ByteArray).decodeToString() } else { response.toString() }