From 2a4b09d06586af92100f13aa9d71a9a469d0113d Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Fri, 31 Mar 2023 02:37:49 +0900 Subject: [PATCH] [Android] Add eventMin parameter (#25204) * Add eventMin parameter * Restyle * Modify space * Modify read dialog string --- .../clusterclient/WildcardFragment.kt | 27 +++- .../app/src/main/res/layout/read_dialog.xml | 30 ++++- .../src/main/res/layout/subscribe_dialog.xml | 12 ++ .../app/src/main/res/values/strings.xml | 2 + .../java/CHIPDeviceController-JNI.cpp | 14 +- .../ChipDeviceController.java | 120 ++++++++++++++++-- 6 files changed, 187 insertions(+), 18 deletions(-) diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt index 83a3ba0eae7cbc..c665adaeb97b47 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt @@ -229,7 +229,7 @@ class WildcardFragment : Fragment() { return stringBuilder.toString() } - private suspend fun subscribe(minInterval: Int, maxInterval: Int, keepSubscriptions: Boolean, isFabricFiltered: Boolean) { + private suspend fun subscribe(minInterval: Int, maxInterval: Int, keepSubscriptions: Boolean, isFabricFiltered: Boolean, eventMin: Long?) { val subscriptionEstablishedCallback = SubscriptionEstablishedCallback { subscriptionId -> @@ -255,17 +255,19 @@ class WildcardFragment : Fragment() { maxInterval, keepSubscriptions, isFabricFiltered, - /* imTimeoutMs= */ 0) + /* imTimeoutMs= */ 0, + eventMin) } - private suspend fun read(isFabricFiltered: Boolean) { + private suspend fun read(isFabricFiltered: Boolean, eventMin: Long?) { deviceController.readPath(reportCallback, ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), attributePath.ifEmpty { null }, eventPath.ifEmpty { null }, isFabricFiltered, - /* imTimeoutMs= */ 0) + /* imTimeoutMs= */ 0, + eventMin) } private suspend fun write(writeValueType: String, writeValue: String, dataVersion: Int?, timedRequestTimeoutMs: Int, imTimeoutMs: Int) { @@ -336,14 +338,20 @@ class WildcardFragment : Fragment() { return } val dialogView = requireActivity().layoutInflater.inflate(R.layout.read_dialog, null) + val eventMinEd = dialogView.findViewById(R.id.eventMinEd) + eventMinEd.visibility = if (eventPath.isNotEmpty()) { View.VISIBLE } else { View.GONE } val dialog = AlertDialog.Builder(requireContext()).apply { setView(dialogView) }.create() - val isFabricFilteredEd = dialogView.findViewById(R.id.isFabricFilteredSp) + val isFabricFilteredEd = dialogView.findViewById(R.id.isFabricFilteredSp) dialogView.findViewById