Skip to main content

Data Communication

Access via xplugin::xPluginInterface() (underlying class: InterfaceManager). See API Reference for full signatures.

Inter-Plugin Communication​

  • The commandCustomData interface is used for custom controller-side plugin communication and returns QJsonArray (elements are JSON objects with plugin names and key-value pairs).
// 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 can align JSON structure with controller plugins; see controller-side Client Interaction.

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 */ },
""); // *key* is empty by default

iface.disconnectXServiceData(PLUGIN_NAME, "project.tasks_pointer");

commandXServiceData() sends a command asynchronously and does not wait for the result. execCommandXServiceData() runs a command synchronously and returns QJsonValue.

RC Interface 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 timeouts: async 4800 ms, sync 1600 ms.

Network Status​

Method 1: Qt signal

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

Method 2: Callback registration

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

Method 3: Event bus — NetworkConnected / NetworkDisconnected; see Event System.