Skip to main content

Data Communication

Access via xplugin::xPluginInterface() (underlying class: InterfaceManager). Full signatures: API Reference.

Inter-Plugin Communication

  • commandCustomData is used for custom communication with controller plugins; returns QJsonArray (elements are plugin names and key-value JSON).
// Custom controller plugin name "ControllerPluginName"

// read
auto arr = xplugin::xPluginInterface().commandCustomData(
this, "ControllerPluginName", "key");

// write key-val
xplugin::xPluginInterface().commandCustomData(
this, "ControllerPluginName", "key", "value");

// write JSON object / array
xplugin::xPluginInterface().commandCustomData(
this, "ControllerPluginName", QJsonObject{{"k", "v"}});
  • Protocol design may use JSON structures agreed with the controller plugin.

xservice Read/Write and Subscription

auto &iface = xplugin::xPluginInterface();

QJsonValue v = iface.getXServiceData("project.tasks_pointer");
iface.setXServiceData("some.key", QVariant(1));

iface.connectXServiceData(PLUGIN_NAME, "project.tasks_pointer",
[](const QVariant &data) { /* change callback */ },
""); // optional key; unique id = pluginName + serviceKey

iface.disconnectXServiceData(PLUGIN_NAME, "project.tasks_pointer");
  • commandXServiceData: asynchronous operation
  • execCommandXServiceData: synchronous operation, returns QJsonValue

RC API Requests

auto &iface = xplugin::xPluginInterface();

iface.rcRequest("module", "command", QJsonValue());

QJsonValue result = iface.rcExecRequest("module", "command", QJsonValue(), true, 1600);
iface.rcRequestFullCommand("full.path.command", QJsonValue());
  • Default timeout: async 4800 ms, sync 1600 ms.

Network Status

Option 1: Qt signals

connect(&xplugin::xPluginInterface(), &xplugin::InterfaceManager::sigNetworkConnect,
this, &MyClass::onConnected);

Option 2: Callback registration

auto &iface = xplugin::xPluginInterface();
QString id = iface.connectNetworkStatus(true, PLUGIN_NAME, this, [](){});
iface.disconnectNetworkStatus(true, PLUGIN_NAME, id);

Option 3: Event bus -> NetworkConnected / NetworkDisconnected; see Event System.