Skip to content

Commit

Permalink
Merge branch 'master' into chef-robotic-vacuum-cleaner-326681447
Browse files Browse the repository at this point in the history
  • Loading branch information
stingchang authored May 11, 2024
2 parents c5eea35 + f075b9b commit 67b77e0
Show file tree
Hide file tree
Showing 279 changed files with 10,904 additions and 10,181 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/examples-infineon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,32 @@ jobs:
/tmp/bloat_reports/
- name: Clean out build output
run: rm -rf ./out
- name: Build CYW30739 Thermostat App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target cyw30739-cyw30739b2_p5_evk_01-thermostat \
--target cyw30739-cyw30739b2_p5_evk_02-thermostat \
--target cyw30739-cyw30739b2_p5_evk_03-thermostat \
build \
--copy-artifacts-to out/artifacts \
"
- name: Get thermostat size stats
run: |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
cyw30739 CYW30739B2-P5-EVK-01 thermostat \
out/artifacts/cyw30739-cyw30739b2_p5_evk_01-thermostat/thermostat-CYW30739B2-P5-EVK-01.elf \
/tmp/bloat_reports/
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
cyw30739 CYW30739B2-P5-EVK-02 thermostat \
out/artifacts/cyw30739-cyw30739b2_p5_evk_02-thermostat/thermostat-CYW30739B2-P5-EVK-02.elf \
/tmp/bloat_reports/
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
cyw30739 CYW30739B2-P5-EVK-03 thermostat \
out/artifacts/cyw30739-cyw30739b2_p5_evk_03-thermostat/thermostat-CYW30739B2-P5-EVK-03.elf \
/tmp/bloat_reports/
- name: Clean out build output
run: rm -rf ./out
- name: Uploading Size Reports
uses: ./.github/actions/upload-size-reports
if: ${{ !env.ACT }}
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/examples-linux-standalone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,16 @@ jobs:
linux debug air-purifier-app \
out/linux-x64-air-purifier/chip-air-purifier-app \
/tmp/bloat_reports/
- name: Build example Fabric Bridge App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target linux-x64-fabric-bridge \
build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
linux debug fabric-bridge-app \
out/linux-x64-fabric-bridge/fabric-bridge-app \
/tmp/bloat_reports/
- name: Uploading Size Reports
uses: ./.github/actions/upload-size-reports
if: ${{ !env.ACT }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ jobs:
output.
if: always()
run: |
git grep -I -n '0x%[0-9l.-]*[^0-9lxX".-]' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0
git grep -I -n '0x%[0-9l.*-]*[^xX"0-9l.*-]' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0
# git grep exits with 0 if it finds a match, but we want
# to fail (exit nonzero) on match. And we want to exclude this file,
Expand Down
8 changes: 8 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,14 @@
"cwd": "${workspaceFolder}"
},

{
"name": "Fabric Bridge App (Linux)",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/out/debug/standalone/fabric-bridge-app",
"cwd": "${workspaceFolder}"
},

{
"name": "OTA Requestor App (Linux)",
"type": "lldb",
Expand Down
1 change: 1 addition & 0 deletions docs/ERROR_CODES.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ This file was **AUTOMATICALLY** generated by
| 29 | 0x1D | `CHIP_ERROR_INVALID_IPK` |
| 30 | 0x1E | `CHIP_ERROR_INVALID_STRING_LENGTH` |
| 31 | 0x1F | `CHIP_ERROR_INVALID_LIST_LENGTH` |
| 32 | 0x20 | `CHIP_ERROR_FAILED_DEVICE_ATTESTATION` |
| 33 | 0x21 | `CHIP_ERROR_END_OF_TLV` |
| 34 | 0x22 | `CHIP_ERROR_TLV_UNDERRUN` |
| 35 | 0x23 | `CHIP_ERROR_INVALID_TLV_ELEMENT` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class CHIPToolActivity :
startActivity(redirectIntent)
}

