Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into jmeg-sfy/window-covering-add-featuremap
  • Loading branch information
woody-apple committed Oct 27, 2021
2 parents dada6df + 1d10ef8 commit 3af5516
Show file tree
Hide file tree
Showing 43 changed files with 708 additions and 413 deletions.
77 changes: 15 additions & 62 deletions config/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,8 @@ if (CONFIG_CHIP_PW_RPC)
list(APPEND CHIP_LIBRARIES -lPwRpc)
if (${APP_TARGET} MATCHES "pigweed-app")
set(CONFIG_CHIP_PW_RPC_ECHO_PROTO "y")
elseif (${APP_TARGET} MATCHES "lighting-app")
set(CONFIG_CHIP_PW_RPC_COMMON_PROTO "y")
set(CONFIG_CHIP_PW_RPC_LIGHTING_PROTO "y")
elseif (${APP_TARGET} MATCHES "lock-app")
set(CONFIG_CHIP_PW_RPC_COMMON_PROTO "y")
set(CONFIG_CHIP_PW_RPC_LOCKING_PROTO "y")
else()
set(CONFIG_CHIP_PW_RPC_ECHO_PROTO "n")
endif()
endif(CONFIG_CHIP_PW_RPC)

Expand Down Expand Up @@ -275,9 +271,6 @@ chip_gn_arg_bool ("chip_bypass_rendezvous" CONFIG_CHIP_BYPASS_REN
chip_gn_arg_bool ("chip_build_pw_rpc_lib" CONFIG_CHIP_PW_RPC)
if (CONFIG_CHIP_PW_RPC)
chip_gn_arg_bool ("chip_build_pw_rpc_echo_proto" CONFIG_CHIP_PW_RPC_ECHO_PROTO)
chip_gn_arg_bool ("chip_build_pw_rpc_common_proto" CONFIG_CHIP_PW_RPC_COMMON_PROTO)
chip_gn_arg_bool ("chip_build_pw_rpc_lighting_proto" CONFIG_CHIP_PW_RPC_LIGHTING_PROTO)
chip_gn_arg_bool ("chip_build_pw_rpc_locking_proto" CONFIG_CHIP_PW_RPC_LOCKING_PROTO)
endif(CONFIG_CHIP_PW_RPC)

file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/args.gn CONTENT ${CHIP_GN_ARGS})
Expand Down Expand Up @@ -342,18 +335,26 @@ endif()
if (CONFIG_CHIP_PW_RPC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17" PARENT_SCOPE)
list(APPEND CHIP_DEFINES
CHIP_PW_RPC=1
CONFIG_CHIP_PW_RPC=1
)
endif()

target_include_directories(${APP_TARGET} PRIVATE
${CHIP_INCLUDES}
)

target_compile_definitions(${APP_TARGET} PRIVATE
${CHIP_DEFINES}
)


if (CONFIG_CHIP_PW_RPC)

set(PIGWEED_ROOT "${CHIP_ROOT}/third_party/pigweed/repo")

target_sources(${APP_TARGET} PRIVATE
${CHIP_ROOT}/examples/common/pigweed/RpcService.cpp
${CHIP_ROOT}/examples/common/pigweed/mbed/PigweedLoggerMutex.cpp
${CHIP_ROOT}/examples/common/pigweed/mbed/Rpc.cpp
${MBED_COMMON}/util/PigweedLogger.cpp
)

Expand Down Expand Up @@ -388,64 +389,16 @@ target_include_directories(${APP_TARGET} PRIVATE
${CHIP_ROOT}/third_party/nanopb/repo

${CHIP_ROOT}/examples/common
${CHIP_ROOT}/examples/common/pigweed
${CHIP_ROOT}/examples/common/pigweed/mbed
${CHIP_ROOT}/examples//common/pigweed/mbed
${MBED_COMMON}/pw_sys_io/public

${CMAKE_CURRENT_BINARY_DIR}/protocol_buffer/gen/third_party/connectedhomeip/third_party/pigweed/repo/pw_rpc/protos.proto_library/pwpb
${CMAKE_CURRENT_BINARY_DIR}/protocol_buffer/gen/third_party/connectedhomeip/third_party/pigweed/repo/pw_protobuf/common_protos.proto_library/nanopb
)

if (CONFIG_CHIP_PW_RPC_ECHO_PROTO)
target_include_directories(${APP_TARGET} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/protocol_buffer/gen/third_party/connectedhomeip/third_party/pigweed/repo/pw_rpc/protos.proto_library/nanopb_rpc
${CMAKE_CURRENT_BINARY_DIR}/protocol_buffer/gen/third_party/connectedhomeip/third_party/pigweed/repo/pw_rpc/protos.proto_library/nanopb
)
list(APPEND CHIP_DEFINES
CHIP_PW_RPC_ECHO_PROTO=1
${CMAKE_CURRENT_BINARY_DIR}/protocol_buffer/gen/third_party/connectedhomeip/third_party/pigweed/repo/pw_rpc/protos.proto_library/pwpb
)
endif(CONFIG_CHIP_PW_RPC_ECHO_PROTO)

if (CONFIG_CHIP_PW_RPC_COMMON_PROTO)
target_include_directories(${APP_TARGET} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/protocol_buffer/gen/third_party/connectedhomeip/examples/common/pigweed/button_service.proto_library/nanopb
${CMAKE_CURRENT_BINARY_DIR}/protocol_buffer/gen/third_party/connectedhomeip/examples/common/pigweed/button_service.proto_library/nanopb_rpc

${CMAKE_CURRENT_BINARY_DIR}/protocol_buffer/gen/third_party/connectedhomeip/examples/common/pigweed/device_service.proto_library/nanopb
${CMAKE_CURRENT_BINARY_DIR}/protocol_buffer/gen/third_party/connectedhomeip/examples/common/pigweed/device_service.proto_library/nanopb_rpc
)
list(APPEND CHIP_DEFINES
CHIP_PW_RPC_COMMON_PROTO=1
)
endif(CONFIG_CHIP_PW_RPC_COMMON_PROTO)

if (CONFIG_CHIP_PW_RPC_LIGHTING_PROTO)
target_include_directories(${APP_TARGET} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/protocol_buffer/gen/third_party/connectedhomeip/examples/common/pigweed/lighting_service.proto_library/nanopb
${CMAKE_CURRENT_BINARY_DIR}/protocol_buffer/gen/third_party/connectedhomeip/examples/common/pigweed/lighting_service.proto_library/nanopb_rpc
)
list(APPEND CHIP_DEFINES
CHIP_PW_RPC_LIGHTING_PROTO=1
)
endif(CONFIG_CHIP_PW_RPC_LIGHTING_PROTO)

if (CONFIG_CHIP_PW_RPC_LOCKING_PROTO)
target_include_directories(${APP_TARGET} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/protocol_buffer/gen/third_party/connectedhomeip/examples/common/pigweed/locking_service.proto_library/nanopb
${CMAKE_CURRENT_BINARY_DIR}/protocol_buffer/gen/third_party/connectedhomeip/examples/common/pigweed/locking_service.proto_library/nanopb_rpc
)
list(APPEND CHIP_DEFINES
CHIP_PW_RPC_LOCKING_PROTO=1
)
endif(CONFIG_CHIP_PW_RPC_LOCKING_PROTO)

endif(CONFIG_CHIP_PW_RPC)


target_include_directories(${APP_TARGET} PRIVATE
${CHIP_INCLUDES}
)

target_compile_definitions(${APP_TARGET} PRIVATE
${CHIP_DEFINES}
)
endif(CONFIG_CHIP_PW_RPC)
20 changes: 0 additions & 20 deletions config/mbed/chip-gn/lib/pw_rpc/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ import("$dir_pw_build/target_types.gni")

declare_args() {
chip_build_pw_rpc_echo_proto = false
chip_build_pw_rpc_common_proto = false
chip_build_pw_rpc_lighting_proto = false
chip_build_pw_rpc_locking_proto = false
}

static_library("pw_rpc") {
Expand All @@ -40,23 +37,6 @@ static_library("pw_rpc") {
deps += [ "$dir_pw_rpc/nanopb:echo_service" ]
}

if (chip_build_pw_rpc_common_proto) {
deps += [
"${chip_root}/examples/common/pigweed:button_service.nanopb_rpc",
"${chip_root}/examples/common/pigweed:device_service.nanopb_rpc",
]
}

if (chip_build_pw_rpc_lighting_proto) {
deps +=
[ "${chip_root}/examples/common/pigweed:lighting_service.nanopb_rpc" ]
}

if (chip_build_pw_rpc_locking_proto) {
deps +=
[ "${chip_root}/examples/common/pigweed:locking_service.nanopb_rpc" ]
}

deps += pw_build_LINK_DEPS

output_dir = "${root_out_dir}/lib"
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-----BEGIN CERTIFICATE-----
MIIBszCCAVqgAwIBAgIIRdrzneR6oI8wCgYIKoZIzj0EAwIwKzEpMCcGA1UEAwwg
TWF0dGVyIFRlc3QgQ0QgU2lnbmluZyBBdXRob3JpdHkwIBcNMjEwNjI4MTQyMzQz
WhgPOTk5OTEyMzEyMzU5NTlaMCsxKTAnBgNVBAMMIE1hdHRlciBUZXN0IENEIFNp
Z25pbmcgQXV0aG9yaXR5MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEPDmJIkUr
VcrzicJb0bykZWlSzLkOiGkkmthHRlMBTL+V1oeWXgNrUhxRA35rjO3vyh60QEZp
T6CIgu7WUZ3suqNmMGQwEgYDVR0TAQH/BAgwBgEB/wIBATAOBgNVHQ8BAf8EBAMC
AQYwHQYDVR0OBBYEFGL6gjNZrPqplj4c+hQK3fUE83FgMB8GA1UdIwQYMBaAFGL6
gjNZrPqplj4c+hQK3fUE83FgMAoGCCqGSM49BAMCA0cAMEQCICxUXOTkV9im8NnZ
u+vW7OHd/n+MbZps83UyH8b6xxOEAiBUB3jodDlyUn7t669YaGIgtUB48s1OYqdq
58u5L/VMiw==
-----END CERTIFICATE-----
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIK7zSEEW6UgexXvgRy30G/SZBk5QJK2GnspeiJgC1IB1oAoGCCqGSM49
AwEHoUQDQgAEPDmJIkUrVcrzicJb0bykZWlSzLkOiGkkmthHRlMBTL+V1oeWXgNr
UhxRA35rjO3vyh60QEZpT6CIgu7WUZ3sug==
-----END EC PRIVATE KEY-----
84 changes: 84 additions & 0 deletions credentials/test/gen-test-cds.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env bash

#
# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Script that can be used to generate Certification Declaration (CD)
# for testing purposes.
# The script expects the path to the chip-cert tool binary as an input argument.
#
# Usage example when the script is run from the CHIP SDK root directory:
# ./credentials/test/gen-test-cds.sh ./out/debug/standalone/chip-cert
#
# The result will be stored in:
# credentials/test/certification-declaration
#
# If the intention is to re-generate a new set of CDs that replace the already
# present ones then it is recommended to clear the folder:
# rm credentials/test/certification-declaration/*
#

set -e

here=${0%/*}

dest_dir="$here/certification-declaration"

mkdir -p "$dest_dir"

if [ $# == 1 ]; then
chip_cert_tool=$1
else
echo "Error: Please specify exactly one input argument; the path to the chip-cert tool binary"
exit
fi

cert_valid_from="2021-06-28 14:23:43"
cert_lifetime=4294967295

format_version=1
vids=(FFF2 FFF3)
pid0=8001
pid1=8002
device_type_id=0x1234
certificate_id0="ZIG20141ZB330001-24"
certificate_id1="ZIG20142ZB330002-24"
security_level=0
security_info=0
version_num=9876
certification_type=0
dac_origin_vendor_id=0xFFF1
dac_origin_product_id=0x8000

cd_signing_key="$dest_dir/Chip-Test-CD-Signing-Key.pem"
cd_signing_cert="$dest_dir/Chip-Test-CD-Signing-Cert.pem"

# Using gen-att-cert command to generate CD Signing Cert/Key:
"$chip_cert_tool" gen-att-cert --type a --subject-cn "Matter Test CD Signing Authority" --valid-from "$cert_valid_from" --lifetime "$cert_lifetime" --out-key "$cd_signing_key" --out "$cd_signing_cert"

for vid in "${vids[@]}"; do

"$chip_cert_tool" gen-cd --key "$cd_signing_key" --cert "$cd_signing_cert" --out "$dest_dir/Chip-Test-CD-$vid-$pid0.der" --format-version "$format_version" --vendor-id "0x$vid" --product-id "0x$pid0" --device-type-id "$device_type_id" --certificate-id "$certificate_id0" --security-level "$security_level" --security-info "$security_info" --version-number "$version_num" --certification-type "$certification_type"

"$chip_cert_tool" gen-cd --key "$cd_signing_key" --cert "$cd_signing_cert" --out "$dest_dir/Chip-Test-CD-$vid-$pid1.der" --format-version "$format_version" --vendor-id "0x$vid" --product-id "0x$pid1" --device-type-id "$device_type_id" --certificate-id "$certificate_id1" --security-level "$security_level" --security-info "$security_info" --version-number "$version_num" --certification-type "$certification_type"

"$chip_cert_tool" gen-cd --key "$cd_signing_key" --cert "$cd_signing_cert" --out "$dest_dir/Chip-Test-CD-$vid-$pid1-WithDACOrigin.der" --format-version "$format_version" --vendor-id "0x$vid" --product-id "0x$pid1" --device-type-id "$device_type_id" --certificate-id "$certificate_id1" --security-level "$security_level" --security-info "$security_info" --version-number "$version_num" --certification-type "$certification_type" --dac-origin-vendor-id "$dac_origin_vendor_id" --dac-origin-product-id "$dac_origin_product_id"

"$chip_cert_tool" gen-cd --key "$cd_signing_key" --cert "$cd_signing_cert" --out "$dest_dir/Chip-Test-CD-$vid-$pid0-$pid1.der" --format-version "$format_version" --vendor-id "0x$vid" --product-id "0x$pid0" --product-id "0x$pid1" --device-type-id "$device_type_id" --certificate-id "$certificate_id1" --security-level "$security_level" --security-info "$security_info" --version-number "$version_num" --certification-type "$certification_type"

"$chip_cert_tool" gen-cd --key "$cd_signing_key" --cert "$cd_signing_cert" --out "$dest_dir/Chip-Test-CD-$vid-$pid0-$pid1-WithDACOrigin.der" --format-version "$format_version" --vendor-id "0x$vid" --product-id "0x$pid0" --product-id "0x$pid1" --device-type-id "$device_type_id" --certificate-id "$certificate_id1" --security-level "$security_level" --security-info "$security_info" --version-number "$version_num" --certification-type "$certification_type" --dac-origin-vendor-id "$dac_origin_vendor_id" --dac-origin-product-id "$dac_origin_product_id"

done
138 changes: 0 additions & 138 deletions examples/common/pigweed/mbed/Rpc.cpp

This file was deleted.

Loading

0 comments on commit 3af5516

Please sign in to comment.