diff --git a/install/soa_server/rk3576/soa_server b/install/soa_server/rk3576/soa_server index 8d3f6bb..06f206c 100755 Binary files a/install/soa_server/rk3576/soa_server and b/install/soa_server/rk3576/soa_server differ diff --git a/install/tmp/lib.zip b/install/tmp/lib.zip index 1ab8af6..b98307e 100644 Binary files a/install/tmp/lib.zip and b/install/tmp/lib.zip differ diff --git a/install/tmp/lib/libboost_thread.so b/install/tmp/lib/libboost_thread.so new file mode 100755 index 0000000..d02a494 Binary files /dev/null and b/install/tmp/lib/libboost_thread.so differ diff --git a/install/tmp/lib/libboost_thread.so.1.75.0 b/install/tmp/lib/libboost_thread.so.1.75.0 new file mode 100755 index 0000000..d02a494 Binary files /dev/null and b/install/tmp/lib/libboost_thread.so.1.75.0 differ diff --git a/source/soa_server/someip_server.hpp b/source/soa_server/someip_server.hpp index 6f3d3b8..01ef696 100644 --- a/source/soa_server/someip_server.hpp +++ b/source/soa_server/someip_server.hpp @@ -277,6 +277,8 @@ public: { someip_log_i("Start event [0x%04x] notify thread.",_event); + + std::vector lastData; // 用于 on-change 模式去重 while (running_) { @@ -289,23 +291,16 @@ public: if (_update_on_change || (0U == _cycle)) { - // for update on change - /* If data is not empty and changed, to notify */ - static std::vector lastData; - std::vector notify_data; - notify_data.clear(); - notify_data = _notify_data_func(); + // for update on change: only notify when data changes + std::vector notify_data = _notify_data_func(); - if ((nullptr != _notify_data_func) && (lastData != notify_data)) + if (lastData != notify_data) { lastData = notify_data; std::shared_ptr _payload = runtime::get()->create_payload(); _payload->set_data(notify_data); - - someip_log_d("Notify event[0x%04x] with data size[%d] payload length[%d].", _event,notify_data.size(), _payload->get_length()); - + someip_log_d("Notify event[0x%04x] with data size[%d] payload length[%d].", _event, notify_data.size(), _payload->get_length()); app_->notify(_service, _instance, _event, _payload); - } } diff --git a/source/soa_server/spi_server.cpp b/source/soa_server/spi_server.cpp index 395e172..6349059 100644 --- a/source/soa_server/spi_server.cpp +++ b/source/soa_server/spi_server.cpp @@ -168,12 +168,12 @@ void my_spi_server_thread_func(void* arg) { // 调用SpiProtocol_Unpack解析SPI数据 SpiProtocol_RxResultType result; int32_t unpack_ret = SpiProtocol_Unpack(buf, sizeof(buf), SPI_PROTO_FRAME_SIZE, &result); - if (unpack_ret != SPI_PROTO_ERR_NONE) + if (unpack_ret < 0) { printf("SpiProtocol_Unpack error: %d\n", unpack_ret); continue; } - printf("SpiProtocol_Unpack success\n"); + printf("SpiProtocol_Unpack success, tlv_count=%d\n", unpack_ret); // 处理解包后的数据:提取 CAN0~CAN5 数据分发到对应缓冲区 for (uint8_t i = 0; i < result.tlv_count; i++) @@ -187,6 +187,10 @@ void my_spi_server_thread_func(void* arg) { g_can_data[can_ch].assign(result.tlvs[i].value, result.tlvs[i].value + result.tlvs[i].length); printf("CAN%d data updated, length=%u\n", can_ch, result.tlvs[i].length); + printf(" HEX: "); + for (size_t j = 0; j < g_can_data[can_ch].size(); j++) + printf("%02X ", g_can_data[can_ch][j]); + printf("\n"); } else {