// Generated by tools/generate_bindings.py -- do not edit by hand.
// Mechanical output: lint findings here are the generator's business.
#![allow(clippy::all, unused_imports, rustdoc::bare_urls)]
use crate::error::{check, Error, Result};
use crate::object::{BaseObject, Interface, Ref};
use crate::sys;
use crate::value::{Complex, Ratio, Value};
use crate::generated::*;
use std::ffi::c_char;
/// Acts as a base interface for components, such as device, function block, channel and signal.
/// The IComponent provides a set of methods that are common to all components:
/// LocalID, GlobalID and Active properties.
/// Wrapper over the openDAQ `daqComponent` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Component(pub(crate) PropertyObject);
impl std::ops::Deref for Component {
type Target = PropertyObject;
fn deref(&self) -> &PropertyObject { &self.0 }
}
impl crate::sealed::Sealed for Component {}
unsafe impl Interface for Component {
const NAME: &'static str = "daqComponent";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqComponent_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl Component {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { Component(PropertyObject::__from_ref(r)) }
}
impl std::fmt::Display for Component {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&Component> for Value {
fn from(value: &Component) -> Value { Value::Object(value.to_base_object()) }
}
impl From<Component> for Value {
fn from(value: Component) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for Component {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Wrapper over the openDAQ `daqComponentDeserializeContext` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ComponentDeserializeContext(pub(crate) BaseObject);
impl std::ops::Deref for ComponentDeserializeContext {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ComponentDeserializeContext {}
unsafe impl Interface for ComponentDeserializeContext {
const NAME: &'static str = "daqComponentDeserializeContext";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqComponentDeserializeContext_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl ComponentDeserializeContext {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ComponentDeserializeContext(BaseObject(r)) }
}
impl std::fmt::Display for ComponentDeserializeContext {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ComponentDeserializeContext> for Value {
fn from(value: &ComponentDeserializeContext) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ComponentDeserializeContext> for Value {
fn from(value: ComponentDeserializeContext) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ComponentDeserializeContext {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Wrapper over the openDAQ `daqComponentHolder` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ComponentHolder(pub(crate) BaseObject);
impl std::ops::Deref for ComponentHolder {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ComponentHolder {}
unsafe impl Interface for ComponentHolder {
const NAME: &'static str = "daqComponentHolder";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqComponentHolder_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl ComponentHolder {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ComponentHolder(BaseObject(r)) }
}
impl std::fmt::Display for ComponentHolder {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ComponentHolder> for Value {
fn from(value: &ComponentHolder) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ComponentHolder> for Value {
fn from(value: ComponentHolder) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ComponentHolder {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Provides access to private methods of the component.
/// Said methods allow for triggering a Core event of the component, and locking/unlocking attributes of
/// the component.
/// Wrapper over the openDAQ `daqComponentPrivate` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ComponentPrivate(pub(crate) BaseObject);
impl std::ops::Deref for ComponentPrivate {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ComponentPrivate {}
unsafe impl Interface for ComponentPrivate {
const NAME: &'static str = "daqComponentPrivate";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqComponentPrivate_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl ComponentPrivate {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ComponentPrivate(BaseObject(r)) }
}
impl std::fmt::Display for ComponentPrivate {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ComponentPrivate> for Value {
fn from(value: &ComponentPrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ComponentPrivate> for Value {
fn from(value: ComponentPrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ComponentPrivate {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// A container of Component Statuses and their corresponding values.
/// Each status has a unique name and represents an actual status related to the openDAQ Component,
/// such as connection status, synchronization status, etc. The statuses' values are represented
/// by Enumeration objects.
/// Wrapper over the openDAQ `daqComponentStatusContainer` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ComponentStatusContainer(pub(crate) BaseObject);
impl std::ops::Deref for ComponentStatusContainer {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ComponentStatusContainer {}
unsafe impl Interface for ComponentStatusContainer {
const NAME: &'static str = "daqComponentStatusContainer";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqComponentStatusContainer_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl ComponentStatusContainer {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ComponentStatusContainer(BaseObject(r)) }
}
impl std::fmt::Display for ComponentStatusContainer {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ComponentStatusContainer> for Value {
fn from(value: &ComponentStatusContainer) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ComponentStatusContainer> for Value {
fn from(value: ComponentStatusContainer) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ComponentStatusContainer {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Provides access to private methods of the Component status container.
/// Said methods allow for adding new statuses and setting a value for existing statuses stored in
/// the component status container. Device connection statuses, however, are managed independently
/// via IConnectionStatusContainerPrivate.
/// "StatusChanged" Core events are triggered whenever there is a change in the status of the openDAQ Component.
/// Wrapper over the openDAQ `daqComponentStatusContainerPrivate` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ComponentStatusContainerPrivate(pub(crate) BaseObject);
impl std::ops::Deref for ComponentStatusContainerPrivate {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ComponentStatusContainerPrivate {}
unsafe impl Interface for ComponentStatusContainerPrivate {
const NAME: &'static str = "daqComponentStatusContainerPrivate";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqComponentStatusContainerPrivate_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl ComponentStatusContainerPrivate {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ComponentStatusContainerPrivate(BaseObject(r)) }
}
impl std::fmt::Display for ComponentStatusContainerPrivate {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ComponentStatusContainerPrivate> for Value {
fn from(value: &ComponentStatusContainerPrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ComponentStatusContainerPrivate> for Value {
fn from(value: ComponentStatusContainerPrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ComponentStatusContainerPrivate {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Provides information about the component types.
/// Is a Struct core type, and has access to Struct methods internally. Note that the Default config is not part of
/// the Struct fields.
/// Wrapper over the openDAQ `daqComponentType` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ComponentType(pub(crate) BaseObject);
impl std::ops::Deref for ComponentType {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ComponentType {}
unsafe impl Interface for ComponentType {
const NAME: &'static str = "daqComponentType";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqComponentType_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl ComponentType {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ComponentType(BaseObject(r)) }
}
impl std::fmt::Display for ComponentType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ComponentType> for Value {
fn from(value: &ComponentType) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ComponentType> for Value {
fn from(value: ComponentType) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ComponentType {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Builder component of Component type objects. Contains setter methods to configure the Component type parameters, and a `build` method that builds the object.
/// Depending on the set "Type" builder parameter, a different Component type is created - eg. Streaming type,
/// Device type, Function block type, or Server type
/// Wrapper over the openDAQ `daqComponentTypeBuilder` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ComponentTypeBuilder(pub(crate) BaseObject);
impl std::ops::Deref for ComponentTypeBuilder {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ComponentTypeBuilder {}
unsafe impl Interface for ComponentTypeBuilder {
const NAME: &'static str = "daqComponentTypeBuilder";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqComponentTypeBuilder_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl ComponentTypeBuilder {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ComponentTypeBuilder(BaseObject(r)) }
}
impl std::fmt::Display for ComponentTypeBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ComponentTypeBuilder> for Value {
fn from(value: &ComponentTypeBuilder) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ComponentTypeBuilder> for Value {
fn from(value: ComponentTypeBuilder) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ComponentTypeBuilder {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Private interface to component type. Allows for setting the module information.
/// Wrapper over the openDAQ `daqComponentTypePrivate` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ComponentTypePrivate(pub(crate) BaseObject);
impl std::ops::Deref for ComponentTypePrivate {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ComponentTypePrivate {}
unsafe impl Interface for ComponentTypePrivate {
const NAME: &'static str = "daqComponentTypePrivate";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqComponentTypePrivate_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl ComponentTypePrivate {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ComponentTypePrivate(BaseObject(r)) }
}
impl std::fmt::Display for ComponentTypePrivate {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ComponentTypePrivate> for Value {
fn from(value: &ComponentTypePrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ComponentTypePrivate> for Value {
fn from(value: ComponentTypePrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ComponentTypePrivate {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// @ingroup types_utility
/// @defgroup types_updatable Updatable
/// Wrapper over the openDAQ `daqComponentUpdateContext` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ComponentUpdateContext(pub(crate) BaseObject);
impl std::ops::Deref for ComponentUpdateContext {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ComponentUpdateContext {}
unsafe impl Interface for ComponentUpdateContext {
const NAME: &'static str = "daqComponentUpdateContext";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqComponentUpdateContext_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl ComponentUpdateContext {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ComponentUpdateContext(BaseObject(r)) }
}
impl std::fmt::Display for ComponentUpdateContext {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ComponentUpdateContext> for Value {
fn from(value: &ComponentUpdateContext) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ComponentUpdateContext> for Value {
fn from(value: ComponentUpdateContext) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ComponentUpdateContext {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// The Context serves as a container for the Scheduler and Logger. It originates at the instance, and is passed to the root device, which forwards it to components such as function blocks and signals.
/// Note: The context holds a strong reference to the Module Manager until the reference is moved via the
/// ContextInternal move function. The strong reference moved to an external owner to avoid memory leaks
/// due to circular references. This is done automatically when the Context is used in the openDAQ Instance
/// constructor.
/// Wrapper over the openDAQ `daqContext` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Context(pub(crate) BaseObject);
impl std::ops::Deref for Context {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for Context {}
unsafe impl Interface for Context {
const NAME: &'static str = "daqContext";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqContext_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl Context {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { Context(BaseObject(r)) }
}
impl std::fmt::Display for Context {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&Context> for Value {
fn from(value: &Context) -> Value { Value::Object(value.to_base_object()) }
}
impl From<Context> for Value {
fn from(value: Context) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for Context {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Wrapper over the openDAQ `daqDeserializeComponent` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DeserializeComponent(pub(crate) BaseObject);
impl std::ops::Deref for DeserializeComponent {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for DeserializeComponent {}
unsafe impl Interface for DeserializeComponent {
const NAME: &'static str = "daqDeserializeComponent";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqDeserializeComponent_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl DeserializeComponent {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { DeserializeComponent(BaseObject(r)) }
}
impl std::fmt::Display for DeserializeComponent {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&DeserializeComponent> for Value {
fn from(value: &DeserializeComponent) -> Value { Value::Object(value.to_base_object()) }
}
impl From<DeserializeComponent> for Value {
fn from(value: DeserializeComponent) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for DeserializeComponent {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Allows for specifying how a device and its subdevices are to be updated when loading a configuration.
/// The device options object can be created using a serialized openDAQ JSON setup. The options are structured
/// hierarchically, so that options for subdevices are stored in the parent device options. The following metadata
/// is read from the setup: local ID, manufacturer, serial number, and connection string.
/// For each individual device in the setup, the update mode can be specified. The update mode defines how the device is updated when loading:
/// - Load: Updates the device. Adds the device if missing.
/// - UpdateOnly: The device is updated, but not added if missing.
/// - Skip: The device is not updated. Does neither add nor remove the device.
/// - Remove: Removes the device from the tree, if present.
/// - Remap: Same as load, but removes old device (if present) and uses the new manufacturer, serial number, and connection string to add a new one and update.
/// @subsection opendaq_device_options_remapping Remapping
/// When the update mode is set to Remap, the device is removed and added again with the new manufacturer, serial number, and connection
/// string. This can be used when swapping out a device with a different one of the same make/model. This option will try and load the same
/// settings used to configure the original device to the new one.
/// When loading, the new manufacturer + serial number combination will have priority over the new connection string. In case a device with
/// the new manufacturer + serial number combination is not found, the new connection string will be used as fallback.
/// If the remapping fails (e.g. due to missing device with the new manufacturer + serial number combination and invalid connection string),
/// the original device will be removed (if present) and no new device will be added.
/// Signal-\>Input port connections will be preserved when remapping, assuming the new device has the same signal and input port structure and IDs.
/// Wrapper over the openDAQ `daqDeviceUpdateOptions` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DeviceUpdateOptions(pub(crate) BaseObject);
impl std::ops::Deref for DeviceUpdateOptions {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for DeviceUpdateOptions {}
unsafe impl Interface for DeviceUpdateOptions {
const NAME: &'static str = "daqDeviceUpdateOptions";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqDeviceUpdateOptions_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl DeviceUpdateOptions {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { DeviceUpdateOptions(BaseObject(r)) }
}
impl std::fmt::Display for DeviceUpdateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&DeviceUpdateOptions> for Value {
fn from(value: &DeviceUpdateOptions) -> Value { Value::Object(value.to_base_object()) }
}
impl From<DeviceUpdateOptions> for Value {
fn from(value: DeviceUpdateOptions) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for DeviceUpdateOptions {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Acts as a container for other components
/// Other components use the folder component to organize the children components,
/// such as channels, signals, function blocks, etc.
/// Wrapper over the openDAQ `daqFolder` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Folder(pub(crate) Component);
impl std::ops::Deref for Folder {
type Target = Component;
fn deref(&self) -> &Component { &self.0 }
}
impl crate::sealed::Sealed for Folder {}
unsafe impl Interface for Folder {
const NAME: &'static str = "daqFolder";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqFolder_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl Folder {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { Folder(Component::__from_ref(r)) }
}
impl std::fmt::Display for Folder {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&Folder> for Value {
fn from(value: &Folder) -> Value { Value::Object(value.to_base_object()) }
}
impl From<Folder> for Value {
fn from(value: Folder) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for Folder {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Allows write access to folder.
/// Provides methods to add and remove items to the folder.
/// Wrapper over the openDAQ `daqFolderConfig` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct FolderConfig(pub(crate) Folder);
impl std::ops::Deref for FolderConfig {
type Target = Folder;
fn deref(&self) -> &Folder { &self.0 }
}
impl crate::sealed::Sealed for FolderConfig {}
unsafe impl Interface for FolderConfig {
const NAME: &'static str = "daqFolderConfig";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqFolderConfig_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl FolderConfig {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { FolderConfig(Folder::__from_ref(r)) }
}
impl std::fmt::Display for FolderConfig {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&FolderConfig> for Value {
fn from(value: &FolderConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl From<FolderConfig> for Value {
fn from(value: FolderConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for FolderConfig {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Give module information composing of: - version info (major, minor, patch) - name - id.
/// Wrapper over the openDAQ `daqModuleInfo` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ModuleInfo(pub(crate) BaseObject);
impl std::ops::Deref for ModuleInfo {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ModuleInfo {}
unsafe impl Interface for ModuleInfo {
const NAME: &'static str = "daqModuleInfo";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqModuleInfo_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl ModuleInfo {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ModuleInfo(BaseObject(r)) }
}
impl std::fmt::Display for ModuleInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ModuleInfo> for Value {
fn from(value: &ModuleInfo) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ModuleInfo> for Value {
fn from(value: ModuleInfo) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ModuleInfo {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Allows the component to be notified when it is removed.
/// Wrapper over the openDAQ `daqRemovable` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Removable(pub(crate) BaseObject);
impl std::ops::Deref for Removable {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for Removable {}
unsafe impl Interface for Removable {
const NAME: &'static str = "daqRemovable";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqRemovable_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl Removable {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { Removable(BaseObject(r)) }
}
impl std::fmt::Display for Removable {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&Removable> for Value {
fn from(value: &Removable) -> Value { Value::Object(value.to_base_object()) }
}
impl From<Removable> for Value {
fn from(value: Removable) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for Removable {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// A signal with an unique ID that sends event/data packets through connections to input ports the signal is connected to.
/// A signal features an unique ID within a given device. It sends data along its signal path to all
/// connected input ports, if its set to be active via its active property.
/// A signal is visible, and its data is streamed to all clients connected to a device only if its public
/// property is set to `True`.
/// Each signal has a domain descriptor, which is set by the owner of the signal - most often a function
/// block or device. The descriptor defines all properties of the signal, such as its name, description
/// and data structure.
/// Signals can have a reference to another signal, which is used for determining the domain data. The domain
/// signal outputs data at the same rate as the signal itself, providing domain (most often time - timestamps)
/// information for each sample sent along the signal path. Each value packet sent by a signal thus contains
/// a reference to another data packet containing domain data (if the signal is associated with another domain signal).
/// Additionally, a list of related signals can be defined, containing any signals relevant to interpreting the
/// signal data.
/// To get the list of connections to input ports of the signal, `getConnections` can be used.
/// Wrapper over the openDAQ `daqSignal` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Signal(pub(crate) Component);
impl std::ops::Deref for Signal {
type Target = Component;
fn deref(&self) -> &Component { &self.0 }
}
impl crate::sealed::Sealed for Signal {}
unsafe impl Interface for Signal {
const NAME: &'static str = "daqSignal";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqSignal_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl Signal {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { Signal(Component::__from_ref(r)) }
}
impl std::fmt::Display for Signal {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&Signal> for Value {
fn from(value: &Signal) -> Value { Value::Object(value.to_base_object()) }
}
impl From<Signal> for Value {
fn from(value: Signal) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for Signal {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// List of string tags. Provides helpers to get and search the list of tags.
/// Tags provide a view into an underlying list of tags. The list can be retrieved via
/// `getList`, and inspected through `contains` and `query`.
/// To manipulate the list of tags, the add/remove tag functions can be used. The Tags
/// object can only be modified if the object is not locked by the owning Component.
/// Wrapper over the openDAQ `daqTags` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Tags(pub(crate) BaseObject);
impl std::ops::Deref for Tags {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for Tags {}
unsafe impl Interface for Tags {
const NAME: &'static str = "daqTags";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqTags_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl Tags {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { Tags(BaseObject(r)) }
}
impl std::fmt::Display for Tags {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&Tags> for Value {
fn from(value: &Tags) -> Value { Value::Object(value.to_base_object()) }
}
impl From<Tags> for Value {
fn from(value: Tags) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for Tags {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Private interface to component tags. Allows for adding/removing tags.
/// Modifying the tags of a component might have unintended sideffects and should in most cases only be done
/// by the component owner module.
/// Wrapper over the openDAQ `daqTagsPrivate` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct TagsPrivate(pub(crate) BaseObject);
impl std::ops::Deref for TagsPrivate {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for TagsPrivate {}
unsafe impl Interface for TagsPrivate {
const NAME: &'static str = "daqTagsPrivate";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqTagsPrivate_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl TagsPrivate {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { TagsPrivate(BaseObject(r)) }
}
impl std::fmt::Display for TagsPrivate {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&TagsPrivate> for Value {
fn from(value: &TagsPrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl From<TagsPrivate> for Value {
fn from(value: TagsPrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for TagsPrivate {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// IUpdateParameters interface provides a set of methods to give user flexibility to load instance configuration.
/// Wrapper over the openDAQ `daqUpdateParameters` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct UpdateParameters(pub(crate) PropertyObject);
impl std::ops::Deref for UpdateParameters {
type Target = PropertyObject;
fn deref(&self) -> &PropertyObject { &self.0 }
}
impl crate::sealed::Sealed for UpdateParameters {}
unsafe impl Interface for UpdateParameters {
const NAME: &'static str = "daqUpdateParameters";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqUpdateParameters_getInterfaceId)(&mut id) };
Some(id)
}
unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
Ref::from_owned(ptr).map(Self::__from_ref)
}
fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl UpdateParameters {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { UpdateParameters(PropertyObject::__from_ref(r)) }
}
impl std::fmt::Display for UpdateParameters {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&UpdateParameters> for Value {
fn from(value: &UpdateParameters) -> Value { Value::Object(value.to_base_object()) }
}
impl From<UpdateParameters> for Value {
fn from(value: UpdateParameters) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for UpdateParameters {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
impl ComponentDeserializeContext {
/// Calls the openDAQ C function `daqComponentDeserializeContext_clone()`.
pub fn clone_object(&self, new_parent: &Component, new_local_id: &str) -> Result<(Option<ComponentDeserializeContext>, crate::IntfID)> {
let __new_local_id = crate::marshal::make_string(new_local_id)?;
let mut __new_component_deserialize_context: *mut sys::daqComponentDeserializeContext = std::ptr::null_mut();
let mut __new_intf_id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
let __code = unsafe { (crate::sys::api().daqComponentDeserializeContext_clone)(self.as_raw() as *mut _, new_parent.as_raw() as *mut _, __new_local_id.as_ptr() as *mut _, &mut __new_component_deserialize_context, &mut __new_intf_id, std::ptr::null_mut()) };
check(__code, "daqComponentDeserializeContext_clone")?;
Ok((unsafe { crate::marshal::take_object::<ComponentDeserializeContext>(__new_component_deserialize_context as *mut _) }, __new_intf_id))
}
/// Calls the openDAQ C function `daqComponentDeserializeContext_clone()`.
pub fn clone_object_with(&self, new_parent: &Component, new_local_id: &str, new_trigger_core_event: Option<&Procedure>) -> Result<(Option<ComponentDeserializeContext>, crate::IntfID)> {
let __new_local_id = crate::marshal::make_string(new_local_id)?;
let mut __new_component_deserialize_context: *mut sys::daqComponentDeserializeContext = std::ptr::null_mut();
let mut __new_intf_id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
let __code = unsafe { (crate::sys::api().daqComponentDeserializeContext_clone)(self.as_raw() as *mut _, new_parent.as_raw() as *mut _, __new_local_id.as_ptr() as *mut _, &mut __new_component_deserialize_context, &mut __new_intf_id, new_trigger_core_event.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqComponentDeserializeContext_clone")?;
Ok((unsafe { crate::marshal::take_object::<ComponentDeserializeContext>(__new_component_deserialize_context as *mut _) }, __new_intf_id))
}
/// Calls the openDAQ C function `daqComponentDeserializeContext_getContext()`.
pub fn context(&self) -> Result<Option<Context>> {
let mut __context: *mut sys::daqContext = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentDeserializeContext_getContext)(self.as_raw() as *mut _, &mut __context) };
check(__code, "daqComponentDeserializeContext_getContext")?;
Ok(unsafe { crate::marshal::take_object::<Context>(__context as *mut _) })
}
/// Calls the openDAQ C function `daqComponentDeserializeContext_getIntfID()`.
pub fn intf_id(&self) -> Result<crate::IntfID> {
let mut __intf_id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
let __code = unsafe { (crate::sys::api().daqComponentDeserializeContext_getIntfID)(self.as_raw() as *mut _, &mut __intf_id) };
check(__code, "daqComponentDeserializeContext_getIntfID")?;
Ok(__intf_id)
}
/// Calls the openDAQ C function `daqComponentDeserializeContext_getLocalId()`.
pub fn local_id(&self) -> Result<String> {
let mut __local_id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentDeserializeContext_getLocalId)(self.as_raw() as *mut _, &mut __local_id) };
check(__code, "daqComponentDeserializeContext_getLocalId")?;
Ok(unsafe { crate::marshal::take_string(__local_id) })
}
/// Calls the openDAQ C function `daqComponentDeserializeContext_getParent()`.
pub fn parent(&self) -> Result<Option<Component>> {
let mut __parent: *mut sys::daqComponent = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentDeserializeContext_getParent)(self.as_raw() as *mut _, &mut __parent) };
check(__code, "daqComponentDeserializeContext_getParent")?;
Ok(unsafe { crate::marshal::take_object::<Component>(__parent as *mut _) })
}
/// Calls the openDAQ C function `daqComponentDeserializeContext_getRoot()`.
pub fn root(&self) -> Result<Option<Component>> {
let mut __root: *mut sys::daqComponent = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentDeserializeContext_getRoot)(self.as_raw() as *mut _, &mut __root) };
check(__code, "daqComponentDeserializeContext_getRoot")?;
Ok(unsafe { crate::marshal::take_object::<Component>(__root as *mut _) })
}
/// Calls the openDAQ C function `daqComponentDeserializeContext_getTriggerCoreEvent()`.
pub fn trigger_core_event(&self) -> Result<Option<Procedure>> {
let mut __trigger_core_event: *mut sys::daqProcedure = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentDeserializeContext_getTriggerCoreEvent)(self.as_raw() as *mut _, &mut __trigger_core_event) };
check(__code, "daqComponentDeserializeContext_getTriggerCoreEvent")?;
Ok(unsafe { crate::marshal::take_object::<Procedure>(__trigger_core_event as *mut _) })
}
}
impl ComponentHolder {
/// Calls the openDAQ C function `daqComponentHolder_createComponentHolder()`.
pub fn new(component: &Component) -> Result<ComponentHolder> {
let mut __obj: *mut sys::daqComponentHolder = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentHolder_createComponentHolder)(&mut __obj, component.as_raw() as *mut _) };
check(__code, "daqComponentHolder_createComponentHolder")?;
Ok(unsafe { crate::marshal::require_object::<ComponentHolder>(__obj as *mut _, "daqComponentHolder_createComponentHolder") }?)
}
/// Calls the openDAQ C function `daqComponentHolder_createComponentHolderWithIds()`.
pub fn with_ids(id: &str, parent_global_id: &str, component: &Component) -> Result<ComponentHolder> {
let __id = crate::marshal::make_string(id)?;
let __parent_global_id = crate::marshal::make_string(parent_global_id)?;
let mut __obj: *mut sys::daqComponentHolder = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentHolder_createComponentHolderWithIds)(&mut __obj, __id.as_ptr() as *mut _, __parent_global_id.as_ptr() as *mut _, component.as_raw() as *mut _) };
check(__code, "daqComponentHolder_createComponentHolderWithIds")?;
Ok(unsafe { crate::marshal::require_object::<ComponentHolder>(__obj as *mut _, "daqComponentHolder_createComponentHolderWithIds") }?)
}
/// Calls the openDAQ C function `daqComponentHolder_getComponent()`.
pub fn component(&self) -> Result<Option<Component>> {
let mut __component: *mut sys::daqComponent = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentHolder_getComponent)(self.as_raw() as *mut _, &mut __component) };
check(__code, "daqComponentHolder_getComponent")?;
Ok(unsafe { crate::marshal::take_object::<Component>(__component as *mut _) })
}
/// Calls the openDAQ C function `daqComponentHolder_getLocalId()`.
pub fn local_id(&self) -> Result<String> {
let mut __local_id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentHolder_getLocalId)(self.as_raw() as *mut _, &mut __local_id) };
check(__code, "daqComponentHolder_getLocalId")?;
Ok(unsafe { crate::marshal::take_string(__local_id) })
}
/// Calls the openDAQ C function `daqComponentHolder_getParentGlobalId()`.
pub fn parent_global_id(&self) -> Result<String> {
let mut __parent_id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentHolder_getParentGlobalId)(self.as_raw() as *mut _, &mut __parent_id) };
check(__code, "daqComponentHolder_getParentGlobalId")?;
Ok(unsafe { crate::marshal::take_string(__parent_id) })
}
}
impl ComponentPrivate {
/// Retrieves the configuration which was used to create the component.
///
/// # Parameters
/// - `config`: The configuration of the component.
///
/// Calls the openDAQ C function `daqComponentPrivate_getComponentConfig()`.
pub fn component_config(&self) -> Result<Option<PropertyObject>> {
let mut __config: *mut sys::daqPropertyObject = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentPrivate_getComponentConfig)(self.as_raw() as *mut _, &mut __config) };
check(__code, "daqComponentPrivate_getComponentConfig")?;
Ok(unsafe { crate::marshal::take_object::<PropertyObject>(__config as *mut _) })
}
/// Locks all attributes of the component.
///
/// Calls the openDAQ C function `daqComponentPrivate_lockAllAttributes()`.
pub fn lock_all_attributes(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqComponentPrivate_lockAllAttributes)(self.as_raw() as *mut _) };
check(__code, "daqComponentPrivate_lockAllAttributes")?;
Ok(())
}
/// Locks the attributes contained in the provided list.
///
/// # Parameters
/// - `attributes`: The list of attributes that should be locked. Is not case sensitive.
///
/// Calls the openDAQ C function `daqComponentPrivate_lockAttributes()`.
pub fn lock_attributes(&self, attributes: &[&str]) -> Result<()> {
let __attributes = crate::marshal::list_from_strs(attributes)?;
let __code = unsafe { (crate::sys::api().daqComponentPrivate_lockAttributes)(self.as_raw() as *mut _, __attributes.as_ptr() as *mut _) };
check(__code, "daqComponentPrivate_lockAttributes")?;
Ok(())
}
/// Sets the configuration which was used to create the component.
///
/// # Parameters
/// - `config`: The configuration of the component.
///
/// Calls the openDAQ C function `daqComponentPrivate_setComponentConfig()`.
pub fn set_component_config(&self, config: &PropertyObject) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqComponentPrivate_setComponentConfig)(self.as_raw() as *mut _, config.as_raw() as *mut _) };
check(__code, "daqComponentPrivate_setComponentConfig")?;
Ok(())
}
/// Called by parent component to notify this component about parent's active state change.
///
/// # Parameters
/// - `parent_active`: True if parent is active. The component updates its internal parentActive flag and recomputes its effective active state. If the effective active state changes, triggers an AttributeChanged event. Container components (folders, devices) propagate this call to their children.
///
/// Calls the openDAQ C function `daqComponentPrivate_setParentActive()`.
pub fn set_parent_active(&self, parent_active: bool) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqComponentPrivate_setParentActive)(self.as_raw() as *mut _, u8::from(parent_active)) };
check(__code, "daqComponentPrivate_setParentActive")?;
Ok(())
}
/// Triggers the component-specific core event with the provided arguments.
///
/// # Parameters
/// - `args`: The arguments of the core event.
///
/// Calls the openDAQ C function `daqComponentPrivate_triggerComponentCoreEvent()`.
pub fn trigger_component_core_event(&self, args: &CoreEventArgs) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqComponentPrivate_triggerComponentCoreEvent)(self.as_raw() as *mut _, args.as_raw() as *mut _) };
check(__code, "daqComponentPrivate_triggerComponentCoreEvent")?;
Ok(())
}
/// Unlocks all attributes of the component.
///
/// Calls the openDAQ C function `daqComponentPrivate_unlockAllAttributes()`.
pub fn unlock_all_attributes(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqComponentPrivate_unlockAllAttributes)(self.as_raw() as *mut _) };
check(__code, "daqComponentPrivate_unlockAllAttributes")?;
Ok(())
}
/// Unlocks the attributes contained in the provided list.
///
/// # Parameters
/// - `attributes`: The list of attributes that should be unlocked. Is not case sensitive.
///
/// Calls the openDAQ C function `daqComponentPrivate_unlockAttributes()`.
pub fn unlock_attributes(&self, attributes: &[&str]) -> Result<()> {
let __attributes = crate::marshal::list_from_strs(attributes)?;
let __code = unsafe { (crate::sys::api().daqComponentPrivate_unlockAttributes)(self.as_raw() as *mut _, __attributes.as_ptr() as *mut _) };
check(__code, "daqComponentPrivate_unlockAttributes")?;
Ok(())
}
/// Notifies component about the change of the operation mode.
///
/// # Parameters
/// - `mode_type`: The new operation mode.
///
/// Calls the openDAQ C function `daqComponentPrivate_updateOperationMode()`.
pub fn update_operation_mode(&self, mode_type: OperationModeType) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqComponentPrivate_updateOperationMode)(self.as_raw() as *mut _, mode_type as u32) };
check(__code, "daqComponentPrivate_updateOperationMode")?;
Ok(())
}
}
impl ComponentStatusContainerPrivate {
/// Adds the new status with given name and initial value.
///
/// # Parameters
/// - `name`: The name of the component status.
/// - `initial_value`: The initial value of the component status.
///
/// Calls the openDAQ C function `daqComponentStatusContainerPrivate_addStatus()`.
pub fn add_status(&self, name: &str, initial_value: &Enumeration) -> Result<()> {
let __name = crate::marshal::make_string(name)?;
let __code = unsafe { (crate::sys::api().daqComponentStatusContainerPrivate_addStatus)(self.as_raw() as *mut _, __name.as_ptr() as *mut _, initial_value.as_raw() as *mut _) };
check(__code, "daqComponentStatusContainerPrivate_addStatus")?;
Ok(())
}
/// Adds the new status with given name, initial value, and message.
///
/// # Parameters
/// - `name`: The name of the component status.
/// - `initial_value`: The initial value of the component status.
/// - `message`: The message of the component status.
///
/// Calls the openDAQ C function `daqComponentStatusContainerPrivate_addStatusWithMessage()`.
pub fn add_status_with_message(&self, name: &str, initial_value: &Enumeration, message: &str) -> Result<()> {
let __name = crate::marshal::make_string(name)?;
let __message = crate::marshal::make_string(message)?;
let __code = unsafe { (crate::sys::api().daqComponentStatusContainerPrivate_addStatusWithMessage)(self.as_raw() as *mut _, __name.as_ptr() as *mut _, initial_value.as_raw() as *mut _, __message.as_ptr() as *mut _) };
check(__code, "daqComponentStatusContainerPrivate_addStatusWithMessage")?;
Ok(())
}
/// Sets the value for the existing component status.
///
/// # Parameters
/// - `name`: The name of the component status.
/// - `value`: The new value of the component status.
///
/// Calls the openDAQ C function `daqComponentStatusContainerPrivate_setStatus()`.
pub fn set_status(&self, name: &str, value: &Enumeration) -> Result<()> {
let __name = crate::marshal::make_string(name)?;
let __code = unsafe { (crate::sys::api().daqComponentStatusContainerPrivate_setStatus)(self.as_raw() as *mut _, __name.as_ptr() as *mut _, value.as_raw() as *mut _) };
check(__code, "daqComponentStatusContainerPrivate_setStatus")?;
Ok(())
}
/// Sets the value for the existing component status with a message.
///
/// # Parameters
/// - `name`: The name of the component status.
/// - `value`: The new value of the component status.
/// - `message`: The new message of the component status.
///
/// Calls the openDAQ C function `daqComponentStatusContainerPrivate_setStatusWithMessage()`.
pub fn set_status_with_message(&self, name: &str, value: &Enumeration, message: &str) -> Result<()> {
let __name = crate::marshal::make_string(name)?;
let __message = crate::marshal::make_string(message)?;
let __code = unsafe { (crate::sys::api().daqComponentStatusContainerPrivate_setStatusWithMessage)(self.as_raw() as *mut _, __name.as_ptr() as *mut _, value.as_raw() as *mut _, __message.as_ptr() as *mut _) };
check(__code, "daqComponentStatusContainerPrivate_setStatusWithMessage")?;
Ok(())
}
}
impl ComponentStatusContainer {
/// Calls the openDAQ C function `daqComponentStatusContainer_createComponentStatusContainer()`.
pub fn new() -> Result<ComponentStatusContainer> {
let mut __obj: *mut sys::daqComponentStatusContainer = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentStatusContainer_createComponentStatusContainer)(&mut __obj) };
check(__code, "daqComponentStatusContainer_createComponentStatusContainer")?;
Ok(unsafe { crate::marshal::require_object::<ComponentStatusContainer>(__obj as *mut _, "daqComponentStatusContainer_createComponentStatusContainer") }?)
}
/// Gets the current value of Component status with a given name.
///
/// # Parameters
/// - `name`: The name of Component status.
///
/// # Returns
/// - `value`: The current value of Component status.
///
/// Calls the openDAQ C function `daqComponentStatusContainer_getStatus()`.
pub fn status(&self, name: &str) -> Result<Option<Enumeration>> {
let __name = crate::marshal::make_string(name)?;
let mut __value: *mut sys::daqEnumeration = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentStatusContainer_getStatus)(self.as_raw() as *mut _, __name.as_ptr() as *mut _, &mut __value) };
check(__code, "daqComponentStatusContainer_getStatus")?;
Ok(unsafe { crate::marshal::take_object::<Enumeration>(__value as *mut _) })
}
/// Gets the status message of Component status with a given name.
///
/// # Parameters
/// - `name`: The name of Component status.
///
/// # Returns
/// - `message`: The current message of Component status.
///
/// Calls the openDAQ C function `daqComponentStatusContainer_getStatusMessage()`.
pub fn status_message(&self, name: &str) -> Result<String> {
let __name = crate::marshal::make_string(name)?;
let mut __message: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentStatusContainer_getStatusMessage)(self.as_raw() as *mut _, __name.as_ptr() as *mut _, &mut __message) };
check(__code, "daqComponentStatusContainer_getStatusMessage")?;
Ok(unsafe { crate::marshal::take_string(__message) })
}
/// Gets the current values of all Component statuses.
///
/// # Returns
/// - `statuses`: The Component statuses as a dictionary. All objects in the statuses dictionary are key value pairs of \<IString, IEnumeration\>.
///
/// Calls the openDAQ C function `daqComponentStatusContainer_getStatuses()`.
pub fn statuses(&self) -> Result<std::collections::HashMap<String, Enumeration>> {
let mut __statuses: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentStatusContainer_getStatuses)(self.as_raw() as *mut _, &mut __statuses) };
check(__code, "daqComponentStatusContainer_getStatuses")?;
Ok(unsafe { crate::marshal::take_dict::<String, Enumeration>(__statuses as *mut _, "daqComponentStatusContainer_getStatuses") }?)
}
}
impl ComponentTypeBuilder {
/// Builds and returns a Component type object using the currently set values of the Builder.
///
/// # Returns
/// - `component_type`: The built Component type. Depending on the set "sort" builder parameter, a different Component type is created - eg. Streaming type, Device type, Function block type, or Server type
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_build()`.
pub fn build(&self) -> Result<Option<ComponentType>> {
let mut __component_type: *mut sys::daqComponentType = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_build)(self.as_raw() as *mut _, &mut __component_type) };
check(__code, "daqComponentTypeBuilder_build")?;
Ok(unsafe { crate::marshal::take_object::<ComponentType>(__component_type as *mut _) })
}
/// Creates a ComponentTypeBuilder with default parameters.
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_createComponentTypeBuilder()`.
pub fn new() -> Result<ComponentTypeBuilder> {
let mut __obj: *mut sys::daqComponentTypeBuilder = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_createComponentTypeBuilder)(&mut __obj) };
check(__code, "daqComponentTypeBuilder_createComponentTypeBuilder")?;
Ok(unsafe { crate::marshal::require_object::<ComponentTypeBuilder>(__obj as *mut _, "daqComponentTypeBuilder_createComponentTypeBuilder") }?)
}
/// Creates a ComponentTypeBuilder with the type sort set to "Device".
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_createDeviceTypeBuilder()`.
pub fn device() -> Result<ComponentTypeBuilder> {
let mut __obj: *mut sys::daqComponentTypeBuilder = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_createDeviceTypeBuilder)(&mut __obj) };
check(__code, "daqComponentTypeBuilder_createDeviceTypeBuilder")?;
Ok(unsafe { crate::marshal::require_object::<ComponentTypeBuilder>(__obj as *mut _, "daqComponentTypeBuilder_createDeviceTypeBuilder") }?)
}
/// Creates a ComponentTypeBuilder with the type sort set to "FunctionBlock".
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_createFunctionBlockTypeBuilder()`.
pub fn function_block() -> Result<ComponentTypeBuilder> {
let mut __obj: *mut sys::daqComponentTypeBuilder = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_createFunctionBlockTypeBuilder)(&mut __obj) };
check(__code, "daqComponentTypeBuilder_createFunctionBlockTypeBuilder")?;
Ok(unsafe { crate::marshal::require_object::<ComponentTypeBuilder>(__obj as *mut _, "daqComponentTypeBuilder_createFunctionBlockTypeBuilder") }?)
}
/// Creates a ComponentTypeBuilder with the type sort set to "Server".
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_createServerTypeBuilder()`.
pub fn server() -> Result<ComponentTypeBuilder> {
let mut __obj: *mut sys::daqComponentTypeBuilder = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_createServerTypeBuilder)(&mut __obj) };
check(__code, "daqComponentTypeBuilder_createServerTypeBuilder")?;
Ok(unsafe { crate::marshal::require_object::<ComponentTypeBuilder>(__obj as *mut _, "daqComponentTypeBuilder_createServerTypeBuilder") }?)
}
/// Creates a ComponentTypeBuilder with the type sort set to "Streaming".
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_createStreamingTypeBuilder()`.
pub fn streaming() -> Result<ComponentTypeBuilder> {
let mut __obj: *mut sys::daqComponentTypeBuilder = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_createStreamingTypeBuilder)(&mut __obj) };
check(__code, "daqComponentTypeBuilder_createStreamingTypeBuilder")?;
Ok(unsafe { crate::marshal::require_object::<ComponentTypeBuilder>(__obj as *mut _, "daqComponentTypeBuilder_createStreamingTypeBuilder") }?)
}
/// Calls the openDAQ C function `daqComponentTypeBuilder_getConnectionStringPrefix()`.
pub fn connection_string_prefix(&self) -> Result<String> {
let mut __prefix: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_getConnectionStringPrefix)(self.as_raw() as *mut _, &mut __prefix) };
check(__code, "daqComponentTypeBuilder_getConnectionStringPrefix")?;
Ok(unsafe { crate::marshal::take_string(__prefix) })
}
/// Gets the default configuration object that will be cloned and passed to users by the built Component type when requested.
///
/// # Returns
/// - `default_config`: The default configuration object. Configuration objects are property object with user-defined key-value pairs. For example: Port=1000, OutputRate=5000, ...
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_getDefaultConfig()`.
pub fn default_config(&self) -> Result<Option<PropertyObject>> {
let mut __default_config: *mut sys::daqPropertyObject = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_getDefaultConfig)(self.as_raw() as *mut _, &mut __default_config) };
check(__code, "daqComponentTypeBuilder_getDefaultConfig")?;
Ok(unsafe { crate::marshal::take_object::<PropertyObject>(__default_config as *mut _) })
}
/// Gets the description of a component type.
///
/// # Returns
/// - `description`: The description of a component type. A short description of a component type and the associated configuration parameters it offers.
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_getDescription()`.
pub fn description(&self) -> Result<String> {
let mut __description: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_getDescription)(self.as_raw() as *mut _, &mut __description) };
check(__code, "daqComponentTypeBuilder_getDescription")?;
Ok(unsafe { crate::marshal::take_string(__description) })
}
/// Gets the unique component type id.
///
/// # Returns
/// - `id`: The unique id of a component type. Unique id should not be presented on the UI.
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_getId()`.
pub fn id(&self) -> Result<String> {
let mut __id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_getId)(self.as_raw() as *mut _, &mut __id) };
check(__code, "daqComponentTypeBuilder_getId")?;
Ok(unsafe { crate::marshal::take_string(__id) })
}
/// Gets the user-friendly name of a component type.
///
/// # Returns
/// - `name`: The user-friendly name of a component type. Name is usually presented on the UI. Does not have to be unique.
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_getName()`.
pub fn name(&self) -> Result<String> {
let mut __name: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_getName)(self.as_raw() as *mut _, &mut __name) };
check(__code, "daqComponentTypeBuilder_getName")?;
Ok(unsafe { crate::marshal::take_string(__name) })
}
/// Gets the component type sort. Can be either Streaming, Function block, Device, or Server. Depending on the setting, the corresponding Component type object will be built.
///
/// # Parameters
/// - `sort`: The sort of the component type.
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_getTypeSort()`.
pub fn type_sort(&self) -> Result<ComponentTypeSort> {
let mut __sort: u32 = 0;
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_getTypeSort)(self.as_raw() as *mut _, &mut __sort) };
check(__code, "daqComponentTypeBuilder_getTypeSort")?;
Ok(crate::marshal::enum_out(ComponentTypeSort::from_raw(__sort), "daqComponentTypeBuilder_getTypeSort")?)
}
/// Calls the openDAQ C function `daqComponentTypeBuilder_setConnectionStringPrefix()`.
pub fn set_connection_string_prefix(&self, prefix: &str) -> Result<()> {
let __prefix = crate::marshal::make_string(prefix)?;
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_setConnectionStringPrefix)(self.as_raw() as *mut _, __prefix.as_ptr() as *mut _) };
check(__code, "daqComponentTypeBuilder_setConnectionStringPrefix")?;
Ok(())
}
/// Sets the default configuration object that will be cloned and passed to users by the built Component type when requested.
///
/// # Parameters
/// - `default_config`: The default configuration object. Configuration objects are property object with user-defined key-value pairs. For example: Port=1000, OutputRate=5000, ...
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_setDefaultConfig()`.
pub fn set_default_config(&self, default_config: &PropertyObject) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_setDefaultConfig)(self.as_raw() as *mut _, default_config.as_raw() as *mut _) };
check(__code, "daqComponentTypeBuilder_setDefaultConfig")?;
Ok(())
}
/// Sets the description of a component type.
///
/// # Parameters
/// - `description`: The description of a component type. A short description of a component type and the associated configuration parameters it offers.
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_setDescription()`.
pub fn set_description(&self, description: &str) -> Result<()> {
let __description = crate::marshal::make_string(description)?;
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_setDescription)(self.as_raw() as *mut _, __description.as_ptr() as *mut _) };
check(__code, "daqComponentTypeBuilder_setDescription")?;
Ok(())
}
/// Sets the unique component type id.
///
/// # Parameters
/// - `id`: The unique id of a component type. Unique id should not be presented on the UI.
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_setId()`.
pub fn set_id(&self, id: &str) -> Result<()> {
let __id = crate::marshal::make_string(id)?;
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_setId)(self.as_raw() as *mut _, __id.as_ptr() as *mut _) };
check(__code, "daqComponentTypeBuilder_setId")?;
Ok(())
}
/// Sets the user-friendly name of a component type.
///
/// # Parameters
/// - `name`: The user-friendly name of a component type. Name is usually presented on the UI. Does not have to be unique.
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_setName()`.
pub fn set_name(&self, name: &str) -> Result<()> {
let __name = crate::marshal::make_string(name)?;
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_setName)(self.as_raw() as *mut _, __name.as_ptr() as *mut _) };
check(__code, "daqComponentTypeBuilder_setName")?;
Ok(())
}
/// Sets the component type sort. Can be either Streaming, Function block, Device, or Server. Depending on the setting, the corresponding Component type object will be built.
///
/// # Parameters
/// - `sort`: The sort of the component type.
///
/// Calls the openDAQ C function `daqComponentTypeBuilder_setTypeSort()`.
pub fn set_type_sort(&self, sort: ComponentTypeSort) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqComponentTypeBuilder_setTypeSort)(self.as_raw() as *mut _, sort as u32) };
check(__code, "daqComponentTypeBuilder_setTypeSort")?;
Ok(())
}
}
impl ComponentTypePrivate {
/// Sets the module information.
///
/// # Parameters
/// - `info`: The module information.
///
/// Calls the openDAQ C function `daqComponentTypePrivate_setModuleInfo()`.
pub fn set_module_info(&self, info: &ModuleInfo) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqComponentTypePrivate_setModuleInfo)(self.as_raw() as *mut _, info.as_raw() as *mut _) };
check(__code, "daqComponentTypePrivate_setModuleInfo")?;
Ok(())
}
}
impl ComponentType {
/// The function clones and returns default configuration. On each call, we need to create new object, because we want that each instance of the component has its own configuration object.
///
/// # Returns
/// - `default_config`: Newly created configuration object. Configuration objects are property object with user-defined key-value pairs. For example: Port=1000, OutputRate=5000, ...
///
/// Calls the openDAQ C function `daqComponentType_createDefaultConfig()`.
pub fn create_default_config(&self) -> Result<Option<PropertyObject>> {
let mut __default_config: *mut sys::daqPropertyObject = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentType_createDefaultConfig)(self.as_raw() as *mut _, &mut __default_config) };
check(__code, "daqComponentType_createDefaultConfig")?;
Ok(unsafe { crate::marshal::take_object::<PropertyObject>(__default_config as *mut _) })
}
/// Gets the description of a component type.
///
/// # Returns
/// - `description`: The description of a component type. A short description of a component type and the associated configuration parameters it offers.
///
/// Calls the openDAQ C function `daqComponentType_getDescription()`.
pub fn description(&self) -> Result<String> {
let mut __description: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentType_getDescription)(self.as_raw() as *mut _, &mut __description) };
check(__code, "daqComponentType_getDescription")?;
Ok(unsafe { crate::marshal::take_string(__description) })
}
/// Gets the unique component type id.
///
/// # Returns
/// - `id`: The unique id of a component type. Unique id should not be presented on the UI.
///
/// Calls the openDAQ C function `daqComponentType_getId()`.
pub fn id(&self) -> Result<String> {
let mut __id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentType_getId)(self.as_raw() as *mut _, &mut __id) };
check(__code, "daqComponentType_getId")?;
Ok(unsafe { crate::marshal::take_string(__id) })
}
/// Retrieves the module information.
///
/// # Returns
/// - `info`: The module information.
///
/// Calls the openDAQ C function `daqComponentType_getModuleInfo()`.
pub fn module_info(&self) -> Result<Option<ModuleInfo>> {
let mut __info: *mut sys::daqModuleInfo = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentType_getModuleInfo)(self.as_raw() as *mut _, &mut __info) };
check(__code, "daqComponentType_getModuleInfo")?;
Ok(unsafe { crate::marshal::take_object::<ModuleInfo>(__info as *mut _) })
}
/// Gets the user-friendly name of a component type.
///
/// # Returns
/// - `name`: The user-friendly name of a component type. Name is usually presented on the UI. Does not have to be unique.
///
/// Calls the openDAQ C function `daqComponentType_getName()`.
pub fn name(&self) -> Result<String> {
let mut __name: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentType_getName)(self.as_raw() as *mut _, &mut __name) };
check(__code, "daqComponentType_getName")?;
Ok(unsafe { crate::marshal::take_string(__name) })
}
}
impl ComponentUpdateContext {
/// Adds a device remapping from the original device's local ID to the new device local ID.
///
/// # Parameters
/// - `original_device_id`: The local ID of the original device to be remapped.
/// - `new_device_id`: The local ID of the new device to be used for remapping. Used to remap signal -\> input port connections to the remapped device when loading.
///
/// Calls the openDAQ C function `daqComponentUpdateContext_addDeviceRemapping()`.
pub fn add_device_remapping(&self, original_device_id: &str, new_device_id: &str) -> Result<()> {
let __original_device_id = crate::marshal::make_string(original_device_id)?;
let __new_device_id = crate::marshal::make_string(new_device_id)?;
let __code = unsafe { (crate::sys::api().daqComponentUpdateContext_addDeviceRemapping)(self.as_raw() as *mut _, __original_device_id.as_ptr() as *mut _, __new_device_id.as_ptr() as *mut _) };
check(__code, "daqComponentUpdateContext_addDeviceRemapping")?;
Ok(())
}
/// Gets the DeviceUpdateOptions object for the device with the specified local ID. Returns null if no options are found for the device.
///
/// # Parameters
/// - `local_id`: The local ID of the device to get the options for.
/// - `options`: The DeviceUpdateOptions object for the device with the specified local ID; null if no options are found for the device.
///
/// Calls the openDAQ C function `daqComponentUpdateContext_getDeviceUpdateOptionsWithLocalIdOrNull()`.
pub fn device_update_options_with_local_id_or_null(&self, local_id: &str) -> Result<Option<DeviceUpdateOptions>> {
let __local_id = crate::marshal::make_string(local_id)?;
let mut __options: *mut sys::daqDeviceUpdateOptions = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentUpdateContext_getDeviceUpdateOptionsWithLocalIdOrNull)(self.as_raw() as *mut _, __local_id.as_ptr() as *mut _, &mut __options) };
check(__code, "daqComponentUpdateContext_getDeviceUpdateOptionsWithLocalIdOrNull")?;
Ok(unsafe { crate::marshal::take_object::<DeviceUpdateOptions>(__options as *mut _) })
}
/// Gets the dictionary with key-value pairs of input port local IDs and signal IDs for the specified parent component.
///
/// # Parameters
/// - `parent_id`: The ID of the parent component.
///
/// # Returns
/// - `connections`: The connections to the input ports.
///
/// Calls the openDAQ C function `daqComponentUpdateContext_getInputPortConnections()`.
pub fn input_port_connections(&self, parent_id: &str) -> Result<std::collections::HashMap<String, String>> {
let __parent_id = crate::marshal::make_string(parent_id)?;
let mut __connections: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentUpdateContext_getInputPortConnections)(self.as_raw() as *mut _, __parent_id.as_ptr() as *mut _, &mut __connections) };
check(__code, "daqComponentUpdateContext_getInputPortConnections")?;
Ok(unsafe { crate::marshal::take_dict::<String, String>(__connections as *mut _, "daqComponentUpdateContext_getInputPortConnections") }?)
}
/// Calls the openDAQ C function `daqComponentUpdateContext_getInternalState()`.
pub fn internal_state(&self) -> Result<std::collections::HashMap<String, Value>> {
let mut __state: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentUpdateContext_getInternalState)(self.as_raw() as *mut _, &mut __state) };
check(__code, "daqComponentUpdateContext_getInternalState")?;
Ok(unsafe { crate::marshal::take_dict::<String, Value>(__state as *mut _, "daqComponentUpdateContext_getInternalState") }?)
}
/// Gets the root component of the current component.
///
/// # Returns
/// - `root_component`: The root component.
///
/// Calls the openDAQ C function `daqComponentUpdateContext_getRootComponent()`.
pub fn root_component(&self) -> Result<Option<Component>> {
let mut __root_component: *mut sys::daqComponent = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentUpdateContext_getRootComponent)(self.as_raw() as *mut _, &mut __root_component) };
check(__code, "daqComponentUpdateContext_getRootComponent")?;
Ok(unsafe { crate::marshal::take_object::<Component>(__root_component as *mut _) })
}
/// Gets the signal by the specified parent and port ID.
///
/// # Parameters
/// - `parent_id`: The ID of the parent component.
/// - `port_id`: The ID of the input port.
///
/// # Returns
/// - `signal`: The found signal. If signal is not found signal is set to nullptr.
///
/// Calls the openDAQ C function `daqComponentUpdateContext_getSignal()`.
pub fn signal(&self, parent_id: &str, port_id: &str) -> Result<Option<Signal>> {
let __parent_id = crate::marshal::make_string(parent_id)?;
let __port_id = crate::marshal::make_string(port_id)?;
let mut __signal: *mut sys::daqSignal = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentUpdateContext_getSignal)(self.as_raw() as *mut _, __parent_id.as_ptr() as *mut _, __port_id.as_ptr() as *mut _, &mut __signal) };
check(__code, "daqComponentUpdateContext_getSignal")?;
Ok(unsafe { crate::marshal::take_object::<Signal>(__signal as *mut _) })
}
/// Gets the update parameters provided by the user through the `update` call.
///
/// # Parameters
/// - `update_parameters`: The update parameters.
///
/// Calls the openDAQ C function `daqComponentUpdateContext_getUpdateParameters()`.
pub fn update_parameters(&self) -> Result<Option<UpdateParameters>> {
let mut __update_parameters: *mut sys::daqUpdateParameters = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponentUpdateContext_getUpdateParameters)(self.as_raw() as *mut _, &mut __update_parameters) };
check(__code, "daqComponentUpdateContext_getUpdateParameters")?;
Ok(unsafe { crate::marshal::take_object::<UpdateParameters>(__update_parameters as *mut _) })
}
/// Overrides the internal context state with that of another.
///
/// # Parameters
/// - `update_context`: The context with which the object is to be overridden.
///
/// Calls the openDAQ C function `daqComponentUpdateContext_overrideState()`.
pub fn override_state(&self, update_context: &ComponentUpdateContext) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqComponentUpdateContext_overrideState)(self.as_raw() as *mut _, update_context.as_raw() as *mut _) };
check(__code, "daqComponentUpdateContext_overrideState")?;
Ok(())
}
/// Internal method that uses the device mapping to remap the input port connections.
/// Should be called after the initial update, but before `onUpdatableUpdateEnd`.
///
/// Calls the openDAQ C function `daqComponentUpdateContext_remapInputPortConnections()`.
pub fn remap_input_port_connections(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqComponentUpdateContext_remapInputPortConnections)(self.as_raw() as *mut _) };
check(__code, "daqComponentUpdateContext_remapInputPortConnections")?;
Ok(())
}
/// Removes the connection to the input port for the specified parent component.
///
/// # Parameters
/// - `parent_id`: The ID of the parent component.
///
/// Calls the openDAQ C function `daqComponentUpdateContext_removeInputPortConnection()`.
pub fn remove_input_port_connection(&self, parent_id: &str) -> Result<()> {
let __parent_id = crate::marshal::make_string(parent_id)?;
let __code = unsafe { (crate::sys::api().daqComponentUpdateContext_removeInputPortConnection)(self.as_raw() as *mut _, __parent_id.as_ptr() as *mut _) };
check(__code, "daqComponentUpdateContext_removeInputPortConnection")?;
Ok(())
}
/// Sets signal connection to the input port for the specified parent component which is usualy a function block.
///
/// # Parameters
/// - `parent_id`: The ID of the parent component.
/// - `port_id`: The ID of the input port.
/// - `signal_id`: The ID of the signal.
///
/// Calls the openDAQ C function `daqComponentUpdateContext_setInputPortConnection()`.
pub fn set_input_port_connection(&self, parent_id: &str, port_id: &str, signal_id: &str) -> Result<()> {
let __parent_id = crate::marshal::make_string(parent_id)?;
let __port_id = crate::marshal::make_string(port_id)?;
let __signal_id = crate::marshal::make_string(signal_id)?;
let __code = unsafe { (crate::sys::api().daqComponentUpdateContext_setInputPortConnection)(self.as_raw() as *mut _, __parent_id.as_ptr() as *mut _, __port_id.as_ptr() as *mut _, __signal_id.as_ptr() as *mut _) };
check(__code, "daqComponentUpdateContext_setInputPortConnection")?;
Ok(())
}
/// Sets the root component of the current component. Iterates through the parent components until the root is found and sets it as the root component for the context.
///
/// # Parameters
/// - `base_component`: The base component from which we iterate to the openDAQ root. This method shortcuts the need for callers to provide the openDAQ root device as the component, by automatically iterating to the root component from any component in the hierarchy.
///
/// Calls the openDAQ C function `daqComponentUpdateContext_setRootComponent()`.
pub fn set_root_component(&self, root_component: &Component) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqComponentUpdateContext_setRootComponent)(self.as_raw() as *mut _, root_component.as_raw() as *mut _) };
check(__code, "daqComponentUpdateContext_setRootComponent")?;
Ok(())
}
/// Sets the signal dependency to the function block.
///
/// # Parameters
/// - `signal_id`: The ID of the signal.
/// - `parent_id`: The ID of the parent component.
///
/// Calls the openDAQ C function `daqComponentUpdateContext_setSignalDependency()`.
pub fn set_signal_dependency(&self, signal_id: &str, parent_id: &str) -> Result<()> {
let __signal_id = crate::marshal::make_string(signal_id)?;
let __parent_id = crate::marshal::make_string(parent_id)?;
let __code = unsafe { (crate::sys::api().daqComponentUpdateContext_setSignalDependency)(self.as_raw() as *mut _, __signal_id.as_ptr() as *mut _, __parent_id.as_ptr() as *mut _) };
check(__code, "daqComponentUpdateContext_setSignalDependency")?;
Ok(())
}
}
impl Component {
/// Creates a component.
///
/// # Parameters
/// - `context`: The Context. Most often the creating function-block/device passes its own Context to the Folder.
/// - `parent`: The parent component.
/// - `local_id`: The local ID of the component.
///
/// Calls the openDAQ C function `daqComponent_createComponent()`.
pub fn new(context: &Context, parent: Option<&Component>, local_id: &str, class_name: Option<&str>) -> Result<Component> {
let __local_id = crate::marshal::make_string(local_id)?;
let __class_name = match class_name { Some(s) => Some(crate::marshal::make_string(s)?), None => None };
let mut __obj: *mut sys::daqComponent = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponent_createComponent)(&mut __obj, context.as_raw() as *mut _, parent.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _), __local_id.as_ptr() as *mut _, __class_name.as_ref().map_or(std::ptr::null_mut(), |r| r.as_ptr()) as *mut _) };
check(__code, "daqComponent_createComponent")?;
Ok(unsafe { crate::marshal::require_object::<Component>(__obj as *mut _, "daqComponent_createComponent") }?)
}
/// Finds the component (signal/device/function block) with the specified (global) id.
///
/// # Parameters
/// - `id`: The id of the component to search for.
///
/// # Returns
/// - `out_component`: The resulting component. If the component parameter is true, the starting component is the root device. The id provided should be in relative form from the starting component. E.g., to find a signal in the starting component, the id should be in the form of "Dev/dev_id/Ch/ch_id/Sig/sig_id.
///
/// Calls the openDAQ C function `daqComponent_findComponent()`.
pub fn find_component(&self, id: &str) -> Result<Option<Component>> {
let __id = crate::marshal::make_string(id)?;
let mut __out_component: *mut sys::daqComponent = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponent_findComponent)(self.as_raw() as *mut _, __id.as_ptr() as *mut _, &mut __out_component) };
check(__code, "daqComponent_findComponent")?;
Ok(unsafe { crate::marshal::take_object::<Component>(__out_component as *mut _) })
}
/// Returns true if the component is active; false otherwise.
///
/// # Returns
/// - `active`: True if the component is active; false otherwise. A component is active if its local active state is true and its parent is active. An active component acquires data, performs calculations and send packets on the signal path.
///
/// Calls the openDAQ C function `daqComponent_getActive()`.
pub fn active(&self) -> Result<bool> {
let mut __active: u8 = 0;
let __code = unsafe { (crate::sys::api().daqComponent_getActive)(self.as_raw() as *mut _, &mut __active) };
check(__code, "daqComponent_getActive")?;
Ok(__active != 0)
}
/// Gets the context object.
///
/// # Returns
/// - `context`: The context object.
///
/// Calls the openDAQ C function `daqComponent_getContext()`.
pub fn context(&self) -> Result<Option<Context>> {
let mut __context: *mut sys::daqContext = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponent_getContext)(self.as_raw() as *mut _, &mut __context) };
check(__code, "daqComponent_getContext")?;
Ok(unsafe { crate::marshal::take_object::<Context>(__context as *mut _) })
}
/// Gets the description of the component.
///
/// # Returns
/// - `description`: The description of the component. Empty if not configured. The object that implements this interface defines how the description is specified.
///
/// Calls the openDAQ C function `daqComponent_getDescription()`.
pub fn description(&self) -> Result<String> {
let mut __description: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponent_getDescription)(self.as_raw() as *mut _, &mut __description) };
check(__code, "daqComponent_getDescription")?;
Ok(unsafe { crate::marshal::take_string(__description) })
}
/// Gets the global ID of the component.
///
/// # Returns
/// - `global_id`: The global ID of the component. Represents the identifier that is globally unique. Globally unique identifier is composed from local identifiers from the parent components separated by '/' character. Device component must make sure that its ID is globally unique.
///
/// Calls the openDAQ C function `daqComponent_getGlobalId()`.
pub fn global_id(&self) -> Result<String> {
let mut __global_id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponent_getGlobalId)(self.as_raw() as *mut _, &mut __global_id) };
check(__code, "daqComponent_getGlobalId")?;
Ok(unsafe { crate::marshal::take_string(__global_id) })
}
/// Returns true if the component is local active; false otherwise.
///
/// # Returns
/// - `local_active`: True if the component is local active; false otherwise. An active component acquires data, performs calculations and send packets on the signal path. Note that is local active is True, the component may still be inactive if its parents are inactive.
///
/// Calls the openDAQ C function `daqComponent_getLocalActive()`.
pub fn local_active(&self) -> Result<bool> {
let mut __local_active: u8 = 0;
let __code = unsafe { (crate::sys::api().daqComponent_getLocalActive)(self.as_raw() as *mut _, &mut __local_active) };
check(__code, "daqComponent_getLocalActive")?;
Ok(__local_active != 0)
}
/// Gets the local ID of the component.
///
/// # Returns
/// - `local_id`: The local ID of the component. Represents the identifier that is unique in a relation to the parent component. There is no predefined format for local ID. It is a string defined by its parent component.
///
/// Calls the openDAQ C function `daqComponent_getLocalId()`.
pub fn local_id(&self) -> Result<String> {
let mut __local_id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponent_getLocalId)(self.as_raw() as *mut _, &mut __local_id) };
check(__code, "daqComponent_getLocalId")?;
Ok(unsafe { crate::marshal::take_string(__local_id) })
}
/// Gets a list of the component's locked attributes. The locked attributes cannot be modified via their respective setters.
///
/// # Returns
/// - `attributes`: A list of strings containing the names of locked attributes in capital case (eg. "Name", "Description").
///
/// Calls the openDAQ C function `daqComponent_getLockedAttributes()`.
pub fn locked_attributes(&self) -> Result<Vec<String>> {
let mut __attributes: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponent_getLockedAttributes)(self.as_raw() as *mut _, &mut __attributes) };
check(__code, "daqComponent_getLockedAttributes")?;
Ok(unsafe { crate::marshal::take_list::<String>(__attributes as *mut _, "daqComponent_getLockedAttributes") }?)
}
/// Gets the name of the component.
///
/// # Returns
/// - `name`: The name of the component. Local ID if name is not configured. The object that implements this interface defines how the name is specified.
///
/// Calls the openDAQ C function `daqComponent_getName()`.
pub fn name(&self) -> Result<String> {
let mut __name: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponent_getName)(self.as_raw() as *mut _, &mut __name) };
check(__code, "daqComponent_getName")?;
Ok(unsafe { crate::marshal::take_string(__name) })
}
/// Gets the Core Event object that triggers whenever a change to this component happens within the openDAQ core structure.
///
/// # Returns
/// - `event`: The Core Event object. The event triggers with a Component reference and a CoreEventArgs object as arguments. The Core Event is triggered on various changes to the openDAQ Components. This includes changes to property values, addition/removal of child components, connecting signals to input ports and others. The event type can be identified via the event ID available within the CoreEventArgs object. Each event type has a set of predetermined parameters available in the `parameters` field of the arguments. These can be used by any openDAQ server, or other listener to react to changes within the core structure.
///
/// Calls the openDAQ C function `daqComponent_getOnComponentCoreEvent()`.
pub fn on_component_core_event(&self) -> Result<Option<Event>> {
let mut __event: *mut sys::daqEvent = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponent_getOnComponentCoreEvent)(self.as_raw() as *mut _, &mut __event) };
check(__code, "daqComponent_getOnComponentCoreEvent")?;
Ok(unsafe { crate::marshal::take_object::<Event>(__event as *mut _) })
}
/// Gets the operation mode of the device.
///
/// # Returns
/// - `mode_type`: The current operation mode.
///
/// Calls the openDAQ C function `daqComponent_getOperationMode()`.
pub fn operation_mode(&self) -> Result<OperationModeType> {
let mut __mode_type: u32 = 0;
let __code = unsafe { (crate::sys::api().daqComponent_getOperationMode)(self.as_raw() as *mut _, &mut __mode_type) };
check(__code, "daqComponent_getOperationMode")?;
Ok(crate::marshal::enum_out(OperationModeType::from_raw(__mode_type), "daqComponent_getOperationMode")?)
}
/// Gets the parent of the component.
///
/// # Returns
/// - `parent`: The parent of the component. Every openDAQ component has a parent, except for instance. Parent should be passed as a parameter to the constructor/factory. Once the component is created, the parent cannot be changed.
///
/// Calls the openDAQ C function `daqComponent_getParent()`.
pub fn parent(&self) -> Result<Option<Component>> {
let mut __parent: *mut sys::daqComponent = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponent_getParent)(self.as_raw() as *mut _, &mut __parent) };
check(__code, "daqComponent_getParent")?;
Ok(unsafe { crate::marshal::take_object::<Component>(__parent as *mut _) })
}
/// Returns true if the component's parent is active; false otherwise.
///
/// # Returns
/// - `parent_active`: True if the component's parent is active; false otherwise.
///
/// Calls the openDAQ C function `daqComponent_getParentActive()`.
pub fn parent_active(&self) -> Result<bool> {
let mut __parent_active: u8 = 0;
let __code = unsafe { (crate::sys::api().daqComponent_getParentActive)(self.as_raw() as *mut _, &mut __parent_active) };
check(__code, "daqComponent_getParentActive")?;
Ok(__parent_active != 0)
}
/// Gets the container of Component statuses.
///
/// # Returns
/// - `status_container`: The container of Component statuses.
///
/// Calls the openDAQ C function `daqComponent_getStatusContainer()`.
pub fn status_container(&self) -> Result<Option<ComponentStatusContainer>> {
let mut __status_container: *mut sys::daqComponentStatusContainer = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponent_getStatusContainer)(self.as_raw() as *mut _, &mut __status_container) };
check(__code, "daqComponent_getStatusContainer")?;
Ok(unsafe { crate::marshal::take_object::<ComponentStatusContainer>(__status_container as *mut _) })
}
/// Gets the tags of the component.
///
/// # Returns
/// - `tags`: The tags of the component. Tags are user definable labels that can be attached to the component.
///
/// Calls the openDAQ C function `daqComponent_getTags()`.
pub fn tags(&self) -> Result<Option<Tags>> {
let mut __tags: *mut sys::daqTags = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqComponent_getTags)(self.as_raw() as *mut _, &mut __tags) };
check(__code, "daqComponent_getTags")?;
Ok(unsafe { crate::marshal::take_object::<Tags>(__tags as *mut _) })
}
/// Gets `visible` metadata state of the component
///
/// # Returns
/// - `visible`: True if the component is visible; False otherwise. Visible determines whether search/getter methods return find the component by default.
///
/// Calls the openDAQ C function `daqComponent_getVisible()`.
pub fn visible(&self) -> Result<bool> {
let mut __visible: u8 = 0;
let __code = unsafe { (crate::sys::api().daqComponent_getVisible)(self.as_raw() as *mut _, &mut __visible) };
check(__code, "daqComponent_getVisible")?;
Ok(__visible != 0)
}
/// Sets the component to be either active or inactive. Sets the local active state and notifies children about the parent active state change.
///
/// # Parameters
/// - `active`: The new local active state of the component.
///
/// # Errors
/// - `OPENDAQ_IGNORED`: if "Active" is part of the component's list of locked attributes, or if the new active value is equal to the previous. An active component acquires data, performs calculations and send packets on the signal path.
///
/// Calls the openDAQ C function `daqComponent_setActive()`.
pub fn set_active(&self, active: bool) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqComponent_setActive)(self.as_raw() as *mut _, u8::from(active)) };
check(__code, "daqComponent_setActive")?;
Ok(())
}
/// Sets the description of the component.
///
/// # Parameters
/// - `description`: The description of the component.
///
/// # Errors
/// - `OPENDAQ_IGNORED`: if "Description" is part of the component's list of locked attributes, or if the new description value is equal to the previous. The object that implements this interface defines how the description is specified.
///
/// Calls the openDAQ C function `daqComponent_setDescription()`.
pub fn set_description(&self, description: &str) -> Result<()> {
let __description = crate::marshal::make_string(description)?;
let __code = unsafe { (crate::sys::api().daqComponent_setDescription)(self.as_raw() as *mut _, __description.as_ptr() as *mut _) };
check(__code, "daqComponent_setDescription")?;
Ok(())
}
/// Sets the name of the component.
///
/// # Parameters
/// - `name`: The name of the component.
///
/// # Errors
/// - `OPENDAQ_IGNORED`: if "Name" is part of the component's list of locked attributes, or if the new name value is equal to the previous. The object that implements this interface defines how the name is specified.
///
/// Calls the openDAQ C function `daqComponent_setName()`.
pub fn set_name(&self, name: &str) -> Result<()> {
let __name = crate::marshal::make_string(name)?;
let __code = unsafe { (crate::sys::api().daqComponent_setName)(self.as_raw() as *mut _, __name.as_ptr() as *mut _) };
check(__code, "daqComponent_setName")?;
Ok(())
}
/// Sets `visible` attribute state of the component
///
/// # Parameters
/// - `visible`: True if the component is visible; False otherwise.
///
/// # Errors
/// - `OPENDAQ_IGNORED`: if "Visible" is part of the component's list of locked attributes. Visible determines whether search/getter methods return find the component by default.
///
/// Calls the openDAQ C function `daqComponent_setVisible()`.
pub fn set_visible(&self, visible: bool) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqComponent_setVisible)(self.as_raw() as *mut _, u8::from(visible)) };
check(__code, "daqComponent_setVisible")?;
Ok(())
}
}
impl Context {
/// @ingroup opendaq_context
/// @addtogroup opendaq_context_factories Factories
///
/// Calls the openDAQ C function `daqContext_createContext()`.
pub fn new(scheduler: Option<&Scheduler>, logger: &Logger, type_manager: &TypeManager, module_manager: Option<&ModuleManager>, authentication_provider: Option<&AuthenticationProvider>, options: impl Into<Value>, discovery_servers: impl Into<Value>) -> Result<Context> {
let __options = crate::value::to_daq(&options.into())?;
let __discovery_servers = crate::value::to_daq(&discovery_servers.into())?;
let mut __obj: *mut sys::daqContext = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqContext_createContext)(&mut __obj, scheduler.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _), logger.as_raw() as *mut _, type_manager.as_raw() as *mut _, module_manager.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _), authentication_provider.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _), crate::value::opt_ref_ptr(&__options) as *mut _, crate::value::opt_ref_ptr(&__discovery_servers) as *mut _) };
check(__code, "daqContext_createContext")?;
Ok(unsafe { crate::marshal::require_object::<Context>(__obj as *mut _, "daqContext_createContext") }?)
}
/// Gets the Authentication provider.
///
/// # Returns
/// - `authentication_provider`: The authentication provider.
///
/// Calls the openDAQ C function `daqContext_getAuthenticationProvider()`.
pub fn authentication_provider(&self) -> Result<Option<AuthenticationProvider>> {
let mut __authentication_provider: *mut sys::daqAuthenticationProvider = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqContext_getAuthenticationProvider)(self.as_raw() as *mut _, &mut __authentication_provider) };
check(__code, "daqContext_getAuthenticationProvider")?;
Ok(unsafe { crate::marshal::take_object::<AuthenticationProvider>(__authentication_provider as *mut _) })
}
/// Gets the dictionary of available discovery servers.
///
/// # Returns
/// - `servers`: The dictionary of available discovery servers.
///
/// Calls the openDAQ C function `daqContext_getDiscoveryServers()`.
pub fn discovery_servers(&self) -> Result<std::collections::HashMap<String, Value>> {
let mut __servers: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqContext_getDiscoveryServers)(self.as_raw() as *mut _, &mut __servers) };
check(__code, "daqContext_getDiscoveryServers")?;
Ok(unsafe { crate::marshal::take_dict::<String, Value>(__servers as *mut _, "daqContext_getDiscoveryServers") }?)
}
/// Gets the logger.
///
/// # Returns
/// - `logger`: The logger.
///
/// Calls the openDAQ C function `daqContext_getLogger()`.
pub fn logger(&self) -> Result<Option<Logger>> {
let mut __logger: *mut sys::daqLogger = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqContext_getLogger)(self.as_raw() as *mut _, &mut __logger) };
check(__code, "daqContext_getLogger")?;
Ok(unsafe { crate::marshal::take_object::<Logger>(__logger as *mut _) })
}
/// Gets the Module Manager as a Base Object.
///
/// # Returns
/// - `manager`: The module manager.
///
/// Calls the openDAQ C function `daqContext_getModuleManager()`.
pub fn module_manager(&self) -> Result<Value> {
let mut __manager: *mut sys::daqBaseObject = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqContext_getModuleManager)(self.as_raw() as *mut _, &mut __manager) };
check(__code, "daqContext_getModuleManager")?;
Ok(unsafe { crate::value::take_value(__manager, "daqContext_getModuleManager") }?)
}
/// Retrieves the options associated with the specified module ID.
///
/// # Parameters
/// - `module_id`: The identifier of the module for which options are requested.
///
/// # Returns
/// - `options`: A dictionary containing the options associated with the specified module ID.
///
/// Calls the openDAQ C function `daqContext_getModuleOptions()`.
pub fn module_options(&self, module_id: &str) -> Result<std::collections::HashMap<String, Value>> {
let __module_id = crate::marshal::make_string(module_id)?;
let mut __options: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqContext_getModuleOptions)(self.as_raw() as *mut _, __module_id.as_ptr() as *mut _, &mut __options) };
check(__code, "daqContext_getModuleOptions")?;
Ok(unsafe { crate::marshal::take_dict::<String, Value>(__options as *mut _, "daqContext_getModuleOptions") }?)
}
/// Gets the Core Event object that triggers whenever a change happens within the openDAQ core structure.
///
/// # Returns
/// - `event`: The Core Event object. The event triggers with a Component reference and a CoreEventArgs object as arguments. The Core Event is triggered on various changes to the openDAQ Components. This includes changes to property values, addition/removal of child components, connecting signals to input ports and others. The event type can be identified via the event ID available within the CoreEventArgs object. Each event type has a set of predetermined parameters available in the `parameters` field of the arguments. These can be used by any openDAQ server, or other listener to react to changes within the core structure.
///
/// Calls the openDAQ C function `daqContext_getOnCoreEvent()`.
pub fn on_core_event(&self) -> Result<Option<Event>> {
let mut __event: *mut sys::daqEvent = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqContext_getOnCoreEvent)(self.as_raw() as *mut _, &mut __event) };
check(__code, "daqContext_getOnCoreEvent")?;
Ok(unsafe { crate::marshal::take_object::<Event>(__event as *mut _) })
}
/// Gets the dictionary of options
///
/// # Returns
/// - `options`: The dictionary of options
///
/// Calls the openDAQ C function `daqContext_getOptions()`.
pub fn options(&self) -> Result<std::collections::HashMap<String, Value>> {
let mut __options: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqContext_getOptions)(self.as_raw() as *mut _, &mut __options) };
check(__code, "daqContext_getOptions")?;
Ok(unsafe { crate::marshal::take_dict::<String, Value>(__options as *mut _, "daqContext_getOptions") }?)
}
/// Gets the scheduler.
///
/// # Returns
/// - `scheduler`: The scheduler.
///
/// Calls the openDAQ C function `daqContext_getScheduler()`.
pub fn scheduler(&self) -> Result<Option<Scheduler>> {
let mut __scheduler: *mut sys::daqScheduler = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqContext_getScheduler)(self.as_raw() as *mut _, &mut __scheduler) };
check(__code, "daqContext_getScheduler")?;
Ok(unsafe { crate::marshal::take_object::<Scheduler>(__scheduler as *mut _) })
}
/// Gets the Type Manager.
///
/// # Returns
/// - `manager`: The type manager.
///
/// Calls the openDAQ C function `daqContext_getTypeManager()`.
pub fn type_manager(&self) -> Result<Option<TypeManager>> {
let mut __manager: *mut sys::daqTypeManager = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqContext_getTypeManager)(self.as_raw() as *mut _, &mut __manager) };
check(__code, "daqContext_getTypeManager")?;
Ok(unsafe { crate::marshal::take_object::<TypeManager>(__manager as *mut _) })
}
}
impl DeserializeComponent {
/// Calls the openDAQ C function `daqDeserializeComponent_complete()`.
pub fn complete(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDeserializeComponent_complete)(self.as_raw() as *mut _) };
check(__code, "daqDeserializeComponent_complete")?;
Ok(())
}
/// Calls the openDAQ C function `daqDeserializeComponent_deserializeValues()`.
pub fn deserialize_values(&self, serialized_object: &SerializedObject, context: impl Into<Value>, callback_factory: &FunctionObject) -> Result<()> {
let __context = crate::value::to_daq(&context.into())?;
let __code = unsafe { (crate::sys::api().daqDeserializeComponent_deserializeValues)(self.as_raw() as *mut _, serialized_object.as_raw() as *mut _, crate::value::opt_ref_ptr(&__context) as *mut _, callback_factory.as_raw() as *mut _) };
check(__code, "daqDeserializeComponent_deserializeValues")?;
Ok(())
}
/// Calls the openDAQ C function `daqDeserializeComponent_getDeserializedParameter()`.
pub fn deserialized_parameter(&self, parameter: &str) -> Result<Value> {
let __parameter = crate::marshal::make_string(parameter)?;
let mut __value: *mut sys::daqBaseObject = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeserializeComponent_getDeserializedParameter)(self.as_raw() as *mut _, __parameter.as_ptr() as *mut _, &mut __value) };
check(__code, "daqDeserializeComponent_getDeserializedParameter")?;
Ok(unsafe { crate::value::take_value(__value, "daqDeserializeComponent_getDeserializedParameter") }?)
}
}
impl DeviceUpdateOptions {
/// Calls the openDAQ C function `daqDeviceUpdateOptions_createDeviceUpdateOptions()`.
pub fn new(setup_string: &str) -> Result<DeviceUpdateOptions> {
let __setup_string = crate::marshal::make_string(setup_string)?;
let mut __obj: *mut sys::daqDeviceUpdateOptions = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceUpdateOptions_createDeviceUpdateOptions)(&mut __obj, __setup_string.as_ptr() as *mut _) };
check(__code, "daqDeviceUpdateOptions_createDeviceUpdateOptions")?;
Ok(unsafe { crate::marshal::require_object::<DeviceUpdateOptions>(__obj as *mut _, "daqDeviceUpdateOptions_createDeviceUpdateOptions") }?)
}
/// Gets the list of child device options for the device. These are used to configure subdevices of the current device.
///
/// # Parameters
/// - `child_device_options`: The list of child device options for the device.
///
/// Calls the openDAQ C function `daqDeviceUpdateOptions_getChildDeviceOptions()`.
pub fn child_device_options(&self) -> Result<Vec<DeviceUpdateOptions>> {
let mut __child_device_options: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceUpdateOptions_getChildDeviceOptions)(self.as_raw() as *mut _, &mut __child_device_options) };
check(__code, "daqDeviceUpdateOptions_getChildDeviceOptions")?;
Ok(unsafe { crate::marshal::take_list::<DeviceUpdateOptions>(__child_device_options as *mut _, "daqDeviceUpdateOptions_getChildDeviceOptions") }?)
}
/// Gets the connection string of the device, as written in the setup string.
///
/// # Parameters
/// - `connection_string`: The connection string of the device.
///
/// Calls the openDAQ C function `daqDeviceUpdateOptions_getConnectionString()`.
pub fn connection_string(&self) -> Result<String> {
let mut __connection_string: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceUpdateOptions_getConnectionString)(self.as_raw() as *mut _, &mut __connection_string) };
check(__code, "daqDeviceUpdateOptions_getConnectionString")?;
Ok(unsafe { crate::marshal::take_string(__connection_string) })
}
/// Gets the local ID of the device. The local ID is obtained from the JSON key for the device entry.
///
/// # Parameters
/// - `local_id`: The local ID of the device. The root device might not have the local ID configured. In this case the local ID will be set to "Root".
///
/// Calls the openDAQ C function `daqDeviceUpdateOptions_getLocalId()`.
pub fn local_id(&self) -> Result<String> {
let mut __local_id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceUpdateOptions_getLocalId)(self.as_raw() as *mut _, &mut __local_id) };
check(__code, "daqDeviceUpdateOptions_getLocalId")?;
Ok(unsafe { crate::marshal::take_string(__local_id) })
}
/// Gets the manufacturer of the device, as written in the setup string.
///
/// # Parameters
/// - `manufacturer`: The manufacturer of the device.
///
/// Calls the openDAQ C function `daqDeviceUpdateOptions_getManufacturer()`.
pub fn manufacturer(&self) -> Result<String> {
let mut __manufacturer: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceUpdateOptions_getManufacturer)(self.as_raw() as *mut _, &mut __manufacturer) };
check(__code, "daqDeviceUpdateOptions_getManufacturer")?;
Ok(unsafe { crate::marshal::take_string(__manufacturer) })
}
/// Gets the new connection string of the device to be used for remapping.
///
/// # Parameters
/// - `connection_string`: The new connection string of the device to be used for remapping. The manufacturer and serial number combination has priority over the connection string when remapping.
///
/// Calls the openDAQ C function `daqDeviceUpdateOptions_getNewConnectionString()`.
pub fn new_connection_string(&self) -> Result<String> {
let mut __connection_string: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceUpdateOptions_getNewConnectionString)(self.as_raw() as *mut _, &mut __connection_string) };
check(__code, "daqDeviceUpdateOptions_getNewConnectionString")?;
Ok(unsafe { crate::marshal::take_string(__connection_string) })
}
/// Gets the new manufacturer of the device to be used for remapping.
///
/// # Parameters
/// - `manufacturer`: The new manufacturer of the device to be used for remapping.
///
/// Calls the openDAQ C function `daqDeviceUpdateOptions_getNewManufacturer()`.
pub fn new_manufacturer(&self) -> Result<String> {
let mut __manufacturer: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceUpdateOptions_getNewManufacturer)(self.as_raw() as *mut _, &mut __manufacturer) };
check(__code, "daqDeviceUpdateOptions_getNewManufacturer")?;
Ok(unsafe { crate::marshal::take_string(__manufacturer) })
}
/// Gets the new serial number of the device to be used for remapping.
///
/// # Parameters
/// - `serial_number`: The new serial number of the device to be used for remapping.
///
/// Calls the openDAQ C function `daqDeviceUpdateOptions_getNewSerialNumber()`.
pub fn new_serial_number(&self) -> Result<String> {
let mut __serial_number: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceUpdateOptions_getNewSerialNumber)(self.as_raw() as *mut _, &mut __serial_number) };
check(__code, "daqDeviceUpdateOptions_getNewSerialNumber")?;
Ok(unsafe { crate::marshal::take_string(__serial_number) })
}
/// Gets the serial number of the device, as written in the setup string.
///
/// # Parameters
/// - `serial_number`: The serial number of the device.
///
/// Calls the openDAQ C function `daqDeviceUpdateOptions_getSerialNumber()`.
pub fn serial_number(&self) -> Result<String> {
let mut __serial_number: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceUpdateOptions_getSerialNumber)(self.as_raw() as *mut _, &mut __serial_number) };
check(__code, "daqDeviceUpdateOptions_getSerialNumber")?;
Ok(unsafe { crate::marshal::take_string(__serial_number) })
}
/// Gets the update mode for the device.
///
/// # Parameters
/// - `mode`: The update mode for the device.
///
/// Calls the openDAQ C function `daqDeviceUpdateOptions_getUpdateMode()`.
pub fn update_mode(&self) -> Result<DeviceUpdateMode> {
let mut __mode: u32 = 0;
let __code = unsafe { (crate::sys::api().daqDeviceUpdateOptions_getUpdateMode)(self.as_raw() as *mut _, &mut __mode) };
check(__code, "daqDeviceUpdateOptions_getUpdateMode")?;
Ok(crate::marshal::enum_out(DeviceUpdateMode::from_raw(__mode), "daqDeviceUpdateOptions_getUpdateMode")?)
}
/// Sets the new connection string of the device to be used for remapping.
///
/// # Parameters
/// - `connection_string`: The new connection string of the device to be used for remapping. The manufacturer and serial number combination has priority over the connection string when remapping.
///
/// Calls the openDAQ C function `daqDeviceUpdateOptions_setNewConnectionString()`.
pub fn set_new_connection_string(&self, connection_string: &str) -> Result<()> {
let __connection_string = crate::marshal::make_string(connection_string)?;
let __code = unsafe { (crate::sys::api().daqDeviceUpdateOptions_setNewConnectionString)(self.as_raw() as *mut _, __connection_string.as_ptr() as *mut _) };
check(__code, "daqDeviceUpdateOptions_setNewConnectionString")?;
Ok(())
}
/// Sets the new manufacturer of the device to be used for remapping.
///
/// # Parameters
/// - `manufacturer`: The new manufacturer of the device to be used for remapping.
///
/// Calls the openDAQ C function `daqDeviceUpdateOptions_setNewManufacturer()`.
pub fn set_new_manufacturer(&self, manufacturer: &str) -> Result<()> {
let __manufacturer = crate::marshal::make_string(manufacturer)?;
let __code = unsafe { (crate::sys::api().daqDeviceUpdateOptions_setNewManufacturer)(self.as_raw() as *mut _, __manufacturer.as_ptr() as *mut _) };
check(__code, "daqDeviceUpdateOptions_setNewManufacturer")?;
Ok(())
}
/// Sets the new serial number of the device to be used for remapping.
///
/// # Parameters
/// - `serial_number`: The new serial number of the device to be used for remapping.
///
/// Calls the openDAQ C function `daqDeviceUpdateOptions_setNewSerialNumber()`.
pub fn set_new_serial_number(&self, serial_number: &str) -> Result<()> {
let __serial_number = crate::marshal::make_string(serial_number)?;
let __code = unsafe { (crate::sys::api().daqDeviceUpdateOptions_setNewSerialNumber)(self.as_raw() as *mut _, __serial_number.as_ptr() as *mut _) };
check(__code, "daqDeviceUpdateOptions_setNewSerialNumber")?;
Ok(())
}
/// Sets the update mode for the device.
///
/// # Parameters
/// - `mode`: The update mode for the device.
///
/// Calls the openDAQ C function `daqDeviceUpdateOptions_setUpdateMode()`.
pub fn set_update_mode(&self, mode: DeviceUpdateMode) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDeviceUpdateOptions_setUpdateMode)(self.as_raw() as *mut _, mode as u32) };
check(__code, "daqDeviceUpdateOptions_setUpdateMode")?;
Ok(())
}
}
impl FolderConfig {
/// Adds a component to the folder.
///
/// # Parameters
/// - `item`: The component.
///
/// Calls the openDAQ C function `daqFolderConfig_addItem()`.
pub fn add_item(&self, item: &Component) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqFolderConfig_addItem)(self.as_raw() as *mut _, item.as_raw() as *mut _) };
check(__code, "daqFolderConfig_addItem")?;
Ok(())
}
/// Removes all items from the folder.
///
/// Calls the openDAQ C function `daqFolderConfig_clear()`.
pub fn clear(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqFolderConfig_clear)(self.as_raw() as *mut _) };
check(__code, "daqFolderConfig_clear")?;
Ok(())
}
/// Creates a folder.
///
/// # Parameters
/// - `context`: The Context. Most often the creating function-block/device passes its own Context to the Folder.
/// - `parent`: The parent component.
/// - `local_id`: The local ID of the component.
///
/// Calls the openDAQ C function `daqFolderConfig_createFolder()`.
pub fn folder(context: &Context, parent: &Component, local_id: &str) -> Result<FolderConfig> {
let __local_id = crate::marshal::make_string(local_id)?;
let mut __obj: *mut sys::daqFolderConfig = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFolderConfig_createFolder)(&mut __obj, context.as_raw() as *mut _, parent.as_raw() as *mut _, __local_id.as_ptr() as *mut _) };
check(__code, "daqFolderConfig_createFolder")?;
Ok(unsafe { crate::marshal::require_object::<FolderConfig>(__obj as *mut _, "daqFolderConfig_createFolder") }?)
}
/// Creates a folder with an interface ID that must be implemented by its children.
///
/// # Parameters
/// - `context`: The Context. Most often the creating function-block/device passes its own Context to the Folder.
/// - `item_type`: The ID of interface that child objects of the folder must implement.
/// - `parent`: The parent component.
/// - `local_id`: The local ID of the component.
///
/// Calls the openDAQ C function `daqFolderConfig_createFolderWithItemType()`.
pub fn folder_with_item_type(item_type: crate::IntfID, context: &Context, parent: &Component, local_id: &str) -> Result<FolderConfig> {
let __local_id = crate::marshal::make_string(local_id)?;
let mut __obj: *mut sys::daqFolderConfig = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFolderConfig_createFolderWithItemType)(&mut __obj, item_type, context.as_raw() as *mut _, parent.as_raw() as *mut _, __local_id.as_ptr() as *mut _) };
check(__code, "daqFolderConfig_createFolderWithItemType")?;
Ok(unsafe { crate::marshal::require_object::<FolderConfig>(__obj as *mut _, "daqFolderConfig_createFolderWithItemType") }?)
}
/// Creates an IO folder.
///
/// # Parameters
/// - `context`: The Context. Most often the creating function-block/device passes its own Context to the Folder.
/// - `parent`: The parent component.
/// - `local_id`: The local ID of the parent. IO folders are folder created by device and may contain only channels and other IO folders.
///
/// Calls the openDAQ C function `daqFolderConfig_createIoFolder()`.
pub fn io_folder(context: &Context, parent: &Component, local_id: &str) -> Result<FolderConfig> {
let __local_id = crate::marshal::make_string(local_id)?;
let mut __obj: *mut sys::daqFolderConfig = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFolderConfig_createIoFolder)(&mut __obj, context.as_raw() as *mut _, parent.as_raw() as *mut _, __local_id.as_ptr() as *mut _) };
check(__code, "daqFolderConfig_createIoFolder")?;
Ok(unsafe { crate::marshal::require_object::<FolderConfig>(__obj as *mut _, "daqFolderConfig_createIoFolder") }?)
}
/// Removes the item from the folder.
///
/// # Parameters
/// - `item`: The item component.
///
/// Calls the openDAQ C function `daqFolderConfig_removeItem()`.
pub fn remove_item(&self, item: &Component) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqFolderConfig_removeItem)(self.as_raw() as *mut _, item.as_raw() as *mut _) };
check(__code, "daqFolderConfig_removeItem")?;
Ok(())
}
/// Removes the item from the folder using local id of the component.
///
/// # Parameters
/// - `local_id`: The local id of the component.
///
/// Calls the openDAQ C function `daqFolderConfig_removeItemWithLocalId()`.
pub fn remove_item_with_local_id(&self, local_id: &str) -> Result<()> {
let __local_id = crate::marshal::make_string(local_id)?;
let __code = unsafe { (crate::sys::api().daqFolderConfig_removeItemWithLocalId)(self.as_raw() as *mut _, __local_id.as_ptr() as *mut _) };
check(__code, "daqFolderConfig_removeItemWithLocalId")?;
Ok(())
}
}
impl Folder {
/// Gets the item component with the specified localId.
///
/// # Parameters
/// - `local_id`: The local id of the child component.
///
/// # Returns
/// - `item`: The item component.
///
/// # Errors
/// - `OPENDAQ_SUCCESS`: if succeeded.
/// - `OPENDAQ_NOT_FOUND`: if folder with the specified ID not found.
///
/// Calls the openDAQ C function `daqFolder_getItem()`.
pub fn item(&self, local_id: &str) -> Result<Option<Component>> {
let __local_id = crate::marshal::make_string(local_id)?;
let mut __item: *mut sys::daqComponent = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFolder_getItem)(self.as_raw() as *mut _, __local_id.as_ptr() as *mut _, &mut __item) };
check(__code, "daqFolder_getItem")?;
Ok(unsafe { crate::marshal::take_object::<Component>(__item as *mut _) })
}
/// Gets the list of the items in the folder.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `items`: The list of the items. If searchFilter is not provided, the returned list contains only immediate children with visible set to `true`.
///
/// Calls the openDAQ C function `daqFolder_getItems()`.
pub fn items(&self) -> Result<Vec<Component>> {
let mut __items: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFolder_getItems)(self.as_raw() as *mut _, &mut __items, std::ptr::null_mut()) };
check(__code, "daqFolder_getItems")?;
Ok(unsafe { crate::marshal::take_list::<Component>(__items as *mut _, "daqFolder_getItems") }?)
}
/// Gets the list of the items in the folder.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `items`: The list of the items. If searchFilter is not provided, the returned list contains only immediate children with visible set to `true`.
///
/// Calls the openDAQ C function `daqFolder_getItems()`.
pub fn items_with(&self, search_filter: Option<&SearchFilter>) -> Result<Vec<Component>> {
let mut __items: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFolder_getItems)(self.as_raw() as *mut _, &mut __items, search_filter.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqFolder_getItems")?;
Ok(unsafe { crate::marshal::take_list::<Component>(__items as *mut _, "daqFolder_getItems") }?)
}
/// Returns True if the folder has an item with local ID.
///
/// # Parameters
/// - `local_id`: The local ID of the item.
///
/// # Returns
/// - `value`: True if the folder contains item with local ID.
///
/// Calls the openDAQ C function `daqFolder_hasItem()`.
pub fn has_item(&self, local_id: &str) -> Result<bool> {
let __local_id = crate::marshal::make_string(local_id)?;
let mut __value: u8 = 0;
let __code = unsafe { (crate::sys::api().daqFolder_hasItem)(self.as_raw() as *mut _, __local_id.as_ptr() as *mut _, &mut __value) };
check(__code, "daqFolder_hasItem")?;
Ok(__value != 0)
}
/// Returns True if the folder is empty.
///
/// # Returns
/// - `empty`: True if the folder is empty.
///
/// Calls the openDAQ C function `daqFolder_isEmpty()`.
pub fn is_empty(&self) -> Result<bool> {
let mut __empty: u8 = 0;
let __code = unsafe { (crate::sys::api().daqFolder_isEmpty)(self.as_raw() as *mut _, &mut __empty) };
check(__code, "daqFolder_isEmpty")?;
Ok(__empty != 0)
}
}
impl ModuleInfo {
/// Calls the openDAQ C function `daqModuleInfo_createModuleInfo()`.
pub fn new(version_info: &VersionInfo, name: &str, id: &str) -> Result<ModuleInfo> {
let __name = crate::marshal::make_string(name)?;
let __id = crate::marshal::make_string(id)?;
let mut __obj: *mut sys::daqModuleInfo = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModuleInfo_createModuleInfo)(&mut __obj, version_info.as_raw() as *mut _, __name.as_ptr() as *mut _, __id.as_ptr() as *mut _) };
check(__code, "daqModuleInfo_createModuleInfo")?;
Ok(unsafe { crate::marshal::require_object::<ModuleInfo>(__obj as *mut _, "daqModuleInfo_createModuleInfo") }?)
}
/// Gets the module id.
///
/// # Returns
/// - `id`: The module id.
///
/// Calls the openDAQ C function `daqModuleInfo_getId()`.
pub fn id(&self) -> Result<String> {
let mut __id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModuleInfo_getId)(self.as_raw() as *mut _, &mut __id) };
check(__code, "daqModuleInfo_getId")?;
Ok(unsafe { crate::marshal::take_string(__id) })
}
/// Gets the module name.
///
/// # Returns
/// - `name`: The module name.
///
/// Calls the openDAQ C function `daqModuleInfo_getName()`.
pub fn name(&self) -> Result<String> {
let mut __name: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModuleInfo_getName)(self.as_raw() as *mut _, &mut __name) };
check(__code, "daqModuleInfo_getName")?;
Ok(unsafe { crate::marshal::take_string(__name) })
}
/// Retrieves the module version information.
///
/// # Returns
/// - `version`: The semantic version information.
///
/// Calls the openDAQ C function `daqModuleInfo_getVersionInfo()`.
pub fn version_info(&self) -> Result<Option<VersionInfo>> {
let mut __version: *mut sys::daqVersionInfo = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModuleInfo_getVersionInfo)(self.as_raw() as *mut _, &mut __version) };
check(__code, "daqModuleInfo_getVersionInfo")?;
Ok(unsafe { crate::marshal::take_object::<VersionInfo>(__version as *mut _) })
}
}
impl Removable {
/// Returns True if component was removed.
///
/// # Returns
/// - `removed`: True if component was removed; otherwise False.
///
/// Calls the openDAQ C function `daqRemovable_isRemoved()`.
pub fn is_removed(&self) -> Result<bool> {
let mut __removed: u8 = 0;
let __code = unsafe { (crate::sys::api().daqRemovable_isRemoved)(self.as_raw() as *mut _, &mut __removed) };
check(__code, "daqRemovable_isRemoved")?;
Ok(__removed != 0)
}
/// Notifies the component that it is being removed.
/// Call `remove` on the component to mark it as removed. It's up to the implementation
/// to define what is does on the act of removal. Basic implementation of `Component`
/// will switch it to inactive state and it cannot be activated again.
///
/// Calls the openDAQ C function `daqRemovable_remove()`.
pub fn remove(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqRemovable_remove)(self.as_raw() as *mut _) };
check(__code, "daqRemovable_remove")?;
Ok(())
}
}
impl Signal {
/// Gets the list of connections to input ports formed by the signal.
///
/// # Returns
/// - `connections`: The list of connections.
///
/// Calls the openDAQ C function `daqSignal_getConnections()`.
pub fn connections(&self) -> Result<Vec<Connection>> {
let mut __connections: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqSignal_getConnections)(self.as_raw() as *mut _, &mut __connections) };
check(__code, "daqSignal_getConnections")?;
Ok(unsafe { crate::marshal::take_list::<Connection>(__connections as *mut _, "daqSignal_getConnections") }?)
}
/// Gets the signal's data descriptor.
///
/// # Returns
/// - `descriptor`: The signal's data descriptor. The descriptor contains metadata about the signal, providing information about its name, description,... and defines how the data in it's packet's buffers should be interpreted.
///
/// Calls the openDAQ C function `daqSignal_getDescriptor()`.
pub fn descriptor(&self) -> Result<Option<DataDescriptor>> {
let mut __descriptor: *mut sys::daqDataDescriptor = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqSignal_getDescriptor)(self.as_raw() as *mut _, &mut __descriptor) };
check(__code, "daqSignal_getDescriptor")?;
Ok(unsafe { crate::marshal::take_object::<DataDescriptor>(__descriptor as *mut _) })
}
/// Gets the signal that carries its domain data.
///
/// # Returns
/// - `signal`: The domain signal. The domain signal contains domain (most often time) data that is used to interpret a signal's data in a given domain. It has the same sampling rate as the signal.
///
/// Calls the openDAQ C function `daqSignal_getDomainSignal()`.
pub fn domain_signal(&self) -> Result<Option<Signal>> {
let mut __signal: *mut sys::daqSignal = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqSignal_getDomainSignal)(self.as_raw() as *mut _, &mut __signal) };
check(__code, "daqSignal_getDomainSignal")?;
Ok(unsafe { crate::marshal::take_object::<Signal>(__signal as *mut _) })
}
/// Gets the signal last value.
///
/// # Returns
/// - `value`: The IBaseObject value can be a nullptr if there is no value, or if the data type is not supported by the function. If a value is assigned, it can be cast based on the signal description to IFloat if the type is Float32 or Float64, to IInteger if the type is Int8 through Int64 or UInt8 through UInt64, to IComplexNumber if the type is ComplexFloat32 or ComplexFloat64, to IRange if the type is RangeInt64, to IString if the type is String, to IStruct if the type is Struct, and to IList of the forementioned types if there is exactly one dimension. For String type signals in binary data packets, the string data must be encoded as UTF-8 strings. The string length is determined by the sample size, and the string does not need to be null-terminated. The method extracts the string value from the packet data and returns it as an IString object.
///
/// Calls the openDAQ C function `daqSignal_getLastValue()`.
pub fn last_value(&self) -> Result<Value> {
let mut __value: *mut sys::daqBaseObject = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqSignal_getLastValue)(self.as_raw() as *mut _, &mut __value) };
check(__code, "daqSignal_getLastValue")?;
Ok(unsafe { crate::value::take_value(__value, "daqSignal_getLastValue") }?)
}
/// Returns true if the signal is public; false otherwise.
///
/// # Returns
/// - `is_public`: True if the signal is public; false otherwise. Public signals are visible to clients connected to the device, and are streamed.
///
/// Calls the openDAQ C function `daqSignal_getPublic()`.
pub fn public(&self) -> Result<bool> {
let mut __is_public: u8 = 0;
let __code = unsafe { (crate::sys::api().daqSignal_getPublic)(self.as_raw() as *mut _, &mut __is_public) };
check(__code, "daqSignal_getPublic")?;
Ok(__is_public != 0)
}
/// Gets a list of related signals.
///
/// # Returns
/// - `signals`: The list of related signals. Signals within the related signals list are facilitate the interpretation of a given signal's data, or are otherwise relevant when working with the signal.
///
/// Calls the openDAQ C function `daqSignal_getRelatedSignals()`.
pub fn related_signals(&self) -> Result<Vec<Signal>> {
let mut __signals: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqSignal_getRelatedSignals)(self.as_raw() as *mut _, &mut __signals) };
check(__code, "daqSignal_getRelatedSignals")?;
Ok(unsafe { crate::marshal::take_list::<Signal>(__signals as *mut _, "daqSignal_getRelatedSignals") }?)
}
/// Returns true if the signal is streamed; false otherwise.
///
/// # Returns
/// - `streamed`: True if the signal is streamed; false otherwise. A streamed signal receives packets from a streaming server and forwards packets on the signal path. Method always sets `streamed` parameter to False if the signal is local to the current Instance.
///
/// Calls the openDAQ C function `daqSignal_getStreamed()`.
pub fn streamed(&self) -> Result<bool> {
let mut __streamed: u8 = 0;
let __code = unsafe { (crate::sys::api().daqSignal_getStreamed)(self.as_raw() as *mut _, &mut __streamed) };
check(__code, "daqSignal_getStreamed")?;
Ok(__streamed != 0)
}
/// Sets the signal to be either public or private.
///
/// # Parameters
/// - `is_public`: If false, the signal is set to private; if true, the signal is set to be public. Public signals are visible to clients connected to the device, and are streamed.
///
/// Calls the openDAQ C function `daqSignal_setPublic()`.
pub fn set_public(&self, is_public: bool) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqSignal_setPublic)(self.as_raw() as *mut _, u8::from(is_public)) };
check(__code, "daqSignal_setPublic")?;
Ok(())
}
/// Sets the signal to be either streamed or not.
///
/// # Parameters
/// - `streamed`: The new streamed state of the signal. A streamed signal receives packets from a streaming server and forwards packets on the signal path. Setting the "Streamed" flag has no effect if the signal is local to the current Instance. Method returns OPENDAQ_IGNORED if that is the case.
///
/// Calls the openDAQ C function `daqSignal_setStreamed()`.
pub fn set_streamed(&self, streamed: bool) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqSignal_setStreamed)(self.as_raw() as *mut _, u8::from(streamed)) };
check(__code, "daqSignal_setStreamed")?;
Ok(())
}
}
impl TagsPrivate {
/// Adds a new tag to the list.
///
/// # Parameters
/// - `name`: The name of the tag to be added.
///
/// # Errors
/// - `OPENDAQ_IGNORED`: if a node with the `name` is already in the list of tags.
///
/// Calls the openDAQ C function `daqTagsPrivate_add()`.
pub fn add(&self, name: &str) -> Result<()> {
let __name = crate::marshal::make_string(name)?;
let __code = unsafe { (crate::sys::api().daqTagsPrivate_add)(self.as_raw() as *mut _, __name.as_ptr() as *mut _) };
check(__code, "daqTagsPrivate_add")?;
Ok(())
}
/// Removes a new tag from the list.
///
/// # Parameters
/// - `name`: The name of the tag to be removed.
///
/// # Errors
/// - `OPENDAQ_IGNORED`: if a node with the `name` is not in the list of tags.
///
/// Calls the openDAQ C function `daqTagsPrivate_remove()`.
pub fn remove(&self, name: &str) -> Result<()> {
let __name = crate::marshal::make_string(name)?;
let __code = unsafe { (crate::sys::api().daqTagsPrivate_remove)(self.as_raw() as *mut _, __name.as_ptr() as *mut _) };
check(__code, "daqTagsPrivate_remove")?;
Ok(())
}
/// Replaces all tags.
///
/// # Parameters
/// - `tags`: The new list of tags.
///
/// Calls the openDAQ C function `daqTagsPrivate_replace()`.
pub fn replace(&self, tags: &[&str]) -> Result<()> {
let __tags = crate::marshal::list_from_strs(tags)?;
let __code = unsafe { (crate::sys::api().daqTagsPrivate_replace)(self.as_raw() as *mut _, __tags.as_ptr() as *mut _) };
check(__code, "daqTagsPrivate_replace")?;
Ok(())
}
}
impl Tags {
/// Checks whether a tag is present in the list of tags.
///
/// # Parameters
/// - `name`: The name of the tag being checked.
///
/// # Returns
/// - `value`: True if a tag is found; false otherwise.
///
/// Calls the openDAQ C function `daqTags_contains()`.
pub fn contains(&self, name: &str) -> Result<bool> {
let __name = crate::marshal::make_string(name)?;
let mut __value: u8 = 0;
let __code = unsafe { (crate::sys::api().daqTags_contains)(self.as_raw() as *mut _, __name.as_ptr() as *mut _, &mut __value) };
check(__code, "daqTags_contains")?;
Ok(__value != 0)
}
/// Calls the openDAQ C function `daqTags_createTags()`.
pub fn new() -> Result<Tags> {
let mut __obj: *mut sys::daqTags = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqTags_createTags)(&mut __obj) };
check(__code, "daqTags_createTags")?;
Ok(unsafe { crate::marshal::require_object::<Tags>(__obj as *mut _, "daqTags_createTags") }?)
}
/// Gets the list of all tags in the list.
///
/// # Returns
/// - `value`: The list of tag strings.
///
/// Calls the openDAQ C function `daqTags_getList()`.
pub fn list(&self) -> Result<Vec<String>> {
let mut __value: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqTags_getList)(self.as_raw() as *mut _, &mut __value) };
check(__code, "daqTags_getList")?;
Ok(unsafe { crate::marshal::take_list::<String>(__value as *mut _, "daqTags_getList") }?)
}
/// Queries the list of tags, creating an EvalValue expression from the `query` string. Returns true if the list of tags matches the query, false otherwise.
///
/// # Parameters
/// - `query`: The query string. I.e. "tag1 || (tag2 && tag3)"
///
/// # Returns
/// - `value`: The result of the query
///
/// Calls the openDAQ C function `daqTags_query()`.
pub fn query(&self, query: &str) -> Result<bool> {
let __query = crate::marshal::make_string(query)?;
let mut __value: u8 = 0;
let __code = unsafe { (crate::sys::api().daqTags_query)(self.as_raw() as *mut _, __query.as_ptr() as *mut _, &mut __value) };
check(__code, "daqTags_query")?;
Ok(__value != 0)
}
}
impl UpdateParameters {
/// @ingroup opendaq_update_parameters
/// @addtogroup opendaq_update_parameters Factories
///
/// Calls the openDAQ C function `daqUpdateParameters_createUpdateParameters()`.
pub fn new() -> Result<UpdateParameters> {
let mut __obj: *mut sys::daqUpdateParameters = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqUpdateParameters_createUpdateParameters)(&mut __obj) };
check(__code, "daqUpdateParameters_createUpdateParameters")?;
Ok(unsafe { crate::marshal::require_object::<UpdateParameters>(__obj as *mut _, "daqUpdateParameters_createUpdateParameters") }?)
}
/// Gets the device update options object that allows for specifying how a device and its subdevices are to be updated.
///
/// # Parameters
/// - `options`: The device update options object.
///
/// Calls the openDAQ C function `daqUpdateParameters_getDeviceUpdateOptions()`.
pub fn device_update_options(&self) -> Result<Option<DeviceUpdateOptions>> {
let mut __options: *mut sys::daqDeviceUpdateOptions = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqUpdateParameters_getDeviceUpdateOptions)(self.as_raw() as *mut _, &mut __options) };
check(__code, "daqUpdateParameters_getDeviceUpdateOptions")?;
Ok(unsafe { crate::marshal::take_object::<DeviceUpdateOptions>(__options as *mut _) })
}
/// Sets the device update options object that allows for specifying how a device and its subdevices are to be updated.
///
/// # Parameters
/// - `options`: The device update options object.
///
/// Calls the openDAQ C function `daqUpdateParameters_setDeviceUpdateOptions()`.
pub fn set_device_update_options(&self, options: &DeviceUpdateOptions) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqUpdateParameters_setDeviceUpdateOptions)(self.as_raw() as *mut _, options.as_raw() as *mut _) };
check(__code, "daqUpdateParameters_setDeviceUpdateOptions")?;
Ok(())
}
}