Client-side VLink proxy monitoring and control API.
ProxyAPI provides a C++ interface for connecting to a running ProxyServer daemon. It inherits from MessageLoop, but incoming DDS/SHM callbacks may execute on transport-managed receive threads. The inherited MessageLoop is used for posted tasks and timers when run() or async_run() is started.
- Roles
- A
ProxyAPI instance operates in one of two roles:
| Role | Description |
| kController | Can send Control messages to direct the server's observation/playback. |
| kListener | Passive observer only; send_control() and send_data() are rejected. |
- Operation Modes
- The proxy server supports eight operation modes, selectable by
kController:
| Mode | Value | Description |
| kOffline | 0 | Disconnected; server releases all subscriptions. |
| kObserveOne | 1 | Observe a single selected topic. |
| kObserveAll | 2 | Observe all discovered topics. |
| kRecord | 3 | Record all topics matching the subscription URL list. |
| kPlay | 4 | Replay previously recorded data via the server. |
| kEdit | 5 | Edit mode: injects data through the server. |
| kAuto | 6 | Auto mode: observe specified topics. |
| kAutoAndObserveAll | 7 | Auto + observe all topics simultaneously. |
- Error Codes
| Error | Value | Description |
| kNoError | 0 | No error. |
| kModeError | 1 | Unsupported mode requested. |
| kControlError | 2 | Control ID mismatch with the server. |
| kReliableCompError | 3 | reliable setting mismatch between client/server. |
| kTcpCompError | 4 | enable_tcp setting mismatch. |
| kDirectCompError | 5 | direct setting mismatch. |
| kMultiProxyError | 7 | Multiple proxy servers detected on the network. |
| kVersionCompError | 8 | VLink version mismatch between client and server. |
| kUnknownError | 9 | Unknown error. |
- Connectivity and Heartbeat
- Internally the API subscribes to a 1-second Time heartbeat published by
ProxyServer over a security-authenticated DDS channel. If no heartbeat is received for 5 consecutive seconds the connection is declared lost and ConnectCallback is invoked with connected = false. A kController client also sends an initial Control message at construction and re-sends the last control automatically when the server reconnects.
- Communication Channels
- The transport channels are determined by
Config::direct:
| direct | Data path | Control/Info/Time path |
| false | DDS (reliable or best-effort) | DDS (security-enabled) |
| true | SHM (Iceoryx) | DDS (security-enabled) |
- Version Matching
- When
Config::match_version is true (default) the client checks that the server's reported VLINK_VERSION string matches its own at connection time. A mismatch triggers kVersionCompError.
- Usage Example (Controller)
api.register_connect_callback([](bool connected) {
if (connected) {
}
});
api.register_info_callback([](const std::vector<vlink::ProxyAPI::Info>& list) {
for (const auto& info : list) {
}
});
api.send_control(ctrl);
api.async_run();
Client-side proxy monitoring and control API backed by a MessageLoop.
定义 proxy_api.h:169
@ kObserveOne
Observe a single topic from the URL list.
定义 proxy_api.h:181
@ kController
定义 proxy_api.h:229
@ kProtobuf
Decode using the Protocol Buffers stack.
定义 types.h:188
@ kSubscriber
Event subscriber (receive broadcast).
定义 types.h:94
Construction-time configuration for ProxyAPI.
定义 proxy_api.h:327
bool match_version
Reject connections when the server's VLINK_VERSION differs from the client.
定义 proxy_api.h:336
int domain_id
DDS domain ID; must match the server's domain_id.
定义 proxy_api.h:329
std::string dds_impl
DDS implementation transport: "dds", "ddsc", "ddsr", etc.
定义 proxy_api.h:330
Role role
Role of this client instance.
定义 proxy_api.h:328
bool reliable
Use reliable DDS QoS; must match the server's reliable setting.
定义 proxy_api.h:333
Control message sent from a kController client to ProxyServer.
定义 proxy_api.h:290
std::vector< UrlMeta > url_meta_list
Topics to observe / inject (mode-dependent).
定义 proxy_api.h:292
Mode mode
Target operation mode.
定义 proxy_api.h:291
- 注解
- Only one
ProxyServer should exist on a given DDS domain/channel at a time; connecting to two will trigger kMultiProxyError.
send_control() and send_data() return false immediately when the role is kListener.