diff --git a/config/ameba/lib/pw_rpc/BUILD.gn b/config/ameba/lib/pw_rpc/BUILD.gn index 4b47ab1d61a16a..0b125c8a98aada 100644 --- a/config/ameba/lib/pw_rpc/BUILD.gn +++ b/config/ameba/lib/pw_rpc/BUILD.gn @@ -24,7 +24,6 @@ static_library("pw_rpc") { "$dir_pw_rpc:server", "$dir_pw_rpc/nanopb:echo_service", "${chip_root}/examples/platform/ameba/pw_sys_io:pw_sys_io_ameba", - "${dir_pigweed}/pw_hdlc:pw_rpc", dir_pw_assert, dir_pw_hdlc, dir_pw_log, diff --git a/config/bouffalolab/common/lib/pw_rpc/BUILD.gn b/config/bouffalolab/common/lib/pw_rpc/BUILD.gn index b1c9e1a596209e..999ffe37618ec7 100644 --- a/config/bouffalolab/common/lib/pw_rpc/BUILD.gn +++ b/config/bouffalolab/common/lib/pw_rpc/BUILD.gn @@ -36,7 +36,6 @@ static_library("pw_rpc") { "$dir_pw_rpc:server", "$dir_pw_rpc/nanopb:echo_service", "${chip_root}/examples/platform/bouffalolab/common/rpc/pw_sys_io:pw_sys_io", - "${dir_pigweed}/pw_hdlc:pw_rpc", dir_pw_assert, dir_pw_checksum, dir_pw_hdlc, diff --git a/config/efr32/lib/pw_rpc/BUILD.gn b/config/efr32/lib/pw_rpc/BUILD.gn index ed2e3a47bc1305..f858f6c1321999 100644 --- a/config/efr32/lib/pw_rpc/BUILD.gn +++ b/config/efr32/lib/pw_rpc/BUILD.gn @@ -25,7 +25,6 @@ static_library("pw_rpc") { "$dir_pw_rpc:server", "$dir_pw_rpc/nanopb:echo_service", "${chip_root}/examples/platform/silabs/pw_sys_io:pw_sys_io_silabs", - "${dir_pigweed}/pw_hdlc:pw_rpc", dir_pw_assert, dir_pw_checksum, dir_pw_hdlc, diff --git a/config/esp32/lib/pw_rpc/BUILD.gn b/config/esp32/lib/pw_rpc/BUILD.gn index 383e4b25f21d56..2ced13e5c5574d 100644 --- a/config/esp32/lib/pw_rpc/BUILD.gn +++ b/config/esp32/lib/pw_rpc/BUILD.gn @@ -24,7 +24,6 @@ static_library("pw_rpc") { "$dir_pw_rpc:server", "$dir_pw_rpc/nanopb:echo_service", "${chip_root}/examples/platform/esp32/pw_sys_io:pw_sys_io_esp32", - "${dir_pigweed}/pw_hdlc:pw_rpc", dir_pw_assert, dir_pw_hdlc, dir_pw_log, diff --git a/config/linux/lib/pw_rpc/BUILD.gn b/config/linux/lib/pw_rpc/BUILD.gn index e79af448d13e57..a01627c32541d1 100644 --- a/config/linux/lib/pw_rpc/BUILD.gn +++ b/config/linux/lib/pw_rpc/BUILD.gn @@ -22,7 +22,6 @@ static_library("pw_rpc") { public_configs = [ "${dir_pigweed}/pw_hdlc:default_config" ] deps = [ "$dir_pw_hdlc:encoder", - "$dir_pw_hdlc:pw_rpc", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_rpc/system_server:facade", "$dir_pw_stream:socket_stream", diff --git a/config/mbed/chip-gn/lib/pw_rpc/BUILD.gn b/config/mbed/chip-gn/lib/pw_rpc/BUILD.gn index f1a5e071e9c619..c84adde4fb1e46 100644 --- a/config/mbed/chip-gn/lib/pw_rpc/BUILD.gn +++ b/config/mbed/chip-gn/lib/pw_rpc/BUILD.gn @@ -30,7 +30,6 @@ static_library("pw_rpc") { deps = [ "$dir_pw_rpc:server", "${chip_root}/examples/platform/mbed/pw_sys_io:pw_sys_io_mbed", - "${dir_pigweed}/pw_hdlc:pw_rpc", dir_pw_assert, dir_pw_hdlc, dir_pw_log, diff --git a/config/qpg/lib/pw_rpc/BUILD.gn b/config/qpg/lib/pw_rpc/BUILD.gn index bd633d591b3577..99c64201f5df19 100644 --- a/config/qpg/lib/pw_rpc/BUILD.gn +++ b/config/qpg/lib/pw_rpc/BUILD.gn @@ -36,7 +36,6 @@ static_library("pw_rpc") { "$dir_pw_rpc:server", "$dir_pw_rpc/nanopb:echo_service", "${chip_root}/examples/platform/qpg/pw_sys_io:pw_sys_io_qpg", - "${dir_pigweed}/pw_hdlc:pw_rpc", dir_pw_assert, dir_pw_checksum, dir_pw_hdlc, diff --git a/examples/chef/linux/BUILD.gn b/examples/chef/linux/BUILD.gn index d3cf534a01ba75..fa12a79a91a09f 100644 --- a/examples/chef/linux/BUILD.gn +++ b/examples/chef/linux/BUILD.gn @@ -82,7 +82,7 @@ executable("${sample_name}") { ] deps += [ - "$dir_pw_hdlc:pw_rpc", + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_log", "$dir_pw_rpc:server", diff --git a/examples/chef/nrfconnect/CMakeLists.txt b/examples/chef/nrfconnect/CMakeLists.txt index b0b69815246c10..1d9ab2fb436a62 100644 --- a/examples/chef/nrfconnect/CMakeLists.txt +++ b/examples/chef/nrfconnect/CMakeLists.txt @@ -214,7 +214,6 @@ target_link_libraries(app PRIVATE thread_service.nanopb_rpc pw_checksum pw_hdlc - pw_hdlc.pw_rpc pw_log pw_rpc.server pw_sys_io diff --git a/examples/chef/silabs/BUILD.gn b/examples/chef/silabs/BUILD.gn index cecef1c71bc050..3f74106f9f54c2 100644 --- a/examples/chef/silabs/BUILD.gn +++ b/examples/chef/silabs/BUILD.gn @@ -120,6 +120,7 @@ silabs_executable("chef_app") { ] deps += [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", "$dir_pw_trace", diff --git a/examples/chef/telink/CMakeLists.txt b/examples/chef/telink/CMakeLists.txt index 5d30d424ea3dfd..71f0c549e6ed79 100755 --- a/examples/chef/telink/CMakeLists.txt +++ b/examples/chef/telink/CMakeLists.txt @@ -231,7 +231,6 @@ target_link_libraries(app PRIVATE thread_service.nanopb_rpc pw_checksum pw_hdlc - pw_hdlc.pw_rpc pw_log pw_rpc.server pw_sys_io diff --git a/examples/common/pigweed/BUILD.gn b/examples/common/pigweed/BUILD.gn index 389c3fbc242951..d190b07fd85082 100644 --- a/examples/common/pigweed/BUILD.gn +++ b/examples/common/pigweed/BUILD.gn @@ -115,7 +115,7 @@ pw_source_set("system_rpc_server") { ] public_deps = [ - "$dir_pw_hdlc:pw_rpc", + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", ] diff --git a/examples/common/pigweed/RpcService.cpp b/examples/common/pigweed/RpcService.cpp index e36ab54afe1eb4..74d0b891e9b00d 100644 --- a/examples/common/pigweed/RpcService.cpp +++ b/examples/common/pigweed/RpcService.cpp @@ -22,8 +22,9 @@ #include #include +#include "pw_hdlc/decoder.h" +#include "pw_hdlc/default_addresses.h" #include "pw_hdlc/rpc_channel.h" -#include "pw_hdlc/rpc_packets.h" #include "pw_log/log.h" #include "pw_rpc/channel.h" #include "pw_status/status.h" @@ -116,7 +117,25 @@ void Start(void (*RegisterServices)(pw::rpc::Server &), ::chip::rpc::Mutex * uar std::array input_buffer; Logging::Log(Logging::kLogModule_NotSpecified, Logging::kLogCategory_Detail, "Starting pw_rpc server"); - pw::hdlc::ReadAndProcessPackets(server, input_buffer); + + pw::hdlc::Decoder decoder(input_buffer); + while (true) + { + std::byte data; + if (!pw::sys_io::ReadByte(&data).ok()) + { + // TODO: should we log? + return; + } + if (auto result = decoder.Process(data); result.ok()) + { + pw::hdlc::Frame & frame = result.value(); + if (frame.address() == pw::hdlc::kDefaultRpcAddress) + { + server.ProcessPacket(frame.data()).IgnoreError(); + } + } + } } } // namespace rpc diff --git a/examples/common/pigweed/mbed/Rpc.cpp b/examples/common/pigweed/mbed/Rpc.cpp index 79940b005eba06..2695822363d4ad 100644 --- a/examples/common/pigweed/mbed/Rpc.cpp +++ b/examples/common/pigweed/mbed/Rpc.cpp @@ -22,7 +22,6 @@ #include "pigweed/RpcService.h" #include "pw_hdlc/rpc_channel.h" -#include "pw_hdlc/rpc_packets.h" #include "pw_rpc/server.h" #include "pw_stream/sys_io_stream.h" #include "pw_sys_io/sys_io.h" diff --git a/examples/common/pigweed/system_rpc_server.cc b/examples/common/pigweed/system_rpc_server.cc index 6778499c54ab3c..098aa3b1711058 100644 --- a/examples/common/pigweed/system_rpc_server.cc +++ b/examples/common/pigweed/system_rpc_server.cc @@ -17,8 +17,9 @@ #include +#include "pw_hdlc/decoder.h" +#include "pw_hdlc/default_addresses.h" #include "pw_hdlc/rpc_channel.h" -#include "pw_hdlc/rpc_packets.h" #include "pw_log/log.h" #include "pw_rpc_system_server/rpc_server.h" #include "pw_stream/sys_io_stream.h" diff --git a/examples/energy-management-app/linux/BUILD.gn b/examples/energy-management-app/linux/BUILD.gn index 7504d51c242c98..11919a4e8c12a3 100644 --- a/examples/energy-management-app/linux/BUILD.gn +++ b/examples/energy-management-app/linux/BUILD.gn @@ -86,7 +86,7 @@ executable("chip-energy-management-app") { ] deps += [ - "$dir_pw_hdlc:pw_rpc", + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_log", "$dir_pw_rpc:server", diff --git a/examples/light-switch-app/qpg/BUILD.gn b/examples/light-switch-app/qpg/BUILD.gn index a5488d27b33dbc..659f2d4ab1efd3 100644 --- a/examples/light-switch-app/qpg/BUILD.gn +++ b/examples/light-switch-app/qpg/BUILD.gn @@ -102,6 +102,7 @@ qpg_executable("light_switch_app") { ] deps += [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", "${chip_root}/config/qpg/lib/pw_rpc:pw_rpc", diff --git a/examples/light-switch-app/silabs/BUILD.gn b/examples/light-switch-app/silabs/BUILD.gn index fc52c0b96b03b7..f302a1593facce 100644 --- a/examples/light-switch-app/silabs/BUILD.gn +++ b/examples/light-switch-app/silabs/BUILD.gn @@ -157,6 +157,7 @@ silabs_executable("light_switch_app") { ] deps += [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", "${chip_root}/config/efr32/lib/pw_rpc:pw_rpc", diff --git a/examples/light-switch-app/telink/CMakeLists.txt b/examples/light-switch-app/telink/CMakeLists.txt index 5dd8720ce8d59f..451727b9fe20ae 100755 --- a/examples/light-switch-app/telink/CMakeLists.txt +++ b/examples/light-switch-app/telink/CMakeLists.txt @@ -235,7 +235,6 @@ target_link_libraries(app PRIVATE thread_service.nanopb_rpc pw_checksum pw_hdlc - pw_hdlc.pw_rpc pw_log pw_rpc.server pw_sys_io diff --git a/examples/lighting-app/bouffalolab/bl602/BUILD.gn b/examples/lighting-app/bouffalolab/bl602/BUILD.gn index b24c8731b08efe..ab89ae3f3bdb63 100644 --- a/examples/lighting-app/bouffalolab/bl602/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl602/BUILD.gn @@ -182,6 +182,7 @@ bouffalolab_executable("lighting_app") { ] deps += [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_kvs:crc16", "$dir_pw_log", diff --git a/examples/lighting-app/bouffalolab/bl702/BUILD.gn b/examples/lighting-app/bouffalolab/bl702/BUILD.gn index fa863ceaf699d3..f923e3bad6ffe9 100644 --- a/examples/lighting-app/bouffalolab/bl702/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl702/BUILD.gn @@ -252,6 +252,7 @@ bouffalolab_executable("lighting_app") { ] deps += [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", diff --git a/examples/lighting-app/bouffalolab/bl702l/BUILD.gn b/examples/lighting-app/bouffalolab/bl702l/BUILD.gn index b3e6f809b6ba38..24fad9ffa1897d 100644 --- a/examples/lighting-app/bouffalolab/bl702l/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl702l/BUILD.gn @@ -214,6 +214,7 @@ bouffalolab_executable("lighting_app") { ] deps += [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", diff --git a/examples/lighting-app/linux/BUILD.gn b/examples/lighting-app/linux/BUILD.gn index aac02352bacf40..47b2b7e34cd48a 100644 --- a/examples/lighting-app/linux/BUILD.gn +++ b/examples/lighting-app/linux/BUILD.gn @@ -77,7 +77,7 @@ executable("chip-lighting-app") { ] deps += [ - "$dir_pw_hdlc:pw_rpc", + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_log", "$dir_pw_rpc:server", diff --git a/examples/lighting-app/nrfconnect/CMakeLists.txt b/examples/lighting-app/nrfconnect/CMakeLists.txt index a4480b43f0afc6..04dacfac4af308 100644 --- a/examples/lighting-app/nrfconnect/CMakeLists.txt +++ b/examples/lighting-app/nrfconnect/CMakeLists.txt @@ -218,7 +218,6 @@ target_link_libraries(app PRIVATE thread_service.nanopb_rpc pw_checksum pw_hdlc - pw_hdlc.pw_rpc pw_log pw_rpc.server pw_sys_io diff --git a/examples/lighting-app/qpg/BUILD.gn b/examples/lighting-app/qpg/BUILD.gn index 981e7405150cb5..d8f86311d627eb 100644 --- a/examples/lighting-app/qpg/BUILD.gn +++ b/examples/lighting-app/qpg/BUILD.gn @@ -105,6 +105,7 @@ qpg_executable("lighting_app") { ] deps += [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", "${chip_root}/config/qpg/lib/pw_rpc:pw_rpc", diff --git a/examples/lighting-app/silabs/BUILD.gn b/examples/lighting-app/silabs/BUILD.gn index 9c314b025f63fd..4ca705caac2cef 100644 --- a/examples/lighting-app/silabs/BUILD.gn +++ b/examples/lighting-app/silabs/BUILD.gn @@ -173,6 +173,7 @@ silabs_executable("lighting_app") { ] deps += [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", "$dir_pw_trace", diff --git a/examples/lighting-app/telink/CMakeLists.txt b/examples/lighting-app/telink/CMakeLists.txt index 2017d797558eb6..9620a00e1127e5 100644 --- a/examples/lighting-app/telink/CMakeLists.txt +++ b/examples/lighting-app/telink/CMakeLists.txt @@ -268,7 +268,6 @@ target_link_libraries(app PRIVATE thread_service.nanopb_rpc pw_checksum pw_hdlc - pw_hdlc.pw_rpc pw_log pw_rpc.server pw_sys_io diff --git a/examples/lit-icd-app/silabs/BUILD.gn b/examples/lit-icd-app/silabs/BUILD.gn index d547ddec637678..d0956cc9a7a2e3 100644 --- a/examples/lit-icd-app/silabs/BUILD.gn +++ b/examples/lit-icd-app/silabs/BUILD.gn @@ -156,6 +156,7 @@ silabs_executable("lit_icd_app") { ] deps += [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", "${chip_root}/config/efr32/lib/pw_rpc:pw_rpc", diff --git a/examples/lock-app/qpg/BUILD.gn b/examples/lock-app/qpg/BUILD.gn index 1023e9f2751ce2..2426fa7c3179d5 100644 --- a/examples/lock-app/qpg/BUILD.gn +++ b/examples/lock-app/qpg/BUILD.gn @@ -102,6 +102,7 @@ qpg_executable("lock_app") { ] deps += [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", "${chip_root}/config/qpg/lib/pw_rpc:pw_rpc", diff --git a/examples/lock-app/silabs/BUILD.gn b/examples/lock-app/silabs/BUILD.gn index f5d00f7d48ab63..fe2abc95512c20 100644 --- a/examples/lock-app/silabs/BUILD.gn +++ b/examples/lock-app/silabs/BUILD.gn @@ -157,6 +157,7 @@ silabs_executable("lock_app") { ] deps += [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", "${chip_root}/config/efr32/lib/pw_rpc:pw_rpc", diff --git a/examples/platform/linux/system_rpc_server.cc b/examples/platform/linux/system_rpc_server.cc index fc44cb30478ee0..c4e45be56360a6 100644 --- a/examples/platform/linux/system_rpc_server.cc +++ b/examples/platform/linux/system_rpc_server.cc @@ -25,8 +25,9 @@ #include #include "pw_assert/check.h" +#include "pw_hdlc/decoder.h" +#include "pw_hdlc/default_addresses.h" #include "pw_hdlc/rpc_channel.h" -#include "pw_hdlc/rpc_packets.h" #include "pw_log/log.h" #include "pw_rpc_system_server/rpc_server.h" #include "pw_stream/socket_stream.h" diff --git a/examples/platform/mbed/util/PigweedLogger.cpp b/examples/platform/mbed/util/PigweedLogger.cpp index 1fefd2d614afba..d1c9afbbf0c435 100644 --- a/examples/platform/mbed/util/PigweedLogger.cpp +++ b/examples/platform/mbed/util/PigweedLogger.cpp @@ -28,6 +28,7 @@ #include #include +#include #include namespace PigweedLogger { diff --git a/examples/pump-app/silabs/BUILD.gn b/examples/pump-app/silabs/BUILD.gn index f255000ea525d5..9b577950023bc0 100644 --- a/examples/pump-app/silabs/BUILD.gn +++ b/examples/pump-app/silabs/BUILD.gn @@ -171,6 +171,7 @@ silabs_executable("pump_app") { ] deps += [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", "$dir_pw_trace", diff --git a/examples/smoke-co-alarm-app/silabs/BUILD.gn b/examples/smoke-co-alarm-app/silabs/BUILD.gn index 7750dc31f6324b..73b015ea232822 100644 --- a/examples/smoke-co-alarm-app/silabs/BUILD.gn +++ b/examples/smoke-co-alarm-app/silabs/BUILD.gn @@ -173,6 +173,7 @@ silabs_executable("smoke_co_alarm_app") { ] deps += [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", "${chip_root}/config/efr32/lib/pw_rpc:pw_rpc", diff --git a/examples/thermostat/qpg/BUILD.gn b/examples/thermostat/qpg/BUILD.gn index 4c82da60be8be9..d4285571114721 100644 --- a/examples/thermostat/qpg/BUILD.gn +++ b/examples/thermostat/qpg/BUILD.gn @@ -101,6 +101,7 @@ qpg_executable("thermostat") { ] deps += [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", "${chip_root}/config/qpg/lib/pw_rpc:pw_rpc", diff --git a/examples/thermostat/silabs/BUILD.gn b/examples/thermostat/silabs/BUILD.gn index f82bbc40776c40..bb094b894f8db3 100644 --- a/examples/thermostat/silabs/BUILD.gn +++ b/examples/thermostat/silabs/BUILD.gn @@ -185,6 +185,7 @@ silabs_executable("thermostat_app") { ] deps += [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", "${chip_root}/config/efr32/lib/pw_rpc:pw_rpc", diff --git a/third_party/pigweed/repo b/third_party/pigweed/repo index 9640cdef100f87..0380161bd68c21 160000 --- a/third_party/pigweed/repo +++ b/third_party/pigweed/repo @@ -1 +1 @@ -Subproject commit 9640cdef100f87d7987875d3a418931d6500e5b2 +Subproject commit 0380161bd68c216a590230f0cc49d26add7eef8a