Skip to content

Commit

Permalink
Revert "[Mbed] Add RPC support for locking and lighting examples (#10960
Browse files Browse the repository at this point in the history
)"

This reverts commit 2149dae.
  • Loading branch information
woody-apple authored Oct 27, 2021
1 parent a449d18 commit b77cb32
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 318 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
138 changes: 0 additions & 138 deletions examples/common/pigweed/mbed/Rpc.cpp

This file was deleted.

30 changes: 0 additions & 30 deletions examples/common/pigweed/mbed/Rpc.h

This file was deleted.

4 changes: 2 additions & 2 deletions examples/common/pigweed/rpc_services/Locking.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ class Locking final : public generated::Locking<Locking>

virtual pw::Status Set(ServerContext &, const chip_rpc_LockingState & request, pw_protobuf_Empty & response)
{
bool locked = request.locked;
uint8_t locked = request.locked;
RETURN_STATUS_IF_NOT_OK(app::Clusters::OnOff::Attributes::OnOff::Set(kEndpoint, locked));
return pw::OkStatus();
}

virtual pw::Status Get(ServerContext &, const pw_protobuf_Empty & request, chip_rpc_LockingState & response)
{
bool locked;
uint8_t locked;
RETURN_STATUS_IF_NOT_OK(app::Clusters::OnOff::Attributes::OnOff::Get(kEndpoint, &locked));
response.locked = locked;
return pw::OkStatus();
Expand Down
3 changes: 1 addition & 2 deletions examples/lighting-app/mbed/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ CONFIG_CHIP_BUILD_TESTS=n
CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS=y
CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h
CONFIG_CHIP_BYPASS_RENDEZVOUS=n
CONFIG_MBED_BSD_SOCKET_TRACE=n
CONFIG_CHIP_PW_RPC=y
CONFIG_MBED_BSD_SOCKET_TRACE=n
1 change: 1 addition & 0 deletions examples/lighting-app/mbed/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ static bool sHaveBLEConnections = false;

static mbed::Timeout sFunctionTimer;

// TODO: change EventQueue default event size
static events::EventQueue sAppEventQueue;

using namespace ::chip::Credentials;
Expand Down
3 changes: 1 addition & 2 deletions examples/lighting-app/mbed/main/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class AppTask
void PostEvent(AppEvent * aEvent);
void UpdateClusterState(void);

void ButtonEventHandler(uint32_t id, bool pushed);

private:
friend AppTask & GetAppTask(void);

Expand All @@ -52,6 +50,7 @@ class AppTask
void LightingButtonPressEventHandler(void);
void FunctionButtonPressEventHandler(void);
void FunctionButtonReleaseEventHandler(void);
void ButtonEventHandler(uint32_t id, bool pushed);
void SliderEventHandler(int slider_pos);
void TimerEventHandler(void);

Expand Down
Loading

0 comments on commit b77cb32

Please sign in to comment.