// 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;
/// @ingroup opendaq_server_capability
/// @addtogroup opendaq_address_info Address info
/// Wrapper over the openDAQ `daqAddressInfo` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct AddressInfo(pub(crate) PropertyObject);
impl std::ops::Deref for AddressInfo {
type Target = PropertyObject;
fn deref(&self) -> &PropertyObject { &self.0 }
}
impl crate::sealed::Sealed for AddressInfo {}
unsafe impl Interface for AddressInfo {
const NAME: &'static str = "daqAddressInfo";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqAddressInfo_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 AddressInfo {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { AddressInfo(PropertyObject::__from_ref(r)) }
}
impl std::fmt::Display for AddressInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&AddressInfo> for Value {
fn from(value: &AddressInfo) -> Value { Value::Object(value.to_base_object()) }
}
impl From<AddressInfo> for Value {
fn from(value: AddressInfo) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for AddressInfo {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// @ingroup opendaq_server_capability
/// @addtogroup opendaq_address_info Address info
/// Wrapper over the openDAQ `daqAddressInfoBuilder` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct AddressInfoBuilder(pub(crate) BaseObject);
impl std::ops::Deref for AddressInfoBuilder {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for AddressInfoBuilder {}
unsafe impl Interface for AddressInfoBuilder {
const NAME: &'static str = "daqAddressInfoBuilder";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqAddressInfoBuilder_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 AddressInfoBuilder {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { AddressInfoBuilder(BaseObject(r)) }
}
impl std::fmt::Display for AddressInfoBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&AddressInfoBuilder> for Value {
fn from(value: &AddressInfoBuilder) -> Value { Value::Object(value.to_base_object()) }
}
impl From<AddressInfoBuilder> for Value {
fn from(value: AddressInfoBuilder) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for AddressInfoBuilder {
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 `daqAddressInfoPrivate` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct AddressInfoPrivate(pub(crate) BaseObject);
impl std::ops::Deref for AddressInfoPrivate {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for AddressInfoPrivate {}
unsafe impl Interface for AddressInfoPrivate {
const NAME: &'static str = "daqAddressInfoPrivate";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqAddressInfoPrivate_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 AddressInfoPrivate {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { AddressInfoPrivate(BaseObject(r)) }
}
impl std::fmt::Display for AddressInfoPrivate {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&AddressInfoPrivate> for Value {
fn from(value: &AddressInfoPrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl From<AddressInfoPrivate> for Value {
fn from(value: AddressInfoPrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for AddressInfoPrivate {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// @ingroup opendaq_server_capability
/// @addtogroup opendaq_connected_client_info Connected client info
/// Wrapper over the openDAQ `daqConnectedClientInfo` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ConnectedClientInfo(pub(crate) PropertyObject);
impl std::ops::Deref for ConnectedClientInfo {
type Target = PropertyObject;
fn deref(&self) -> &PropertyObject { &self.0 }
}
impl crate::sealed::Sealed for ConnectedClientInfo {}
unsafe impl Interface for ConnectedClientInfo {
const NAME: &'static str = "daqConnectedClientInfo";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqConnectedClientInfo_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 ConnectedClientInfo {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ConnectedClientInfo(PropertyObject::__from_ref(r)) }
}
impl std::fmt::Display for ConnectedClientInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ConnectedClientInfo> for Value {
fn from(value: &ConnectedClientInfo) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ConnectedClientInfo> for Value {
fn from(value: ConnectedClientInfo) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ConnectedClientInfo {
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 for managing the Device's connection statuses.
/// Enables adding, removing, and updating statuses stored in the connection status container.
/// Statuses are identified by unique connection strings and can be accessed via
/// IComponentStatusContainer using name aliases. A configuration status, accessible via alias "ConfigurationStatus",
/// is unique per container and cannot be removed if added.
/// On the other hand, multiple streaming statuses are supported, one per each streaming source attached to the device.
/// Aliases for these follow the pattern "StreamingStatus_n," with optional protocol-based prefixes (e.g.,
/// "OpenDAQNativeStreamingStatus_1", "OpenDAQLTStreamingStatus_2", "StreamingStatus_3" etc.).
/// "ConnectionStatusChanged" Core events are triggered whenever there is a change in the connection status of the openDAQ Device,
/// including parameters such as status name alias, value, protocol type, connection string, and streaming
/// object (nullptr for configuration statuses). Removing streaming statuses also triggers said Core event with
/// "Removed" as the value and nullptr for the streaming object parameters.
/// Wrapper over the openDAQ `daqConnectionStatusContainerPrivate` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ConnectionStatusContainerPrivate(pub(crate) BaseObject);
impl std::ops::Deref for ConnectionStatusContainerPrivate {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ConnectionStatusContainerPrivate {}
unsafe impl Interface for ConnectionStatusContainerPrivate {
const NAME: &'static str = "daqConnectionStatusContainerPrivate";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqConnectionStatusContainerPrivate_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 ConnectionStatusContainerPrivate {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ConnectionStatusContainerPrivate(BaseObject(r)) }
}
impl std::fmt::Display for ConnectionStatusContainerPrivate {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ConnectionStatusContainerPrivate> for Value {
fn from(value: &ConnectionStatusContainerPrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ConnectionStatusContainerPrivate> for Value {
fn from(value: ConnectionStatusContainerPrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ConnectionStatusContainerPrivate {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Represents an openDAQ device. The device contains a list of signals and physical channels. Some devices support adding function blocks, or connecting to devices. The list of available function blocks/devices can be obtained via the `getAvailable` functions, and added via the `add` functions.
/// Devices can be split up into three different types, with each devices supporting one or more:
/// 1. Physical devices
/// Physical devices provide access to physical channels. They measure real-world data and send
/// it via packets through output signals of channels. The list of channels can be obtained via
/// `getChannels` as a flat list.
/// 2. Client devices
/// Client devices can connect to other devices via their supported connection protocol. openDAQ
/// natively supports connecting to TMS devices via its openDAQ OpcUa Client Module. A list of available
/// devices a client device can connect to can be obtained via `getAvailableDevices`. The
/// `addDevice` is used to connect to/add a device.
/// 3. Function block devices
/// Function block devices provide a dictionary of available function block types that can be added to them
/// and configured. The calculation of function blocks is done on the device itself. The dictionary
/// of available function block types can be obtained via `getAvailableFunctionBlockTypes`. They
/// can then be added via `addFunctionBlock`.
/// All devices also provide access to their Device information, containing metadata such as the
/// device's serial number, location... They can also be queried for their current domain values
/// (time) through its device domain.
/// As each device is a property object, a device has access to all Property object methods, allowing
/// each device to expose a list of custom properties such as sample rate, scaling factor and many
/// others. By default, openDAQ devices have the UserName and Location string Properties.
/// Wrapper over the openDAQ `daqDevice` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Device(pub(crate) Folder);
impl std::ops::Deref for Device {
type Target = Folder;
fn deref(&self) -> &Folder { &self.0 }
}
impl crate::sealed::Sealed for Device {}
unsafe impl Interface for Device {
const NAME: &'static str = "daqDevice";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqDevice_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 Device {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { Device(Folder::__from_ref(r)) }
}
impl std::fmt::Display for Device {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&Device> for Value {
fn from(value: &Device) -> Value { Value::Object(value.to_base_object()) }
}
impl From<Device> for Value {
fn from(value: Device) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for Device {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Contains information about the domain of the device.
/// The device domain contains a general view into the device's domain data. While devices most often operate
/// in the time domain, this interface allows for description of any other domain commonly used in signal processing.
/// For example, common domains include the angle domain, frequency domain, the spatial domain, and the wavelet domain.
/// The device domain allows for users to query a device for its current domain value via `getTicksSinceOrigin`
/// and convert that into its domain unit by multiplying the tick count with the resolution. To get the absolute
/// domain value, we can then also add the value to the Origin, which is most often provided
/// as a time epoch in the ISO 8601 format.
/// Note that all devices might note provide a device domain implementation. Such devices cannot be directly queried
/// for their domain data. In such a case, the domain data can be obtained through the device's output signals.
/// Wrapper over the openDAQ `daqDeviceDomain` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DeviceDomain(pub(crate) BaseObject);
impl std::ops::Deref for DeviceDomain {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for DeviceDomain {}
unsafe impl Interface for DeviceDomain {
const NAME: &'static str = "daqDeviceDomain";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqDeviceDomain_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 DeviceDomain {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { DeviceDomain(BaseObject(r)) }
}
impl std::fmt::Display for DeviceDomain {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&DeviceDomain> for Value {
fn from(value: &DeviceDomain) -> Value { Value::Object(value.to_base_object()) }
}
impl From<DeviceDomain> for Value {
fn from(value: DeviceDomain) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for DeviceDomain {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Contains standard information about an openDAQ device and device type. The Device Info object is a Property Object, allowing for custom String, Int, Bool, or Float-type properties to be added.
/// The getter methods represent a standardized set of Device properties according to the
/// OPC UA: Devices standard. Any additional String, Int, Bool, or Float-type properties can be added, using the
/// appropriate Property Object "add property" method. Any other types of properties are invalid.
/// Although Integer-type properties are valid additions, Selection properties cannot be added to
/// Device Info.
/// As the Device Info object adheres to the OPC UA: Devices standard, it behaves differently than
/// standard Property Objects. No metadata except the Value Type and Default Value are published
/// via OPC UA, and this only said Property metadata is visible to any clients.
/// All fields - default (e.g. platform, manufacturer...) and custom are represented as either:
/// - String-type properties
/// - Integer-type properties
/// - Bool-type properties
/// - Float type properties
/// As such, listing all properties via Property Object methods, will return both the
/// names of the default and custom properties. All default properties are initialized to an empty
/// string except for RevisionCounter and Position that are integer properties and are
/// thus initialized to '0'. The names of the properties are written in camelCase - for
/// example "systemUuid", "parentMacAddress", "manufacturerUri".
/// If the DeviceInfo object is obtained from a device, or when listing available devices, the
/// object is frozen (immutable). As such, Property Object setter methods cannot be used
/// and will fail when called.
/// Wrapper over the openDAQ `daqDeviceInfo` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DeviceInfo(pub(crate) PropertyObject);
impl std::ops::Deref for DeviceInfo {
type Target = PropertyObject;
fn deref(&self) -> &PropertyObject { &self.0 }
}
impl crate::sealed::Sealed for DeviceInfo {}
unsafe impl Interface for DeviceInfo {
const NAME: &'static str = "daqDeviceInfo";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqDeviceInfo_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 DeviceInfo {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { DeviceInfo(PropertyObject::__from_ref(r)) }
}
impl std::fmt::Display for DeviceInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&DeviceInfo> for Value {
fn from(value: &DeviceInfo) -> Value { Value::Object(value.to_base_object()) }
}
impl From<DeviceInfo> for Value {
fn from(value: DeviceInfo) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for DeviceInfo {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Configuration component of Device info objects. Contains setter methods that are available until the object is frozen.
/// Device info config contains functions that allow for the configuration of Device info objects.
/// The implementation of `config` also implements the `freeze` function that freezes the object making it
/// immutable. Once frozen, the setter methods fail as the object can no longer be modified.
/// Wrapper over the openDAQ `daqDeviceInfoConfig` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DeviceInfoConfig(pub(crate) DeviceInfo);
impl std::ops::Deref for DeviceInfoConfig {
type Target = DeviceInfo;
fn deref(&self) -> &DeviceInfo { &self.0 }
}
impl crate::sealed::Sealed for DeviceInfoConfig {}
unsafe impl Interface for DeviceInfoConfig {
const NAME: &'static str = "daqDeviceInfoConfig";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqDeviceInfoConfig_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 DeviceInfoConfig {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { DeviceInfoConfig(DeviceInfo::__from_ref(r)) }
}
impl std::fmt::Display for DeviceInfoConfig {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&DeviceInfoConfig> for Value {
fn from(value: &DeviceInfoConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl From<DeviceInfoConfig> for Value {
fn from(value: DeviceInfoConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for DeviceInfoConfig {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// @ingroup opendaq_devices
/// @addtogroup opendaq_device_info Device info internal
/// Wrapper over the openDAQ `daqDeviceInfoInternal` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DeviceInfoInternal(pub(crate) BaseObject);
impl std::ops::Deref for DeviceInfoInternal {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for DeviceInfoInternal {}
unsafe impl Interface for DeviceInfoInternal {
const NAME: &'static str = "daqDeviceInfoInternal";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqDeviceInfoInternal_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 DeviceInfoInternal {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { DeviceInfoInternal(BaseObject(r)) }
}
impl std::fmt::Display for DeviceInfoInternal {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&DeviceInfoInternal> for Value {
fn from(value: &DeviceInfoInternal) -> Value { Value::Object(value.to_base_object()) }
}
impl From<DeviceInfoInternal> for Value {
fn from(value: DeviceInfoInternal) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for DeviceInfoInternal {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Interface for managing device network configuration information and settings.
/// The interface is typically used by the discovery server, if present, to obtain the necessary
/// information for advertising the device's network configuration capabilities and handling related requests.
/// The device must be designated as the root device to enable the use of this interface's methods.
/// Wrapper over the openDAQ `daqDeviceNetworkConfig` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DeviceNetworkConfig(pub(crate) BaseObject);
impl std::ops::Deref for DeviceNetworkConfig {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for DeviceNetworkConfig {}
unsafe impl Interface for DeviceNetworkConfig {
const NAME: &'static str = "daqDeviceNetworkConfig";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqDeviceNetworkConfig_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 DeviceNetworkConfig {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { DeviceNetworkConfig(BaseObject(r)) }
}
impl std::fmt::Display for DeviceNetworkConfig {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&DeviceNetworkConfig> for Value {
fn from(value: &DeviceNetworkConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl From<DeviceNetworkConfig> for Value {
fn from(value: DeviceNetworkConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for DeviceNetworkConfig {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// @ingroup opendaq_devices
/// @addtogroup opendaq_device Device private
/// Wrapper over the openDAQ `daqDevicePrivate` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DevicePrivate(pub(crate) BaseObject);
impl std::ops::Deref for DevicePrivate {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for DevicePrivate {}
unsafe impl Interface for DevicePrivate {
const NAME: &'static str = "daqDevicePrivate";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqDevicePrivate_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 DevicePrivate {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { DevicePrivate(BaseObject(r)) }
}
impl std::fmt::Display for DevicePrivate {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&DevicePrivate> for Value {
fn from(value: &DevicePrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl From<DevicePrivate> for Value {
fn from(value: DevicePrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for DevicePrivate {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Provides information on what device type can be created by a given module. Can be used to obtain the default configuration used when either adding/creating a new device.
/// Wrapper over the openDAQ `daqDeviceType` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DeviceType(pub(crate) ComponentType);
impl std::ops::Deref for DeviceType {
type Target = ComponentType;
fn deref(&self) -> &ComponentType { &self.0 }
}
impl crate::sealed::Sealed for DeviceType {}
unsafe impl Interface for DeviceType {
const NAME: &'static str = "daqDeviceType";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqDeviceType_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 DeviceType {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { DeviceType(ComponentType::__from_ref(r)) }
}
impl std::fmt::Display for DeviceType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&DeviceType> for Value {
fn from(value: &DeviceType) -> Value { Value::Object(value.to_base_object()) }
}
impl From<DeviceType> for Value {
fn from(value: DeviceType) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for DeviceType {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Function blocks perform calculations on inputs/generate data, outputting new data in its output signals as packets.
/// Each function block describes its behaviour and identifiers in its FunctionBlockType structure. It
/// provides a list of input ports that can be connected to signals that the input port accepts, as well as a
/// list of output signals that carry the function block's output data.
/// Additionally, as each function block is a property object, it can define its own set of properties, providing
/// user-configurable settings. In example, a FFT function block would expose a `blockSize` property, defining the
/// amount of samples to be used for calculation in each block.
/// Function blocks also provide a status signal, through which a status packet is sent whenever a connection to a
/// new input port is formed, or when the status changes.
/// Wrapper over the openDAQ `daqFunctionBlock` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct FunctionBlock(pub(crate) Folder);
impl std::ops::Deref for FunctionBlock {
type Target = Folder;
fn deref(&self) -> &Folder { &self.0 }
}
impl crate::sealed::Sealed for FunctionBlock {}
unsafe impl Interface for FunctionBlock {
const NAME: &'static str = "daqFunctionBlock";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqFunctionBlock_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 FunctionBlock {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { FunctionBlock(Folder::__from_ref(r)) }
}
impl std::fmt::Display for FunctionBlock {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&FunctionBlock> for Value {
fn from(value: &FunctionBlock) -> Value { Value::Object(value.to_base_object()) }
}
impl From<FunctionBlock> for Value {
fn from(value: FunctionBlock) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for FunctionBlock {
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 channels and other io folders.
/// Every device has an IO folder, which allows only other IO folders and
/// channels as children.
/// Wrapper over the openDAQ `daqIoFolderConfig` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct IoFolderConfig(pub(crate) FolderConfig);
impl std::ops::Deref for IoFolderConfig {
type Target = FolderConfig;
fn deref(&self) -> &FolderConfig { &self.0 }
}
impl crate::sealed::Sealed for IoFolderConfig {}
unsafe impl Interface for IoFolderConfig {
const NAME: &'static str = "daqIoFolderConfig";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqIoFolderConfig_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 IoFolderConfig {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { IoFolderConfig(FolderConfig::__from_ref(r)) }
}
impl std::fmt::Display for IoFolderConfig {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&IoFolderConfig> for Value {
fn from(value: &IoFolderConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl From<IoFolderConfig> for Value {
fn from(value: IoFolderConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for IoFolderConfig {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// @ingroup opendaq_log_file_info
/// @addtogroup opendaq_log_file_info log_file_info
/// Wrapper over the openDAQ `daqLogFileInfo` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct LogFileInfo(pub(crate) BaseObject);
impl std::ops::Deref for LogFileInfo {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for LogFileInfo {}
unsafe impl Interface for LogFileInfo {
const NAME: &'static str = "daqLogFileInfo";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqLogFileInfo_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 LogFileInfo {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { LogFileInfo(BaseObject(r)) }
}
impl std::fmt::Display for LogFileInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&LogFileInfo> for Value {
fn from(value: &LogFileInfo) -> Value { Value::Object(value.to_base_object()) }
}
impl From<LogFileInfo> for Value {
fn from(value: LogFileInfo) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for LogFileInfo {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// @ingroup opendaq_log_file_info
/// @addtogroup opendaq_log_file_info log_file_info_builder
/// Wrapper over the openDAQ `daqLogFileInfoBuilder` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct LogFileInfoBuilder(pub(crate) BaseObject);
impl std::ops::Deref for LogFileInfoBuilder {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for LogFileInfoBuilder {}
unsafe impl Interface for LogFileInfoBuilder {
const NAME: &'static str = "daqLogFileInfoBuilder";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqLogFileInfoBuilder_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 LogFileInfoBuilder {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { LogFileInfoBuilder(BaseObject(r)) }
}
impl std::fmt::Display for LogFileInfoBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&LogFileInfoBuilder> for Value {
fn from(value: &LogFileInfoBuilder) -> Value { Value::Object(value.to_base_object()) }
}
impl From<LogFileInfoBuilder> for Value {
fn from(value: LogFileInfoBuilder) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for LogFileInfoBuilder {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Provides an interface to manipulate the configuration of a device's (server's) network interface. Offers methods to update the IP configuration and retrieve the currently active one, if the corresponding feature supported by the device. Additionally, includes a helper method to create a prebuilt property object with valid default configuration.
/// The configuration property object, passed as a parameter to said methods, should include the following properties:
/// - **"dhcp4"**: A boolean property indicating whether DHCP is enabled for IPv4. Defaults to `True` (DHCP enabled).
/// If set to `False` (DHCP disabled), non-empty static configuration properties are required.
/// - **"address4"**: A string property specifying the statically assigned IPv4 address in the format `address/netmask` (e.g. 192.168.1.2/24).
/// This property is ignored when DHCP is enabled for IPv4. However, if DHCP is disabled, the list must include at least one address. Defaults to an empty string.
/// - **"gateway4"**: A string property specifying the IPv4 gateway address. This is required if DHCP is disabled and ignored otherwise. Defaults to an empty string.
/// - **"dhcp6"**, **"address6"**, **"gateway6"**: These properties follow the same format and rules as their IPv4 counterparts but apply to IPv6 configuration.
/// Wrapper over the openDAQ `daqNetworkInterface` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct NetworkInterface(pub(crate) BaseObject);
impl std::ops::Deref for NetworkInterface {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for NetworkInterface {}
unsafe impl Interface for NetworkInterface {
const NAME: &'static str = "daqNetworkInterface";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqNetworkInterface_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 NetworkInterface {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { NetworkInterface(BaseObject(r)) }
}
impl std::fmt::Display for NetworkInterface {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&NetworkInterface> for Value {
fn from(value: &NetworkInterface) -> Value { Value::Object(value.to_base_object()) }
}
impl From<NetworkInterface> for Value {
fn from(value: NetworkInterface) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for NetworkInterface {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// If set, gives additional information about the reference domain.
/// Wrapper over the openDAQ `daqReferenceDomainInfo` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ReferenceDomainInfo(pub(crate) BaseObject);
impl std::ops::Deref for ReferenceDomainInfo {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ReferenceDomainInfo {}
unsafe impl Interface for ReferenceDomainInfo {
const NAME: &'static str = "daqReferenceDomainInfo";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqReferenceDomainInfo_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 ReferenceDomainInfo {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ReferenceDomainInfo(BaseObject(r)) }
}
impl std::fmt::Display for ReferenceDomainInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ReferenceDomainInfo> for Value {
fn from(value: &ReferenceDomainInfo) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ReferenceDomainInfo> for Value {
fn from(value: ReferenceDomainInfo) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ReferenceDomainInfo {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Represents a server. The server provides access to the openDAQ device. Depend of the implementation, it can support configuring the device, reading configuration, and data streaming.
/// We do not make the server directly. But through the instance and module manager. For that reason, the server must be uniquely
/// defined with "ServerType". The server is then created with the current root device, context and configuration object.
/// Configuration of the server can be done with custom property object.
/// The configuration object is created with the corresponding ServerType object (IServerType::createDefaultConfig method).
/// For example, with a configuration object, we can define connection timeout.
/// Wrapper over the openDAQ `daqServer` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Server(pub(crate) Folder);
impl std::ops::Deref for Server {
type Target = Folder;
fn deref(&self) -> &Folder { &self.0 }
}
impl crate::sealed::Sealed for Server {}
unsafe impl Interface for Server {
const NAME: &'static str = "daqServer";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqServer_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 Server {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { Server(Folder::__from_ref(r)) }
}
impl std::fmt::Display for Server {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&Server> for Value {
fn from(value: &Server) -> Value { Value::Object(value.to_base_object()) }
}
impl From<Server> for Value {
fn from(value: Server) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for Server {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Represents standard information about a server's capability to support various protocols. The Server Capability object functions as a Property Object, facilitating the inclusion of custom properties of String, Int, Bool, or Float types. This interface serves to store essential details regarding the supported protocol by a device. It adheres to a standardized set of properties, including methods to retrieve information such as the connection string, protocol name, protocol type, connection type, and core events enabled.
/// Additional String, Int, Bool, or Float-type properties can be added using the appropriate Property Object "add property" method.
/// However, other property types are considered invalid for this interface.
/// The Server Capability object conforms to a standardized format, ensuring compatibility with communication standards.
/// For instance, it provides methods to retrieve details like
/// - the connection string (URL),
/// - protocol name (e.g., "OpenDAQNativeStreaming", "OpenDAQOPCUA"),
/// - protocol type (e.g., "Configuration&Streaming", "Streaming"),
/// - connection type (e.g., IPv4, IPv6),
/// - core events enabled (indicating communication mode).
/// Wrapper over the openDAQ `daqServerCapability` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ServerCapability(pub(crate) PropertyObject);
impl std::ops::Deref for ServerCapability {
type Target = PropertyObject;
fn deref(&self) -> &PropertyObject { &self.0 }
}
impl crate::sealed::Sealed for ServerCapability {}
unsafe impl Interface for ServerCapability {
const NAME: &'static str = "daqServerCapability";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqServerCapability_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 ServerCapability {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ServerCapability(PropertyObject::__from_ref(r)) }
}
impl std::fmt::Display for ServerCapability {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ServerCapability> for Value {
fn from(value: &ServerCapability) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ServerCapability> for Value {
fn from(value: ServerCapability) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ServerCapability {
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 `daqServerCapabilityConfig` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ServerCapabilityConfig(pub(crate) ServerCapability);
impl std::ops::Deref for ServerCapabilityConfig {
type Target = ServerCapability;
fn deref(&self) -> &ServerCapability { &self.0 }
}
impl crate::sealed::Sealed for ServerCapabilityConfig {}
unsafe impl Interface for ServerCapabilityConfig {
const NAME: &'static str = "daqServerCapabilityConfig";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqServerCapabilityConfig_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 ServerCapabilityConfig {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ServerCapabilityConfig(ServerCapability::__from_ref(r)) }
}
impl std::fmt::Display for ServerCapabilityConfig {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ServerCapabilityConfig> for Value {
fn from(value: &ServerCapabilityConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ServerCapabilityConfig> for Value {
fn from(value: ServerCapabilityConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ServerCapabilityConfig {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Represents the client-side part of a streaming service responsible for initiating communication with the openDAQ device streaming server and processing the received data. Wraps the client-side implementation details of the particular data transfer protocol used by openDAQ to send processed/acquired data from devices running an openDAQ Server to an openDAQ Client.
/// The Streaming is used as a selectable data source for mirrored signals. For this, it
/// provides methods, allowing mirrored signals to be added/removed dynamically,
/// to enable/disable the use of Streaming as a data source of these signals.
/// Forwarding of packets received from the remote device through the data transfer protocol down to
/// the signal path is enabled when the following conditions are met:
/// - Streaming object itself is in active state.
/// - Streaming is selected as an active source of the corresponding signal.
/// Usually, the data transfer protocol provides information about the signals whose data can be sent
/// over the protocol. It allows the implementation to reject unsupported signals from being added to
/// the streaming. Each Streaming object provides the string representation of a connection address
/// used to connect to the streaming service of the device. This string representation is used as
/// a unique ID to determine the streaming source for the mirrored signal.
/// When the generalized client-to-device streaming mechanism is employed, however, the roles are effectively switched:
/// the server becomes a consumer of signal data, while the client-side Streaming object acts as
/// the producer, sending signal data over the protocol. In this context, Streaming objects are expected
/// to exist on the server side as well to interact with mirrored copies of client signals.
/// In context of client-to-device streaming, in addition to signals, mirrored input ports can also be added or removed
/// dynamically through the corresponding methods of the Streaming interface, similarly to mirrored signals.
/// The support for client-to-device streaming can be checked via `getClientToDeviceStreamingEnabled`.
/// If it is not enabled or not supported by the protocol, the method provides `false` value, and adding or removing
/// mirrored input ports is not allowed, therefore disabling any client-to-device streaming operations.
/// Wrapper over the openDAQ `daqStreaming` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Streaming(pub(crate) BaseObject);
impl std::ops::Deref for Streaming {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for Streaming {}
unsafe impl Interface for Streaming {
const NAME: &'static str = "daqStreaming";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqStreaming_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 Streaming {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { Streaming(BaseObject(r)) }
}
impl std::fmt::Display for Streaming {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&Streaming> for Value {
fn from(value: &Streaming) -> Value { Value::Object(value.to_base_object()) }
}
impl From<Streaming> for Value {
fn from(value: Streaming) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for Streaming {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Interface representing a Synchronization Component in a Test & Measurement system. A SynchronizationComponent ensures synchronization among measurement devices in the system. It can act as a sync source and/or as a sync output, with each component having one sync input and 0 to n sync outputs.
/// SynchronizationComponents are configured via interfaces, which can include PTP, IRIQ, GPS,
/// and CLK sync interfaces, among others.
///
/// # Notes
/// Every SynchronizationComponent has at least one interface. Only one interface can be set as an input, while others can be used as sync outputs to synchronize other devices. The configuration of these interfaces and the reading of their status is defined in Part 4.
/// Depending on the setup, some interfaces may be switched off, and some interfaces may act as sync sources or outputs.
/// A CLK interface can be used to let a device run in Fre-Run mode, where the device syncs internally to an internal quartz.
/// Wrapper over the openDAQ `daqSyncComponent` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct SyncComponent(pub(crate) Component);
impl std::ops::Deref for SyncComponent {
type Target = Component;
fn deref(&self) -> &Component { &self.0 }
}
impl crate::sealed::Sealed for SyncComponent {}
unsafe impl Interface for SyncComponent {
const NAME: &'static str = "daqSyncComponent";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqSyncComponent_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 SyncComponent {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { SyncComponent(Component::__from_ref(r)) }
}
impl std::fmt::Display for SyncComponent {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&SyncComponent> for Value {
fn from(value: &SyncComponent) -> Value { Value::Object(value.to_base_object()) }
}
impl From<SyncComponent> for Value {
fn from(value: SyncComponent) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for SyncComponent {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// This class manages the lock state of an object, usually a device. A device can be locked either with a specific user or without one. If the device is locked with a specific user, only that user can unlock it. If the device is locked without a user, any user can unlock it.
/// Wrapper over the openDAQ `daqUserLock` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct UserLock(pub(crate) BaseObject);
impl std::ops::Deref for UserLock {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for UserLock {}
unsafe impl Interface for UserLock {
const NAME: &'static str = "daqUserLock";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqUserLock_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 UserLock {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { UserLock(BaseObject(r)) }
}
impl std::fmt::Display for UserLock {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&UserLock> for Value {
fn from(value: &UserLock) -> Value { Value::Object(value.to_base_object()) }
}
impl From<UserLock> for Value {
fn from(value: UserLock) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for UserLock {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
impl AddressInfoBuilder {
/// Builds the address.
///
/// # Returns
/// - `address`: The address.
///
/// Calls the openDAQ C function `daqAddressInfoBuilder_build()`.
pub fn build(&self) -> Result<Option<AddressInfo>> {
let mut __address: *mut sys::daqAddressInfo = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqAddressInfoBuilder_build)(self.as_raw() as *mut _, &mut __address) };
check(__code, "daqAddressInfoBuilder_build")?;
Ok(unsafe { crate::marshal::take_object::<AddressInfo>(__address as *mut _) })
}
/// Creates an Address builder with no parameters configured.
///
/// Calls the openDAQ C function `daqAddressInfoBuilder_createAddressInfoBuilder()`.
pub fn new() -> Result<AddressInfoBuilder> {
let mut __obj: *mut sys::daqAddressInfoBuilder = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqAddressInfoBuilder_createAddressInfoBuilder)(&mut __obj) };
check(__code, "daqAddressInfoBuilder_createAddressInfoBuilder")?;
Ok(unsafe { crate::marshal::require_object::<AddressInfoBuilder>(__obj as *mut _, "daqAddressInfoBuilder_createAddressInfoBuilder") }?)
}
/// Gets the server address as a string.
///
/// # Returns
/// - `address`: The server address as a string.
///
/// Calls the openDAQ C function `daqAddressInfoBuilder_getAddress()`.
pub fn address(&self) -> Result<String> {
let mut __address: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqAddressInfoBuilder_getAddress)(self.as_raw() as *mut _, &mut __address) };
check(__code, "daqAddressInfoBuilder_getAddress")?;
Ok(unsafe { crate::marshal::take_string(__address) })
}
/// Gets the connection string corresponding to the address.
///
/// # Returns
/// - `connection_string`: The connection string.
///
/// Calls the openDAQ C function `daqAddressInfoBuilder_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().daqAddressInfoBuilder_getConnectionString)(self.as_raw() as *mut _, &mut __connection_string) };
check(__code, "daqAddressInfoBuilder_getConnectionString")?;
Ok(unsafe { crate::marshal::take_string(__connection_string) })
}
/// Gets the reachability status of the address.
///
/// # Parameters
/// - `address_reachability`: The reachability status of the address. This status is set to "Unknown" by default. For IPv4 address types, the module manager checks reachability when querying for available devices.
///
/// Calls the openDAQ C function `daqAddressInfoBuilder_getReachabilityStatus()`.
pub fn reachability_status(&self) -> Result<AddressReachabilityStatus> {
let mut __address_reachability: u32 = 0;
let __code = unsafe { (crate::sys::api().daqAddressInfoBuilder_getReachabilityStatus)(self.as_raw() as *mut _, &mut __address_reachability) };
check(__code, "daqAddressInfoBuilder_getReachabilityStatus")?;
Ok(crate::marshal::enum_out(AddressReachabilityStatus::from_raw(__address_reachability), "daqAddressInfoBuilder_getReachabilityStatus")?)
}
/// Gets the type of the address.
///
/// # Returns
/// - `type`: The type the address. Currently available address types in the main openDAQ modules are: IPv4 and IPv6.
///
/// Calls the openDAQ C function `daqAddressInfoBuilder_getType()`.
pub fn type_(&self) -> Result<String> {
let mut __type_: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqAddressInfoBuilder_getType)(self.as_raw() as *mut _, &mut __type_) };
check(__code, "daqAddressInfoBuilder_getType")?;
Ok(unsafe { crate::marshal::take_string(__type_) })
}
/// Sets the server address as a string.
///
/// # Parameters
/// - `address`: The server address as a string.
///
/// Calls the openDAQ C function `daqAddressInfoBuilder_setAddress()`.
pub fn set_address(&self, address: &str) -> Result<()> {
let __address = crate::marshal::make_string(address)?;
let __code = unsafe { (crate::sys::api().daqAddressInfoBuilder_setAddress)(self.as_raw() as *mut _, __address.as_ptr() as *mut _) };
check(__code, "daqAddressInfoBuilder_setAddress")?;
Ok(())
}
/// Sets the connection string corresponding to the address.
///
/// # Parameters
/// - `connection_string`: The connection string.
///
/// Calls the openDAQ C function `daqAddressInfoBuilder_setConnectionString()`.
pub fn set_connection_string(&self, connection_string: &str) -> Result<()> {
let __connection_string = crate::marshal::make_string(connection_string)?;
let __code = unsafe { (crate::sys::api().daqAddressInfoBuilder_setConnectionString)(self.as_raw() as *mut _, __connection_string.as_ptr() as *mut _) };
check(__code, "daqAddressInfoBuilder_setConnectionString")?;
Ok(())
}
/// Sets the reachability status of the address.
///
/// # Parameters
/// - `address_reachability`: The reachability status of the address. This status is set to "Unknown" by default. For IPv4 address types, the module manager checks reachability when querying for available devices.
///
/// Calls the openDAQ C function `daqAddressInfoBuilder_setReachabilityStatus()`.
pub fn set_reachability_status(&self, address_reachability: AddressReachabilityStatus) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqAddressInfoBuilder_setReachabilityStatus)(self.as_raw() as *mut _, address_reachability as u32) };
check(__code, "daqAddressInfoBuilder_setReachabilityStatus")?;
Ok(())
}
/// Sets the type of the address.
///
/// # Parameters
/// - `type`: The type the address. Currently available address types in the main openDAQ modules are: IPv4 and IPv6.
///
/// Calls the openDAQ C function `daqAddressInfoBuilder_setType()`.
pub fn set_type(&self, type_: &str) -> Result<()> {
let __type_ = crate::marshal::make_string(type_)?;
let __code = unsafe { (crate::sys::api().daqAddressInfoBuilder_setType)(self.as_raw() as *mut _, __type_.as_ptr() as *mut _) };
check(__code, "daqAddressInfoBuilder_setType")?;
Ok(())
}
}
impl AddressInfoPrivate {
/// Sets the reachability status of the address, ignoring the "Frozen" status of the address.
///
/// # Parameters
/// - `address_reachability`: The reachability status of the address. This status is set to "Unknown" by default. For IPv4 address types, the module manager checks reachability when querying for available devices.
///
/// Calls the openDAQ C function `daqAddressInfoPrivate_setReachabilityStatusPrivate()`.
pub fn set_reachability_status_private(&self, address_reachability: AddressReachabilityStatus) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqAddressInfoPrivate_setReachabilityStatusPrivate)(self.as_raw() as *mut _, address_reachability as u32) };
check(__code, "daqAddressInfoPrivate_setReachabilityStatusPrivate")?;
Ok(())
}
}
impl AddressInfo {
/// Creates an Address with no parameters configured.
///
/// Calls the openDAQ C function `daqAddressInfo_createAddressInfo()`.
pub fn new() -> Result<AddressInfo> {
let mut __obj: *mut sys::daqAddressInfo = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqAddressInfo_createAddressInfo)(&mut __obj) };
check(__code, "daqAddressInfo_createAddressInfo")?;
Ok(unsafe { crate::marshal::require_object::<AddressInfo>(__obj as *mut _, "daqAddressInfo_createAddressInfo") }?)
}
/// Creates an Address using the builder's configuration parameters.
///
/// # Parameters
/// - `builder`: The address info builder.
///
/// Calls the openDAQ C function `daqAddressInfo_createAddressInfoFromBuilder()`.
pub fn from_builder(builder: &AddressInfoBuilder) -> Result<AddressInfo> {
let mut __obj: *mut sys::daqAddressInfo = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqAddressInfo_createAddressInfoFromBuilder)(&mut __obj, builder.as_raw() as *mut _) };
check(__code, "daqAddressInfo_createAddressInfoFromBuilder")?;
Ok(unsafe { crate::marshal::require_object::<AddressInfo>(__obj as *mut _, "daqAddressInfo_createAddressInfoFromBuilder") }?)
}
/// Gets the server address as a string.
///
/// # Returns
/// - `address`: The server address as a string.
///
/// Calls the openDAQ C function `daqAddressInfo_getAddress()`.
pub fn address(&self) -> Result<String> {
let mut __address: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqAddressInfo_getAddress)(self.as_raw() as *mut _, &mut __address) };
check(__code, "daqAddressInfo_getAddress")?;
Ok(unsafe { crate::marshal::take_string(__address) })
}
/// Gets the connection string corresponding to the address.
///
/// # Returns
/// - `connection_string`: The connection string.
///
/// Calls the openDAQ C function `daqAddressInfo_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().daqAddressInfo_getConnectionString)(self.as_raw() as *mut _, &mut __connection_string) };
check(__code, "daqAddressInfo_getConnectionString")?;
Ok(unsafe { crate::marshal::take_string(__connection_string) })
}
/// Gets the reachability status of the address.
///
/// # Parameters
/// - `address_reachability`: The reachability status of the address. This status is set to "Unknown" by default. For IPv4 address types, the module manager checks reachability when querying for available devices.
///
/// Calls the openDAQ C function `daqAddressInfo_getReachabilityStatus()`.
pub fn reachability_status(&self) -> Result<AddressReachabilityStatus> {
let mut __address_reachability: u32 = 0;
let __code = unsafe { (crate::sys::api().daqAddressInfo_getReachabilityStatus)(self.as_raw() as *mut _, &mut __address_reachability) };
check(__code, "daqAddressInfo_getReachabilityStatus")?;
Ok(crate::marshal::enum_out(AddressReachabilityStatus::from_raw(__address_reachability), "daqAddressInfo_getReachabilityStatus")?)
}
/// Gets the type of the address.
///
/// # Parameters
/// - `type`: The type the address. Currently available address types in the main openDAQ modules are: IPv4 and IPv6.
///
/// Calls the openDAQ C function `daqAddressInfo_getType()`.
pub fn type_(&self) -> Result<String> {
let mut __type_: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqAddressInfo_getType)(self.as_raw() as *mut _, &mut __type_) };
check(__code, "daqAddressInfo_getType")?;
Ok(unsafe { crate::marshal::take_string(__type_) })
}
}
impl ConnectedClientInfo {
/// Creates a Connected client with no parameters configured.
///
/// Calls the openDAQ C function `daqConnectedClientInfo_createConnectedClientInfo()`.
pub fn new() -> Result<ConnectedClientInfo> {
let mut __obj: *mut sys::daqConnectedClientInfo = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqConnectedClientInfo_createConnectedClientInfo)(&mut __obj) };
check(__code, "daqConnectedClientInfo_createConnectedClientInfo")?;
Ok(unsafe { crate::marshal::require_object::<ConnectedClientInfo>(__obj as *mut _, "daqConnectedClientInfo_createConnectedClientInfo") }?)
}
/// Creates a Connected client info using the provided parameters.
///
/// # Parameters
/// - `address`: The address of connected client.
/// - `protocol_type`: The type of the protocol type used by the client.
/// - `protocol_name`: The name of the protocol name used by the client.
/// - `client_type`: The configuration connection client type name.
/// - `host_name`: The host name of connected client.
///
/// Calls the openDAQ C function `daqConnectedClientInfo_createConnectedClientInfoWithParams()`.
pub fn with_params(address: &str, protocol_type: ProtocolType, protocol_name: &str, client_type: &str, host_name: &str) -> Result<ConnectedClientInfo> {
let __address = crate::marshal::make_string(address)?;
let __protocol_name = crate::marshal::make_string(protocol_name)?;
let __client_type = crate::marshal::make_string(client_type)?;
let __host_name = crate::marshal::make_string(host_name)?;
let mut __obj: *mut sys::daqConnectedClientInfo = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqConnectedClientInfo_createConnectedClientInfoWithParams)(&mut __obj, __address.as_ptr() as *mut _, protocol_type as u32, __protocol_name.as_ptr() as *mut _, __client_type.as_ptr() as *mut _, __host_name.as_ptr() as *mut _) };
check(__code, "daqConnectedClientInfo_createConnectedClientInfoWithParams")?;
Ok(unsafe { crate::marshal::require_object::<ConnectedClientInfo>(__obj as *mut _, "daqConnectedClientInfo_createConnectedClientInfoWithParams") }?)
}
/// Gets the client address string.
///
/// # Returns
/// - `address`: The client address string.
///
/// Calls the openDAQ C function `daqConnectedClientInfo_getAddress()`.
pub fn address(&self) -> Result<String> {
let mut __address: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqConnectedClientInfo_getAddress)(self.as_raw() as *mut _, &mut __address) };
check(__code, "daqConnectedClientInfo_getAddress")?;
Ok(unsafe { crate::marshal::take_string(__address) })
}
/// Gets the type of connected configuration connection client.
///
/// # Returns
/// - `type`: The string representation of client type ("Control", "ExclusiveControl", "ViewOnly").
///
/// Calls the openDAQ C function `daqConnectedClientInfo_getClientTypeName()`.
pub fn client_type_name(&self) -> Result<String> {
let mut __type_: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqConnectedClientInfo_getClientTypeName)(self.as_raw() as *mut _, &mut __type_) };
check(__code, "daqConnectedClientInfo_getClientTypeName")?;
Ok(unsafe { crate::marshal::take_string(__type_) })
}
/// Gets the client host name.
///
/// # Returns
/// - `host_name`: The client host name.
///
/// Calls the openDAQ C function `daqConnectedClientInfo_getHostName()`.
pub fn host_name(&self) -> Result<String> {
let mut __host_name: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqConnectedClientInfo_getHostName)(self.as_raw() as *mut _, &mut __host_name) };
check(__code, "daqConnectedClientInfo_getHostName")?;
Ok(unsafe { crate::marshal::take_string(__host_name) })
}
/// Gets the name of the protocol used by the client.
///
/// # Returns
/// - `protocol_name`: The name of the protocol (e.g., "OpenDAQNativeStreaming", "OpenDAQOPCUA", "OpenDAQLTStreaming").
///
/// Calls the openDAQ C function `daqConnectedClientInfo_getProtocolName()`.
pub fn protocol_name(&self) -> Result<String> {
let mut __protocol_name: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqConnectedClientInfo_getProtocolName)(self.as_raw() as *mut _, &mut __protocol_name) };
check(__code, "daqConnectedClientInfo_getProtocolName")?;
Ok(unsafe { crate::marshal::take_string(__protocol_name) })
}
/// Gets the type of protocol used by the client.
///
/// # Returns
/// - `type`: The type of protocol (Enumeration value reflecting protocol type: "ConfigurationAndStreaming", "Configuration", "Streaming", "Unknown").
///
/// Calls the openDAQ C function `daqConnectedClientInfo_getProtocolType()`.
pub fn protocol_type(&self) -> Result<ProtocolType> {
let mut __type_: u32 = 0;
let __code = unsafe { (crate::sys::api().daqConnectedClientInfo_getProtocolType)(self.as_raw() as *mut _, &mut __type_) };
check(__code, "daqConnectedClientInfo_getProtocolType")?;
Ok(crate::marshal::enum_out(ProtocolType::from_raw(__type_), "daqConnectedClientInfo_getProtocolType")?)
}
}
impl ConnectionStatusContainerPrivate {
/// Adds a new configuration connection status with the specified connection string and initial value.
///
/// # Parameters
/// - `connection_string`: The connection string identifying the status.
/// - `initial_value`: The initial value of the status.
///
/// Calls the openDAQ C function `daqConnectionStatusContainerPrivate_addConfigurationConnectionStatus()`.
pub fn add_configuration_connection_status(&self, connection_string: &str, initial_value: &Enumeration) -> Result<()> {
let __connection_string = crate::marshal::make_string(connection_string)?;
let __code = unsafe { (crate::sys::api().daqConnectionStatusContainerPrivate_addConfigurationConnectionStatus)(self.as_raw() as *mut _, __connection_string.as_ptr() as *mut _, initial_value.as_raw() as *mut _) };
check(__code, "daqConnectionStatusContainerPrivate_addConfigurationConnectionStatus")?;
Ok(())
}
/// Adds a new streaming connection status with the specified connection string, initial value, and streaming object.
///
/// # Parameters
/// - `connection_string`: The connection string identifying the status.
/// - `initial_value`: The initial value of the status.
/// - `streaming_object`: The streaming object associated with the status.
///
/// Calls the openDAQ C function `daqConnectionStatusContainerPrivate_addStreamingConnectionStatus()`.
pub fn add_streaming_connection_status(&self, connection_string: &str, initial_value: &Enumeration, streaming_object: &Streaming) -> Result<()> {
let __connection_string = crate::marshal::make_string(connection_string)?;
let __code = unsafe { (crate::sys::api().daqConnectionStatusContainerPrivate_addStreamingConnectionStatus)(self.as_raw() as *mut _, __connection_string.as_ptr() as *mut _, initial_value.as_raw() as *mut _, streaming_object.as_raw() as *mut _) };
check(__code, "daqConnectionStatusContainerPrivate_addStreamingConnectionStatus")?;
Ok(())
}
/// Removes a streaming connection status associated with the specified connection string.
///
/// # Parameters
/// - `connection_string`: The connection string identifying the status to remove.
///
/// Calls the openDAQ C function `daqConnectionStatusContainerPrivate_removeStreamingConnectionStatus()`.
pub fn remove_streaming_connection_status(&self, connection_string: &str) -> Result<()> {
let __connection_string = crate::marshal::make_string(connection_string)?;
let __code = unsafe { (crate::sys::api().daqConnectionStatusContainerPrivate_removeStreamingConnectionStatus)(self.as_raw() as *mut _, __connection_string.as_ptr() as *mut _) };
check(__code, "daqConnectionStatusContainerPrivate_removeStreamingConnectionStatus")?;
Ok(())
}
/// Updates the value of an existing connection status.
///
/// # Parameters
/// - `connection_string`: The connection string identifying the status to update.
/// - `value`: The new value of the status.
/// - `streaming_object`: The streaming object associated with the connection, used in triggered Core events. Set to nullptr for configuration connections.
///
/// Calls the openDAQ C function `daqConnectionStatusContainerPrivate_updateConnectionStatus()`.
pub fn update_connection_status(&self, connection_string: &str, value: &Enumeration, streaming_object: &Streaming) -> Result<()> {
let __connection_string = crate::marshal::make_string(connection_string)?;
let __code = unsafe { (crate::sys::api().daqConnectionStatusContainerPrivate_updateConnectionStatus)(self.as_raw() as *mut _, __connection_string.as_ptr() as *mut _, value.as_raw() as *mut _, streaming_object.as_raw() as *mut _) };
check(__code, "daqConnectionStatusContainerPrivate_updateConnectionStatus")?;
Ok(())
}
/// Updates the value of an existing connection status with a message.
///
/// # Parameters
/// - `connection_string`: The connection string identifying the status to update.
/// - `value`: The new value of the status.
/// - `streaming_object`: The streaming object associated with the connection, used in triggered Core events. Set to nullptr for configuration connections.
/// - `message`: The new message of the connection status. Usually describes last reconnect attempt failure.
///
/// Calls the openDAQ C function `daqConnectionStatusContainerPrivate_updateConnectionStatusWithMessage()`.
pub fn update_connection_status_with_message(&self, connection_string: &str, value: &Enumeration, streaming_object: &Streaming, message: &str) -> Result<()> {
let __connection_string = crate::marshal::make_string(connection_string)?;
let __message = crate::marshal::make_string(message)?;
let __code = unsafe { (crate::sys::api().daqConnectionStatusContainerPrivate_updateConnectionStatusWithMessage)(self.as_raw() as *mut _, __connection_string.as_ptr() as *mut _, value.as_raw() as *mut _, streaming_object.as_raw() as *mut _, __message.as_ptr() as *mut _) };
check(__code, "daqConnectionStatusContainerPrivate_updateConnectionStatusWithMessage")?;
Ok(())
}
}
impl DeviceDomain {
/// Calls the openDAQ C function `daqDeviceDomain_createDeviceDomain()`.
pub fn new(tick_resolution: Ratio, origin: &str, unit: &Unit) -> Result<DeviceDomain> {
let __tick_resolution = crate::value::ratio_to_ref(tick_resolution)?;
let __origin = crate::marshal::make_string(origin)?;
let mut __obj: *mut sys::daqDeviceDomain = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceDomain_createDeviceDomain)(&mut __obj, __tick_resolution.as_ptr() as *mut _, __origin.as_ptr() as *mut _, unit.as_raw() as *mut _) };
check(__code, "daqDeviceDomain_createDeviceDomain")?;
Ok(unsafe { crate::marshal::require_object::<DeviceDomain>(__obj as *mut _, "daqDeviceDomain_createDeviceDomain") }?)
}
/// Calls the openDAQ C function `daqDeviceDomain_createDeviceDomainWithReferenceDomainInfo()`.
pub fn with_reference_domain_info(tick_resolution: Ratio, origin: &str, unit: &Unit, reference_domain_info: &ReferenceDomainInfo) -> Result<DeviceDomain> {
let __tick_resolution = crate::value::ratio_to_ref(tick_resolution)?;
let __origin = crate::marshal::make_string(origin)?;
let mut __obj: *mut sys::daqDeviceDomain = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceDomain_createDeviceDomainWithReferenceDomainInfo)(&mut __obj, __tick_resolution.as_ptr() as *mut _, __origin.as_ptr() as *mut _, unit.as_raw() as *mut _, reference_domain_info.as_raw() as *mut _) };
check(__code, "daqDeviceDomain_createDeviceDomainWithReferenceDomainInfo")?;
Ok(unsafe { crate::marshal::require_object::<DeviceDomain>(__obj as *mut _, "daqDeviceDomain_createDeviceDomainWithReferenceDomainInfo") }?)
}
/// Gets the device's absolute origin. Most often this is a time epoch in the ISO 8601 format.
///
/// # Returns
/// - `origin`: The origin.
///
/// Calls the openDAQ C function `daqDeviceDomain_getOrigin()`.
pub fn origin(&self) -> Result<String> {
let mut __origin: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceDomain_getOrigin)(self.as_raw() as *mut _, &mut __origin) };
check(__code, "daqDeviceDomain_getOrigin")?;
Ok(unsafe { crate::marshal::take_string(__origin) })
}
/// Gets the Reference Domain Info.
///
/// # Returns
/// - `reference_domain_info`: The Reference Domain Info. If set, gives additional information about the reference domain.
///
/// Calls the openDAQ C function `daqDeviceDomain_getReferenceDomainInfo()`.
pub fn reference_domain_info(&self) -> Result<Option<ReferenceDomainInfo>> {
let mut __reference_domain_info: *mut sys::daqReferenceDomainInfo = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceDomain_getReferenceDomainInfo)(self.as_raw() as *mut _, &mut __reference_domain_info) };
check(__code, "daqDeviceDomain_getReferenceDomainInfo")?;
Ok(unsafe { crate::marshal::take_object::<ReferenceDomainInfo>(__reference_domain_info as *mut _) })
}
/// Gets domain (usually time) between two consecutive ticks. Resolution is provided in a domain unit.
///
/// # Returns
/// - `tick_resolution`: The device's resolution.
///
/// Calls the openDAQ C function `daqDeviceDomain_getTickResolution()`.
pub fn tick_resolution(&self) -> Result<Option<Ratio>> {
let mut __tick_resolution: *mut sys::daqRatio = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceDomain_getTickResolution)(self.as_raw() as *mut _, &mut __tick_resolution) };
check(__code, "daqDeviceDomain_getTickResolution")?;
Ok(unsafe { crate::value::take_ratio(__tick_resolution, "daqDeviceDomain_getTickResolution") }?)
}
/// Gets the domain unit (eg. seconds, hours, degrees...)
///
/// # Returns
/// - `unit`: The domain unit.
///
/// Calls the openDAQ C function `daqDeviceDomain_getUnit()`.
pub fn unit(&self) -> Result<Option<Unit>> {
let mut __unit: *mut sys::daqUnit = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceDomain_getUnit)(self.as_raw() as *mut _, &mut __unit) };
check(__code, "daqDeviceDomain_getUnit")?;
Ok(unsafe { crate::marshal::take_object::<Unit>(__unit as *mut _) })
}
}
impl DeviceInfoConfig {
/// Calls the openDAQ C function `daqDeviceInfoConfig_createDeviceInfoConfig()`.
pub fn new(name: &str, connection_string: &str) -> Result<DeviceInfoConfig> {
let __name = crate::marshal::make_string(name)?;
let __connection_string = crate::marshal::make_string(connection_string)?;
let mut __obj: *mut sys::daqDeviceInfoConfig = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_createDeviceInfoConfig)(&mut __obj, __name.as_ptr() as *mut _, __connection_string.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_createDeviceInfoConfig")?;
Ok(unsafe { crate::marshal::require_object::<DeviceInfoConfig>(__obj as *mut _, "daqDeviceInfoConfig_createDeviceInfoConfig") }?)
}
/// Calls the openDAQ C function `daqDeviceInfoConfig_createDeviceInfoConfigWithCustomSdkVersion()`.
pub fn with_custom_sdk_version(name: &str, connection_string: &str, sdk_version: &str) -> Result<DeviceInfoConfig> {
let __name = crate::marshal::make_string(name)?;
let __connection_string = crate::marshal::make_string(connection_string)?;
let __sdk_version = crate::marshal::make_string(sdk_version)?;
let mut __obj: *mut sys::daqDeviceInfoConfig = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_createDeviceInfoConfigWithCustomSdkVersion)(&mut __obj, __name.as_ptr() as *mut _, __connection_string.as_ptr() as *mut _, __sdk_version.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_createDeviceInfoConfigWithCustomSdkVersion")?;
Ok(unsafe { crate::marshal::require_object::<DeviceInfoConfig>(__obj as *mut _, "daqDeviceInfoConfig_createDeviceInfoConfigWithCustomSdkVersion") }?)
}
/// Sets the asset ID of the device. Represents a user writable alphanumeric character sequence uniquely identifying a component.
///
/// # Parameters
/// - `id`: The asset ID of the device. The ID is provided by the integrator or user of the device. It contains typically an identifier in a branch, use case or user specific naming scheme. This could be for example a reference to an electric scheme.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setAssetId()`.
pub fn set_asset_id(&self, id: &str) -> Result<()> {
let __id = crate::marshal::make_string(id)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setAssetId)(self.as_raw() as *mut _, __id.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setAssetId")?;
Ok(())
}
/// Sets the string representation of a connection address used to connect to the device.
///
/// # Parameters
/// - `connection_string`: The string used to connect to the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setConnectionString()`.
pub fn set_connection_string(&self, connection_string: &str) -> Result<()> {
let __connection_string = crate::marshal::make_string(connection_string)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setConnectionString)(self.as_raw() as *mut _, __connection_string.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setConnectionString")?;
Ok(())
}
/// Sets the purpose of the device. For example "TestMeasurementDevice".
///
/// # Parameters
/// - `device_class`: The class of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setDeviceClass()`.
pub fn set_device_class(&self, device_class: &str) -> Result<()> {
let __device_class = crate::marshal::make_string(device_class)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setDeviceClass)(self.as_raw() as *mut _, __device_class.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setDeviceClass")?;
Ok(())
}
/// Sets the address of the user manual. It may be a pathname in the file system or a URL (Web address)
///
/// # Parameters
/// - `device_manual`: The manual of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setDeviceManual()`.
pub fn set_device_manual(&self, device_manual: &str) -> Result<()> {
let __device_manual = crate::marshal::make_string(device_manual)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setDeviceManual)(self.as_raw() as *mut _, __device_manual.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setDeviceManual")?;
Ok(())
}
/// Sets the revision level of the device.
///
/// # Parameters
/// - `device_revision`: The device revision level.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setDeviceRevision()`.
pub fn set_device_revision(&self, device_revision: &str) -> Result<()> {
let __device_revision = crate::marshal::make_string(device_revision)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setDeviceRevision)(self.as_raw() as *mut _, __device_revision.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setDeviceRevision")?;
Ok(())
}
/// Sets a device type as an object providing type id, name, short description and default device configuration.
///
/// # Returns
/// - `device_type`: The device type object
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setDeviceType()`.
pub fn set_device_type(&self, device_type: &DeviceType) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setDeviceType)(self.as_raw() as *mut _, device_type.as_raw() as *mut _) };
check(__code, "daqDeviceInfoConfig_setDeviceType")?;
Ok(())
}
/// Sets the revision level of the hardware
///
/// # Parameters
/// - `hardware_revision`: The hardware revision of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setHardwareRevision()`.
pub fn set_hardware_revision(&self, hardware_revision: &str) -> Result<()> {
let __hardware_revision = crate::marshal::make_string(hardware_revision)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setHardwareRevision)(self.as_raw() as *mut _, __hardware_revision.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setHardwareRevision")?;
Ok(())
}
/// Sets the location of the device.
///
/// # Returns
/// - `location`: The location of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setLocation()`.
pub fn set_location(&self, location: &str) -> Result<()> {
let __location = crate::marshal::make_string(location)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setLocation)(self.as_raw() as *mut _, __location.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setLocation")?;
Ok(())
}
/// Sets the Mac address of the device.
///
/// # Parameters
/// - `mac_address`: The Mac address.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setMacAddress()`.
pub fn set_mac_address(&self, mac_address: &str) -> Result<()> {
let __mac_address = crate::marshal::make_string(mac_address)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setMacAddress)(self.as_raw() as *mut _, __mac_address.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setMacAddress")?;
Ok(())
}
/// Sets the company that manufactured the device
///
/// # Parameters
/// - `manufacturer`: The manufacturer of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setManufacturer()`.
pub fn set_manufacturer(&self, manufacturer: &str) -> Result<()> {
let __manufacturer = crate::marshal::make_string(manufacturer)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setManufacturer)(self.as_raw() as *mut _, __manufacturer.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setManufacturer")?;
Ok(())
}
/// Sets the unique identifier of the company that manufactured the device. This identifier should be a fully qualified domain name; however, it may be a GUID or similar construct that ensures global uniqueness.
///
/// # Parameters
/// - `manufacturer_uri`: The manufacturer uri of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setManufacturerUri()`.
pub fn set_manufacturer_uri(&self, manufacturer_uri: &str) -> Result<()> {
let __manufacturer_uri = crate::marshal::make_string(manufacturer_uri)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setManufacturerUri)(self.as_raw() as *mut _, __manufacturer_uri.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setManufacturerUri")?;
Ok(())
}
/// Sets the model of the device
///
/// # Parameters
/// - `model`: The model of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setModel()`.
pub fn set_model(&self, model: &str) -> Result<()> {
let __model = crate::marshal::make_string(model)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setModel)(self.as_raw() as *mut _, __model.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setModel")?;
Ok(())
}
/// Sets the name of the device
///
/// # Parameters
/// - `name`: The name of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setName()`.
pub fn set_name(&self, name: &str) -> Result<()> {
let __name = crate::marshal::make_string(name)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setName)(self.as_raw() as *mut _, __name.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setName")?;
Ok(())
}
/// Sets the Mac address of the device's parent.
///
/// # Parameters
/// - `mac_address`: The parent's Mac address.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setParentMacAddress()`.
pub fn set_parent_mac_address(&self, mac_address: &str) -> Result<()> {
let __mac_address = crate::marshal::make_string(mac_address)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setParentMacAddress)(self.as_raw() as *mut _, __mac_address.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setParentMacAddress")?;
Ok(())
}
/// Sets the platform of the device. The platform specifies whether real hardware is used or if the device is simulated.
///
/// # Parameters
/// - `platform`: The platform of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setPlatform()`.
pub fn set_platform(&self, platform: &str) -> Result<()> {
let __platform = crate::marshal::make_string(platform)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setPlatform)(self.as_raw() as *mut _, __platform.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setPlatform")?;
Ok(())
}
/// Sets the position of the device. The position specifies the position within a given system. For example in which slot or slice the device is in.
///
/// # Parameters
/// - `position`: The position of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setPosition()`.
pub fn set_position(&self, position: i64) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setPosition)(self.as_raw() as *mut _, position) };
check(__code, "daqDeviceInfoConfig_setPosition")?;
Ok(())
}
/// Sets the unique combination of numbers and letters used to identify the device.
///
/// # Parameters
/// - `product_code`: The product code of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setProductCode()`.
pub fn set_product_code(&self, product_code: &str) -> Result<()> {
let __product_code = crate::marshal::make_string(product_code)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setProductCode)(self.as_raw() as *mut _, __product_code.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setProductCode")?;
Ok(())
}
/// Sets the globally unique resource identifier provided by the manufacturer. The recommended syntax of the ProductInstanceUri is: \<ManufacturerUri\>/\<any string\> where \<any string\> is unique among all instances using the same ManufacturerUri.
///
/// # Parameters
/// - `product_instance_uri`: The product instance uri of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setProductInstanceUri()`.
pub fn set_product_instance_uri(&self, product_instance_uri: &str) -> Result<()> {
let __product_instance_uri = crate::marshal::make_string(product_instance_uri)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setProductInstanceUri)(self.as_raw() as *mut _, __product_instance_uri.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setProductInstanceUri")?;
Ok(())
}
/// Sets the incremental counter indicating the number of times the configuration data has been modified.
///
/// # Parameters
/// - `revision_counter`: The revision counter of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setRevisionCounter()`.
pub fn set_revision_counter(&self, revision_counter: i64) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setRevisionCounter)(self.as_raw() as *mut _, revision_counter) };
check(__code, "daqDeviceInfoConfig_setRevisionCounter")?;
Ok(())
}
/// Sets the serial number of the device
///
/// # Parameters
/// - `serial_number`: The serial number of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setSerialNumber()`.
pub fn set_serial_number(&self, serial_number: &str) -> Result<()> {
let __serial_number = crate::marshal::make_string(serial_number)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setSerialNumber)(self.as_raw() as *mut _, __serial_number.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setSerialNumber")?;
Ok(())
}
/// sets the revision level of the software component
///
/// # Parameters
/// - `software_revision`: The software revision of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setSoftwareRevision()`.
pub fn set_software_revision(&self, software_revision: &str) -> Result<()> {
let __software_revision = crate::marshal::make_string(software_revision)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setSoftwareRevision)(self.as_raw() as *mut _, __software_revision.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setSoftwareRevision")?;
Ok(())
}
/// Sets the system type. The system type can, for example, be LayeredSystem, StandaloneSystem, or RackSystem.
///
/// # Parameters
/// - `type`: The system type of the device.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setSystemType()`.
pub fn set_system_type(&self, type_: &str) -> Result<()> {
let __type_ = crate::marshal::make_string(type_)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setSystemType)(self.as_raw() as *mut _, __type_.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setSystemType")?;
Ok(())
}
/// Sets the system UUID that represents a unique ID of a system. All devices in a system share this UUID.
///
/// # Parameters
/// - `uuid`: The unique ID of a system.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setSystemUuid()`.
pub fn set_system_uuid(&self, uuid: &str) -> Result<()> {
let __uuid = crate::marshal::make_string(uuid)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setSystemUuid)(self.as_raw() as *mut _, __uuid.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setSystemUuid")?;
Ok(())
}
/// Sets the name of the current user of the device.
///
/// # Returns
/// - `user_name`: The location of the device. If the info object is obtained from a device that is already added (not through discovery), the username string value matches that of the device's "userName" property.
///
/// Calls the openDAQ C function `daqDeviceInfoConfig_setUserName()`.
pub fn set_user_name(&self, user_name: &str) -> Result<()> {
let __user_name = crate::marshal::make_string(user_name)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoConfig_setUserName)(self.as_raw() as *mut _, __user_name.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoConfig_setUserName")?;
Ok(())
}
}
impl DeviceInfoInternal {
/// Registers a newly connected client or re-registers a reconnected client.
///
/// # Parameters
/// - `client_number`: If provided, represents the original ordinal number of the re-registered client. If unassigned or exceeding the total number of clients ever registered (including those that were later deregistered), it is set to the incremented total count; otherwise, the client is registered under the specified number.
/// - `client_info`: The connected client information object.
///
/// # Returns
/// OPENDAQ_ERR_ALREADYEXISTS if a client with the specified number already registered.
///
/// Calls the openDAQ C function `daqDeviceInfoInternal_addConnectedClient()`.
pub fn add_connected_client(&self, client_info: &ConnectedClientInfo) -> Result<usize> {
let mut __client_number: usize = Default::default();
let __code = unsafe { (crate::sys::api().daqDeviceInfoInternal_addConnectedClient)(self.as_raw() as *mut _, &mut __client_number, client_info.as_raw() as *mut _) };
check(__code, "daqDeviceInfoInternal_addConnectedClient")?;
Ok(__client_number)
}
/// Adds a network interface to the dictionary of available interfaces.
///
/// # Parameters
/// - `network_interface`: The available interface to add.
/// - `name`: The name of available interface to add. The provided name should be unique within the device info as used as the key in the dictionary of available interfaces.
///
/// Calls the openDAQ C function `daqDeviceInfoInternal_addNetworkInteface()`.
pub fn add_network_inteface(&self, name: &str, network_interface: &NetworkInterface) -> Result<()> {
let __name = crate::marshal::make_string(name)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoInternal_addNetworkInteface)(self.as_raw() as *mut _, __name.as_ptr() as *mut _, network_interface.as_raw() as *mut _) };
check(__code, "daqDeviceInfoInternal_addNetworkInteface")?;
Ok(())
}
/// Adds a protocol to the list of supported capabilities.
///
/// # Parameters
/// - `server_capability`: The supported protocol to add.
///
/// Calls the openDAQ C function `daqDeviceInfoInternal_addServerCapability()`.
pub fn add_server_capability(&self, server_capability: &ServerCapability) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDeviceInfoInternal_addServerCapability)(self.as_raw() as *mut _, server_capability.as_raw() as *mut _) };
check(__code, "daqDeviceInfoInternal_addServerCapability")?;
Ok(())
}
/// Removes all server streaming capabilities from the list of supported capabilities.
///
/// Calls the openDAQ C function `daqDeviceInfoInternal_clearServerStreamingCapabilities()`.
pub fn clear_server_streaming_capabilities(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDeviceInfoInternal_clearServerStreamingCapabilities)(self.as_raw() as *mut _) };
check(__code, "daqDeviceInfoInternal_clearServerStreamingCapabilities")?;
Ok(())
}
/// Unregisters a previously connected client upon disconnection.
///
/// # Parameters
/// - `client_number`: The number identifying the disconnected client.
///
/// Calls the openDAQ C function `daqDeviceInfoInternal_removeConnectedClient()`.
pub fn remove_connected_client(&self, client_number: usize) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDeviceInfoInternal_removeConnectedClient)(self.as_raw() as *mut _, client_number) };
check(__code, "daqDeviceInfoInternal_removeConnectedClient")?;
Ok(())
}
/// Removes a protocol from the list of supported capabilities.
///
/// # Parameters
/// - `protocol_id`: The ID of the protocol to remove.
///
/// Calls the openDAQ C function `daqDeviceInfoInternal_removeServerCapability()`.
pub fn remove_server_capability(&self, protocol_id: &str) -> Result<()> {
let __protocol_id = crate::marshal::make_string(protocol_id)?;
let __code = unsafe { (crate::sys::api().daqDeviceInfoInternal_removeServerCapability)(self.as_raw() as *mut _, __protocol_id.as_ptr() as *mut _) };
check(__code, "daqDeviceInfoInternal_removeServerCapability")?;
Ok(())
}
}
impl DeviceInfo {
/// Gets the asset ID of the device. Represents a user writable alphanumeric character sequence uniquely identifying a component.
///
/// # Returns
/// - `id`: The asset ID of the device. The ID is provided by the integrator or user of the device. It contains typically an identifier in a branch, use case or user specific naming scheme. This could be for example a reference to an electric scheme. The ID must be a string representation of an Int32 number.
///
/// Calls the openDAQ C function `daqDeviceInfo_getAssetId()`.
pub fn asset_id(&self) -> Result<String> {
let mut __id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getAssetId)(self.as_raw() as *mut _, &mut __id) };
check(__code, "daqDeviceInfo_getAssetId")?;
Ok(unsafe { crate::marshal::take_string(__id) })
}
/// Retrieves the configuration connection information of the server to which the client is connected.
///
/// # Returns
/// - `connection_info`: The server capability with the configuration connection information. This method returns the configuration connection information of the server to which the client is connected. If the connection to the server is not established, the fields of the server capability object are empty.
///
/// Calls the openDAQ C function `daqDeviceInfo_getConfigurationConnectionInfo()`.
pub fn configuration_connection_info(&self) -> Result<Option<ServerCapability>> {
let mut __connection_info: *mut sys::daqServerCapability = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getConfigurationConnectionInfo)(self.as_raw() as *mut _, &mut __connection_info) };
check(__code, "daqDeviceInfo_getConfigurationConnectionInfo")?;
Ok(unsafe { crate::marshal::take_object::<ServerCapability>(__connection_info as *mut _) })
}
/// Gets the list of connected client information objects.
///
/// # Returns
/// - `connected_clients_info`: The list of connected client information objects.
///
/// Calls the openDAQ C function `daqDeviceInfo_getConnectedClientsInfo()`.
pub fn connected_clients_info(&self) -> Result<Vec<ConnectedClientInfo>> {
let mut __connected_clients_info: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getConnectedClientsInfo)(self.as_raw() as *mut _, &mut __connected_clients_info) };
check(__code, "daqDeviceInfo_getConnectedClientsInfo")?;
Ok(unsafe { crate::marshal::take_list::<ConnectedClientInfo>(__connected_clients_info as *mut _, "daqDeviceInfo_getConnectedClientsInfo") }?)
}
/// Gets the string representation of a connection address used to connect to the device.
///
/// # Returns
/// - `connection_string`: The string used to connect to the device.
///
/// Calls the openDAQ C function `daqDeviceInfo_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().daqDeviceInfo_getConnectionString)(self.as_raw() as *mut _, &mut __connection_string) };
check(__code, "daqDeviceInfo_getConnectionString")?;
Ok(unsafe { crate::marshal::take_string(__connection_string) })
}
/// Gets the list of property names that are not in the default set of Device info properties. Default properties are all info properties that have a corresponding getter method.
///
/// # Returns
/// - `custom_info_names`: The list of names of custom properties.
///
/// Calls the openDAQ C function `daqDeviceInfo_getCustomInfoPropertyNames()`.
pub fn custom_info_property_names(&self) -> Result<Vec<String>> {
let mut __custom_info_names: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getCustomInfoPropertyNames)(self.as_raw() as *mut _, &mut __custom_info_names) };
check(__code, "daqDeviceInfo_getCustomInfoPropertyNames")?;
Ok(unsafe { crate::marshal::take_list::<String>(__custom_info_names as *mut _, "daqDeviceInfo_getCustomInfoPropertyNames") }?)
}
/// Gets the purpose of the device. For example "TestMeasurementDevice".
///
/// # Returns
/// - `device_class`: The class of the device.
///
/// Calls the openDAQ C function `daqDeviceInfo_getDeviceClass()`.
pub fn device_class(&self) -> Result<String> {
let mut __device_class: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getDeviceClass)(self.as_raw() as *mut _, &mut __device_class) };
check(__code, "daqDeviceInfo_getDeviceClass")?;
Ok(unsafe { crate::marshal::take_string(__device_class) })
}
/// Gets the address of the user manual. It may be a pathname in the file system or a URL (Web address)
///
/// # Returns
/// - `device_manual`: The manual of the device.
///
/// Calls the openDAQ C function `daqDeviceInfo_getDeviceManual()`.
pub fn device_manual(&self) -> Result<String> {
let mut __device_manual: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getDeviceManual)(self.as_raw() as *mut _, &mut __device_manual) };
check(__code, "daqDeviceInfo_getDeviceManual")?;
Ok(unsafe { crate::marshal::take_string(__device_manual) })
}
/// Gets the revision level of the device.
///
/// # Returns
/// - `device_revision`: The device revision level.
///
/// Calls the openDAQ C function `daqDeviceInfo_getDeviceRevision()`.
pub fn device_revision(&self) -> Result<String> {
let mut __device_revision: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getDeviceRevision)(self.as_raw() as *mut _, &mut __device_revision) };
check(__code, "daqDeviceInfo_getDeviceRevision")?;
Ok(unsafe { crate::marshal::take_string(__device_revision) })
}
/// Gets a device type as an object providing type id, name, short description and default device configuration. By using default config object as a starting point, users can easily modify the preset properties to tailor the configuration of the client device accordingly.
///
/// # Returns
/// - `device_type`: The device type object
///
/// Calls the openDAQ C function `daqDeviceInfo_getDeviceType()`.
pub fn device_type(&self) -> Result<Option<DeviceType>> {
let mut __device_type: *mut sys::daqDeviceType = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getDeviceType)(self.as_raw() as *mut _, &mut __device_type) };
check(__code, "daqDeviceInfo_getDeviceType")?;
Ok(unsafe { crate::marshal::take_object::<DeviceType>(__device_type as *mut _) })
}
/// Gets the revision level of the hardware.
///
/// # Returns
/// - `hardware_revision`: The hardware revision of the device.
///
/// Calls the openDAQ C function `daqDeviceInfo_getHardwareRevision()`.
pub fn hardware_revision(&self) -> Result<String> {
let mut __hardware_revision: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getHardwareRevision)(self.as_raw() as *mut _, &mut __hardware_revision) };
check(__code, "daqDeviceInfo_getHardwareRevision")?;
Ok(unsafe { crate::marshal::take_string(__hardware_revision) })
}
/// Gets the location of the device.
///
/// # Returns
/// - `location`: The location of the device. If the info object is obtained from a device that is already added (not through discovery), the location string value matches that of the device's "location" property.
///
/// Calls the openDAQ C function `daqDeviceInfo_getLocation()`.
pub fn location(&self) -> Result<String> {
let mut __location: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getLocation)(self.as_raw() as *mut _, &mut __location) };
check(__code, "daqDeviceInfo_getLocation")?;
Ok(unsafe { crate::marshal::take_string(__location) })
}
/// Gets the Mac address of the device.
///
/// # Returns
/// - `mac_address`: The Mac address.
///
/// Calls the openDAQ C function `daqDeviceInfo_getMacAddress()`.
pub fn mac_address(&self) -> Result<String> {
let mut __mac_address: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getMacAddress)(self.as_raw() as *mut _, &mut __mac_address) };
check(__code, "daqDeviceInfo_getMacAddress")?;
Ok(unsafe { crate::marshal::take_string(__mac_address) })
}
/// Gets the company that manufactured the device
///
/// # Returns
/// - `manufacturer`: The manufacturer of the device.
///
/// Calls the openDAQ C function `daqDeviceInfo_getManufacturer()`.
pub fn manufacturer(&self) -> Result<String> {
let mut __manufacturer: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getManufacturer)(self.as_raw() as *mut _, &mut __manufacturer) };
check(__code, "daqDeviceInfo_getManufacturer")?;
Ok(unsafe { crate::marshal::take_string(__manufacturer) })
}
/// Gets the unique identifier of the company that manufactured the device This identifier should be a fully qualified domain name; however, it may be a GUID or similar construct that ensures global uniqueness.
///
/// # Returns
/// - `manufacturer_uri`: The manufacturer uri of the device.
///
/// Calls the openDAQ C function `daqDeviceInfo_getManufacturerUri()`.
pub fn manufacturer_uri(&self) -> Result<String> {
let mut __manufacturer_uri: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getManufacturerUri)(self.as_raw() as *mut _, &mut __manufacturer_uri) };
check(__code, "daqDeviceInfo_getManufacturerUri")?;
Ok(unsafe { crate::marshal::take_string(__manufacturer_uri) })
}
/// Gets the model of the device
///
/// # Returns
/// - `model`: The model of the device.
///
/// Calls the openDAQ C function `daqDeviceInfo_getModel()`.
pub fn model(&self) -> Result<String> {
let mut __model: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getModel)(self.as_raw() as *mut _, &mut __model) };
check(__code, "daqDeviceInfo_getModel")?;
Ok(unsafe { crate::marshal::take_string(__model) })
}
/// Gets the name of the device
///
/// # Returns
/// - `name`: The name of the device. If the info object is obtained from a device that is already added (not through discovery), the name string value matches that of the device's "Name" attribute.
///
/// Calls the openDAQ C function `daqDeviceInfo_getName()`.
pub fn name(&self) -> Result<String> {
let mut __name: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getName)(self.as_raw() as *mut _, &mut __name) };
check(__code, "daqDeviceInfo_getName")?;
Ok(unsafe { crate::marshal::take_string(__name) })
}
/// Gets the network interface with a given name.
///
/// # Parameters
/// - `interface_name`: The name of the device network interface.
///
/// # Returns
/// - `intf`: The device network interface with the given name.
///
/// # Errors
/// - `OPENDAQ_ERR_NOTFOUND`: if the network interface with the given name is not available.
///
/// Calls the openDAQ C function `daqDeviceInfo_getNetworkInterface()`.
pub fn network_interface(&self, interface_name: &str) -> Result<Option<NetworkInterface>> {
let __interface_name = crate::marshal::make_string(interface_name)?;
let mut __intf: *mut sys::daqNetworkInterface = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getNetworkInterface)(self.as_raw() as *mut _, __interface_name.as_ptr() as *mut _, &mut __intf) };
check(__code, "daqDeviceInfo_getNetworkInterface")?;
Ok(unsafe { crate::marshal::take_object::<NetworkInterface>(__intf as *mut _) })
}
/// Gets the dictionary of network interfaces stored in device info.
///
/// # Returns
/// - `interfaces`: The dictionary of device network interfaces. Obtained dictionary contains INetworkInterface objects, representing the available network interfaces and allowing to manage their configurations. The dictionary key corresponds to interface identifier (e.g. "eth0").
///
/// Calls the openDAQ C function `daqDeviceInfo_getNetworkInterfaces()`.
pub fn network_interfaces(&self) -> Result<std::collections::HashMap<String, NetworkInterface>> {
let mut __interfaces: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getNetworkInterfaces)(self.as_raw() as *mut _, &mut __interfaces) };
check(__code, "daqDeviceInfo_getNetworkInterfaces")?;
Ok(unsafe { crate::marshal::take_dict::<String, NetworkInterface>(__interfaces as *mut _, "daqDeviceInfo_getNetworkInterfaces") }?)
}
/// Gets the Mac address of the device's parent.
///
/// # Returns
/// - `mac_address`: The parent's Mac address.
///
/// Calls the openDAQ C function `daqDeviceInfo_getParentMacAddress()`.
pub fn parent_mac_address(&self) -> Result<String> {
let mut __mac_address: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getParentMacAddress)(self.as_raw() as *mut _, &mut __mac_address) };
check(__code, "daqDeviceInfo_getParentMacAddress")?;
Ok(unsafe { crate::marshal::take_string(__mac_address) })
}
/// Gets the platform of the device. The platform specifies whether real hardware is used or if the device is simulated.
///
/// # Returns
/// - `platform`: The platform of the device.
///
/// Calls the openDAQ C function `daqDeviceInfo_getPlatform()`.
pub fn platform(&self) -> Result<String> {
let mut __platform: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getPlatform)(self.as_raw() as *mut _, &mut __platform) };
check(__code, "daqDeviceInfo_getPlatform")?;
Ok(unsafe { crate::marshal::take_string(__platform) })
}
/// Gets the position of the device. The position specifies the position within a given system. For example in which slot or slice the device is in.
///
/// # Returns
/// - `position`: The position of the device. The Position should be a positive integer in the range supported by the UInt16 data type.
///
/// Calls the openDAQ C function `daqDeviceInfo_getPosition()`.
pub fn position(&self) -> Result<i64> {
let mut __position: i64 = Default::default();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getPosition)(self.as_raw() as *mut _, &mut __position) };
check(__code, "daqDeviceInfo_getPosition")?;
Ok(__position)
}
/// Gets the unique combination of numbers and letters used to identify the device.
///
/// # Returns
/// - `product_code`: The product code of the device.
///
/// Calls the openDAQ C function `daqDeviceInfo_getProductCode()`.
pub fn product_code(&self) -> Result<String> {
let mut __product_code: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getProductCode)(self.as_raw() as *mut _, &mut __product_code) };
check(__code, "daqDeviceInfo_getProductCode")?;
Ok(unsafe { crate::marshal::take_string(__product_code) })
}
/// Gets the globally unique resource identifier provided by the manufacturer. The recommended syntax of the ProductInstanceUri is: \<ManufacturerUri\>/\<any string\> where \<any string\> is unique among all instances using the same ManufacturerUri.
///
/// # Returns
/// - `product_instance_uri`: The product instance uri of the device.
///
/// Calls the openDAQ C function `daqDeviceInfo_getProductInstanceUri()`.
pub fn product_instance_uri(&self) -> Result<String> {
let mut __product_instance_uri: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getProductInstanceUri)(self.as_raw() as *mut _, &mut __product_instance_uri) };
check(__code, "daqDeviceInfo_getProductInstanceUri")?;
Ok(unsafe { crate::marshal::take_string(__product_instance_uri) })
}
/// Gets the incremental counter indicating the number of times the configuration data has been modified.
///
/// # Returns
/// - `revision_counter`: The revision counter of the device.
///
/// Calls the openDAQ C function `daqDeviceInfo_getRevisionCounter()`.
pub fn revision_counter(&self) -> Result<i64> {
let mut __revision_counter: i64 = Default::default();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getRevisionCounter)(self.as_raw() as *mut _, &mut __revision_counter) };
check(__code, "daqDeviceInfo_getRevisionCounter")?;
Ok(__revision_counter)
}
/// Gets the version of the SDK used to build said device. Can be empty if the device does not use the SDK as its firmware/is implemented at a protocol-level.
///
/// # Returns
/// - `version`: The SDK version.
///
/// Calls the openDAQ C function `daqDeviceInfo_getSdkVersion()`.
pub fn sdk_version(&self) -> Result<String> {
let mut __version: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getSdkVersion)(self.as_raw() as *mut _, &mut __version) };
check(__code, "daqDeviceInfo_getSdkVersion")?;
Ok(unsafe { crate::marshal::take_string(__version) })
}
/// Gets the unique production number provided by the manufacturer
///
/// # Returns
/// - `serial_number`: The serial number of the device.
///
/// Calls the openDAQ C function `daqDeviceInfo_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().daqDeviceInfo_getSerialNumber)(self.as_raw() as *mut _, &mut __serial_number) };
check(__code, "daqDeviceInfo_getSerialNumber")?;
Ok(unsafe { crate::marshal::take_string(__serial_number) })
}
/// Gets the list of server capabilities stored in device info.
///
/// # Returns
/// - `server_capabilities`: The list of device supported protocols (List containing IServerCapability objects, representing the supported protocols along with their properties).
///
/// Calls the openDAQ C function `daqDeviceInfo_getServerCapabilities()`.
pub fn server_capabilities(&self) -> Result<Vec<ServerCapability>> {
let mut __server_capabilities: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getServerCapabilities)(self.as_raw() as *mut _, &mut __server_capabilities) };
check(__code, "daqDeviceInfo_getServerCapabilities")?;
Ok(unsafe { crate::marshal::take_list::<ServerCapability>(__server_capabilities as *mut _, "daqDeviceInfo_getServerCapabilities") }?)
}
/// Gets the server capability with a given ID.
///
/// # Parameters
/// - `protocol_id`: The ID of the server capability protocol.
///
/// # Returns
/// - `server_capability`: The server capability with the given ID.
///
/// # Errors
/// - `OPENDAQ_ERR_NOTFOUND`: if the server capability is not available.
///
/// Calls the openDAQ C function `daqDeviceInfo_getServerCapability()`.
pub fn server_capability(&self, protocol_id: &str) -> Result<Option<ServerCapability>> {
let __protocol_id = crate::marshal::make_string(protocol_id)?;
let mut __server_capability: *mut sys::daqServerCapability = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getServerCapability)(self.as_raw() as *mut _, __protocol_id.as_ptr() as *mut _, &mut __server_capability) };
check(__code, "daqDeviceInfo_getServerCapability")?;
Ok(unsafe { crate::marshal::take_object::<ServerCapability>(__server_capability as *mut _) })
}
/// Gets the revision level of the software component.
///
/// # Returns
/// - `software_revision`: The software revision of the device.
///
/// Calls the openDAQ C function `daqDeviceInfo_getSoftwareRevision()`.
pub fn software_revision(&self) -> Result<String> {
let mut __software_revision: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getSoftwareRevision)(self.as_raw() as *mut _, &mut __software_revision) };
check(__code, "daqDeviceInfo_getSoftwareRevision")?;
Ok(unsafe { crate::marshal::take_string(__software_revision) })
}
/// Gets the system type. The system type can, for example, be LayeredSystem, StandaloneSystem, or RackSystem.
///
/// # Returns
/// - `type`: The system type of the device.
///
/// Calls the openDAQ C function `daqDeviceInfo_getSystemType()`.
pub fn system_type(&self) -> Result<String> {
let mut __type_: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getSystemType)(self.as_raw() as *mut _, &mut __type_) };
check(__code, "daqDeviceInfo_getSystemType")?;
Ok(unsafe { crate::marshal::take_string(__type_) })
}
/// Gets the system UUID that represents a unique ID of a system. All devices in a system share this UUID.
///
/// # Returns
/// - `uuid`: The unique ID of a system.
///
/// Calls the openDAQ C function `daqDeviceInfo_getSystemUuid()`.
pub fn system_uuid(&self) -> Result<String> {
let mut __uuid: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getSystemUuid)(self.as_raw() as *mut _, &mut __uuid) };
check(__code, "daqDeviceInfo_getSystemUuid")?;
Ok(unsafe { crate::marshal::take_string(__uuid) })
}
/// Gets the name of the current user of the device.
///
/// # Returns
/// - `user_name`: The name of the current user of the device. If the info object is obtained from a device that is already added (not through discovery), the username string value matches that of the device's "userName" property.
///
/// Calls the openDAQ C function `daqDeviceInfo_getUserName()`.
pub fn user_name(&self) -> Result<String> {
let mut __user_name: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceInfo_getUserName)(self.as_raw() as *mut _, &mut __user_name) };
check(__code, "daqDeviceInfo_getUserName")?;
Ok(unsafe { crate::marshal::take_string(__user_name) })
}
/// Checks whether the server capability with a given ID is available.
///
/// # Parameters
/// - `protocol_id`: The ID of the server capability protocol.
///
/// # Returns
/// - `has_capability`: True if the protocol is available; False otherwise.
///
/// Calls the openDAQ C function `daqDeviceInfo_hasServerCapability()`.
pub fn has_server_capability(&self, protocol_id: &str) -> Result<bool> {
let __protocol_id = crate::marshal::make_string(protocol_id)?;
let mut __has_capability: u8 = 0;
let __code = unsafe { (crate::sys::api().daqDeviceInfo_hasServerCapability)(self.as_raw() as *mut _, __protocol_id.as_ptr() as *mut _, &mut __has_capability) };
check(__code, "daqDeviceInfo_hasServerCapability")?;
Ok(__has_capability != 0)
}
}
impl DeviceNetworkConfig {
/// Checks if the device supports network configuration management.
///
/// # Returns
/// - `enabled`: A flag indicating whether the device supports managing network configurations.
///
/// Calls the openDAQ C function `daqDeviceNetworkConfig_getNetworkConfigurationEnabled()`.
pub fn network_configuration_enabled(&self) -> Result<bool> {
let mut __enabled: u8 = 0;
let __code = unsafe { (crate::sys::api().daqDeviceNetworkConfig_getNetworkConfigurationEnabled)(self.as_raw() as *mut _, &mut __enabled) };
check(__code, "daqDeviceNetworkConfig_getNetworkConfigurationEnabled")?;
Ok(__enabled != 0)
}
/// Gets the names of all configurable network interfaces on the device.
///
/// # Returns
/// - `iface_names`: A list containing the names of network interface adapters available for configuration.
///
/// # Errors
/// - `OPENDAQ_ERR_NOTIMPLEMENTED`: if the device does not support network configuration management.
///
/// Calls the openDAQ C function `daqDeviceNetworkConfig_getNetworkInterfaceNames()`.
pub fn network_interface_names(&self) -> Result<Vec<String>> {
let mut __iface_names: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceNetworkConfig_getNetworkInterfaceNames)(self.as_raw() as *mut _, &mut __iface_names) };
check(__code, "daqDeviceNetworkConfig_getNetworkInterfaceNames")?;
Ok(unsafe { crate::marshal::take_list::<String>(__iface_names as *mut _, "daqDeviceNetworkConfig_getNetworkInterfaceNames") }?)
}
/// Retrieves the currently active configuration of a specified network interface.
///
/// # Parameters
/// - `iface_name`: The name of the network interface adapter as registered in the operating system. Typically, this is a short symbolic identifier for the adapter, e.g. "eth0".
///
/// # Returns
/// - `config`: The property object containing the active configuration of the network interface.
///
/// # Errors
/// - `OPENDAQ_ERR_NOTIMPLEMENTED`: if the device does not support retrieving network configurations.
///
/// Calls the openDAQ C function `daqDeviceNetworkConfig_retrieveNetworkConfiguration()`.
pub fn retrieve_network_configuration(&self, iface_name: &str) -> Result<Option<PropertyObject>> {
let __iface_name = crate::marshal::make_string(iface_name)?;
let mut __config: *mut sys::daqPropertyObject = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceNetworkConfig_retrieveNetworkConfiguration)(self.as_raw() as *mut _, __iface_name.as_ptr() as *mut _, &mut __config) };
check(__code, "daqDeviceNetworkConfig_retrieveNetworkConfiguration")?;
Ok(unsafe { crate::marshal::take_object::<PropertyObject>(__config as *mut _) })
}
/// Submits a new configuration parameters to a specified network interface.
///
/// # Parameters
/// - `iface_name`: The name of the network interface adapter as registered in the operating system. Typically, this is a short symbolic identifier for the adapter, e.g. "eth0".
/// - `config`: The property object with new configuration parameters to submit. The format of the properties matches that used in INetworkInterface.
///
/// # Errors
/// - `OPENDAQ_ERR_NOTIMPLEMENTED`: if the device does not support network configuration management.
///
/// Calls the openDAQ C function `daqDeviceNetworkConfig_submitNetworkConfiguration()`.
pub fn submit_network_configuration(&self, iface_name: &str, config: &PropertyObject) -> Result<()> {
let __iface_name = crate::marshal::make_string(iface_name)?;
let __code = unsafe { (crate::sys::api().daqDeviceNetworkConfig_submitNetworkConfiguration)(self.as_raw() as *mut _, __iface_name.as_ptr() as *mut _, config.as_raw() as *mut _) };
check(__code, "daqDeviceNetworkConfig_submitNetworkConfiguration")?;
Ok(())
}
}
impl DevicePrivate {
/// Calls the openDAQ C function `daqDevicePrivate_forceUnlock()`.
pub fn force_unlock(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDevicePrivate_forceUnlock)(self.as_raw() as *mut _) };
check(__code, "daqDevicePrivate_forceUnlock")?;
Ok(())
}
/// Calls the openDAQ C function `daqDevicePrivate_getDeviceConfig()`.
pub fn device_config(&self) -> Result<Option<PropertyObject>> {
let mut __config: *mut sys::daqPropertyObject = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevicePrivate_getDeviceConfig)(self.as_raw() as *mut _, &mut __config) };
check(__code, "daqDevicePrivate_getDeviceConfig")?;
Ok(unsafe { crate::marshal::take_object::<PropertyObject>(__config as *mut _) })
}
/// Calls the openDAQ C function `daqDevicePrivate_isLockedInternal()`.
pub fn is_locked_internal(&self) -> Result<bool> {
let mut __locked: u8 = 0;
let __code = unsafe { (crate::sys::api().daqDevicePrivate_isLockedInternal)(self.as_raw() as *mut _, &mut __locked) };
check(__code, "daqDevicePrivate_isLockedInternal")?;
Ok(__locked != 0)
}
/// Calls the openDAQ C function `daqDevicePrivate_lock()`.
pub fn lock(&self, user: &User) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDevicePrivate_lock)(self.as_raw() as *mut _, user.as_raw() as *mut _) };
check(__code, "daqDevicePrivate_lock")?;
Ok(())
}
/// Calls the openDAQ C function `daqDevicePrivate_setAsRoot()`.
pub fn set_as_root(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDevicePrivate_setAsRoot)(self.as_raw() as *mut _) };
check(__code, "daqDevicePrivate_setAsRoot")?;
Ok(())
}
/// Calls the openDAQ C function `daqDevicePrivate_setDeviceConfig()`.
pub fn set_device_config(&self, config: &PropertyObject) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDevicePrivate_setDeviceConfig)(self.as_raw() as *mut _, config.as_raw() as *mut _) };
check(__code, "daqDevicePrivate_setDeviceConfig")?;
Ok(())
}
/// Calls the openDAQ C function `daqDevicePrivate_unlock()`.
pub fn unlock(&self, user: &User) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDevicePrivate_unlock)(self.as_raw() as *mut _, user.as_raw() as *mut _) };
check(__code, "daqDevicePrivate_unlock")?;
Ok(())
}
}
impl DeviceType {
/// Creates a Device type object, with the id, name, description and optional defaultConfig.
///
/// # Parameters
/// - `id`: The unique type ID of the device.
/// - `name`: The name of the device type.
/// - `description`: A short description of the device type.
/// - `default_config`: The property object, to be cloned and returned, each time user creates default configuration object. This way each instance of the device has its own configuration object.
///
/// Calls the openDAQ C function `daqDeviceType_createDeviceType()`.
pub fn new(id: &str, name: &str, description: &str, default_config: &PropertyObject, prefix: &str) -> Result<DeviceType> {
let __id = crate::marshal::make_string(id)?;
let __name = crate::marshal::make_string(name)?;
let __description = crate::marshal::make_string(description)?;
let __prefix = crate::marshal::make_string(prefix)?;
let mut __obj: *mut sys::daqDeviceType = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDeviceType_createDeviceType)(&mut __obj, __id.as_ptr() as *mut _, __name.as_ptr() as *mut _, __description.as_ptr() as *mut _, default_config.as_raw() as *mut _, __prefix.as_ptr() as *mut _) };
check(__code, "daqDeviceType_createDeviceType")?;
Ok(unsafe { crate::marshal::require_object::<DeviceType>(__obj as *mut _, "daqDeviceType_createDeviceType") }?)
}
/// Calls the openDAQ C function `daqDeviceType_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().daqDeviceType_getConnectionStringPrefix)(self.as_raw() as *mut _, &mut __prefix) };
check(__code, "daqDeviceType_getConnectionStringPrefix")?;
Ok(unsafe { crate::marshal::take_string(__prefix) })
}
}
impl Device {
/// Connects to a device at the given connection string and returns it.
///
/// # Parameters
/// - `connection_string`: The connection string containing the address of the device. In example an IPv4/IPv6 address. The connection string can be found in the Device Info objects returned by `getAvailableDevices`.
/// - `config`: A config object to configure a client device. This object can contain properties like max sample rate, port to use for 3rd party communication, number of channels to generate, or other device specific settings. Can be created from its corresponding Device type object. In case of a null value, it will use the default configuration.
///
/// # Returns
/// - `device`: The added device.
///
/// Calls the openDAQ C function `daqDevice_addDevice()`.
pub fn add_device(&self, connection_string: &str) -> Result<Option<Device>> {
let __connection_string = crate::marshal::make_string(connection_string)?;
let mut __device: *mut sys::daqDevice = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_addDevice)(self.as_raw() as *mut _, &mut __device, __connection_string.as_ptr() as *mut _, std::ptr::null_mut()) };
check(__code, "daqDevice_addDevice")?;
Ok(unsafe { crate::marshal::take_object::<Device>(__device as *mut _) })
}
/// Connects to a device at the given connection string and returns it.
///
/// # Parameters
/// - `connection_string`: The connection string containing the address of the device. In example an IPv4/IPv6 address. The connection string can be found in the Device Info objects returned by `getAvailableDevices`.
/// - `config`: A config object to configure a client device. This object can contain properties like max sample rate, port to use for 3rd party communication, number of channels to generate, or other device specific settings. Can be created from its corresponding Device type object. In case of a null value, it will use the default configuration.
///
/// # Returns
/// - `device`: The added device.
///
/// Calls the openDAQ C function `daqDevice_addDevice()`.
pub fn add_device_with(&self, connection_string: &str, config: Option<&PropertyObject>) -> Result<Option<Device>> {
let __connection_string = crate::marshal::make_string(connection_string)?;
let mut __device: *mut sys::daqDevice = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_addDevice)(self.as_raw() as *mut _, &mut __device, __connection_string.as_ptr() as *mut _, config.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqDevice_addDevice")?;
Ok(unsafe { crate::marshal::take_object::<Device>(__device as *mut _) })
}
/// Connects to multiple devices in parallel using the provided connection strings and returns the connected devices. Each connection is established concurrently to improve performance when handling multiple devices. The additions, in turn, are performed sequentially in the order specified by connectionArgs.
///
/// # Parameters
/// - `connection_args`: A dictionary where each key is a connection string identifying the target device (e.g., IPv4/IPv6), and each value is a configuration object that customizes the connection. The configuration may specify parameters such as maximum sample rate, communication port, number of channels, or other device-specific settings. A `nullptr` value indicates that the default configuration should be used.
/// - `err_codes`: An optional dictionary used to populate error codes for failed connection or addition attempts. For each failed attempt, the key is the connection string, and the value contains the error code.
/// - `error_infos`: An optional dictionary used to populate detailed error info for failed connection or addition attempts. For each failed attempt, the key is the connection string, and the value contains the error info object.
///
/// # Returns
/// OPENDAQ_PARTIAL_SUCCESS if at least one device was successfully created and added, but not all of them; OPENDAQ_ERR_GENERALERROR if no devices were created or added; OPENDAQ_IGNORED if adding the devices from modules is not allowed within the device.
/// - `devices`: A dictionary that maps each connection string to the corresponding added device object. If a device connection or addition attempt fails, the value will be `nullptr` for that entry.
///
/// Calls the openDAQ C function `daqDevice_addDevices()`.
pub fn add_devices(&self, connection_args: impl Into<Value>) -> Result<std::collections::HashMap<String, Device>> {
let __connection_args = crate::value::to_daq(&connection_args.into())?;
let mut __devices: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_addDevices)(self.as_raw() as *mut _, &mut __devices, crate::value::opt_ref_ptr(&__connection_args) as *mut _, std::ptr::null_mut(), std::ptr::null_mut()) };
check(__code, "daqDevice_addDevices")?;
Ok(unsafe { crate::marshal::take_dict::<String, Device>(__devices as *mut _, "daqDevice_addDevices") }?)
}
/// Connects to multiple devices in parallel using the provided connection strings and returns the connected devices. Each connection is established concurrently to improve performance when handling multiple devices. The additions, in turn, are performed sequentially in the order specified by connectionArgs.
///
/// # Parameters
/// - `connection_args`: A dictionary where each key is a connection string identifying the target device (e.g., IPv4/IPv6), and each value is a configuration object that customizes the connection. The configuration may specify parameters such as maximum sample rate, communication port, number of channels, or other device-specific settings. A `nullptr` value indicates that the default configuration should be used.
/// - `err_codes`: An optional dictionary used to populate error codes for failed connection or addition attempts. For each failed attempt, the key is the connection string, and the value contains the error code.
/// - `error_infos`: An optional dictionary used to populate detailed error info for failed connection or addition attempts. For each failed attempt, the key is the connection string, and the value contains the error info object.
///
/// # Returns
/// OPENDAQ_PARTIAL_SUCCESS if at least one device was successfully created and added, but not all of them; OPENDAQ_ERR_GENERALERROR if no devices were created or added; OPENDAQ_IGNORED if adding the devices from modules is not allowed within the device.
/// - `devices`: A dictionary that maps each connection string to the corresponding added device object. If a device connection or addition attempt fails, the value will be `nullptr` for that entry.
///
/// Calls the openDAQ C function `daqDevice_addDevices()`.
pub fn add_devices_with(&self, connection_args: impl Into<Value>, err_codes: impl Into<Value>, error_infos: impl Into<Value>) -> Result<std::collections::HashMap<String, Device>> {
let __connection_args = crate::value::to_daq(&connection_args.into())?;
let __err_codes = crate::value::to_daq(&err_codes.into())?;
let __error_infos = crate::value::to_daq(&error_infos.into())?;
let mut __devices: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_addDevices)(self.as_raw() as *mut _, &mut __devices, crate::value::opt_ref_ptr(&__connection_args) as *mut _, crate::value::opt_ref_ptr(&__err_codes) as *mut _, crate::value::opt_ref_ptr(&__error_infos) as *mut _) };
check(__code, "daqDevice_addDevices")?;
Ok(unsafe { crate::marshal::take_dict::<String, Device>(__devices as *mut _, "daqDevice_addDevices") }?)
}
/// Creates and adds a function block to the device with the provided unique ID and returns it.
///
/// # Parameters
/// - `type_id`: The unique ID of the function block. Can be obtained from its corresponding Function Block Info object.
/// - `config`: A config object to configure a function block with custom settings specific to that function block type.
///
/// # Returns
/// - `function_block`: The added function block.
///
/// Calls the openDAQ C function `daqDevice_addFunctionBlock()`.
pub fn add_function_block(&self, type_id: &str) -> Result<Option<FunctionBlock>> {
let __type_id = crate::marshal::make_string(type_id)?;
let mut __function_block: *mut sys::daqFunctionBlock = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_addFunctionBlock)(self.as_raw() as *mut _, &mut __function_block, __type_id.as_ptr() as *mut _, std::ptr::null_mut()) };
check(__code, "daqDevice_addFunctionBlock")?;
Ok(unsafe { crate::marshal::take_object::<FunctionBlock>(__function_block as *mut _) })
}
/// Creates and adds a function block to the device with the provided unique ID and returns it.
///
/// # Parameters
/// - `type_id`: The unique ID of the function block. Can be obtained from its corresponding Function Block Info object.
/// - `config`: A config object to configure a function block with custom settings specific to that function block type.
///
/// # Returns
/// - `function_block`: The added function block.
///
/// Calls the openDAQ C function `daqDevice_addFunctionBlock()`.
pub fn add_function_block_with(&self, type_id: &str, config: Option<&PropertyObject>) -> Result<Option<FunctionBlock>> {
let __type_id = crate::marshal::make_string(type_id)?;
let mut __function_block: *mut sys::daqFunctionBlock = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_addFunctionBlock)(self.as_raw() as *mut _, &mut __function_block, __type_id.as_ptr() as *mut _, config.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqDevice_addFunctionBlock")?;
Ok(unsafe { crate::marshal::take_object::<FunctionBlock>(__function_block as *mut _) })
}
/// Creates and adds to the device a server with the provided unique type ID and returns it.
///
/// # Parameters
/// - `type_id`: The unique type ID of the server. Can be obtained from its corresponding Server type object.
/// - `config`: A config object to configure a server with custom settings specific to that server type.
///
/// # Returns
/// - `server`: The added server.
///
/// Calls the openDAQ C function `daqDevice_addServer()`.
pub fn add_server(&self, type_id: &str, config: &PropertyObject) -> Result<Option<Server>> {
let __type_id = crate::marshal::make_string(type_id)?;
let mut __server: *mut sys::daqServer = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_addServer)(self.as_raw() as *mut _, __type_id.as_ptr() as *mut _, config.as_raw() as *mut _, &mut __server) };
check(__code, "daqDevice_addServer")?;
Ok(unsafe { crate::marshal::take_object::<Server>(__server as *mut _) })
}
/// Connects to a streaming at the given connection string, adds it as a streaming source of device and returns created streaming object.
///
/// # Parameters
/// - `connection_string`: The connection string containing the address of the streaming. In example an IPv4/IPv6 address. The connection string can be found in the Server Capability objects returned by `getInfo().getServerCapabilities()`.
/// - `config`: A config object to configure a streaming connection. This object can contain properties like various connection timeouts or other streaming protocol specific settings. Can be created from its corresponding Streaming type object. In case of a null value, it will use the default configuration.
///
/// # Returns
/// - `streaming`: The added streaming source.
///
/// Calls the openDAQ C function `daqDevice_addStreaming()`.
pub fn add_streaming(&self, connection_string: &str) -> Result<Option<Streaming>> {
let __connection_string = crate::marshal::make_string(connection_string)?;
let mut __streaming: *mut sys::daqStreaming = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_addStreaming)(self.as_raw() as *mut _, &mut __streaming, __connection_string.as_ptr() as *mut _, std::ptr::null_mut()) };
check(__code, "daqDevice_addStreaming")?;
Ok(unsafe { crate::marshal::take_object::<Streaming>(__streaming as *mut _) })
}
/// Connects to a streaming at the given connection string, adds it as a streaming source of device and returns created streaming object.
///
/// # Parameters
/// - `connection_string`: The connection string containing the address of the streaming. In example an IPv4/IPv6 address. The connection string can be found in the Server Capability objects returned by `getInfo().getServerCapabilities()`.
/// - `config`: A config object to configure a streaming connection. This object can contain properties like various connection timeouts or other streaming protocol specific settings. Can be created from its corresponding Streaming type object. In case of a null value, it will use the default configuration.
///
/// # Returns
/// - `streaming`: The added streaming source.
///
/// Calls the openDAQ C function `daqDevice_addStreaming()`.
pub fn add_streaming_with(&self, connection_string: &str, config: Option<&PropertyObject>) -> Result<Option<Streaming>> {
let __connection_string = crate::marshal::make_string(connection_string)?;
let mut __streaming: *mut sys::daqStreaming = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_addStreaming)(self.as_raw() as *mut _, &mut __streaming, __connection_string.as_ptr() as *mut _, config.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqDevice_addStreaming")?;
Ok(unsafe { crate::marshal::take_object::<Streaming>(__streaming as *mut _) })
}
/// Creates an openDAQ client.
///
/// # Parameters
/// - `ctx`: The context object.
/// - `local_id`: The localID of the client.
/// - `default_device_info`: The DeviceInfo to be used by the client device.
/// - `parent`: The parent component of the client.
///
/// Calls the openDAQ C function `daqDevice_createClient()`.
pub fn client(ctx: &Context, local_id: &str, default_device_info: &DeviceInfo, parent: &Component) -> Result<Device> {
let __local_id = crate::marshal::make_string(local_id)?;
let mut __obj: *mut sys::daqDevice = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_createClient)(&mut __obj, ctx.as_raw() as *mut _, __local_id.as_ptr() as *mut _, default_device_info.as_raw() as *mut _, parent.as_raw() as *mut _) };
check(__code, "daqDevice_createClient")?;
Ok(unsafe { crate::marshal::require_object::<Device>(__obj as *mut _, "daqDevice_createClient") }?)
}
/// Creates config object that can be used when adding a device. Contains Device and Streaming default configuration for all available Device/Streaming types. Also contains general add-device configuration settings.
///
/// # Returns
/// - `default_config`: The configuration object containing default settings for adding a device. The default config object is organized to always have 3 object-type properties: - "General" Contains general properties such as "AutomaticallyConnectStreaming" - "Device": Contains a child object-type property for each available device type, with the key of each property being the ID of the device type. These can be configured to customize the `addDevice` call when using connecting to the selected device type (eg. via the native or OPC UA protocols). - "Streaming": Same as device, but used to configure each individual streaming connection established when calling `addDevice`.
///
/// Calls the openDAQ C function `daqDevice_createDefaultAddDeviceConfig()`.
pub fn create_default_add_device_config(&self) -> Result<Option<PropertyObject>> {
let mut __default_config: *mut sys::daqPropertyObject = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_createDefaultAddDeviceConfig)(self.as_raw() as *mut _, &mut __default_config) };
check(__code, "daqDevice_createDefaultAddDeviceConfig")?;
Ok(unsafe { crate::marshal::take_object::<PropertyObject>(__default_config as *mut _) })
}
/// Get a dictionary of available device types as \<IString, IDeviceType\> pairs
///
/// # Returns
/// - `device_types`: The dictionary of available device types.
///
/// Calls the openDAQ C function `daqDevice_getAvailableDeviceTypes()`.
pub fn available_device_types(&self) -> Result<std::collections::HashMap<String, DeviceType>> {
let mut __device_types: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getAvailableDeviceTypes)(self.as_raw() as *mut _, &mut __device_types) };
check(__code, "daqDevice_getAvailableDeviceTypes")?;
Ok(unsafe { crate::marshal::take_dict::<String, DeviceType>(__device_types as *mut _, "daqDevice_getAvailableDeviceTypes") }?)
}
/// Gets a list of available devices, containing their Device Info.
///
/// # Returns
/// - `available_devices`: The list of available devices. The getAvailableDevices most often runs a discovery client, querying for available devices that a device module can connect to. The replies are formed into Device Info objects and inserted to the list of available devices.
///
/// Calls the openDAQ C function `daqDevice_getAvailableDevices()`.
pub fn available_devices(&self) -> Result<Vec<DeviceInfo>> {
let mut __available_devices: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getAvailableDevices)(self.as_raw() as *mut _, &mut __available_devices) };
check(__code, "daqDevice_getAvailableDevices")?;
Ok(unsafe { crate::marshal::take_list::<DeviceInfo>(__available_devices as *mut _, "daqDevice_getAvailableDevices") }?)
}
/// Gets all function block types that are supported by the device, containing their description.
///
/// # Returns
/// - `function_block_types`: A dictionary of available function block types.
///
/// Calls the openDAQ C function `daqDevice_getAvailableFunctionBlockTypes()`.
pub fn available_function_block_types(&self) -> Result<std::collections::HashMap<String, FunctionBlockType>> {
let mut __function_block_types: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getAvailableFunctionBlockTypes)(self.as_raw() as *mut _, &mut __function_block_types) };
check(__code, "daqDevice_getAvailableFunctionBlockTypes")?;
Ok(unsafe { crate::marshal::take_dict::<String, FunctionBlockType>(__function_block_types as *mut _, "daqDevice_getAvailableFunctionBlockTypes") }?)
}
/// Gets a list of available operation modes for the device.
///
/// # Returns
/// - `available_op_modes`: The list of available operation modes.
///
/// Calls the openDAQ C function `daqDevice_getAvailableOperationModes()`.
pub fn available_operation_modes(&self) -> Result<Vec<i64>> {
let mut __available_op_modes: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getAvailableOperationModes)(self.as_raw() as *mut _, &mut __available_op_modes) };
check(__code, "daqDevice_getAvailableOperationModes")?;
Ok(unsafe { crate::marshal::take_list::<i64>(__available_op_modes as *mut _, "daqDevice_getAvailableOperationModes") }?)
}
/// Gets a flat list of the device's physical channels.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `channels`: The flat list of channels. If searchFilter is not provided, the returned list contains only visible channels and does not include those of child devices.
///
/// Calls the openDAQ C function `daqDevice_getChannels()`.
pub fn channels(&self) -> Result<Vec<Channel>> {
let mut __channels: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getChannels)(self.as_raw() as *mut _, &mut __channels, std::ptr::null_mut()) };
check(__code, "daqDevice_getChannels")?;
Ok(unsafe { crate::marshal::take_list::<Channel>(__channels as *mut _, "daqDevice_getChannels") }?)
}
/// Gets a flat list of the device's physical channels.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `channels`: The flat list of channels. If searchFilter is not provided, the returned list contains only visible channels and does not include those of child devices.
///
/// Calls the openDAQ C function `daqDevice_getChannels()`.
pub fn channels_with(&self, search_filter: Option<&SearchFilter>) -> Result<Vec<Channel>> {
let mut __channels: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getChannels)(self.as_raw() as *mut _, &mut __channels, search_filter.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqDevice_getChannels")?;
Ok(unsafe { crate::marshal::take_list::<Channel>(__channels as *mut _, "daqDevice_getChannels") }?)
}
/// Gets a flat list of the device's physical channels. Also finds all visible channels of visible child devices
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `channels`: The flat list of channels.
///
/// Calls the openDAQ C function `daqDevice_getChannelsRecursive()`.
pub fn channels_recursive(&self) -> Result<Vec<Channel>> {
let mut __channels: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getChannelsRecursive)(self.as_raw() as *mut _, &mut __channels, std::ptr::null_mut()) };
check(__code, "daqDevice_getChannelsRecursive")?;
Ok(unsafe { crate::marshal::take_list::<Channel>(__channels as *mut _, "daqDevice_getChannelsRecursive") }?)
}
/// Gets a flat list of the device's physical channels. Also finds all visible channels of visible child devices
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `channels`: The flat list of channels.
///
/// Calls the openDAQ C function `daqDevice_getChannelsRecursive()`.
pub fn channels_recursive_with(&self, search_filter: Option<&SearchFilter>) -> Result<Vec<Channel>> {
let mut __channels: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getChannelsRecursive)(self.as_raw() as *mut _, &mut __channels, search_filter.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqDevice_getChannelsRecursive")?;
Ok(unsafe { crate::marshal::take_list::<Channel>(__channels as *mut _, "daqDevice_getChannelsRecursive") }?)
}
/// Gets the container holding the statuses of device configuration and streaming connections.
///
/// # Returns
/// - `status_container`: The container for the device connection statuses.
///
/// Calls the openDAQ C function `daqDevice_getConnectionStatusContainer()`.
pub fn connection_status_container(&self) -> Result<Option<ComponentStatusContainer>> {
let mut __status_container: *mut sys::daqComponentStatusContainer = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getConnectionStatusContainer)(self.as_raw() as *mut _, &mut __status_container) };
check(__code, "daqDevice_getConnectionStatusContainer")?;
Ok(unsafe { crate::marshal::take_object::<ComponentStatusContainer>(__status_container as *mut _) })
}
/// Gets a list of all components/folders in a device that are not titled 'IO', 'Sig', 'Dev', 'Synchronization' or 'FB'
///
/// # Returns
/// - `custom_components`: The list of custom components.
///
/// Calls the openDAQ C function `daqDevice_getCustomComponents()`.
pub fn custom_components(&self) -> Result<Vec<Component>> {
let mut __custom_components: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getCustomComponents)(self.as_raw() as *mut _, &mut __custom_components) };
check(__code, "daqDevice_getCustomComponents")?;
Ok(unsafe { crate::marshal::take_list::<Component>(__custom_components as *mut _, "daqDevice_getCustomComponents") }?)
}
/// Gets a list of child devices that the device is connected to.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `devices`: The list of devices. If searchFilter is not provided, the returned list contains only visible devices and does not include those of child devices.
///
/// Calls the openDAQ C function `daqDevice_getDevices()`.
pub fn devices(&self) -> Result<Vec<Device>> {
let mut __devices: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getDevices)(self.as_raw() as *mut _, &mut __devices, std::ptr::null_mut()) };
check(__code, "daqDevice_getDevices")?;
Ok(unsafe { crate::marshal::take_list::<Device>(__devices as *mut _, "daqDevice_getDevices") }?)
}
/// Gets a list of child devices that the device is connected to.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `devices`: The list of devices. If searchFilter is not provided, the returned list contains only visible devices and does not include those of child devices.
///
/// Calls the openDAQ C function `daqDevice_getDevices()`.
pub fn devices_with(&self, search_filter: Option<&SearchFilter>) -> Result<Vec<Device>> {
let mut __devices: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getDevices)(self.as_raw() as *mut _, &mut __devices, search_filter.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqDevice_getDevices")?;
Ok(unsafe { crate::marshal::take_list::<Device>(__devices as *mut _, "daqDevice_getDevices") }?)
}
/// Gets the device's domain data. It allows for querying the device for its domain (time) values.
///
/// # Returns
/// - `domain`: The device domain.
///
/// Calls the openDAQ C function `daqDevice_getDomain()`.
pub fn domain(&self) -> Result<Option<DeviceDomain>> {
let mut __domain: *mut sys::daqDeviceDomain = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getDomain)(self.as_raw() as *mut _, &mut __domain) };
check(__code, "daqDevice_getDomain")?;
Ok(unsafe { crate::marshal::take_object::<DeviceDomain>(__domain as *mut _) })
}
/// Gets the list of added function blocks.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `function_blocks`: The list of added function blocks. If searchFilter is not provided, the returned list contains only visible function blocks and does not include those of child function blocks, devices, or channels.
///
/// Calls the openDAQ C function `daqDevice_getFunctionBlocks()`.
pub fn function_blocks(&self) -> Result<Vec<FunctionBlock>> {
let mut __function_blocks: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getFunctionBlocks)(self.as_raw() as *mut _, &mut __function_blocks, std::ptr::null_mut()) };
check(__code, "daqDevice_getFunctionBlocks")?;
Ok(unsafe { crate::marshal::take_list::<FunctionBlock>(__function_blocks as *mut _, "daqDevice_getFunctionBlocks") }?)
}
/// Gets the list of added function blocks.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `function_blocks`: The list of added function blocks. If searchFilter is not provided, the returned list contains only visible function blocks and does not include those of child function blocks, devices, or channels.
///
/// Calls the openDAQ C function `daqDevice_getFunctionBlocks()`.
pub fn function_blocks_with(&self, search_filter: Option<&SearchFilter>) -> Result<Vec<FunctionBlock>> {
let mut __function_blocks: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getFunctionBlocks)(self.as_raw() as *mut _, &mut __function_blocks, search_filter.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqDevice_getFunctionBlocks")?;
Ok(unsafe { crate::marshal::take_list::<FunctionBlock>(__function_blocks as *mut _, "daqDevice_getFunctionBlocks") }?)
}
/// Gets the device info. It contains data about the device such as the device's serial number, location, and connection string.
///
/// # Returns
/// - `info`: The device info.
///
/// Calls the openDAQ C function `daqDevice_getInfo()`.
pub fn info(&self) -> Result<Option<DeviceInfo>> {
let mut __info: *mut sys::daqDeviceInfo = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getInfo)(self.as_raw() as *mut _, &mut __info) };
check(__code, "daqDevice_getInfo")?;
Ok(unsafe { crate::marshal::take_object::<DeviceInfo>(__info as *mut _) })
}
/// Gets a folder containing channels.
///
/// # Returns
/// - `inputs_outputs_folder`: The folder that contains channels. The InputsOutputs folder can contain other folders that themselves contain channels.
///
/// Calls the openDAQ C function `daqDevice_getInputsOutputsFolder()`.
pub fn inputs_outputs_folder(&self) -> Result<Option<Folder>> {
let mut __inputs_outputs_folder: *mut sys::daqFolder = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getInputsOutputsFolder)(self.as_raw() as *mut _, &mut __inputs_outputs_folder) };
check(__code, "daqDevice_getInputsOutputsFolder")?;
Ok(unsafe { crate::marshal::take_object::<Folder>(__inputs_outputs_folder as *mut _) })
}
/// Retrieves a chunk of the log file with the provided ID.
/// This function extracts a specified portion (or the entire content) of the log file, starting at the given offset.
/// If the size and offset are not specified, it will attempt to return the entire log file by default.
///
/// # Parameters
/// - `id`: Rhe ID of the log file to retrieve.
/// - `size`: The size of the log chunk to retrieve in bytes. Defaults to -1, which means it will return all remaining bytes from the offset.
/// - `offset`: The offset, in bytes, from where the log chunk should be read. Defaults to 0 (start of the file). If size is set to -1, and offset is 0, the entire log file will be returned.
///
/// # Returns
/// - `log`: A string which stores requested log chunk.
///
/// Calls the openDAQ C function `daqDevice_getLog()`.
pub fn log(&self, id: &str) -> Result<String> {
let __id = crate::marshal::make_string(id)?;
let mut __log: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getLog)(self.as_raw() as *mut _, &mut __log, __id.as_ptr() as *mut _, -1, 0) };
check(__code, "daqDevice_getLog")?;
Ok(unsafe { crate::marshal::take_string(__log) })
}
/// Retrieves a chunk of the log file with the provided ID.
/// This function extracts a specified portion (or the entire content) of the log file, starting at the given offset.
/// If the size and offset are not specified, it will attempt to return the entire log file by default.
///
/// # Parameters
/// - `id`: Rhe ID of the log file to retrieve.
/// - `size`: The size of the log chunk to retrieve in bytes. Defaults to -1, which means it will return all remaining bytes from the offset.
/// - `offset`: The offset, in bytes, from where the log chunk should be read. Defaults to 0 (start of the file). If size is set to -1, and offset is 0, the entire log file will be returned.
///
/// # Returns
/// - `log`: A string which stores requested log chunk.
///
/// Calls the openDAQ C function `daqDevice_getLog()`.
pub fn log_with(&self, id: &str, size: i64, offset: i64) -> Result<String> {
let __id = crate::marshal::make_string(id)?;
let mut __log: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getLog)(self.as_raw() as *mut _, &mut __log, __id.as_ptr() as *mut _, size, offset) };
check(__code, "daqDevice_getLog")?;
Ok(unsafe { crate::marshal::take_string(__log) })
}
/// Gets a list of available log files.
///
/// # Returns
/// - `log_file_infos`: The list of available log files.
///
/// Calls the openDAQ C function `daqDevice_getLogFileInfos()`.
pub fn log_file_infos(&self) -> Result<Vec<LogFileInfo>> {
let mut __log_file_infos: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getLogFileInfos)(self.as_raw() as *mut _, &mut __log_file_infos) };
check(__code, "daqDevice_getLogFileInfos")?;
Ok(unsafe { crate::marshal::take_list::<LogFileInfo>(__log_file_infos as *mut _, "daqDevice_getLogFileInfos") }?)
}
/// Get list of added servers.
///
/// # Returns
/// - `servers`: List of added servers.
///
/// Calls the openDAQ C function `daqDevice_getServers()`.
pub fn servers(&self) -> Result<Vec<Server>> {
let mut __servers: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getServers)(self.as_raw() as *mut _, &mut __servers) };
check(__code, "daqDevice_getServers")?;
Ok(unsafe { crate::marshal::take_list::<Server>(__servers as *mut _, "daqDevice_getServers") }?)
}
/// Gets a list of the device's signals.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `signals`: The flat list of signals. If searchFilter is not provided, the returned list contains only visible signals and does not include those of child function blocks, devices, or channels. Device signals are most often domain signals shared by other signals that belong to channels and/or function blocks.
///
/// Calls the openDAQ C function `daqDevice_getSignals()`.
pub fn signals(&self) -> Result<Vec<Signal>> {
let mut __signals: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getSignals)(self.as_raw() as *mut _, &mut __signals, std::ptr::null_mut()) };
check(__code, "daqDevice_getSignals")?;
Ok(unsafe { crate::marshal::take_list::<Signal>(__signals as *mut _, "daqDevice_getSignals") }?)
}
/// Gets a list of the device's signals.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `signals`: The flat list of signals. If searchFilter is not provided, the returned list contains only visible signals and does not include those of child function blocks, devices, or channels. Device signals are most often domain signals shared by other signals that belong to channels and/or function blocks.
///
/// Calls the openDAQ C function `daqDevice_getSignals()`.
pub fn signals_with(&self, search_filter: Option<&SearchFilter>) -> Result<Vec<Signal>> {
let mut __signals: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getSignals)(self.as_raw() as *mut _, &mut __signals, search_filter.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqDevice_getSignals")?;
Ok(unsafe { crate::marshal::take_list::<Signal>(__signals as *mut _, "daqDevice_getSignals") }?)
}
/// Gets a list of the signals that belong to the device.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `signals`: The flat list of signals. The list includes visible signals that belong to visible channels, function blocks, or sub devices of the device.
///
/// Calls the openDAQ C function `daqDevice_getSignalsRecursive()`.
pub fn signals_recursive(&self) -> Result<Vec<Signal>> {
let mut __signals: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getSignalsRecursive)(self.as_raw() as *mut _, &mut __signals, std::ptr::null_mut()) };
check(__code, "daqDevice_getSignalsRecursive")?;
Ok(unsafe { crate::marshal::take_list::<Signal>(__signals as *mut _, "daqDevice_getSignalsRecursive") }?)
}
/// Gets a list of the signals that belong to the device.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `signals`: The flat list of signals. The list includes visible signals that belong to visible channels, function blocks, or sub devices of the device.
///
/// Calls the openDAQ C function `daqDevice_getSignalsRecursive()`.
pub fn signals_recursive_with(&self, search_filter: Option<&SearchFilter>) -> Result<Vec<Signal>> {
let mut __signals: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getSignalsRecursive)(self.as_raw() as *mut _, &mut __signals, search_filter.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqDevice_getSignalsRecursive")?;
Ok(unsafe { crate::marshal::take_list::<Signal>(__signals as *mut _, "daqDevice_getSignalsRecursive") }?)
}
/// Gets the sync component of the device.
///
/// # Returns
/// - `sync`: The sync component.
///
/// Calls the openDAQ C function `daqDevice_getSyncComponent()`.
pub fn sync_component(&self) -> Result<Option<SyncComponent>> {
let mut __sync: *mut sys::daqSyncComponent = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_getSyncComponent)(self.as_raw() as *mut _, &mut __sync) };
check(__code, "daqDevice_getSyncComponent")?;
Ok(unsafe { crate::marshal::take_object::<SyncComponent>(__sync as *mut _) })
}
/// Gets the number of ticks passed since the device's absolute origin.
///
/// # Returns
/// - `ticks`: The number of ticks. To scale the ticks into a domain unit, the Device's Domain should be used.
///
/// Calls the openDAQ C function `daqDevice_getTicksSinceOrigin()`.
pub fn ticks_since_origin(&self) -> Result<u64> {
let mut __ticks: u64 = Default::default();
let __code = unsafe { (crate::sys::api().daqDevice_getTicksSinceOrigin)(self.as_raw() as *mut _, &mut __ticks) };
check(__code, "daqDevice_getTicksSinceOrigin")?;
Ok(__ticks)
}
/// Returns true if device is locked. Once locked, no properties of the device can be changed via the protocol layer.
///
/// # Returns
/// - `locked`: True if device is locked.
///
/// Calls the openDAQ C function `daqDevice_isLocked()`.
pub fn is_locked(&self) -> Result<bool> {
let mut __locked: u8 = 0;
let __code = unsafe { (crate::sys::api().daqDevice_isLocked)(self.as_raw() as *mut _, &mut __locked) };
check(__code, "daqDevice_isLocked")?;
Ok(__locked != 0)
}
/// Loads the configuration of the device from string.
///
/// # Parameters
/// - `configuration`: Serialized configuration of the device.
///
/// Calls the openDAQ C function `daqDevice_loadConfiguration()`.
pub fn load_configuration(&self, configuration: &str) -> Result<()> {
let __configuration = crate::marshal::make_string(configuration)?;
let __code = unsafe { (crate::sys::api().daqDevice_loadConfiguration)(self.as_raw() as *mut _, __configuration.as_ptr() as *mut _, std::ptr::null_mut()) };
check(__code, "daqDevice_loadConfiguration")?;
Ok(())
}
/// Loads the configuration of the device from string.
///
/// # Parameters
/// - `configuration`: Serialized configuration of the device.
///
/// Calls the openDAQ C function `daqDevice_loadConfiguration()`.
pub fn load_configuration_with(&self, configuration: &str, config: Option<&UpdateParameters>) -> Result<()> {
let __configuration = crate::marshal::make_string(configuration)?;
let __code = unsafe { (crate::sys::api().daqDevice_loadConfiguration)(self.as_raw() as *mut _, __configuration.as_ptr() as *mut _, config.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqDevice_loadConfiguration")?;
Ok(())
}
/// Lock a device with a session user. Once locked, no properties of the device can be changed via the protocol layer. Only the same user who locked the device can unlock it. If no user was specified when the device was locked, any user will be able to unlock it.
///
/// Calls the openDAQ C function `daqDevice_lock()`.
pub fn lock(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDevice_lock)(self.as_raw() as *mut _) };
check(__code, "daqDevice_lock")?;
Ok(())
}
/// Disconnects from the device provided as argument and removes it from the internal list of devices.
///
/// # Parameters
/// - `device`: The device to be removed.
///
/// Calls the openDAQ C function `daqDevice_removeDevice()`.
pub fn remove_device(&self, device: &Device) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDevice_removeDevice)(self.as_raw() as *mut _, device.as_raw() as *mut _) };
check(__code, "daqDevice_removeDevice")?;
Ok(())
}
/// Removes the function block provided as argument, disconnecting its signals and input ports.
///
/// # Parameters
/// - `function_block`: The function block to be removed.
///
/// Calls the openDAQ C function `daqDevice_removeFunctionBlock()`.
pub fn remove_function_block(&self, function_block: &FunctionBlock) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDevice_removeFunctionBlock)(self.as_raw() as *mut _, function_block.as_raw() as *mut _) };
check(__code, "daqDevice_removeFunctionBlock")?;
Ok(())
}
/// Removes the server provided as argument.
///
/// # Parameters
/// - `server`: The server to be removed.
///
/// Calls the openDAQ C function `daqDevice_removeServer()`.
pub fn remove_server(&self, server: &Server) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDevice_removeServer)(self.as_raw() as *mut _, server.as_raw() as *mut _) };
check(__code, "daqDevice_removeServer")?;
Ok(())
}
/// Saves the configuration of the device to string.
///
/// # Returns
/// - `configuration`: Serialized configuration of the device.
///
/// Calls the openDAQ C function `daqDevice_saveConfiguration()`.
pub fn save_configuration(&self) -> Result<String> {
let mut __configuration: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDevice_saveConfiguration)(self.as_raw() as *mut _, &mut __configuration) };
check(__code, "daqDevice_saveConfiguration")?;
Ok(unsafe { crate::marshal::take_string(__configuration) })
}
/// Sets the operation mode of the device subtree excluding the sub-devices.
///
/// # Parameters
/// - `mode_type`: The operation mode to set.
///
/// Calls the openDAQ C function `daqDevice_setOperationMode()`.
pub fn set_operation_mode(&self, mode_type: OperationModeType) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDevice_setOperationMode)(self.as_raw() as *mut _, mode_type as u32) };
check(__code, "daqDevice_setOperationMode")?;
Ok(())
}
/// Sets the operation mode of the device subtree including the sub-devices.
///
/// # Parameters
/// - `mode_type`: The operation mode to set.
///
/// Calls the openDAQ C function `daqDevice_setOperationModeRecursive()`.
pub fn set_operation_mode_recursive(&self, mode_type: OperationModeType) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDevice_setOperationModeRecursive)(self.as_raw() as *mut _, mode_type as u32) };
check(__code, "daqDevice_setOperationModeRecursive")?;
Ok(())
}
/// Unlock a device with a session user. A device can only be unlocked by the same user who locked it. If no user was specified when the device was locked, any user will be able to unlock it.
///
/// Calls the openDAQ C function `daqDevice_unlock()`.
pub fn unlock(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDevice_unlock)(self.as_raw() as *mut _) };
check(__code, "daqDevice_unlock")?;
Ok(())
}
}
impl FunctionBlock {
/// Creates and adds a function block as the nested of current function block with the provided unique ID and returns it.
///
/// # Parameters
/// - `type_id`: The unique ID of the function block. Can be obtained from its corresponding Function Block Info object.
/// - `config`: A config object to configure a function block with custom settings specific to that function block type.
///
/// # Returns
/// - `function_block`: The added function block.
///
/// Calls the openDAQ C function `daqFunctionBlock_addFunctionBlock()`.
pub fn add_function_block(&self, type_id: &str) -> Result<Option<FunctionBlock>> {
let __type_id = crate::marshal::make_string(type_id)?;
let mut __function_block: *mut sys::daqFunctionBlock = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFunctionBlock_addFunctionBlock)(self.as_raw() as *mut _, &mut __function_block, __type_id.as_ptr() as *mut _, std::ptr::null_mut()) };
check(__code, "daqFunctionBlock_addFunctionBlock")?;
Ok(unsafe { crate::marshal::take_object::<FunctionBlock>(__function_block as *mut _) })
}
/// Creates and adds a function block as the nested of current function block with the provided unique ID and returns it.
///
/// # Parameters
/// - `type_id`: The unique ID of the function block. Can be obtained from its corresponding Function Block Info object.
/// - `config`: A config object to configure a function block with custom settings specific to that function block type.
///
/// # Returns
/// - `function_block`: The added function block.
///
/// Calls the openDAQ C function `daqFunctionBlock_addFunctionBlock()`.
pub fn add_function_block_with(&self, type_id: &str, config: Option<&PropertyObject>) -> Result<Option<FunctionBlock>> {
let __type_id = crate::marshal::make_string(type_id)?;
let mut __function_block: *mut sys::daqFunctionBlock = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFunctionBlock_addFunctionBlock)(self.as_raw() as *mut _, &mut __function_block, __type_id.as_ptr() as *mut _, config.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqFunctionBlock_addFunctionBlock")?;
Ok(unsafe { crate::marshal::take_object::<FunctionBlock>(__function_block as *mut _) })
}
/// Gets all nested function block types that are supported, containing their description.
///
/// # Returns
/// - `function_block_types`: A dictionary of available function block types.
///
/// Calls the openDAQ C function `daqFunctionBlock_getAvailableFunctionBlockTypes()`.
pub fn available_function_block_types(&self) -> Result<std::collections::HashMap<String, FunctionBlockType>> {
let mut __function_block_types: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFunctionBlock_getAvailableFunctionBlockTypes)(self.as_raw() as *mut _, &mut __function_block_types) };
check(__code, "daqFunctionBlock_getAvailableFunctionBlockTypes")?;
Ok(unsafe { crate::marshal::take_dict::<String, FunctionBlockType>(__function_block_types as *mut _, "daqFunctionBlock_getAvailableFunctionBlockTypes") }?)
}
/// Gets an information structure contain metadata of the function block type.
///
/// # Returns
/// - `type`: The Function block type object.
///
/// Calls the openDAQ C function `daqFunctionBlock_getFunctionBlockType()`.
pub fn function_block_type(&self) -> Result<Option<FunctionBlockType>> {
let mut __type_: *mut sys::daqFunctionBlockType = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFunctionBlock_getFunctionBlockType)(self.as_raw() as *mut _, &mut __type_) };
check(__code, "daqFunctionBlock_getFunctionBlockType")?;
Ok(unsafe { crate::marshal::take_object::<FunctionBlockType>(__type_ as *mut _) })
}
/// Gets a list of sub-function blocks.
///
/// # Parameters
/// - `search_filter`: Provides optional parameters such as "recursive" and "visibleOnly" to modify the search pattern.
///
/// # Returns
/// - `function_blocks`: The list of sub-function blocks. If searchFilter is not provided, the returned list contains only visible function blocks and does not include those of child function blocks.
///
/// Calls the openDAQ C function `daqFunctionBlock_getFunctionBlocks()`.
pub fn function_blocks(&self) -> Result<Vec<FunctionBlock>> {
let mut __function_blocks: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFunctionBlock_getFunctionBlocks)(self.as_raw() as *mut _, &mut __function_blocks, std::ptr::null_mut()) };
check(__code, "daqFunctionBlock_getFunctionBlocks")?;
Ok(unsafe { crate::marshal::take_list::<FunctionBlock>(__function_blocks as *mut _, "daqFunctionBlock_getFunctionBlocks") }?)
}
/// Gets a list of sub-function blocks.
///
/// # Parameters
/// - `search_filter`: Provides optional parameters such as "recursive" and "visibleOnly" to modify the search pattern.
///
/// # Returns
/// - `function_blocks`: The list of sub-function blocks. If searchFilter is not provided, the returned list contains only visible function blocks and does not include those of child function blocks.
///
/// Calls the openDAQ C function `daqFunctionBlock_getFunctionBlocks()`.
pub fn function_blocks_with(&self, search_filter: Option<&SearchFilter>) -> Result<Vec<FunctionBlock>> {
let mut __function_blocks: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFunctionBlock_getFunctionBlocks)(self.as_raw() as *mut _, &mut __function_blocks, search_filter.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqFunctionBlock_getFunctionBlocks")?;
Ok(unsafe { crate::marshal::take_list::<FunctionBlock>(__function_blocks as *mut _, "daqFunctionBlock_getFunctionBlocks") }?)
}
/// Gets a list of the function block's input ports.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `ports`: The list of input ports. If searchFilter is not provided, the returned list contains only visible input ports and does not include those of child function blocks.
///
/// Calls the openDAQ C function `daqFunctionBlock_getInputPorts()`.
pub fn input_ports(&self) -> Result<Vec<InputPort>> {
let mut __ports: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFunctionBlock_getInputPorts)(self.as_raw() as *mut _, &mut __ports, std::ptr::null_mut()) };
check(__code, "daqFunctionBlock_getInputPorts")?;
Ok(unsafe { crate::marshal::take_list::<InputPort>(__ports as *mut _, "daqFunctionBlock_getInputPorts") }?)
}
/// Gets a list of the function block's input ports.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `ports`: The list of input ports. If searchFilter is not provided, the returned list contains only visible input ports and does not include those of child function blocks.
///
/// Calls the openDAQ C function `daqFunctionBlock_getInputPorts()`.
pub fn input_ports_with(&self, search_filter: Option<&SearchFilter>) -> Result<Vec<InputPort>> {
let mut __ports: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFunctionBlock_getInputPorts)(self.as_raw() as *mut _, &mut __ports, search_filter.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqFunctionBlock_getInputPorts")?;
Ok(unsafe { crate::marshal::take_list::<InputPort>(__ports as *mut _, "daqFunctionBlock_getInputPorts") }?)
}
/// Gets the list of the function block's output signals.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `signals`: The list of output signals. If searchFilter is not provided, the returned list contains only visible signals and does not include those of child function blocks.
///
/// Calls the openDAQ C function `daqFunctionBlock_getSignals()`.
pub fn signals(&self) -> Result<Vec<Signal>> {
let mut __signals: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFunctionBlock_getSignals)(self.as_raw() as *mut _, &mut __signals, std::ptr::null_mut()) };
check(__code, "daqFunctionBlock_getSignals")?;
Ok(unsafe { crate::marshal::take_list::<Signal>(__signals as *mut _, "daqFunctionBlock_getSignals") }?)
}
/// Gets the list of the function block's output signals.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `signals`: The list of output signals. If searchFilter is not provided, the returned list contains only visible signals and does not include those of child function blocks.
///
/// Calls the openDAQ C function `daqFunctionBlock_getSignals()`.
pub fn signals_with(&self, search_filter: Option<&SearchFilter>) -> Result<Vec<Signal>> {
let mut __signals: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFunctionBlock_getSignals)(self.as_raw() as *mut _, &mut __signals, search_filter.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqFunctionBlock_getSignals")?;
Ok(unsafe { crate::marshal::take_list::<Signal>(__signals as *mut _, "daqFunctionBlock_getSignals") }?)
}
/// Gets the list of the function block's visible output signals including signals from visible child function blocks.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `signals`: The list of output signals.
///
/// Calls the openDAQ C function `daqFunctionBlock_getSignalsRecursive()`.
pub fn signals_recursive(&self) -> Result<Vec<Signal>> {
let mut __signals: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFunctionBlock_getSignalsRecursive)(self.as_raw() as *mut _, &mut __signals, std::ptr::null_mut()) };
check(__code, "daqFunctionBlock_getSignalsRecursive")?;
Ok(unsafe { crate::marshal::take_list::<Signal>(__signals as *mut _, "daqFunctionBlock_getSignalsRecursive") }?)
}
/// Gets the list of the function block's visible output signals including signals from visible child function blocks.
///
/// # Parameters
/// - `search_filter`: Provides an optional filter that filters out unwanted components and allows for recursion.
///
/// # Returns
/// - `signals`: The list of output signals.
///
/// Calls the openDAQ C function `daqFunctionBlock_getSignalsRecursive()`.
pub fn signals_recursive_with(&self, search_filter: Option<&SearchFilter>) -> Result<Vec<Signal>> {
let mut __signals: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFunctionBlock_getSignalsRecursive)(self.as_raw() as *mut _, &mut __signals, search_filter.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqFunctionBlock_getSignalsRecursive")?;
Ok(unsafe { crate::marshal::take_list::<Signal>(__signals as *mut _, "daqFunctionBlock_getSignalsRecursive") }?)
}
/// Gets the function block's status signal.
///
/// # Returns
/// - `status_signal`: The status signal. The status signal sends out a status event packet every time it is connected to an input port. Additionally, a status event packet is sent whenever the status of the function block changes.
///
/// Calls the openDAQ C function `daqFunctionBlock_getStatusSignal()`.
pub fn status_signal(&self) -> Result<Option<Signal>> {
let mut __status_signal: *mut sys::daqSignal = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqFunctionBlock_getStatusSignal)(self.as_raw() as *mut _, &mut __status_signal) };
check(__code, "daqFunctionBlock_getStatusSignal")?;
Ok(unsafe { crate::marshal::take_object::<Signal>(__status_signal as *mut _) })
}
/// Removes the function block provided as argument, disconnecting its signals and input ports.
///
/// # Parameters
/// - `function_block`: The function block to be removed.
///
/// Calls the openDAQ C function `daqFunctionBlock_removeFunctionBlock()`.
pub fn remove_function_block(&self, function_block: &FunctionBlock) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqFunctionBlock_removeFunctionBlock)(self.as_raw() as *mut _, function_block.as_raw() as *mut _) };
check(__code, "daqFunctionBlock_removeFunctionBlock")?;
Ok(())
}
}
impl LogFileInfoBuilder {
/// Builds the log file info.
///
/// # Returns
/// - `log_file_info`: The log file info.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_build()`.
pub fn build(&self) -> Result<Option<LogFileInfo>> {
let mut __log_file_info: *mut sys::daqLogFileInfo = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_build)(self.as_raw() as *mut _, &mut __log_file_info) };
check(__code, "daqLogFileInfoBuilder_build")?;
Ok(unsafe { crate::marshal::take_object::<LogFileInfo>(__log_file_info as *mut _) })
}
/// Creates an LogFileInfo Builder with no parameters configured.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_createLogFileInfoBuilder()`.
pub fn new() -> Result<LogFileInfoBuilder> {
let mut __obj: *mut sys::daqLogFileInfoBuilder = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_createLogFileInfoBuilder)(&mut __obj) };
check(__code, "daqLogFileInfoBuilder_createLogFileInfoBuilder")?;
Ok(unsafe { crate::marshal::require_object::<LogFileInfoBuilder>(__obj as *mut _, "daqLogFileInfoBuilder_createLogFileInfoBuilder") }?)
}
/// Gets the description of the log file.
///
/// # Returns
/// - `description`: The description of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_getDescription()`.
pub fn description(&self) -> Result<String> {
let mut __description: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_getDescription)(self.as_raw() as *mut _, &mut __description) };
check(__code, "daqLogFileInfoBuilder_getDescription")?;
Ok(unsafe { crate::marshal::take_string(__description) })
}
/// Gets the encoding of the log file.
///
/// # Returns
/// - `encoding`: The encoding of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_getEncoding()`.
pub fn encoding(&self) -> Result<String> {
let mut __encoding: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_getEncoding)(self.as_raw() as *mut _, &mut __encoding) };
check(__code, "daqLogFileInfoBuilder_getEncoding")?;
Ok(unsafe { crate::marshal::take_string(__encoding) })
}
/// Gets the id of the log file. If the local path is not assigned, the id is equal to the `localPath + "/" + name`.
///
/// # Parameters
/// - `id`: The id of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_getId()`.
pub fn id(&self) -> Result<String> {
let mut __id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_getId)(self.as_raw() as *mut _, &mut __id) };
check(__code, "daqLogFileInfoBuilder_getId")?;
Ok(unsafe { crate::marshal::take_string(__id) })
}
/// Gets the date of the last modification of the log file in ISO 8601 format.
///
/// # Returns
/// - `last_modified`: The date of the last modification of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_getLastModified()`.
pub fn last_modified(&self) -> Result<String> {
let mut __last_modified: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_getLastModified)(self.as_raw() as *mut _, &mut __last_modified) };
check(__code, "daqLogFileInfoBuilder_getLastModified")?;
Ok(unsafe { crate::marshal::take_string(__last_modified) })
}
/// Gets the local path of the log file. The local path can be not assigned as it is optional.
///
/// # Returns
/// - `local_path`: The local path of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_getLocalPath()`.
pub fn local_path(&self) -> Result<String> {
let mut __local_path: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_getLocalPath)(self.as_raw() as *mut _, &mut __local_path) };
check(__code, "daqLogFileInfoBuilder_getLocalPath")?;
Ok(unsafe { crate::marshal::take_string(__local_path) })
}
/// Gets the name of the log file.
///
/// # Returns
/// - `name`: The name of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_getName()`.
pub fn name(&self) -> Result<String> {
let mut __name: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_getName)(self.as_raw() as *mut _, &mut __name) };
check(__code, "daqLogFileInfoBuilder_getName")?;
Ok(unsafe { crate::marshal::take_string(__name) })
}
/// Gets the size of the log file in bytes.
///
/// # Returns
/// - `size`: The size of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_getSize()`.
pub fn size(&self) -> Result<usize> {
let mut __size: usize = Default::default();
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_getSize)(self.as_raw() as *mut _, &mut __size) };
check(__code, "daqLogFileInfoBuilder_getSize")?;
Ok(__size)
}
/// Sets the description of the log file.
///
/// # Parameters
/// - `description`: The description of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_setDescription()`.
pub fn set_description(&self, description: &str) -> Result<()> {
let __description = crate::marshal::make_string(description)?;
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_setDescription)(self.as_raw() as *mut _, __description.as_ptr() as *mut _) };
check(__code, "daqLogFileInfoBuilder_setDescription")?;
Ok(())
}
/// Sets the encoding of the log file.
///
/// # Parameters
/// - `encoding`: The encoding of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_setEncoding()`.
pub fn set_encoding(&self, encoding: &str) -> Result<()> {
let __encoding = crate::marshal::make_string(encoding)?;
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_setEncoding)(self.as_raw() as *mut _, __encoding.as_ptr() as *mut _) };
check(__code, "daqLogFileInfoBuilder_setEncoding")?;
Ok(())
}
/// Sets the id of the log file. Oth
///
/// # Parameters
/// - `id`: The id of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_setId()`.
pub fn set_id(&self, id: &str) -> Result<()> {
let __id = crate::marshal::make_string(id)?;
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_setId)(self.as_raw() as *mut _, __id.as_ptr() as *mut _) };
check(__code, "daqLogFileInfoBuilder_setId")?;
Ok(())
}
/// Sets the date of the last modification of the log file in ISO 8601 format.
///
/// # Parameters
/// - `last_modified`: The date of the last modification of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_setLastModified()`.
pub fn set_last_modified(&self, last_modified: &str) -> Result<()> {
let __last_modified = crate::marshal::make_string(last_modified)?;
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_setLastModified)(self.as_raw() as *mut _, __last_modified.as_ptr() as *mut _) };
check(__code, "daqLogFileInfoBuilder_setLastModified")?;
Ok(())
}
/// Sets the local path of the log file. The local path can be not assigned as it is optional.
///
/// # Parameters
/// - `local_path`: The local path of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_setLocalPath()`.
pub fn set_local_path(&self, local_path: &str) -> Result<()> {
let __local_path = crate::marshal::make_string(local_path)?;
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_setLocalPath)(self.as_raw() as *mut _, __local_path.as_ptr() as *mut _) };
check(__code, "daqLogFileInfoBuilder_setLocalPath")?;
Ok(())
}
/// Sets the name of the log file.
///
/// # Parameters
/// - `name`: The name of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_setName()`.
pub fn set_name(&self, name: &str) -> Result<()> {
let __name = crate::marshal::make_string(name)?;
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_setName)(self.as_raw() as *mut _, __name.as_ptr() as *mut _) };
check(__code, "daqLogFileInfoBuilder_setName")?;
Ok(())
}
/// Sets the size of the log file in bytes.
///
/// # Parameters
/// - `size`: The size of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfoBuilder_setSize()`.
pub fn set_size(&self, size: usize) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqLogFileInfoBuilder_setSize)(self.as_raw() as *mut _, size) };
check(__code, "daqLogFileInfoBuilder_setSize")?;
Ok(())
}
}
impl LogFileInfo {
/// Creates an log file info from the builder.
///
/// # Parameters
/// - `builder`: The log file info builder.
///
/// Calls the openDAQ C function `daqLogFileInfo_createLogFileInfoFromBuilder()`.
pub fn from_builder(builder: &LogFileInfoBuilder) -> Result<LogFileInfo> {
let mut __obj: *mut sys::daqLogFileInfo = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqLogFileInfo_createLogFileInfoFromBuilder)(&mut __obj, builder.as_raw() as *mut _) };
check(__code, "daqLogFileInfo_createLogFileInfoFromBuilder")?;
Ok(unsafe { crate::marshal::require_object::<LogFileInfo>(__obj as *mut _, "daqLogFileInfo_createLogFileInfoFromBuilder") }?)
}
/// Gets the description of the log file.
///
/// # Returns
/// - `description`: The description of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfo_getDescription()`.
pub fn description(&self) -> Result<String> {
let mut __description: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqLogFileInfo_getDescription)(self.as_raw() as *mut _, &mut __description) };
check(__code, "daqLogFileInfo_getDescription")?;
Ok(unsafe { crate::marshal::take_string(__description) })
}
/// Gets the encoding of the log file.
///
/// # Returns
/// - `encoding`: The encoding of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfo_getEncoding()`.
pub fn encoding(&self) -> Result<String> {
let mut __encoding: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqLogFileInfo_getEncoding)(self.as_raw() as *mut _, &mut __encoding) };
check(__code, "daqLogFileInfo_getEncoding")?;
Ok(unsafe { crate::marshal::take_string(__encoding) })
}
/// Gets the id of the log file in format `getLocalPath() + "/" + getName()`.
///
/// # Returns
/// - `id`: The id of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfo_getId()`.
pub fn id(&self) -> Result<String> {
let mut __id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqLogFileInfo_getId)(self.as_raw() as *mut _, &mut __id) };
check(__code, "daqLogFileInfo_getId")?;
Ok(unsafe { crate::marshal::take_string(__id) })
}
/// Gets the date of the last modification of the log file in ISO 8601 format.
///
/// # Returns
/// - `last_modified`: The date of the last modification of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfo_getLastModified()`.
pub fn last_modified(&self) -> Result<String> {
let mut __last_modified: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqLogFileInfo_getLastModified)(self.as_raw() as *mut _, &mut __last_modified) };
check(__code, "daqLogFileInfo_getLastModified")?;
Ok(unsafe { crate::marshal::take_string(__last_modified) })
}
/// Gets the local path of the log file. The local path can be not assigned as it is optional.
///
/// # Returns
/// - `local_path`: The local path of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfo_getLocalPath()`.
pub fn local_path(&self) -> Result<String> {
let mut __local_path: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqLogFileInfo_getLocalPath)(self.as_raw() as *mut _, &mut __local_path) };
check(__code, "daqLogFileInfo_getLocalPath")?;
Ok(unsafe { crate::marshal::take_string(__local_path) })
}
/// Gets the name of the log file.
///
/// # Returns
/// - `name`: The name of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfo_getName()`.
pub fn name(&self) -> Result<String> {
let mut __name: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqLogFileInfo_getName)(self.as_raw() as *mut _, &mut __name) };
check(__code, "daqLogFileInfo_getName")?;
Ok(unsafe { crate::marshal::take_string(__name) })
}
/// Gets the size of the log file in bytes.
///
/// # Returns
/// - `size`: The size of the log file.
///
/// Calls the openDAQ C function `daqLogFileInfo_getSize()`.
pub fn size(&self) -> Result<usize> {
let mut __size: usize = Default::default();
let __code = unsafe { (crate::sys::api().daqLogFileInfo_getSize)(self.as_raw() as *mut _, &mut __size) };
check(__code, "daqLogFileInfo_getSize")?;
Ok(__size)
}
}
impl NetworkInterface {
/// Creates a property object containing default configuration values for a network interface.
///
/// # Returns
/// - `default_config`: The configuration object containing default settings for configuring device's network interface. The created object can be modified or directly submitted using the `submitConfiguration` method.
///
/// Calls the openDAQ C function `daqNetworkInterface_createDefaultConfiguration()`.
pub fn create_default_configuration(&self) -> Result<Option<PropertyObject>> {
let mut __default_config: *mut sys::daqPropertyObject = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqNetworkInterface_createDefaultConfiguration)(self.as_raw() as *mut _, &mut __default_config) };
check(__code, "daqNetworkInterface_createDefaultConfiguration")?;
Ok(unsafe { crate::marshal::take_object::<PropertyObject>(__default_config as *mut _) })
}
/// Calls the openDAQ C function `daqNetworkInterface_createNetworkInterface()`.
pub fn new(name: &str, owner_device_manufacturer_name: &str, owner_device_serial_number: &str, module_manager: impl Into<Value>) -> Result<NetworkInterface> {
let __name = crate::marshal::make_string(name)?;
let __owner_device_manufacturer_name = crate::marshal::make_string(owner_device_manufacturer_name)?;
let __owner_device_serial_number = crate::marshal::make_string(owner_device_serial_number)?;
let __module_manager = crate::value::to_daq(&module_manager.into())?;
let mut __obj: *mut sys::daqNetworkInterface = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqNetworkInterface_createNetworkInterface)(&mut __obj, __name.as_ptr() as *mut _, __owner_device_manufacturer_name.as_ptr() as *mut _, __owner_device_serial_number.as_ptr() as *mut _, crate::value::opt_ref_ptr(&__module_manager) as *mut _) };
check(__code, "daqNetworkInterface_createNetworkInterface")?;
Ok(unsafe { crate::marshal::require_object::<NetworkInterface>(__obj as *mut _, "daqNetworkInterface_createNetworkInterface") }?)
}
/// Requests the currently active configuration for the network interface.
///
/// # Returns
/// - `config`: The property object containing the currently active configuration.
///
/// # Errors
/// - `OPENDAQ_ERR_NOTIMPLEMENTED`: if the device doesn't support retrieving the active configuration.
///
/// Calls the openDAQ C function `daqNetworkInterface_requestCurrentConfiguration()`.
pub fn request_current_configuration(&self) -> Result<Option<PropertyObject>> {
let mut __config: *mut sys::daqPropertyObject = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqNetworkInterface_requestCurrentConfiguration)(self.as_raw() as *mut _, &mut __config) };
check(__code, "daqNetworkInterface_requestCurrentConfiguration")?;
Ok(unsafe { crate::marshal::take_object::<PropertyObject>(__config as *mut _) })
}
/// Submits a new configuration for the network interface.
///
/// # Parameters
/// - `config`: The new configuration to apply.
///
/// # Errors
/// - `OPENDAQ_SUCCESS`: if the new configuration is applied successfully; otherwise, returns an informative error code. The provided configuration must adhere to the required properties, including "dhcp4", "address4", "gateway4", and their IPv6 equivalents, as described in the class-level documentation.
///
/// Calls the openDAQ C function `daqNetworkInterface_submitConfiguration()`.
pub fn submit_configuration(&self, config: &PropertyObject) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqNetworkInterface_submitConfiguration)(self.as_raw() as *mut _, config.as_raw() as *mut _) };
check(__code, "daqNetworkInterface_submitConfiguration")?;
Ok(())
}
}
impl ReferenceDomainInfo {
/// Creates a Reference Domain Info using Builder
///
/// # Parameters
/// - `builder`: Reference Domain Info Builder
///
/// Calls the openDAQ C function `daqReferenceDomainInfo_createReferenceDomainInfoFromBuilder()`.
pub fn from_builder(builder: &ReferenceDomainInfoBuilder) -> Result<ReferenceDomainInfo> {
let mut __obj: *mut sys::daqReferenceDomainInfo = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqReferenceDomainInfo_createReferenceDomainInfoFromBuilder)(&mut __obj, builder.as_raw() as *mut _) };
check(__code, "daqReferenceDomainInfo_createReferenceDomainInfoFromBuilder")?;
Ok(unsafe { crate::marshal::require_object::<ReferenceDomainInfo>(__obj as *mut _, "daqReferenceDomainInfo_createReferenceDomainInfoFromBuilder") }?)
}
/// Gets the Reference Domain ID.
///
/// # Returns
/// - `reference_domain_id`: The Reference Domain ID. If set, gives the common identifier of one domain group. Signals with the same Reference Domain ID share a common synchronization source (all the signals in a group either come from the same device or are synchronized using a protocol, such as PTP, NTP, IRIG, etc.). Those signals can always be read together, implying that a Multi Reader can be used to read the signals if their sampling rates are compatible.
///
/// Calls the openDAQ C function `daqReferenceDomainInfo_getReferenceDomainId()`.
pub fn reference_domain_id(&self) -> Result<String> {
let mut __reference_domain_id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqReferenceDomainInfo_getReferenceDomainId)(self.as_raw() as *mut _, &mut __reference_domain_id) };
check(__code, "daqReferenceDomainInfo_getReferenceDomainId")?;
Ok(unsafe { crate::marshal::take_string(__reference_domain_id) })
}
/// Gets the Reference Domain Offset.
///
/// # Returns
/// - `reference_domain_offset`: The Reference Domain Offset. If set, denotes the offset in ticks that must be added to the domain values of the signal for them to be equal to that of the sync source. The sync source will always have an offset of 0. This offset is changed only if the sync source changes and should be kept at 0 otherwise, allowing clients to differentiate between data loss and resync events. Any device can choose to always keep the offset at 0, representing changes in the offset in the domain packet values instead. This implementation prevents clients from differentiating between errors (data loss) and resync events. Additionally, if the offset is not configured, clients have no way of detecting a resync event in the case of asynchronous signals.
///
/// Calls the openDAQ C function `daqReferenceDomainInfo_getReferenceDomainOffset()`.
pub fn reference_domain_offset(&self) -> Result<Option<i64>> {
let mut __reference_domain_offset: *mut sys::daqInteger = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqReferenceDomainInfo_getReferenceDomainOffset)(self.as_raw() as *mut _, &mut __reference_domain_offset) };
check(__code, "daqReferenceDomainInfo_getReferenceDomainOffset")?;
Ok(unsafe { crate::value::take_boxed_int(__reference_domain_offset, "daqReferenceDomainInfo_getReferenceDomainOffset") }?)
}
/// Gets the value that indicates the Reference Time Source.
///
/// # Returns
/// - `reference_time_protocol`: The value that indicates the Reference Time Source. If not set to Unknown, the domain quantity is “time”, and the timestamps are absolute according to the chosen time standard. The possible values are Gps, Tai, and Utc. This field is used to determine if two signals with different Domain IDs can be read together. Signals that have configured a Reference Time Source are trusted to have absolute time stamps that correlate to the chosen time standard (eg. two separate PTP networks, both driven through GPS can be read together, as their absolute time is the same).
///
/// Calls the openDAQ C function `daqReferenceDomainInfo_getReferenceTimeProtocol()`.
pub fn reference_time_protocol(&self) -> Result<TimeProtocol> {
let mut __reference_time_protocol: u32 = 0;
let __code = unsafe { (crate::sys::api().daqReferenceDomainInfo_getReferenceTimeProtocol)(self.as_raw() as *mut _, &mut __reference_time_protocol) };
check(__code, "daqReferenceDomainInfo_getReferenceTimeProtocol")?;
Ok(crate::marshal::enum_out(TimeProtocol::from_raw(__reference_time_protocol), "daqReferenceDomainInfo_getReferenceTimeProtocol")?)
}
/// Gets the value that indicates if offset is used.
///
/// # Returns
/// - `uses_offset`: The value that indicates if offset is used. If False, a device will contain time jumps due to resync in the domain signal data.
///
/// Calls the openDAQ C function `daqReferenceDomainInfo_getUsesOffset()`.
pub fn uses_offset(&self) -> Result<UsesOffset> {
let mut __uses_offset: u32 = 0;
let __code = unsafe { (crate::sys::api().daqReferenceDomainInfo_getUsesOffset)(self.as_raw() as *mut _, &mut __uses_offset) };
check(__code, "daqReferenceDomainInfo_getUsesOffset")?;
Ok(crate::marshal::enum_out(UsesOffset::from_raw(__uses_offset), "daqReferenceDomainInfo_getUsesOffset")?)
}
}
impl ServerCapabilityConfig {
/// Sets the device's address
///
/// # Returns
/// - `address`: The device's address
///
/// Calls the openDAQ C function `daqServerCapabilityConfig_addAddress()`.
pub fn add_address(&self, address: &str) -> Result<()> {
let __address = crate::marshal::make_string(address)?;
let __code = unsafe { (crate::sys::api().daqServerCapabilityConfig_addAddress)(self.as_raw() as *mut _, __address.as_ptr() as *mut _) };
check(__code, "daqServerCapabilityConfig_addAddress")?;
Ok(())
}
/// Calls the openDAQ C function `daqServerCapabilityConfig_addAddressInfo()`.
pub fn add_address_info(&self, address_info: &AddressInfo) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqServerCapabilityConfig_addAddressInfo)(self.as_raw() as *mut _, address_info.as_raw() as *mut _) };
check(__code, "daqServerCapabilityConfig_addAddressInfo")?;
Ok(())
}
/// Sets the connection string of device with current protocol
///
/// # Parameters
/// - `connection_string`: The connection string of device
///
/// Calls the openDAQ C function `daqServerCapabilityConfig_addConnectionString()`.
pub fn add_connection_string(&self, connection_string: &str) -> Result<()> {
let __connection_string = crate::marshal::make_string(connection_string)?;
let __code = unsafe { (crate::sys::api().daqServerCapabilityConfig_addConnectionString)(self.as_raw() as *mut _, __connection_string.as_ptr() as *mut _) };
check(__code, "daqServerCapabilityConfig_addConnectionString")?;
Ok(())
}
/// Calls the openDAQ C function `daqServerCapabilityConfig_createServerCapability()`.
pub fn server_capability(protocol_id: &str, protocol_name: &str, protocol_type: ProtocolType) -> Result<ServerCapabilityConfig> {
let __protocol_id = crate::marshal::make_string(protocol_id)?;
let __protocol_name = crate::marshal::make_string(protocol_name)?;
let mut __obj: *mut sys::daqServerCapabilityConfig = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqServerCapabilityConfig_createServerCapability)(&mut __obj, __protocol_id.as_ptr() as *mut _, __protocol_name.as_ptr() as *mut _, protocol_type as u32) };
check(__code, "daqServerCapabilityConfig_createServerCapability")?;
Ok(unsafe { crate::marshal::require_object::<ServerCapabilityConfig>(__obj as *mut _, "daqServerCapabilityConfig_createServerCapability") }?)
}
/// Sets the connection string of device with current protocol
///
/// # Parameters
/// - `connection_string`: The connection string of device
///
/// Calls the openDAQ C function `daqServerCapabilityConfig_setConnectionString()`.
pub fn set_connection_string(&self, connection_string: &str) -> Result<()> {
let __connection_string = crate::marshal::make_string(connection_string)?;
let __code = unsafe { (crate::sys::api().daqServerCapabilityConfig_setConnectionString)(self.as_raw() as *mut _, __connection_string.as_ptr() as *mut _) };
check(__code, "daqServerCapabilityConfig_setConnectionString")?;
Ok(())
}
/// Sets the type of connection
///
/// # Parameters
/// - `type`: The type of connection
///
/// Calls the openDAQ C function `daqServerCapabilityConfig_setConnectionType()`.
pub fn set_connection_type(&self, type_: &str) -> Result<()> {
let __type_ = crate::marshal::make_string(type_)?;
let __code = unsafe { (crate::sys::api().daqServerCapabilityConfig_setConnectionType)(self.as_raw() as *mut _, __type_.as_ptr() as *mut _) };
check(__code, "daqServerCapabilityConfig_setConnectionType")?;
Ok(())
}
/// Sets the boolean flag indicating whether the server capability supports core event propagation to clients
///
/// # Parameters
/// - `enabled`: True if core events are enabled; false otherwise
///
/// Calls the openDAQ C function `daqServerCapabilityConfig_setCoreEventsEnabled()`.
pub fn set_core_events_enabled(&self, enabled: bool) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqServerCapabilityConfig_setCoreEventsEnabled)(self.as_raw() as *mut _, u8::from(enabled)) };
check(__code, "daqServerCapabilityConfig_setCoreEventsEnabled")?;
Ok(())
}
/// Sets the port of the device
///
/// # Parameters
/// - `port`: The port of the device
///
/// Calls the openDAQ C function `daqServerCapabilityConfig_setPort()`.
pub fn set_port(&self, port: i64) -> Result<()> {
let __port = crate::value::int_to_ref(port)?;
let __code = unsafe { (crate::sys::api().daqServerCapabilityConfig_setPort)(self.as_raw() as *mut _, __port.as_ptr() as *mut _) };
check(__code, "daqServerCapabilityConfig_setPort")?;
Ok(())
}
/// Sets the prefix of the connection string (eg. "daq.nd" or "daq.opcua")
///
/// # Parameters
/// - `prefix`: The connection string prefix
///
/// Calls the openDAQ C function `daqServerCapabilityConfig_setPrefix()`.
pub fn set_prefix(&self, prefix: &str) -> Result<()> {
let __prefix = crate::marshal::make_string(prefix)?;
let __code = unsafe { (crate::sys::api().daqServerCapabilityConfig_setPrefix)(self.as_raw() as *mut _, __prefix.as_ptr() as *mut _) };
check(__code, "daqServerCapabilityConfig_setPrefix")?;
Ok(())
}
/// Sets the ID of protocol
///
/// # Parameters
/// - `protocol_id`: The ID of protocol
///
/// Calls the openDAQ C function `daqServerCapabilityConfig_setProtocolId()`.
pub fn set_protocol_id(&self, protocol_id: &str) -> Result<()> {
let __protocol_id = crate::marshal::make_string(protocol_id)?;
let __code = unsafe { (crate::sys::api().daqServerCapabilityConfig_setProtocolId)(self.as_raw() as *mut _, __protocol_id.as_ptr() as *mut _) };
check(__code, "daqServerCapabilityConfig_setProtocolId")?;
Ok(())
}
/// Sets the name of protocol
///
/// # Parameters
/// - `protocol_name`: The name of protocol
///
/// Calls the openDAQ C function `daqServerCapabilityConfig_setProtocolName()`.
pub fn set_protocol_name(&self, protocol_name: &str) -> Result<()> {
let __protocol_name = crate::marshal::make_string(protocol_name)?;
let __code = unsafe { (crate::sys::api().daqServerCapabilityConfig_setProtocolName)(self.as_raw() as *mut _, __protocol_name.as_ptr() as *mut _) };
check(__code, "daqServerCapabilityConfig_setProtocolName")?;
Ok(())
}
/// Sets the type of protocol
///
/// # Parameters
/// - `type`: The type of protocol
///
/// Calls the openDAQ C function `daqServerCapabilityConfig_setProtocolType()`.
pub fn set_protocol_type(&self, type_: ProtocolType) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqServerCapabilityConfig_setProtocolType)(self.as_raw() as *mut _, type_ as u32) };
check(__code, "daqServerCapabilityConfig_setProtocolType")?;
Ok(())
}
/// Sets the protocol version
///
/// # Parameters
/// - `version`: The protocol version
///
/// Calls the openDAQ C function `daqServerCapabilityConfig_setProtocolVersion()`.
pub fn set_protocol_version(&self, version: &str) -> Result<()> {
let __version = crate::marshal::make_string(version)?;
let __code = unsafe { (crate::sys::api().daqServerCapabilityConfig_setProtocolVersion)(self.as_raw() as *mut _, __version.as_ptr() as *mut _) };
check(__code, "daqServerCapabilityConfig_setProtocolVersion")?;
Ok(())
}
}
impl ServerCapability {
/// Gets the list of address information objects.
///
/// # Returns
/// - `address_info`: The list of address information objects. Address information duplicates the connection string and address as available on the Server Capability object. Additionally, it provides information on what type of address it is (e.g., IPv4, IPv6), as well as whether the address is reachable.
///
/// Calls the openDAQ C function `daqServerCapability_getAddressInfo()`.
pub fn address_info(&self) -> Result<Vec<AddressInfo>> {
let mut __address_info: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqServerCapability_getAddressInfo)(self.as_raw() as *mut _, &mut __address_info) };
check(__code, "daqServerCapability_getAddressInfo")?;
Ok(unsafe { crate::marshal::take_list::<AddressInfo>(__address_info as *mut _, "daqServerCapability_getAddressInfo") }?)
}
/// Gets the device's list of addresses with the current protocol.
///
/// # Returns
/// - `addresses`: The device's list of addresses (hosts)
///
/// Calls the openDAQ C function `daqServerCapability_getAddresses()`.
pub fn addresses(&self) -> Result<Vec<String>> {
let mut __addresses: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqServerCapability_getAddresses)(self.as_raw() as *mut _, &mut __addresses) };
check(__code, "daqServerCapability_getAddresses")?;
Ok(unsafe { crate::marshal::take_list::<String>(__addresses as *mut _, "daqServerCapability_getAddresses") }?)
}
/// Gets the connection string of the device with the current protocol.
///
/// # Returns
/// - `connection_string`: The connection string of the device (URL to connect).
///
/// Calls the openDAQ C function `daqServerCapability_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().daqServerCapability_getConnectionString)(self.as_raw() as *mut _, &mut __connection_string) };
check(__code, "daqServerCapability_getConnectionString")?;
Ok(unsafe { crate::marshal::take_string(__connection_string) })
}
/// Gets the connection string of the device with the current protocol.
///
/// # Returns
/// - `connection_strings`: The connection string of the device (URL to connect).
///
/// Calls the openDAQ C function `daqServerCapability_getConnectionStrings()`.
pub fn connection_strings(&self) -> Result<Vec<String>> {
let mut __connection_strings: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqServerCapability_getConnectionStrings)(self.as_raw() as *mut _, &mut __connection_strings) };
check(__code, "daqServerCapability_getConnectionStrings")?;
Ok(unsafe { crate::marshal::take_list::<String>(__connection_strings as *mut _, "daqServerCapability_getConnectionStrings") }?)
}
/// Gets the type of connection supported by the device.
///
/// # Returns
/// - `type`: The type of connection (e.g., "TCP/IP").
///
/// Calls the openDAQ C function `daqServerCapability_getConnectionType()`.
pub fn connection_type(&self) -> Result<String> {
let mut __type_: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqServerCapability_getConnectionType)(self.as_raw() as *mut _, &mut __type_) };
check(__code, "daqServerCapability_getConnectionType")?;
Ok(unsafe { crate::marshal::take_string(__type_) })
}
/// Gets the client update method supported by the device.
///
/// # Returns
/// - `enabled`: The client update method (Boolean value indicating if core events are enabled for communication between server and client device).
///
/// Calls the openDAQ C function `daqServerCapability_getCoreEventsEnabled()`.
pub fn core_events_enabled(&self) -> Result<bool> {
let mut __enabled: u8 = 0;
let __code = unsafe { (crate::sys::api().daqServerCapability_getCoreEventsEnabled)(self.as_raw() as *mut _, &mut __enabled) };
check(__code, "daqServerCapability_getCoreEventsEnabled")?;
Ok(__enabled != 0)
}
/// Gets the port of the device with the current protocol.
///
/// # Returns
/// - `port`: The port of the device.
///
/// Calls the openDAQ C function `daqServerCapability_getPort()`.
pub fn port(&self) -> Result<Option<i64>> {
let mut __port: *mut sys::daqInteger = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqServerCapability_getPort)(self.as_raw() as *mut _, &mut __port) };
check(__code, "daqServerCapability_getPort")?;
Ok(unsafe { crate::value::take_boxed_int(__port, "daqServerCapability_getPort") }?)
}
/// Gets the prefix of the connection string (eg. "daq.nd" or "daq.opcua")
///
/// # Parameters
/// - `prefix`: The connection string prefix
///
/// Calls the openDAQ C function `daqServerCapability_getPrefix()`.
pub fn prefix(&self) -> Result<String> {
let mut __prefix: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqServerCapability_getPrefix)(self.as_raw() as *mut _, &mut __prefix) };
check(__code, "daqServerCapability_getPrefix")?;
Ok(unsafe { crate::marshal::take_string(__prefix) })
}
/// Gets the id of the protocol supported by the device. Should not contain spaces or special characters except for '_' and '-'.
///
/// # Returns
/// - `protocol_id`: The id of the protocol.
///
/// Calls the openDAQ C function `daqServerCapability_getProtocolId()`.
pub fn protocol_id(&self) -> Result<String> {
let mut __protocol_id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqServerCapability_getProtocolId)(self.as_raw() as *mut _, &mut __protocol_id) };
check(__code, "daqServerCapability_getProtocolId")?;
Ok(unsafe { crate::marshal::take_string(__protocol_id) })
}
/// Gets the name of the protocol supported by the device.
///
/// # Returns
/// - `protocol_name`: The name of the protocol (e.g., "OpenDAQNativeStreaming", "OpenDAQOPCUA", "OpenDAQLTStreaming").
///
/// Calls the openDAQ C function `daqServerCapability_getProtocolName()`.
pub fn protocol_name(&self) -> Result<String> {
let mut __protocol_name: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqServerCapability_getProtocolName)(self.as_raw() as *mut _, &mut __protocol_name) };
check(__code, "daqServerCapability_getProtocolName")?;
Ok(unsafe { crate::marshal::take_string(__protocol_name) })
}
/// Gets the type of protocol supported by the device.
///
/// # Returns
/// - `type`: The type of protocol (Enumeration value reflecting protocol type: "ConfigurationAndStreaming", "Configuration", "Streaming", "Unknown").
///
/// Calls the openDAQ C function `daqServerCapability_getProtocolType()`.
pub fn protocol_type(&self) -> Result<ProtocolType> {
let mut __type_: u32 = 0;
let __code = unsafe { (crate::sys::api().daqServerCapability_getProtocolType)(self.as_raw() as *mut _, &mut __type_) };
check(__code, "daqServerCapability_getProtocolType")?;
Ok(crate::marshal::enum_out(ProtocolType::from_raw(__type_), "daqServerCapability_getProtocolType")?)
}
/// Gets the protocol version supported by the device's protocol.
///
/// # Returns
/// - `version`: The protocol version.
///
/// Calls the openDAQ C function `daqServerCapability_getProtocolVersion()`.
pub fn protocol_version(&self) -> Result<String> {
let mut __version: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqServerCapability_getProtocolVersion)(self.as_raw() as *mut _, &mut __version) };
check(__code, "daqServerCapability_getProtocolVersion")?;
Ok(unsafe { crate::marshal::take_string(__version) })
}
}
impl Server {
/// Disables the server to be discovered by the clients.
///
/// Calls the openDAQ C function `daqServer_disableDiscovery()`.
pub fn disable_discovery(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqServer_disableDiscovery)(self.as_raw() as *mut _) };
check(__code, "daqServer_disableDiscovery")?;
Ok(())
}
/// Enables the server to be discovered by the clients.
///
/// Calls the openDAQ C function `daqServer_enableDiscovery()`.
pub fn enable_discovery(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqServer_enableDiscovery)(self.as_raw() as *mut _) };
check(__code, "daqServer_enableDiscovery")?;
Ok(())
}
/// Gets the server id.
///
/// # Returns
/// - `server_id`: The server id.
///
/// Calls the openDAQ C function `daqServer_getId()`.
pub fn id(&self) -> Result<String> {
let mut __server_id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqServer_getId)(self.as_raw() as *mut _, &mut __server_id) };
check(__code, "daqServer_getId")?;
Ok(unsafe { crate::marshal::take_string(__server_id) })
}
/// Gets a list of the server's signals.
///
/// # Returns
/// - `signals`: The flat list of signals. Server signals are most often the mirrored representations of signals that belong to the client connected to the instance via this server.
///
/// Calls the openDAQ C function `daqServer_getSignals()`.
pub fn signals(&self) -> Result<Vec<Signal>> {
let mut __signals: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqServer_getSignals)(self.as_raw() as *mut _, &mut __signals, std::ptr::null_mut()) };
check(__code, "daqServer_getSignals")?;
Ok(unsafe { crate::marshal::take_list::<Signal>(__signals as *mut _, "daqServer_getSignals") }?)
}
/// Gets a list of the server's signals.
///
/// # Returns
/// - `signals`: The flat list of signals. Server signals are most often the mirrored representations of signals that belong to the client connected to the instance via this server.
///
/// Calls the openDAQ C function `daqServer_getSignals()`.
pub fn signals_with(&self, search_filter: Option<&SearchFilter>) -> Result<Vec<Signal>> {
let mut __signals: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqServer_getSignals)(self.as_raw() as *mut _, &mut __signals, search_filter.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqServer_getSignals")?;
Ok(unsafe { crate::marshal::take_list::<Signal>(__signals as *mut _, "daqServer_getSignals") }?)
}
/// Gets a streaming source associated with server.
///
/// # Returns
/// - `streaming`: The streaming object that represents the server’s client-to-device streaming source. The streaming object is assigned on servers that support the generalized client-to-device streaming mechanism. The object is expected to be associated with mirrored server-side copies of client signals and is responsible for receiving their data sent from the client to the device.
///
/// Calls the openDAQ C function `daqServer_getStreaming()`.
pub fn streaming(&self) -> Result<Option<Streaming>> {
let mut __streaming: *mut sys::daqStreaming = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqServer_getStreaming)(self.as_raw() as *mut _, &mut __streaming) };
check(__code, "daqServer_getStreaming")?;
Ok(unsafe { crate::marshal::take_object::<Streaming>(__streaming as *mut _) })
}
/// Stops the server. This is called when we remove the server from the Instance or Instance is closing.
///
/// Calls the openDAQ C function `daqServer_stop()`.
pub fn stop(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqServer_stop)(self.as_raw() as *mut _) };
check(__code, "daqServer_stop")?;
Ok(())
}
}
impl Streaming {
/// Adds input ports to the Streaming.
///
/// # Parameters
/// - `input_ports`: The list of input ports to be added.
///
/// # Errors
/// - `OPENDAQ_ERR_DUPLICATEITEM`: if an input port on the list is already added to the Streaming.
/// - `OPENDAQ_ERR_NOINTERFACE`: if an input port on the list is not a mirrored signal. After an input port is added to the Streaming, the Streaming automatically appears in the list of available streaming sources of an input port.
///
/// Calls the openDAQ C function `daqStreaming_addInputPorts()`.
pub fn add_input_ports(&self, input_ports: &[MirroredInputPortConfig]) -> Result<()> {
let __input_ports = crate::marshal::list_from_interfaces(input_ports)?;
let __code = unsafe { (crate::sys::api().daqStreaming_addInputPorts)(self.as_raw() as *mut _, __input_ports.as_ptr() as *mut _) };
check(__code, "daqStreaming_addInputPorts")?;
Ok(())
}
/// Adds signals to the Streaming.
///
/// # Parameters
/// - `signals`: The list of signals to be added.
///
/// # Errors
/// - `OPENDAQ_ERR_DUPLICATEITEM`: if a signal on the list is already added to the Streaming.
/// - `OPENDAQ_ERR_NOINTERFACE`: if a signal on the list is not a mirrored signal. After a signal is added to the Streaming, the Streaming automatically appears in the list of available streaming sources of a signal. Some signals, however, may be silently ignored without triggering an error - for example, private signals are excluded by default.
///
/// Calls the openDAQ C function `daqStreaming_addSignals()`.
pub fn add_signals(&self, signals: &[Signal]) -> Result<()> {
let __signals = crate::marshal::list_from_interfaces(signals)?;
let __code = unsafe { (crate::sys::api().daqStreaming_addSignals)(self.as_raw() as *mut _, __signals.as_ptr() as *mut _) };
check(__code, "daqStreaming_addSignals")?;
Ok(())
}
/// Gets the active state of the Streaming.
///
/// # Returns
/// - `active`: True if the Streaming is active; false otherwise.
///
/// Calls the openDAQ C function `daqStreaming_getActive()`.
pub fn active(&self) -> Result<bool> {
let mut __active: u8 = 0;
let __code = unsafe { (crate::sys::api().daqStreaming_getActive)(self.as_raw() as *mut _, &mut __active) };
check(__code, "daqStreaming_getActive")?;
Ok(__active != 0)
}
/// Checks whether client-to-device streaming is enabled for this streaming object.
///
/// # Returns
/// - `enabled`: The flag indicating if client-to-device streaming is enabled.
///
/// Calls the openDAQ C function `daqStreaming_getClientToDeviceStreamingEnabled()`.
pub fn client_to_device_streaming_enabled(&self) -> Result<bool> {
let mut __enabled: u8 = 0;
let __code = unsafe { (crate::sys::api().daqStreaming_getClientToDeviceStreamingEnabled)(self.as_raw() as *mut _, &mut __enabled) };
check(__code, "daqStreaming_getClientToDeviceStreamingEnabled")?;
Ok(__enabled != 0)
}
/// Retrieves the current status of the streaming connection.
///
/// # Returns
/// - `connection_status`: The connection status, represented as an enumeration of type "ConnectionStatusType" with possible values: "Connected", "Reconnecting", or "Unrecoverable".
///
/// Calls the openDAQ C function `daqStreaming_getConnectionStatus()`.
pub fn connection_status(&self) -> Result<Option<Enumeration>> {
let mut __connection_status: *mut sys::daqEnumeration = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqStreaming_getConnectionStatus)(self.as_raw() as *mut _, &mut __connection_status) };
check(__code, "daqStreaming_getConnectionStatus")?;
Ok(unsafe { crate::marshal::take_object::<Enumeration>(__connection_status as *mut _) })
}
/// Gets the string representation of a connection address used to connect to the streaming service of the device.
///
/// # Returns
/// - `connection_string`: The string used to connect to the streaming service.
///
/// Calls the openDAQ C function `daqStreaming_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().daqStreaming_getConnectionString)(self.as_raw() as *mut _, &mut __connection_string) };
check(__code, "daqStreaming_getConnectionString")?;
Ok(unsafe { crate::marshal::take_string(__connection_string) })
}
/// Gets the global ID of the device (as it appears on the remote instance) to which this streaming object establishes a connection.
///
/// # Returns
/// - `device_remote_id`: The string representing the device's remote ID.
///
/// Calls the openDAQ C function `daqStreaming_getOwnerDeviceRemoteId()`.
pub fn owner_device_remote_id(&self) -> Result<String> {
let mut __device_remote_id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqStreaming_getOwnerDeviceRemoteId)(self.as_raw() as *mut _, &mut __device_remote_id) };
check(__code, "daqStreaming_getOwnerDeviceRemoteId")?;
Ok(unsafe { crate::marshal::take_string(__device_remote_id) })
}
/// Gets the identifier of the data transfer protocol (e.g., "OpenDAQNativeStreaming", "OpenDAQLTStreaming") used by this streaming object.
///
/// # Returns
/// - `protocol_id`: The string representing the protocol ID.
///
/// Calls the openDAQ C function `daqStreaming_getProtocolId()`.
pub fn protocol_id(&self) -> Result<String> {
let mut __protocol_id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqStreaming_getProtocolId)(self.as_raw() as *mut _, &mut __protocol_id) };
check(__code, "daqStreaming_getProtocolId")?;
Ok(unsafe { crate::marshal::take_string(__protocol_id) })
}
/// Removes all added input ports from the Streaming.
///
/// Calls the openDAQ C function `daqStreaming_removeAllInputPorts()`.
pub fn remove_all_input_ports(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqStreaming_removeAllInputPorts)(self.as_raw() as *mut _) };
check(__code, "daqStreaming_removeAllInputPorts")?;
Ok(())
}
/// Removes all added signals from the Streaming.
///
/// Calls the openDAQ C function `daqStreaming_removeAllSignals()`.
pub fn remove_all_signals(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqStreaming_removeAllSignals)(self.as_raw() as *mut _) };
check(__code, "daqStreaming_removeAllSignals")?;
Ok(())
}
/// Removes input ports from the Streaming.
///
/// # Parameters
/// - `input_ports`: The list of input ports to be removed.
///
/// # Errors
/// - `OPENDAQ_ERR_NOTFOUND`: if an input port on the list was not added to the Streaming. After an input port is removed from the Streaming, the Streaming is automatically excluded in the list of available streaming sources of an input port.
///
/// Calls the openDAQ C function `daqStreaming_removeInputPorts()`.
pub fn remove_input_ports(&self, input_ports: &[MirroredInputPortConfig]) -> Result<()> {
let __input_ports = crate::marshal::list_from_interfaces(input_ports)?;
let __code = unsafe { (crate::sys::api().daqStreaming_removeInputPorts)(self.as_raw() as *mut _, __input_ports.as_ptr() as *mut _) };
check(__code, "daqStreaming_removeInputPorts")?;
Ok(())
}
/// Removes signals from the Streaming.
///
/// # Parameters
/// - `signals`: The list of signals to be removed.
///
/// # Errors
/// - `OPENDAQ_ERR_NOTFOUND`: if a signal on the list was not added to the Streaming. After a signal is removed from the Streaming, the Streaming is automatically excluded in the list of available streaming sources of a signal.
///
/// Calls the openDAQ C function `daqStreaming_removeSignals()`.
pub fn remove_signals(&self, signals: &[Signal]) -> Result<()> {
let __signals = crate::marshal::list_from_interfaces(signals)?;
let __code = unsafe { (crate::sys::api().daqStreaming_removeSignals)(self.as_raw() as *mut _, __signals.as_ptr() as *mut _) };
check(__code, "daqStreaming_removeSignals")?;
Ok(())
}
/// Sets the Streaming to be either active or inactive.
///
/// # Parameters
/// - `active`: The new active state of the Streaming.
///
/// Calls the openDAQ C function `daqStreaming_setActive()`.
pub fn set_active(&self, active: bool) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqStreaming_setActive)(self.as_raw() as *mut _, u8::from(active)) };
check(__code, "daqStreaming_setActive")?;
Ok(())
}
}
impl SyncComponent {
/// Calls the openDAQ C function `daqSyncComponent_createSyncComponent()`.
pub fn new(context: &Context, parse_failed_exception: &Component, local_id: &str) -> Result<SyncComponent> {
let __local_id = crate::marshal::make_string(local_id)?;
let mut __obj: *mut sys::daqSyncComponent = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqSyncComponent_createSyncComponent)(&mut __obj, context.as_raw() as *mut _, parse_failed_exception.as_raw() as *mut _, __local_id.as_ptr() as *mut _) };
check(__code, "daqSyncComponent_createSyncComponent")?;
Ok(unsafe { crate::marshal::require_object::<SyncComponent>(__obj as *mut _, "daqSyncComponent_createSyncComponent") }?)
}
/// Retrieves the list of interfaces associated with this synchronization component.
///
/// # Returns
/// - `interfaces`: List of interfaces associated with this component.
///
/// Calls the openDAQ C function `daqSyncComponent_getInterfaces()`.
pub fn interfaces(&self) -> Result<std::collections::HashMap<String, PropertyObject>> {
let mut __interfaces: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqSyncComponent_getInterfaces)(self.as_raw() as *mut _, &mut __interfaces) };
check(__code, "daqSyncComponent_getInterfaces")?;
Ok(unsafe { crate::marshal::take_dict::<String, PropertyObject>(__interfaces as *mut _, "daqSyncComponent_getInterfaces") }?)
}
/// Retrieves the selected sync source interface.
///
/// # Returns
/// - `selected_source`: The selected sync source interface.
///
/// Calls the openDAQ C function `daqSyncComponent_getSelectedSource()`.
pub fn selected_source(&self) -> Result<i64> {
let mut __selected_source: i64 = Default::default();
let __code = unsafe { (crate::sys::api().daqSyncComponent_getSelectedSource)(self.as_raw() as *mut _, &mut __selected_source) };
check(__code, "daqSyncComponent_getSelectedSource")?;
Ok(__selected_source)
}
/// Retrieves the synchronization lock status.
///
/// # Returns
/// - `synchronization_locked`: True if synchronization is locked; false otherwise.
///
/// Calls the openDAQ C function `daqSyncComponent_getSyncLocked()`.
pub fn sync_locked(&self) -> Result<bool> {
let mut __synchronization_locked: u8 = 0;
let __code = unsafe { (crate::sys::api().daqSyncComponent_getSyncLocked)(self.as_raw() as *mut _, &mut __synchronization_locked) };
check(__code, "daqSyncComponent_getSyncLocked")?;
Ok(__synchronization_locked != 0)
}
/// Sets the selected sync source interface.
///
/// # Parameters
/// - `selected_source`: The selected sync source interface.
///
/// Calls the openDAQ C function `daqSyncComponent_setSelectedSource()`.
pub fn set_selected_source(&self, selected_source: i64) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqSyncComponent_setSelectedSource)(self.as_raw() as *mut _, selected_source) };
check(__code, "daqSyncComponent_setSelectedSource")?;
Ok(())
}
}
impl UserLock {
/// Creates an unlocked UserLock object.
///
/// Calls the openDAQ C function `daqUserLock_createUserLock()`.
pub fn new() -> Result<UserLock> {
let mut __obj: *mut sys::daqUserLock = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqUserLock_createUserLock)(&mut __obj) };
check(__code, "daqUserLock_createUserLock")?;
Ok(unsafe { crate::marshal::require_object::<UserLock>(__obj as *mut _, "daqUserLock_createUserLock") }?)
}
/// Forcefully unlock the object. A force unlock will always succeed, regardless of which user initially locked the object.
///
/// Calls the openDAQ C function `daqUserLock_forceUnlock()`.
pub fn force_unlock(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqUserLock_forceUnlock)(self.as_raw() as *mut _) };
check(__code, "daqUserLock_forceUnlock")?;
Ok(())
}
/// Returns true if the object is locked.
///
/// # Parameters
/// - `is_locked_out`: \[out\] True if the object is locked.
///
/// Calls the openDAQ C function `daqUserLock_isLocked()`.
pub fn is_locked(&self) -> Result<bool> {
let mut __is_locked_out: u8 = 0;
let __code = unsafe { (crate::sys::api().daqUserLock_isLocked)(self.as_raw() as *mut _, &mut __is_locked_out) };
check(__code, "daqUserLock_isLocked")?;
Ok(__is_locked_out != 0)
}
/// Lock the object. Only the user who locked the object can unlock it. If the object was locked without a specific user, or with an anonymous user, any user can unlock it.
///
/// # Parameters
/// - `user`: User performing the lock action.
///
/// Calls the openDAQ C function `daqUserLock_lock()`.
pub fn lock(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqUserLock_lock)(self.as_raw() as *mut _, std::ptr::null_mut()) };
check(__code, "daqUserLock_lock")?;
Ok(())
}
/// Lock the object. Only the user who locked the object can unlock it. If the object was locked without a specific user, or with an anonymous user, any user can unlock it.
///
/// # Parameters
/// - `user`: User performing the lock action.
///
/// Calls the openDAQ C function `daqUserLock_lock()`.
pub fn lock_with(&self, user: Option<&User>) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqUserLock_lock)(self.as_raw() as *mut _, user.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqUserLock_lock")?;
Ok(())
}
/// Unlock the object. Only the user who locked the object can unlock it. If the object was locked without a specific user, or with an anonymous user, any user can unlock it.
///
/// # Parameters
/// - `user`: User performing the unlock action.
///
/// Calls the openDAQ C function `daqUserLock_unlock()`.
pub fn unlock(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqUserLock_unlock)(self.as_raw() as *mut _, std::ptr::null_mut()) };
check(__code, "daqUserLock_unlock")?;
Ok(())
}
/// Unlock the object. Only the user who locked the object can unlock it. If the object was locked without a specific user, or with an anonymous user, any user can unlock it.
///
/// # Parameters
/// - `user`: User performing the unlock action.
///
/// Calls the openDAQ C function `daqUserLock_unlock()`.
pub fn unlock_with(&self, user: Option<&User>) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqUserLock_unlock)(self.as_raw() as *mut _, user.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqUserLock_unlock")?;
Ok(())
}
}