feat():modify spi

This commit is contained in:
2026-06-24 21:58:02 +08:00
parent f006c77b37
commit c3fb70558d
6 changed files with 12 additions and 13 deletions

View File

@@ -277,6 +277,8 @@ public:
{
someip_log_i("Start event [0x%04x] notify thread.",_event);
std::vector<byte_t> 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<byte_t> lastData;
std::vector<byte_t> notify_data;
notify_data.clear();
notify_data = _notify_data_func();
// for update on change: only notify when data changes
std::vector<byte_t> notify_data = _notify_data_func();
if ((nullptr != _notify_data_func) && (lastData != notify_data))
if (lastData != notify_data)
{
lastData = notify_data;
std::shared_ptr<payload> _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);
}
}