Skip to content

Commit

Permalink
Merge branch 'master' into fix_android_external_noc_issue
Browse files Browse the repository at this point in the history
  • Loading branch information
joonhaengHeo authored Feb 22, 2024
2 parents 54d06d6 + 4158d55 commit 3d6ea89
Show file tree
Hide file tree
Showing 66 changed files with 440 additions and 244 deletions.
4 changes: 3 additions & 1 deletion build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ if (_chip_defaults.custom_toolchain != "") {
"Unsupported target_cpu: ${current_cpu}. Shall be arm for webOS")
}
} else {
assert(false, "No toolchain specified, please specify custom_toolchain")
assert(
false,
"No toolchain specified, please specify custom_toolchain for host_os='${host_os}', target_os='${target_os}', host_cpu='${host_cpu}', target_cpu='${target_cpu}'")
}

set_default_toolchain(_default_toolchain)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,13 @@ class BasicClientFragment : Fragment() {
val attributeId = BasicInformation.Attribute.valueOf(attributeName).id

val devicePtr =
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}

ChipClient.getDeviceController(requireContext())
.readPath(
Expand Down Expand Up @@ -182,7 +188,13 @@ class BasicClientFragment : Fragment() {
private suspend fun sendWriteAttribute(attribute: BasicInformation.Attribute, tlv: ByteArray) {
val clusterId = BasicInformation.ID
val devicePtr =
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}

ChipClient.getDeviceController(requireContext())
.write(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,16 @@ class GroupSettingFragment : Fragment() {
private suspend fun sendKeySetWrite(
groupKeySetStruct: GroupKeyManagementClusterGroupKeySetStruct
) {
val cluster =
ChipClusters.GroupKeyManagementCluster(
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId),
0
)
val devicePtr =
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}
val cluster = ChipClusters.GroupKeyManagementCluster(devicePtr, 0)

cluster.keySetWrite(
object : ChipClusters.DefaultClusterCallback {
override fun onError(e: Exception?) {
Expand Down Expand Up @@ -311,11 +316,15 @@ class GroupSettingFragment : Fragment() {
}

private suspend fun writeGroupKeyMap(groupId: UInt, groupKeySetId: UInt) {
val cluster =
ChipClusters.GroupKeyManagementCluster(
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId),
0
)
val devicePtr =
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}
val cluster = ChipClusters.GroupKeyManagementCluster(devicePtr, 0)
cluster.writeGroupKeyMapAttribute(
object : ChipClusters.DefaultClusterCallback {
override fun onError(e: Exception?) {
Expand Down Expand Up @@ -356,11 +365,16 @@ class GroupSettingFragment : Fragment() {
}

private suspend fun sendAddGroup(groupId: UInt, groupName: String) {
val cluster =
ChipClusters.GroupsCluster(
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId),
0
)
val devicePtr =
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}
val cluster = ChipClusters.GroupsCluster(devicePtr, 0)

cluster.addGroup(
object : ChipClusters.GroupsCluster.AddGroupResponseCallback {
override fun onError(e: Exception?) {
Expand All @@ -379,11 +393,15 @@ class GroupSettingFragment : Fragment() {
}

private suspend fun readAccessControl() {
val cluster =
ChipClusters.AccessControlCluster(
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId),
0
)
val devicePtr =
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}
val cluster = ChipClusters.AccessControlCluster(devicePtr, 0)
cluster.readAclAttribute(
object : ChipClusters.AccessControlCluster.AclAttributeCallback {
override fun onError(e: Exception?) {
Expand Down Expand Up @@ -437,12 +455,16 @@ class GroupSettingFragment : Fragment() {
groupId: UInt,
privilege: UInt
) {
val devicePtr =
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}
// If GroupID is already added to AccessControl, do not add it.
val cluster =
ChipClusters.AccessControlCluster(
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId),
0
)
val cluster = ChipClusters.AccessControlCluster(devicePtr, 0)
val sendEntry = ArrayList<AccessControlClusterAccessControlEntryStruct>()
for (entry in value) {
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,16 @@ class MultiAdminClientFragment : Fragment() {

private suspend fun sendBasicCommissioningCommandClick() {
val testDuration = binding.timeoutEd.text.toString().toInt()
val devicePtr =
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}
deviceController.openPairingWindowCallback(
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId),
devicePtr,
testDuration,
object : OpenCommissioningCallback {
override fun onError(status: Int, deviceId: Long) {
Expand All @@ -140,7 +148,13 @@ class MultiAdminClientFragment : Fragment() {
val testDuration = binding.timeoutEd.text.toString().toInt()
val testIteration = 1000
val devicePointer =
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}

var setupPinCode: Long? = null
if (!binding.setupPinCodeEd.text.toString().isEmpty()) {
Expand Down Expand Up @@ -181,6 +195,14 @@ class MultiAdminClientFragment : Fragment() {
null
)

val devicePointer =
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}
deviceController.invoke(
object : InvokeCallback {
override fun onError(ex: Exception?) {
Expand All @@ -193,7 +215,7 @@ class MultiAdminClientFragment : Fragment() {
showMessage("Revoke Commissioning success")
}
},
getConnectedDevicePointer(),
devicePointer,
invokeElement,
timedInvokeTimeout,
0
Expand All @@ -208,6 +230,16 @@ class MultiAdminClientFragment : Fragment() {
val attributeId = attribute.id
val attributeName = attribute.name
val attributePath = ChipAttributePath.newInstance(endpointId, clusterId, attributeId)

val devicePointer =
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}

deviceController.readAttributePath(
object : ReportCallback {
override fun onReport(nodeState: NodeState?) {
Expand All @@ -230,16 +262,12 @@ class MultiAdminClientFragment : Fragment() {
showMessage("read $attributeName - error : ${e?.message}")
}
},
getConnectedDevicePointer(),
devicePointer,
listOf(attributePath),
0
)
}

private suspend fun getConnectedDevicePointer(): Long {
return ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
}

private fun showMessage(msg: String) {
requireActivity().runOnUiThread { binding.multiAdminClusterCommandStatus.text = msg }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ class OnOffClientFragment : Fragment() {

val attributePath = ChipAttributePath.newInstance(endpointId, clusterId, attributeId)

val devicePointer =
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}

ChipClient.getDeviceController(requireContext())
.readPath(
object : ReportCallback {
Expand All @@ -128,7 +137,7 @@ class OnOffClientFragment : Fragment() {
showMessage("On/Off attribute value: $value")
}
},
getConnectedDevicePointer(),
devicePointer,
listOf(attributePath),
null,
false,
Expand Down Expand Up @@ -181,6 +190,15 @@ class OnOffClientFragment : Fragment() {
)
}

val devicePointer =
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}

deviceController.subscribeToPath(
subscriptionEstablishedCallback,
resubscriptionAttemptCallback,
Expand Down Expand Up @@ -211,7 +229,7 @@ class OnOffClientFragment : Fragment() {
showReportMessage(message)
}
},
getConnectedDevicePointer(),
devicePointer,
listOf(attributePath),
null,
minInterval,
Expand Down Expand Up @@ -265,6 +283,15 @@ class OnOffClientFragment : Fragment() {
null
)

val devicePointer =
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}

deviceController.invoke(
object : InvokeCallback {
override fun onError(ex: Exception?) {
Expand All @@ -277,7 +304,7 @@ class OnOffClientFragment : Fragment() {
showMessage("MoveToLevel command success")
}
},
getConnectedDevicePointer(),
devicePointer,
invokeElement,
0,
0
Expand All @@ -298,6 +325,15 @@ class OnOffClientFragment : Fragment() {
null
)

val devicePointer =
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}

deviceController.invoke(
object : InvokeCallback {
override fun onError(ex: Exception?) {
Expand All @@ -310,17 +346,13 @@ class OnOffClientFragment : Fragment() {
showMessage("${commandId.name} command success")
}
},
getConnectedDevicePointer(),
devicePointer,
invokeElement,
0,
0
)
}

private suspend fun getConnectedDevicePointer(): Long {
return ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
}

private fun showMessage(msg: String) {
requireActivity().runOnUiThread { binding.commandStatusTv.text = msg }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ class OpCredClientFragment : Fragment() {
val attributeId = attribute.id

val devicePtr =
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}

ChipClient.getDeviceController(requireContext())
.readPath(
Expand Down Expand Up @@ -137,7 +143,13 @@ class OpCredClientFragment : Fragment() {

private suspend fun sendRemoveFabricsBtnClick(fabricIndex: UInt) {
val devicePtr =
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
try {
ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId)
} catch (e: IllegalStateException) {
Log.d(TAG, "getConnectedDevicePointer exception", e)
showMessage("Get DevicePointer fail!")
return
}
// TODO : Need to be implement poj-to-tlv
val tlvWriter = TlvWriter()
tlvWriter.startStructure(AnonymousTag)
Expand Down
Loading

0 comments on commit 3d6ea89

Please sign in to comment.