Plugins
Covers Engine Plugin SDK 2.0.0 · Interface Plugin SDK 0.2.0
SDK_API
Host API available to engine plugins and their module instances.
Registration functions qualify local identifiers as <plugin-id>.<local-id>. Channel authority calls require an active task or plugin loop controller.
Declaration
class SDK_API {
public:
SDK_API() = default;
virtual ~SDK_API() = default;
virtual double queryChannelField(const std::string& channel,
ChannelField field,
std::optional<ChannelValue> default_value) = 0;
virtual void insertChannelField(const std::string& channel,
ChannelField field,
ChannelValue value,
ChannelStorage storage = ChannelStorage::Dynamic) = 0;
virtual void upsertChannelField(const std::string& channel,
ChannelField field,
ChannelValue value,
ChannelStorage storage = ChannelStorage::Dynamic) = 0;
void createFixedChannel(const std::string& channel, double initial_value = 0.0);
virtual bool removeChannel(const std::string& channel) = 0;
virtual std::string registerModuleType(ModuleTypeDefinition definition) = 0;
virtual std::string registerShareTransport(ShareTransportDefinition definition) = 0;
virtual std::string registerTaskType(std::string local_id, std::string name, TaskTypeDefinition definition) = 0;
virtual std::string registerOperation(std::string local_id, std::string name, OperationHandler handler) = 0;
virtual std::string registerDCodeFunction(
std::string local_id,
std::string name,
DCodeFunctionHandler handler,
std::string doc = {},
std::vector<DCodeFunctionArgument> input_arguments = {},
std::vector<DCodeFunctionArgument> output_arguments = {}
) = 0;
virtual std::string registerLoop(std::string local_id, std::string name, PluginLoopDefinition definition) = 0;
virtual int consoleError(
std::string message_title,
std::string message_description,
std::vector<std::string> tags,
std::string resolution,
int auto_acknowledge = 0
) = 0;
virtual std::shared_ptr<Modules::BaseModule> getModuleInstance(const std::string& instance_name) = 0;
virtual std::vector<ModuleInstanceSummary> getModuleInstances(const std::string& plugin_id = "") = 0;
virtual void upsertChannelValueBulk(const std::string& channel,
const std::vector<std::pair<double, uint64_t>>& data) = 0;
virtual nlohmann::json callDCodeFunction(const std::string& function_name, const nlohmann::json& payload) = 0;
virtual void commandChannel(const std::string& channel, ChannelValue value) = 0;
virtual void setChannel(const std::string& channel, std::optional<ChannelValue> value = std::nullopt) = 0;
virtual void claimChannel(const std::string& channel) = 0;
virtual void freeChannel(const std::string& channel) = 0;
virtual nlohmann::json recordEvent(nlohmann::json event) { return nlohmann::json::object(); }
virtual bool updateEventStatus(const std::string& event_id, const std::string& status) {
(void)event_id;
(void)status;
return false;
}
virtual FixedChannelBatch resolveFixedChannels(const std::vector<std::string>& channels) = 0;
virtual void queryFixedChannelValues(const FixedChannelBatch& batch,
std::span<double> destination,
double default_value = 0.0) = 0;
virtual void upsertFixedChannelValues(const FixedChannelBatch& batch,
std::span<const double> values,
std::optional<uint64_t> timestamp = std::nullopt) = 0;
virtual nlohmann::json requestInterfaceUi(
const std::string& ui_id,
nlohmann::json payload,
nlohmann::json options = nlohmann::json::object()) {
(void)ui_id;
(void)payload;
(void)options;
return nlohmann::json::object();
}
virtual nlohmann::json getInterfaceUiRequest(const std::string& request_id) {
(void)request_id;
return nlohmann::json::object();
}
virtual nlohmann::json announceDiscoveredDevice(nlohmann::json candidate) {
(void)candidate;
return nlohmann::json::object();
}
virtual bool isNotificationMuted(const std::string& notification_id) {
(void)notification_id;
return false;
}
};