Struct sGCPluginInterface
#[repr(C)]pub struct sGCPluginInterface {
pub publishDatapointValueCallback: Option<unsafe extern "C" fn(*mut c_void, *mut sGCDatapointValue) -> bool>,
pub storeDatapointValueCallback: Option<unsafe extern "C" fn(*mut c_void, *mut sGCDatapointValue)>,
pub logSystemCallback: Option<unsafe extern "C" fn(*mut c_void, u32, *const i8)>,
pub logAuditCallback: Option<unsafe extern "C" fn(*mut c_void, *const i8)>,
pub releaseDatapointValueCallback: Option<unsafe extern "C" fn(*mut sGCDatapointValue) -> bool>,
pub getLastDatapointValueCallback: Option<unsafe extern "C" fn(*mut c_void, u64) -> *mut sGCDatapointValue>,
pub getEthernetInterfaceCallback: Option<unsafe extern "C" fn(*mut c_void, *const i8, *mut sGCEthernetInterface) -> bool>,
pub getSerialInterfaceCallback: Option<unsafe extern "C" fn(*mut c_void, *const i8, *mut sGCSerialInterface) -> bool>,
pub config: sPluginConfig,
pub ctx: *mut c_void,
pub logLevel: u32,
}Expand description
@brief The plugin interface
The interface that the core provides to the plugin, it contains all the callbacks that the plugin can use to interact with the core.
Fields§
§publishDatapointValueCallback: Option<unsafe extern "C" fn(*mut c_void, *mut sGCDatapointValue) -> bool>@brief Callback used to publish datapoint values
This callback is used to publish a new datapoint value to the core. @param ctx The core context @param value The datapoint value to be published, owned by the plugin @return true if the value was published successfully, false if an error occurred while publishing the value
storeDatapointValueCallback: Option<unsafe extern "C" fn(*mut c_void, *mut sGCDatapointValue)>@brief Callback used to store datapoint values
This callback is used to store a new datapoint value to the timeseries database. @param ctx The core context @param value The datapoint value to be stored, owned by the plugin
logSystemCallback: Option<unsafe extern "C" fn(*mut c_void, u32, *const i8)>This callback shouldn’t be used, instead use the higher level @ref gcSystemLog and @ref gcAuditLog functions
logAuditCallback: Option<unsafe extern "C" fn(*mut c_void, *const i8)>This callback shouldn’t be used, instead use the higher level @ref gcSystemLog and @ref gcAuditLog functions
releaseDatapointValueCallback: Option<unsafe extern "C" fn(*mut sGCDatapointValue) -> bool>@brief Callback used to release a datapoint value
This callback is used to release a datapoint value that was previously returned by the core.
@param value The datapoint value to be released @return true if the value was released successfully, false if an error occurred while releasing the value
getLastDatapointValueCallback: Option<unsafe extern "C" fn(*mut c_void, u64) -> *mut sGCDatapointValue>@brief Callback used to get the last value of a datapoint
This callback is used to get the last value of a datapoint from the realtime database.
@param ctx The core context @param identifier The identifier of the datapoint to get the last value from @return If the datapoint exists, a shared reference to the last value of the datapoint, otherwise null @note The plugin must call @ref releaseDatapointValueCallback on the returned value if it is not null. Not doing so will result in a memory leak.
getEthernetInterfaceCallback: Option<unsafe extern "C" fn(*mut c_void, *const i8, *mut sGCEthernetInterface) -> bool>@brief Callback used to get ethernet interface configuration by name
Retrieves the configuration for an ethernet interface by its logical name. This allows plugins to obtain the OS interface name configured for the runtime.
@param ctx The core context @param name The logical name of the ethernet interface (e.g., “primary_eth”) @param out Pointer to output structure (allocated by plugin) @return true if the interface was found and output was filled, false otherwise @note This callback may be NULL if the core does not support device configuration (check before use).
getSerialInterfaceCallback: Option<unsafe extern "C" fn(*mut c_void, *const i8, *mut sGCSerialInterface) -> bool>@brief Callback used to get serial interface configuration by name
Retrieves the configuration for a serial interface by its logical name. This allows plugins to obtain the OS device path and serial settings configured for the runtime.
@param ctx The core context @param name The logical name of the serial interface (e.g., “moxa_port_1”) @param out Pointer to output structure (allocated by plugin) @return true if the interface was found and output was filled, false otherwise @note This callback may be NULL if the core does not support device configuration (check before use).
config: sPluginConfig@brief Configuration and related functions
ctx: *mut c_void@brief Core Context
The context state that the core provides to the plugin, it is required to call most of the core callbacks.
logLevel: u32@brief The log level set for this plugin instance
The log level set for this plugin instance, higher values mean more verbose logging.
Trait Implementations§
§impl Clone for sGCPluginInterface
impl Clone for sGCPluginInterface
§fn clone(&self) -> sGCPluginInterface
fn clone(&self) -> sGCPluginInterface
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more