Engine

Covers Engine 2.0.0

Modules

Configure reusable driver and service instances supplied by engine plugins.

A module is a long-lived C++ object created by an engine plugin. Use it for a device connection, protocol integration, simulator, or reusable engine service. A module owns the external interaction; DCode can automate with the channels it publishes.

Create an instance

Install and load the engine plugin, open Modules, and choose one of its registered module types. Give the instance a unique name and enter its parameters. The interface can use a plugin-provided editor or the type’s configuration metadata.

A module instance is a JSON resource in the project’s modules directory. With the public example plugin installed, its minimal shape is:

{
  "name": "demo_device",
  "plugin": "example_device_plugin",
  "module_type": "example_device",
  "parameters": {
    "host": "127.0.0.1"
  }
}

This is the example plugin’s configuration, not a generic Modbus or device schema. Each driver defines its own parameter names and defaults.

FieldMeaning
nameRuntime instance identity.
pluginInstalled engine plugin ID.
module_typeRegistered type; the engine accepts matching local or plugin-qualified IDs.
parametersValues merged over the type’s default parameters.

Apply configuration

Save and reload the instance through its module controls. The engine reads the JSON, resolves the plugin/type, merges defaults, and calls the plugin’s createModule factory with the local type ID. A failed load reports an error instead of creating a working instance.

After reload, inspect the instance status, published channels, and related tasks. A successful JSON save does not prove the device connected. Use driver diagnostics for connection, retries, failures, and freshness.

Acquisition and command timing

A driver may poll on a task or loop, process incoming packets, or use a worker thread. The module abstraction does not impose one acquisition rate. Likewise, an accepted output channel write may be dispatched immediately or sent on a later device cycle.

Document the input sample rate, output delivery path, timeout/retry behavior, and feedback channels for each integration. DCode inline reactions begin when the measurement reaches RAPID; they cannot remove upstream acquisition or downstream hardware delay.

Useful operations

OperationPurpose
dartwic/get-module-instancesList loaded instances and identities.
dartwic/modules/build-module-instanceBuild an instance document using a registered type and defaults.
dartwic/modules/save-and-reload-module-instanceSave configuration and reload the instance.
dartwic/modules/reload-module-instanceReload an existing configuration.
dartwic/modules/delete-module-instanceRemove an instance through module lifecycle handling.

Use the Modules operation reference for payloads and detached variants. To implement a driver, follow Engine Plugin and BaseModule.