Skip to main content

sGCPluginInterface

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

§

fn clone(&self) -> sGCPluginInterface

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for sGCPluginInterface

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Copy for sGCPluginInterface

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.