devicesbus read data

This commit is contained in:
flower_linux
2026-03-26 17:22:52 +08:00
parent bc07fa0e6e
commit 35fb913957
43 changed files with 1285 additions and 170 deletions

View File

@@ -0,0 +1,36 @@
#pragma once
#include <cstddef>
#include <cstdint>
#include <memory>
#include <QMetaType>
#include "core/memory/MemoryPool.h"
namespace softbus::message_bus::pipeline
{
struct PayloadRef
{
softbus::core::memory::MemoryPool::BlockPtr block;
std::size_t offset{0};
std::size_t length{0};
const std::uint8_t* bytes() const
{
if (!block || !block->data || offset > block->capacity) {
return nullptr;
}
return block->data + offset;
}
bool valid() const
{
return block && block->data && (offset + length <= block->capacity);
}
};
} // namespace softbus::message_bus::pipeline
Q_DECLARE_METATYPE(softbus::message_bus::pipeline::PayloadRef)