override fun SetNetworkType(type: ProvisionNetworkType) {
override fun setNetworkType(type: ProvisionNetworkType?) {
networkType = type
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class SelectActionFragment : Fragment() {
/** Notifies listener of a click to manually input the CHIP device address. */
fun onShowDeviceAddressInput()

fun SetNetworkType(type: ProvisionNetworkType)
fun setNetworkType(type: ProvisionNetworkType?)
}

private fun showFragment(fragment: Fragment, showOnBack: Boolean = true) {
Expand All @@ -172,6 +172,7 @@ class SelectActionFragment : Fragment() {

/** Notifies listener of Scan QR code button click. */
private fun handleScanQrCodeClicked() {
getCallback()?.setNetworkType(null)
showFragment(BarcodeFragment.newInstance())
}

Expand Down Expand Up @@ -226,13 +227,13 @@ class SelectActionFragment : Fragment() {

/** Notifies listener of provision-WiFi-credentials button click. */
private fun handleProvisionWiFiCredentialsClicked() {
getCallback()?.SetNetworkType(ProvisionNetworkType.WIFI)
getCallback()?.setNetworkType(ProvisionNetworkType.WIFI)
showFragment(BarcodeFragment.newInstance())
}

/** Notifies listener of provision-Thread-credentials button click. */
private fun handleProvisionThreadCredentialsClicked() {
getCallback()?.SetNetworkType(ProvisionNetworkType.THREAD)
getCallback()?.setNetworkType(ProvisionNetworkType.THREAD)
showFragment(BarcodeFragment.newInstance())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import com.google.chip.chiptool.ChipClient
import com.google.chip.chiptool.databinding.AddressUpdateFragmentBinding
import com.google.chip.chiptool.util.DeviceIdUtil
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -55,6 +54,8 @@ class AddressUpdateFragment : ICDCheckInCallback, Fragment() {

private val handler = Handler(Looper.getMainLooper())

private var externalICDCheckInMessageCallback: ICDCheckInMessageCallback? = null

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
Expand Down Expand Up @@ -128,11 +129,12 @@ class AddressUpdateFragment : ICDCheckInCallback, Fragment() {
}

val cluster = ChipClusters.IcdManagementCluster(devicePtr, 0)
val duration = suspendCoroutine { cont ->
val retDuration = suspendCoroutine { cont ->
cluster.stayActiveRequest(
object : ChipClusters.IcdManagementCluster.StayActiveResponseCallback {
override fun onError(error: Exception) {
cont.resumeWithException(error)
Log.d(TAG, "onError", error)
cont.resume(0L)
}

override fun onSuccess(promisedActiveDuration: Long) {
Expand All @@ -143,12 +145,11 @@ class AddressUpdateFragment : ICDCheckInCallback, Fragment() {
)
}
isSendingStayActiveCommand = false
return duration
return retDuration
}

private fun updateUIForICDInteractionSwitch(isEnabled: Boolean): Boolean {
val isICD =
deviceController.icdClientInfo.firstOrNull { info -> info.peerNodeId == deviceId } != null
val isICD = isICDDevice()
if (isEnabled && !isICD) {
binding.icdInteractionSwitch.isChecked = false
return false
Expand Down Expand Up @@ -188,7 +189,13 @@ class AddressUpdateFragment : ICDCheckInCallback, Fragment() {
return binding.deviceIdEd.text.toString().toULong(16)
}

fun isICDDevice(): Boolean {
return deviceController.icdClientInfo.firstOrNull { info -> info.peerNodeId == deviceId } !=
null
}

override fun notifyCheckInMessage(info: ICDClientInfo) {
externalICDCheckInMessageCallback?.notifyCheckInMessage()
if (info.peerNodeId != icdDeviceId) {
return
}
Expand All @@ -206,6 +213,14 @@ class AddressUpdateFragment : ICDCheckInCallback, Fragment() {
}
}

fun setNotifyCheckInMessageCallback(callback: ICDCheckInMessageCallback?) {
externalICDCheckInMessageCallback = callback
}

interface ICDCheckInMessageCallback {
fun notifyCheckInMessage()
}

private fun turnOnActiveMode() {
requireActivity().runOnUiThread {
binding.icdProgressBar.max = (icdTotalRemainStayActiveTimeMs / 1000).toInt()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import matter.tlv.AnonymousTag
import matter.tlv.TlvReader
import matter.tlv.TlvWriter

class WildcardFragment : Fragment() {
class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCallback {
private var _binding: WildcardFragmentBinding? = null
private val binding
get() = _binding!!
Expand All @@ -63,6 +63,23 @@ class WildcardFragment : Fragment() {
private val invokePath = ArrayList<InvokeElement>()
private val subscribeIdList = ArrayList<ULong>()

data class ReadICDConfig(val isFabricFiltered: Boolean, val eventMin: Long?)

data class SubscribeICDConfig(
val minInterval: Int,
val maxInterval: Int,
val keepSubscriptions: Boolean,
val isFabricFiltered: Boolean,
val eventMin: Long?
)

data class WriteInvokeICDConfig(val timedRequestTimeoutMs: Int, val imTimeoutMs: Int)

private var readICDConfig: ReadICDConfig? = null
private var subscribeICDConfig: SubscribeICDConfig? = null
private var writeICDConfig: WriteInvokeICDConfig? = null
private var invokeICDConfig: WriteInvokeICDConfig? = null

private val reportCallback =
object : ReportCallback {
override fun onError(
Expand Down Expand Up @@ -173,6 +190,45 @@ class WildcardFragment : Fragment() {
return binding.root
}

override fun onResume() {
super.onResume()
addressUpdateFragment.setNotifyCheckInMessageCallback(this)
}

override fun onPause() {
addressUpdateFragment.setNotifyCheckInMessageCallback(null)
super.onPause()
}

override fun notifyCheckInMessage() {
Log.d(TAG, "notifyCheckInMessage")
if (attributePath.isNotEmpty() || eventPath.isNotEmpty()) {
if (binding.readRadioBtn.isChecked && readICDConfig != null) {
scope.launch { read(readICDConfig!!.isFabricFiltered, readICDConfig!!.eventMin) }
} else if (binding.subscribeRadioBtn.isChecked && subscribeICDConfig != null) {
scope.launch {
subscribe(
subscribeICDConfig!!.minInterval,
subscribeICDConfig!!.maxInterval,
subscribeICDConfig!!.keepSubscriptions,
subscribeICDConfig!!.isFabricFiltered,
subscribeICDConfig!!.eventMin
)
}
}
} else if (
binding.writeRadioBtn.isChecked && writePath.isNotEmpty() && writeICDConfig != null
) {
scope.launch { write(writeICDConfig!!.timedRequestTimeoutMs, writeICDConfig!!.imTimeoutMs) }
} else if (
binding.invokeRadioBtn.isChecked && invokePath.isNotEmpty() && invokeICDConfig != null
) {
scope.launch {
invoke(invokeICDConfig!!.timedRequestTimeoutMs, invokeICDConfig!!.imTimeoutMs)
}
}
}

private fun setVisibilityEachView(radioBtnId: Int) {
val readBtnOn = (radioBtnId == R.id.readRadioBtn)
val subscribeBtnOn = (radioBtnId == R.id.subscribeRadioBtn)
Expand Down Expand Up @@ -520,7 +576,12 @@ class WildcardFragment : Fragment() {
if (eventPath.isNotEmpty() && eventMinEd.text.isNotBlank()) {
eventMin = eventMinEd.text.toString().toULong().toLong()
}
read(isFabricFilteredEd.selectedItem.toString().toBoolean(), eventMin)
if (addressUpdateFragment.isICDDevice()) {
readICDConfig =
ReadICDConfig(isFabricFilteredEd.selectedItem.toString().toBoolean(), eventMin)
} else {
read(isFabricFilteredEd.selectedItem.toString().toBoolean(), eventMin)
}
requireActivity().runOnUiThread { dialog.dismiss() }
}
}
Expand All @@ -537,18 +598,23 @@ class WildcardFragment : Fragment() {
dialogView.findViewById<EditText>(R.id.timedRequestTimeoutEd).text.toString()
val imTimeout = dialogView.findViewById<EditText>(R.id.imTimeoutEd).text.toString()
scope.launch {
write(
val timedRequestTimeoutInt =
if (timedRequestTimeoutMs.isEmpty()) {
0
} else {
timedRequestTimeoutMs.toInt()
},
}
val imTimeoutInt =
if (imTimeout.isEmpty()) {
0
} else {
imTimeout.toInt()
}
)
if (addressUpdateFragment.isICDDevice()) {
writeICDConfig = WriteInvokeICDConfig(timedRequestTimeoutInt, imTimeoutInt)
} else {
write(timedRequestTimeoutInt, imTimeoutInt)
}
requireActivity().runOnUiThread { dialog.dismiss() }
}
}
Expand Down Expand Up @@ -588,13 +654,24 @@ class WildcardFragment : Fragment() {
if (eventPath.isNotEmpty() && eventMinEd.text.isNotBlank()) {
eventMin = eventMinEd.text.toString().toULong().toLong()
}
subscribe(
minIntervalEd.text.toString().toInt(),
maxIntervalEd.text.toString().toInt(),
keepSubscriptionsSp.selectedItem.toString().toBoolean(),
isFabricFilteredSp.selectedItem.toString().toBoolean(),
eventMin,
)
if (addressUpdateFragment.isICDDevice()) {
subscribeICDConfig =
SubscribeICDConfig(
minIntervalEd.text.toString().toInt(),
maxIntervalEd.text.toString().toInt(),
keepSubscriptionsSp.selectedItem.toString().toBoolean(),
isFabricFilteredSp.selectedItem.toString().toBoolean(),
eventMin
)
} else {
subscribe(
minIntervalEd.text.toString().toInt(),
maxIntervalEd.text.toString().toInt(),
keepSubscriptionsSp.selectedItem.toString().toBoolean(),
isFabricFilteredSp.selectedItem.toString().toBoolean(),
eventMin
)
}
} else {
Log.e(TAG, "minInterval or maxInterval is empty!")
}
Expand All @@ -614,18 +691,23 @@ class WildcardFragment : Fragment() {
dialogView.findViewById<EditText>(R.id.timedRequestTimeoutEd).text.toString()
val imTimeout = dialogView.findViewById<EditText>(R.id.imTimeoutEd).text.toString()
scope.launch {
invoke(
val timedRequestTimeoutInt =
if (timedRequestTimeoutMs.isEmpty()) {
0
} else {
timedRequestTimeoutMs.toInt()
},
}
val imTimeoutInt =
if (imTimeout.isEmpty()) {
0
} else {
imTimeout.toInt()
}
)
if (addressUpdateFragment.isICDDevice()) {
invokeICDConfig = WriteInvokeICDConfig(timedRequestTimeoutInt, imTimeoutInt)
} else {
invoke(timedRequestTimeoutInt, imTimeoutInt)
}
requireActivity().runOnUiThread { dialog.dismiss() }
}
}
Expand Down
Loading

0 comments on commit 67b77e0

Please sign in to comment.