Abstract plugin base translating between VLink payloads and visualisation backends.
更多...
#include <convert_plugin_interface.h>
|
| enum class | Target : uint8_t { kFoxglove = 0
, kRerun = 1
} |
| | Visualisation backend identifier carried by every conversion hook. 更多...
|
| |
|
| virtual bool | init (const std::string &config)=0 |
| | Initialises the plugin with an opaque configuration string. 更多...
|
| |
| virtual bool | can_convert (const std::string &ser_type, Target target)=0 |
| | Reports whether this plugin handles a (serialisation, target) pair. 更多...
|
| |
| virtual bool | get_schema (const std::string &ser_type, Target target, SchemaInfo &schema_info)=0 |
| | Provides schema metadata for an accepted (serialisation, target) pair. 更多...
|
| |
| virtual bool | convert (const std::string &ser_type, const Bytes &raw, Target target, Bytes &payload)=0 |
| | Converts a single raw VLink payload to the backend-specific representation. 更多...
|
| |
| virtual int64_t | get_timestamp (const std::string &ser_type, const Bytes &raw, Target target) |
| | Optionally extracts a per-message timestamp from the raw payload. 更多...
|
| |
| virtual bool | can_publish (const FrontendChannel &channel, Target target) |
| | Inbound counterpart of can_convert() for frontend-published channels. 更多...
|
| |
| virtual bool | get_publish (const FrontendChannel &channel, Target target, PublishInfo &publish_info) |
| | Resolves the VLink publish destination for an inbound frontend channel. 更多...
|
| |
| virtual bool | convert_publish (const FrontendChannel &channel, const Bytes &raw, Target target, Bytes &payload) |
| | Converts a frontend-published payload into a raw VLink payload. 更多...
|
| |
Abstract plugin base translating between VLink payloads and visualisation backends.
Loaded via Plugin::load<ConvertPluginInterface>(). The plugin must be thread-safe: convert() and the inbound convert_publish() hooks may run concurrently from multiple ProxyAPI worker threads. A plugin that only supports one backend should return false from can_convert() / can_publish() for the others.
◆ Target
Visualisation backend identifier carried by every conversion hook.
Allows a single plugin to support multiple backends from one binary – the plugin branches on this value to produce the appropriate payload format.
| 枚举值 |
|---|
| kFoxglove | Foxglove Studio (WebSocket transport, FlatBuffers/Protobuf payloads).
|
| kRerun | Rerun Viewer (gRPC + Arrow IPC; plugin payload is UTF-8 JSON).
|
◆ ConvertPluginInterface()
| vlink::ConvertPluginInterface::ConvertPluginInterface |
( |
| ) |
|
|
protecteddefault |
◆ ~ConvertPluginInterface()
| virtual vlink::ConvertPluginInterface::~ConvertPluginInterface |
( |
| ) |
|
|
protectedvirtualdefault |
◆ can_convert()
| virtual bool vlink::ConvertPluginInterface::can_convert |
( |
const std::string & |
ser_type, |
|
|
Target |
target |
|
) |
| |
|
pure virtual |
Reports whether this plugin handles a (serialisation, target) pair.
Polled during channel discovery for each new VLink type. A true answer commits the plugin to subsequent get_schema() and convert() calls for that pair.
- 参数
-
| ser_type | VLink serialisation type name (e.g. "proto.VehiclePose"). |
| target | Visualisation backend asking about the conversion. |
- 返回
true when the plugin can produce a payload for target.
◆ can_publish()
| virtual bool vlink::ConvertPluginInterface::can_publish |
( |
const FrontendChannel & |
channel, |
|
|
Target |
target |
|
) |
| |
|
inlinevirtual |
Inbound counterpart of can_convert() for frontend-published channels.
Default implementation returns false; override to opt in to clientPublish-style command flows.
◆ convert()
| virtual bool vlink::ConvertPluginInterface::convert |
( |
const std::string & |
ser_type, |
|
|
const Bytes & |
raw, |
|
|
Target |
target, |
|
|
Bytes & |
payload |
|
) |
| |
|
pure virtual |
Converts a single raw VLink payload to the backend-specific representation.
Invoked once per incoming message on accepted types. Must be thread-safe.
- 参数
-
| [in] | ser_type | VLink serialisation type name. |
| [in] | raw | Raw serialised VLink payload. |
| [in] | target | Visualisation backend. |
| [out] | payload | Output buffer that receives the backend payload. |
- 返回
true on success.
◆ convert_publish()
Converts a frontend-published payload into a raw VLink payload.
Invoked once per inbound message after get_publish() routed the channel. Default implementation returns false.
◆ get_publish()
Resolves the VLink publish destination for an inbound frontend channel.
Returning true allows the host to provision the required VLink publishers ahead of time. Default implementation returns false.
◆ get_schema()
| virtual bool vlink::ConvertPluginInterface::get_schema |
( |
const std::string & |
ser_type, |
|
|
Target |
target, |
|
|
SchemaInfo & |
schema_info |
|
) |
| |
|
pure virtual |
Provides schema metadata for an accepted (serialisation, target) pair.
Called once per accepted pair when registering the frontend channel. Outputs differ per target:
kFoxglove: fill schema_info with type, encoding and schema bytes (typically the bytes of a compiled BFBS file).
kRerun: fill schema_info.type_name with the archetype name and schema_info.encoding with "json"; schema payload fields are unused.
- 参数
-
| [in] | ser_type | VLink serialisation type name. |
| [in] | target | Visualisation backend. |
| [out] | schema_info | Backend channel schema metadata. |
- 返回
true on success.
◆ get_timestamp()
| virtual int64_t vlink::ConvertPluginInterface::get_timestamp |
( |
const std::string & |
ser_type, |
|
|
const Bytes & |
raw, |
|
|
Target |
target |
|
) |
| |
|
inlinevirtual |
Optionally extracts a per-message timestamp from the raw payload.
Called after convert() so the frontend can prefer a sensor or content timestamp over the proxy transport timestamp. The default implementation returns -1, causing the host to fall back to the transport-level timestamp.
- 参数
-
| [in] | ser_type | VLink serialisation type name. |
| [in] | raw | Raw serialised VLink payload. |
| [in] | target | Visualisation backend. |
- 返回
- Timestamp in nanoseconds since epoch, or
-1 when unavailable.
◆ init()
| virtual bool vlink::ConvertPluginInterface::init |
( |
const std::string & |
config | ) |
|
|
pure virtual |
Initialises the plugin with an opaque configuration string.
Called once after the plugin is loaded; the config string may be a file path, JSON document or anything the plugin defines. Returning false causes the host to unload the plugin.
- 参数
-
| config | Configuration payload; may be empty. |
- 返回
true on success.
该类的文档由以下文件生成: