Skip to content

Commit

Permalink
Implement kotlin setup-payload phase III (#27389)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored and pull[bot] committed Oct 17, 2023
1 parent b6b2238 commit 1078011
Show file tree
Hide file tree
Showing 13 changed files with 988 additions and 384 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class CHIPToolActivity :
// parse payload from JSON
val setupPayload = OnboardingPayload()
// set defaults
setupPayload.discoveryCapabilities = setOf()
setupPayload.discoveryCapabilities = mutableSetOf()
setupPayload.optionalQRCodeInfo = HashMap()

// read from payload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ data class CHIPDeviceInfo(
val setupPinCode: Long = 0L,
var commissioningFlow: Int = 0,
val optionalQrCodeInfoMap: Map<Int, QrCodeInfo> = mapOf(),
val discoveryCapabilities: Set<DiscoveryCapability> = setOf(),
val discoveryCapabilities: MutableSet<DiscoveryCapability> = mutableSetOf(),
val isShortDiscriminator: Boolean = false,
val ipAddress: String? = null,
) : Parcelable {
Expand Down
12 changes: 1 addition & 11 deletions scripts/build/builders/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ def copyToSrcAndroid(self):
# If we unify the JNI libraries, libc++_shared.so may not be needed anymore, which could
# be another path of resolving this inconsistency.
for libName in [
"libOnboardingPayload.so",
"libCHIPController.so",
"libc++_shared.so",
]:
Expand Down Expand Up @@ -478,8 +477,7 @@ def _build(self):
self.root, "examples/", self.app.ExampleName(), "android/App/app/libs"
)

libs = ["libOnboardingPayload.so",
"libc++_shared.so", "libTvApp.so"]
libs = ["libc++_shared.so", "libTvApp.so"]

jars = {
"OnboardingPayload.jar": "third_party/connectedhomeip/src/controller/java/OnboardingPayload.jar",
Expand Down Expand Up @@ -540,14 +538,6 @@ def build_outputs(self):
"lib",
"src/controller/java/OnboardingPayload.jar",
),
"jni/%s/libOnboardingPayload.so"
% self.board.AbiName(): os.path.join(
self.output_dir,
"lib",
"jni",
self.board.AbiName(),
"libOnboardingPayload.so",
),
"jni/%s/libCHIPController.so"
% self.board.AbiName(): os.path.join(
self.output_dir,
Expand Down
2 changes: 0 additions & 2 deletions scripts/build/testdata/dry_run_android-arm64-chip-tool.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ ninja -C {out}/android-arm64-chip-tool
# Prepare Native libs android-arm64-chip-tool
mkdir -p {root}/examples/android/CHIPTool/app/libs/jniLibs/arm64-v8a

cp {out}/android-arm64-chip-tool/lib/jni/arm64-v8a/libOnboardingPayload.so {root}/examples/android/CHIPTool/app/libs/jniLibs/arm64-v8a/libOnboardingPayload.so

cp {out}/android-arm64-chip-tool/lib/jni/arm64-v8a/libCHIPController.so {root}/examples/android/CHIPTool/app/libs/jniLibs/arm64-v8a/libCHIPController.so

cp {out}/android-arm64-chip-tool/lib/jni/arm64-v8a/libc++_shared.so {root}/examples/android/CHIPTool/app/libs/jniLibs/arm64-v8a/libc++_shared.so
Expand Down
27 changes: 5 additions & 22 deletions src/controller/java/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -238,40 +238,23 @@ kotlin_library("json_to_tlv_to_json_test") {
kotlinc_flags = [ "-Xlint:deprecation" ]
}

shared_library("jni_for_onboarding_payload") {
output_name = "libOnboardingPayload"
if (matter_enable_java_compilation) {
include_dirs = java_matter_controller_dependent_paths
output_dir = "${root_out_dir}/lib/jni"
} else {
output_dir = "${root_out_dir}/lib/jni/${android_abi}"
}

sources = [ "OnboardingPayloadParser-JNI.cpp" ]

deps = [
"${chip_root}/src/lib",
"${chip_root}/src/setup_payload",
]
}

kotlin_library("onboarding_payload") {
output_name = "OnboardingPayload.jar"

data_deps = [ ":jni_for_onboarding_payload" ]

if (!matter_enable_java_compilation) {
data_deps += [ "${chip_root}/build/chip/java:shared_cpplib" ]
}
deps = [ ":tlv" ]

sources = [
"src/chip/onboardingpayload/Base38.kt",
"src/chip/onboardingpayload/CommissioningFlow.kt",
"src/chip/onboardingpayload/DiscoveryCapability.kt",
"src/chip/onboardingpayload/ManualOnboardingPayloadGenerator.kt",
"src/chip/onboardingpayload/ManualOnboardingPayloadParser.kt",
"src/chip/onboardingpayload/OnboardingPayload.kt",
"src/chip/onboardingpayload/OnboardingPayloadParser.kt",
"src/chip/onboardingpayload/OptionalQRCodeInfo.kt",
"src/chip/onboardingpayload/QRCodeBasicOnboardingPayloadGenerator.kt",
"src/chip/onboardingpayload/QRCodeOnboardingPayloadGenerator.kt",
"src/chip/onboardingpayload/QRCodeOnboardingPayloadParser.kt",
"src/chip/onboardingpayload/VendorId.kt",
"src/chip/onboardingpayload/Verhoeff.kt",
"src/chip/onboardingpayload/Verhoeff10.kt",
Expand Down
Loading

0 comments on commit 1078011

Please sign in to comment.