From 651c293b289f3f02ce8dab7c803ffef0710e3ec5 Mon Sep 17 00:00:00 2001 From: JasonLiuZhuoCheng Date: Thu, 4 Nov 2021 17:32:46 -0400 Subject: [PATCH] merge with master to get pass the check --- src/android/CHIPTool/.idea/misc.xml | 9 - .../ClusterDetailFragment.kt | 161 ------------------ .../ClusterInteractionFragment.kt | 25 --- 3 files changed, 195 deletions(-) delete mode 100644 src/android/CHIPTool/.idea/misc.xml diff --git a/src/android/CHIPTool/.idea/misc.xml b/src/android/CHIPTool/.idea/misc.xml deleted file mode 100644 index 37a750962da6f2..00000000000000 --- a/src/android/CHIPTool/.idea/misc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file 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 d90b8f4d5a88ad..72f0c0e33ab319 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 @@ -61,80 +61,30 @@ class ClusterDetailFragment : Fragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View { -<<<<<<< HEAD -<<<<<<< HEAD clusterMap = ClusterInfoMapping().clusterMap devicePtr = checkNotNull(requireArguments().getLong(DEVICE_PTR_KEY)) endpointId = checkNotNull(requireArguments().getInt(ENDPOINT_ID_KEY)) -======= - clusterMap = - checkNotNull(requireArguments().getSerializable(CLUSTER_MAP_INFO)) as HashMap - devicePtr = checkNotNull(requireArguments().getLong(DEVICE_PTR)) ->>>>>>> 7c783e227 (add back class description) return inflater.inflate(R.layout.cluster_detail_fragment, container, false).apply { deviceController.setCompletionListener(GenericChipDeviceListener()) -<<<<<<< HEAD commandAutoCompleteTv.visibility = View.GONE clusterAutoCompleteSetup(clusterAutoCompleteTv, commandAutoCompleteTv, parameterList) commandAutoCompleteSetup(commandAutoCompleteTv, inflater, parameterList, callbackList) -======= - commandAutoComplete.visibility = View.GONE - clusterAutoCompleteSetup(clusterAutoComplete, commandAutoComplete, parameterList) - commandAutoCompleteSetup(commandAutoComplete, inflater, parameterList, callbackList) ->>>>>>> d3d83a0bc (select different cluster, command will remove previous displayed parameter) -======= - clusterMap = ClusterInfoMapping().clusterMap - devicePtr = checkNotNull(requireArguments().getLong(DEVICE_PTR_KEY)) - endpointId = checkNotNull(requireArguments().getInt(ENDPOINT_ID_KEY)) - return inflater.inflate(R.layout.cluster_detail_fragment, container, false).apply { - deviceController.setCompletionListener(GenericChipDeviceListener()) - commandAutoCompleteTv.visibility = View.GONE - clusterAutoCompleteSetup(clusterAutoCompleteTv, commandAutoCompleteTv, parameterList) - commandAutoCompleteSetup(commandAutoCompleteTv, inflater, parameterList, callbackList) ->>>>>>> cd1c99028 (resolve comments) invokeCommand.setOnClickListener { val commandArguments = HashMap() parameterList.forEach { val type = -<<<<<<< HEAD -<<<<<<< HEAD selectedCommandInfo.commandParameters[it.clusterParameterNameTv.text.toString()]!!.type val data = castStringToType(it.clusterParameterData.text.toString(), type)!! -======= - selectedCommandInfo.commandParameters[it.parameterName.text.toString()]!!.type!! - val data = castCorrectType(type, it.parameterData.text.toString())!! - commandArguments[it.parameterName.text.toString()] = data - } ->>>>>>> d3d83a0bc (select different cluster, command will remove previous displayed parameter) -<<<<<<< HEAD commandArguments[it.clusterParameterNameTv.text.toString()] = data } -======= ->>>>>>> 7c783e227 (add back class description) -======= - selectedCommandInfo.commandParameters[it.clusterParameterNameTv.text.toString()]!!.type - val data = castStringToType(it.clusterParameterData.text.toString(), type)!! - - commandArguments[it.clusterParameterNameTv.text.toString()] = data - } ->>>>>>> cd1c99028 (resolve comments) selectedCommandInfo.getCommandFunction() .invokeCommand(selectedCluster, selectedCommandCallback, commandArguments) } } } -<<<<<<< HEAD -<<<<<<< HEAD private fun castStringToType(data: String, type: Class<*>): Any? { -======= - private fun castCorrectType(type: Class<*>, data: String): Any? { - ->>>>>>> 7c783e227 (add back class description) -======= - private fun castStringToType(data: String, type: Class<*>): Any? { ->>>>>>> cd1c99028 (resolve comments) return when (type) { Int::class.java -> data.toInt() String::class.java -> data @@ -184,22 +134,8 @@ class ClusterDetailFragment : Fragment() { selectedCommandInfo = selectedClusterInfo.commands[selectedCommand]!! selectedCommandCallback = selectedCommandInfo.commandCallbackSupplier.get() populateCommandParameter(inflater, parameterList) -<<<<<<< HEAD -<<<<<<< HEAD - selectedCommandCallback.setCallbackDelegate(object : ClusterCommandCallback { - override fun onSuccess(responseValues: Map) { -======= - selectedCommandCallback!!.setCallbackDelegate(object : ClusterCommandCallback { -<<<<<<< HEAD - override fun onSuccess(responseValues: Map) { ->>>>>>> d3d83a0bc (select different cluster, command will remove previous displayed parameter) -======= - override fun onSuccess(responseValues: Map) { ->>>>>>> 7a1c5d850 (add responseValueInfo class instead of string split) -======= selectedCommandCallback.setCallbackDelegate(object : ClusterCommandCallback { override fun onSuccess(responseValues: Map) { ->>>>>>> cd1c99028 (resolve comments) showMessage("Command success") // Populate UI based on response values. We know the types from CommandInfo.getCommandResponses(). requireActivity().runOnUiThread { @@ -222,78 +158,29 @@ class ClusterDetailFragment : Fragment() { private fun populateCommandParameter(inflater: LayoutInflater, parameterList: LinearLayout) { selectedCommandInfo.commandParameters.forEach { (paramName, paramInfo) -> -<<<<<<< HEAD -<<<<<<< HEAD val param = inflater.inflate(R.layout.cluster_parameter_item, null, false) as ConstraintLayout param.clusterParameterNameTv.text = "${paramName}" param.clusterParameterTypeTv.text = "${paramInfo.type}" -======= - val param = inflater.inflate(R.layout.parameter_item, null, false) as ConstraintLayout - param.parameterName.text = "${paramName}" - param.parameterType.text = "${paramInfo.type}" ->>>>>>> 78cf954d9 (fix parameter response ui alignment issue) -======= - val param = inflater.inflate(R.layout.cluster_parameter_item, null, false) as ConstraintLayout - param.clusterParameterNameTv.text = "${paramName}" - param.clusterParameterTypeTv.text = "${paramInfo.type}" ->>>>>>> cd1c99028 (resolve comments) parameterList.addView(param) } } private fun populateCallbackResult( -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - responseValues: Map, -======= - responseValues: Map, ->>>>>>> 7c783e227 (add back class description) -======= - responseValues: Map, ->>>>>>> 7a1c5d850 (add responseValueInfo class instead of string split) -======= responseValues: Map, ->>>>>>> cd1c99028 (resolve comments) inflater: LayoutInflater, callbackList: LinearLayout ) { responseValues.forEach { (variableNameType, response) -> -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -======= ->>>>>>> cd1c99028 (resolve comments) val callback = inflater.inflate(R.layout.cluster_callback_item, null, false) as ConstraintLayout callback.clusterCallbackNameTv.text = variableNameType.name callback.clusterCallbackDataTv.text = response.toString() callback.clusterCallbackTypeTv.text = variableNameType.type -<<<<<<< HEAD -======= - val callback = inflater.inflate(R.layout.callback_item, null, false) as LinearLayout -======= - val callback = inflater.inflate(R.layout.callback_item, null, false) as ConstraintLayout ->>>>>>> 78cf954d9 (fix parameter response ui alignment issue) - callback.callbackName.text = variableNameType.name - callback.callbackData.text = response.toString() - callback.callbackType.text = variableNameType.type ->>>>>>> 7a1c5d850 (add responseValueInfo class instead of string split) -======= ->>>>>>> cd1c99028 (resolve comments) callbackList.addView(callback) } } -<<<<<<< HEAD -<<<<<<< HEAD private fun getCommandOptions( -======= - private fun getCommand( ->>>>>>> 7c783e227 (add back class description) -======= - private fun getCommandOptions( ->>>>>>> d3d83a0bc (select different cluster, command will remove previous displayed parameter) clusterName: String ): ArrayAdapter { selectedClusterInfo = clusterMap[clusterName]!! @@ -301,24 +188,8 @@ class ClusterDetailFragment : Fragment() { return ArrayAdapter(requireContext(), android.R.layout.simple_list_item_1, commandNameList) } -<<<<<<< HEAD -<<<<<<< HEAD private fun constructHint(clusterMap: Map): Array { return clusterMap.keys.toTypedArray() -<<<<<<< HEAD -======= - private fun constructHint(clusterMap: HashMap): Array { -======= - private fun constructHint(clusterMap: Map): Array { ->>>>>>> cd1c99028 (resolve comments) - val clusterName = mutableListOf() - for ((name, info) in clusterMap) { - clusterName.add(name) - } - return clusterName.toTypedArray() ->>>>>>> d3d83a0bc (select different cluster, command will remove previous displayed parameter) -======= ->>>>>>> d419b4060 (resolve comments) } override fun onStop() { @@ -328,49 +199,17 @@ class ClusterDetailFragment : Fragment() { companion object { private const val TAG = "ClusterDetailFragment" -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - private const val ENDPOINT_ID_KEY = "endpoint_id" - private const val DEVICE_PTR_KEY = "device_ptr" - - fun newInstance( - deviceId: Long, - endpointId: Int -======= - private const val CLUSTER_MAP_INFO = "cluster_map_info" - private const val DEVICE_PTR = "device_ptr" - fun newInstance( - clusterMap: HashMap, - deviceId: Long ->>>>>>> 7c783e227 (add back class description) - ): ClusterDetailFragment { - return ClusterDetailFragment().apply { - arguments = Bundle(2).apply { - putLong(DEVICE_PTR_KEY, deviceId) - putInt(ENDPOINT_ID_KEY, endpointId) -======= - private const val ENDPOINT_ID = "endpoint_id" - private const val DEVICE_PTR = "device_ptr" -======= private const val ENDPOINT_ID_KEY = "endpoint_id" private const val DEVICE_PTR_KEY = "device_ptr" ->>>>>>> d419b4060 (resolve comments) fun newInstance( deviceId: Long, endpointId: Int ): ClusterDetailFragment { return ClusterDetailFragment().apply { arguments = Bundle(2).apply { -<<<<<<< HEAD - putLong(DEVICE_PTR, deviceId) - putInt(ENDPOINT_ID, endpointId) ->>>>>>> cd1c99028 (resolve comments) -======= putLong(DEVICE_PTR_KEY, deviceId) putInt(ENDPOINT_ID_KEY, endpointId) ->>>>>>> d419b4060 (resolve comments) } } } diff --git a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterInteractionFragment.kt b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterInteractionFragment.kt index 38683a66e8b35b..27c1b14f5d43cd 100644 --- a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterInteractionFragment.kt +++ b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterInteractionFragment.kt @@ -9,21 +9,16 @@ import androidx.fragment.app.Fragment import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.LinearLayoutManager import chip.devicecontroller.ChipDeviceController -import chip.devicecontroller.ClusterInfoMapping import com.google.chip.chiptool.ChipClient import com.google.chip.chiptool.GenericChipDeviceListener import com.google.chip.chiptool.R -<<<<<<< HEAD -======= import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.cancel ->>>>>>> cd1c99028 (resolve comments) import com.google.chip.chiptool.clusterclient.AddressUpdateFragment import kotlinx.android.synthetic.main.cluster_interaction_fragment.view.endpointList import kotlinx.android.synthetic.main.cluster_interaction_fragment.view.getEndpointListBtn -import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch class ClusterInteractionFragment : Fragment() { @@ -71,29 +66,9 @@ class ClusterInteractionFragment : Fragment() { } } -<<<<<<< HEAD - inner class ChipControllerCallback : GenericChipDeviceListener() { - override fun onConnectDeviceComplete() {} - - override fun onCommissioningComplete(nodeId: Long, errorCode: Int) { - } - - override fun onNotifyChipConnectionClosed() { - Log.d(TAG, "onNotifyChipConnectionClosed") - } - - override fun onCloseBleComplete() { - Log.d(TAG, "onCloseBleComplete") - } - - override fun onError(error: Throwable?) { - Log.d(TAG, "onError: $error") - } -======= override fun onStop() { super.onStop() scope.cancel() ->>>>>>> d3d83a0bc (select different cluster, command will remove previous displayed parameter) } companion object {