// 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;
/// Represents an openDAQ mirrored client device. Allows accessing streaming data sources associated with the device.
/// Wrapper over the openDAQ `daqMirroredDevice` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct MirroredDevice(pub(crate) Device);
impl std::ops::Deref for MirroredDevice {
type Target = Device;
fn deref(&self) -> &Device { &self.0 }
}
impl crate::sealed::Sealed for MirroredDevice {}
unsafe impl Interface for MirroredDevice {
const NAME: &'static str = "daqMirroredDevice";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqMirroredDevice_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 MirroredDevice {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { MirroredDevice(Device::__from_ref(r)) }
}
impl std::fmt::Display for MirroredDevice {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&MirroredDevice> for Value {
fn from(value: &MirroredDevice) -> Value { Value::Object(value.to_base_object()) }
}
impl From<MirroredDevice> for Value {
fn from(value: MirroredDevice) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for MirroredDevice {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Represents configuration interface for mirrored device. Allows attaching and removing streaming data sources associated with the device.
/// Wrapper over the openDAQ `daqMirroredDeviceConfig` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct MirroredDeviceConfig(pub(crate) MirroredDevice);
impl std::ops::Deref for MirroredDeviceConfig {
type Target = MirroredDevice;
fn deref(&self) -> &MirroredDevice { &self.0 }
}
impl crate::sealed::Sealed for MirroredDeviceConfig {}
unsafe impl Interface for MirroredDeviceConfig {
const NAME: &'static str = "daqMirroredDeviceConfig";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqMirroredDeviceConfig_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 MirroredDeviceConfig {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { MirroredDeviceConfig(MirroredDevice::__from_ref(r)) }
}
impl std::fmt::Display for MirroredDeviceConfig {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&MirroredDeviceConfig> for Value {
fn from(value: &MirroredDeviceConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl From<MirroredDeviceConfig> for Value {
fn from(value: MirroredDeviceConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for MirroredDeviceConfig {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Represents the configuration interface for mirrored input ports.
/// Allows listing available streaming sources and selecting the active source for a mirrored input port.
/// Only sources that support client-to-device streaming are allowed. The active sources sends client signal
/// (and the associated domain signal) data to the device, which is then consumed by the connection formed
/// by the input port origin and the mirrored signal connected to it.
/// Wrapper over the openDAQ `daqMirroredInputPortConfig` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct MirroredInputPortConfig(pub(crate) InputPortConfig);
impl std::ops::Deref for MirroredInputPortConfig {
type Target = InputPortConfig;
fn deref(&self) -> &InputPortConfig { &self.0 }
}
impl crate::sealed::Sealed for MirroredInputPortConfig {}
unsafe impl Interface for MirroredInputPortConfig {
const NAME: &'static str = "daqMirroredInputPortConfig";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqMirroredInputPortConfig_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 MirroredInputPortConfig {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { MirroredInputPortConfig(InputPortConfig::__from_ref(r)) }
}
impl std::fmt::Display for MirroredInputPortConfig {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&MirroredInputPortConfig> for Value {
fn from(value: &MirroredInputPortConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl From<MirroredInputPortConfig> for Value {
fn from(value: MirroredInputPortConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for MirroredInputPortConfig {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Represents configuration interface for mirrored signals. Allows selecting streaming data sources per signal.
/// Wrapper over the openDAQ `daqMirroredSignalConfig` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct MirroredSignalConfig(pub(crate) SignalConfig);
impl std::ops::Deref for MirroredSignalConfig {
type Target = SignalConfig;
fn deref(&self) -> &SignalConfig { &self.0 }
}
impl crate::sealed::Sealed for MirroredSignalConfig {}
unsafe impl Interface for MirroredSignalConfig {
const NAME: &'static str = "daqMirroredSignalConfig";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqMirroredSignalConfig_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 MirroredSignalConfig {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { MirroredSignalConfig(SignalConfig::__from_ref(r)) }
}
impl std::fmt::Display for MirroredSignalConfig {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&MirroredSignalConfig> for Value {
fn from(value: &MirroredSignalConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl From<MirroredSignalConfig> for Value {
fn from(value: MirroredSignalConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for MirroredSignalConfig {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// Internal functions used by openDAQ core. This interface should never be used in client SDK or module code.
/// Wrapper over the openDAQ `daqMirroredSignalPrivate` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct MirroredSignalPrivate(pub(crate) BaseObject);
impl std::ops::Deref for MirroredSignalPrivate {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for MirroredSignalPrivate {}
unsafe impl Interface for MirroredSignalPrivate {
const NAME: &'static str = "daqMirroredSignalPrivate";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqMirroredSignalPrivate_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 MirroredSignalPrivate {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { MirroredSignalPrivate(BaseObject(r)) }
}
impl std::fmt::Display for MirroredSignalPrivate {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&MirroredSignalPrivate> for Value {
fn from(value: &MirroredSignalPrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl From<MirroredSignalPrivate> for Value {
fn from(value: MirroredSignalPrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for MirroredSignalPrivate {
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 streaming type can be created by a given module. Can be used to obtain the default configuration used when either adding/creating a new device, or establishing a new streaming connection.
/// Wrapper over the openDAQ `daqStreamingType` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct StreamingType(pub(crate) ComponentType);
impl std::ops::Deref for StreamingType {
type Target = ComponentType;
fn deref(&self) -> &ComponentType { &self.0 }
}
impl crate::sealed::Sealed for StreamingType {}
unsafe impl Interface for StreamingType {
const NAME: &'static str = "daqStreamingType";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqStreamingType_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 StreamingType {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { StreamingType(ComponentType::__from_ref(r)) }
}
impl std::fmt::Display for StreamingType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&StreamingType> for Value {
fn from(value: &StreamingType) -> Value { Value::Object(value.to_base_object()) }
}
impl From<StreamingType> for Value {
fn from(value: StreamingType) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for StreamingType {
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 `daqSubscriptionEventArgs` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct SubscriptionEventArgs(pub(crate) EventArgs);
impl std::ops::Deref for SubscriptionEventArgs {
type Target = EventArgs;
fn deref(&self) -> &EventArgs { &self.0 }
}
impl crate::sealed::Sealed for SubscriptionEventArgs {}
unsafe impl Interface for SubscriptionEventArgs {
const NAME: &'static str = "daqSubscriptionEventArgs";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqSubscriptionEventArgs_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 SubscriptionEventArgs {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { SubscriptionEventArgs(EventArgs::__from_ref(r)) }
}
impl std::fmt::Display for SubscriptionEventArgs {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&SubscriptionEventArgs> for Value {
fn from(value: &SubscriptionEventArgs) -> Value { Value::Object(value.to_base_object()) }
}
impl From<SubscriptionEventArgs> for Value {
fn from(value: SubscriptionEventArgs) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for SubscriptionEventArgs {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
impl MirroredDeviceConfig {
/// Adds streaming source for device.
///
/// # Parameters
/// - `streaming`: The Streaming object representing the data source.
///
/// Calls the openDAQ C function `daqMirroredDeviceConfig_addStreamingSource()`.
pub fn add_streaming_source(&self, streaming_source: &Streaming) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqMirroredDeviceConfig_addStreamingSource)(self.as_raw() as *mut _, streaming_source.as_raw() as *mut _) };
check(__code, "daqMirroredDeviceConfig_addStreamingSource")?;
Ok(())
}
/// Removes streaming source for device e.g. when the streaming source is no longer available.
///
/// # Parameters
/// - `streaming_connection_string`: The connection string of streaming source to be removed.
///
/// Calls the openDAQ C function `daqMirroredDeviceConfig_removeStreamingSource()`.
pub fn remove_streaming_source(&self, streaming_connection_string: &str) -> Result<()> {
let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
let __code = unsafe { (crate::sys::api().daqMirroredDeviceConfig_removeStreamingSource)(self.as_raw() as *mut _, __streaming_connection_string.as_ptr() as *mut _) };
check(__code, "daqMirroredDeviceConfig_removeStreamingSource")?;
Ok(())
}
/// Sets the device's type that corresponds to the client-side device module.
///
/// # Parameters
/// - `type`: The device's type.
///
/// Calls the openDAQ C function `daqMirroredDeviceConfig_setMirroredDeviceType()`.
pub fn set_mirrored_device_type(&self, type_: &DeviceType) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqMirroredDeviceConfig_setMirroredDeviceType)(self.as_raw() as *mut _, type_.as_raw() as *mut _) };
check(__code, "daqMirroredDeviceConfig_setMirroredDeviceType")?;
Ok(())
}
}
impl MirroredDevice {
/// Gets the device's type that corresponds to the client-side device module.
///
/// # Parameters
/// - `type`: The device's type.
///
/// Calls the openDAQ C function `daqMirroredDevice_getMirroredDeviceType()`.
pub fn mirrored_device_type(&self) -> Result<Option<DeviceType>> {
let mut __type_: *mut sys::daqDeviceType = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqMirroredDevice_getMirroredDeviceType)(self.as_raw() as *mut _, &mut __type_) };
check(__code, "daqMirroredDevice_getMirroredDeviceType")?;
Ok(unsafe { crate::marshal::take_object::<DeviceType>(__type_ as *mut _) })
}
/// Gets the global ID of the device as it appears on the remote instance.
///
/// # Returns
/// - `id`: The device ID.
///
/// Calls the openDAQ C function `daqMirroredDevice_getRemoteId()`.
pub fn remote_id(&self) -> Result<String> {
let mut __id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqMirroredDevice_getRemoteId)(self.as_raw() as *mut _, &mut __id) };
check(__code, "daqMirroredDevice_getRemoteId")?;
Ok(unsafe { crate::marshal::take_string(__id) })
}
/// Gets a list of streaming objects representing all streaming sources of the device.
///
/// # Returns
/// - `streaming_sources`: The list of streaming objects.
///
/// Calls the openDAQ C function `daqMirroredDevice_getStreamingSources()`.
pub fn streaming_sources(&self) -> Result<Vec<Streaming>> {
let mut __streaming_sources: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqMirroredDevice_getStreamingSources)(self.as_raw() as *mut _, &mut __streaming_sources) };
check(__code, "daqMirroredDevice_getStreamingSources")?;
Ok(unsafe { crate::marshal::take_list::<Streaming>(__streaming_sources as *mut _, "daqMirroredDevice_getStreamingSources") }?)
}
}
impl MirroredInputPortConfig {
/// Gets a connection strings of the active streaming source of the input port.
///
/// # Returns
/// - `streaming_connection_string`: The connection string of active streaming source.
///
/// Calls the openDAQ C function `daqMirroredInputPortConfig_getActiveStreamingSource()`.
pub fn active_streaming_source(&self) -> Result<String> {
let mut __streaming_connection_string: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqMirroredInputPortConfig_getActiveStreamingSource)(self.as_raw() as *mut _, &mut __streaming_connection_string) };
check(__code, "daqMirroredInputPortConfig_getActiveStreamingSource")?;
Ok(unsafe { crate::marshal::take_string(__streaming_connection_string) })
}
/// Gets the global ID of the input port as it appears on the remote device.
///
/// # Returns
/// - `id`: The input port ID.
///
/// Calls the openDAQ C function `daqMirroredInputPortConfig_getRemoteId()`.
pub fn remote_id(&self) -> Result<String> {
let mut __id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqMirroredInputPortConfig_getRemoteId)(self.as_raw() as *mut _, &mut __id) };
check(__code, "daqMirroredInputPortConfig_getRemoteId")?;
Ok(unsafe { crate::marshal::take_string(__id) })
}
/// Gets a list of connection strings of all available streaming sources of the input port.
///
/// # Returns
/// - `streaming_connection_strings`: The list of streaming connection strings.
///
/// Calls the openDAQ C function `daqMirroredInputPortConfig_getStreamingSources()`.
pub fn streaming_sources(&self) -> Result<Vec<String>> {
let mut __streaming_connection_strings: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqMirroredInputPortConfig_getStreamingSources)(self.as_raw() as *mut _, &mut __streaming_connection_strings) };
check(__code, "daqMirroredInputPortConfig_getStreamingSources")?;
Ok(unsafe { crate::marshal::take_list::<String>(__streaming_connection_strings as *mut _, "daqMirroredInputPortConfig_getStreamingSources") }?)
}
/// Sets the active streaming source of the input port.
///
/// # Parameters
/// - `streaming_connection_string`: The connection string of streaming source to be set as active.
///
/// # Errors
/// - `OPENDAQ_ERR_NOTFOUND`: if the streaming source with the corresponding connection string is not part of the available streaming sources for the input port.
///
/// Calls the openDAQ C function `daqMirroredInputPortConfig_setActiveStreamingSource()`.
pub fn set_active_streaming_source(&self, streaming_connection_string: &str) -> Result<()> {
let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
let __code = unsafe { (crate::sys::api().daqMirroredInputPortConfig_setActiveStreamingSource)(self.as_raw() as *mut _, __streaming_connection_string.as_ptr() as *mut _) };
check(__code, "daqMirroredInputPortConfig_setActiveStreamingSource")?;
Ok(())
}
}
impl MirroredSignalConfig {
/// Stops the streaming and clears the active streaming source of the signal.
///
/// Calls the openDAQ C function `daqMirroredSignalConfig_deactivateStreaming()`.
pub fn deactivate_streaming(&self) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqMirroredSignalConfig_deactivateStreaming)(self.as_raw() as *mut _) };
check(__code, "daqMirroredSignalConfig_deactivateStreaming")?;
Ok(())
}
/// Gets a connection strings of the active streaming source of the signal.
///
/// # Returns
/// - `streaming_connection_string`: The connection string of active streaming source.
///
/// Calls the openDAQ C function `daqMirroredSignalConfig_getActiveStreamingSource()`.
pub fn active_streaming_source(&self) -> Result<String> {
let mut __streaming_connection_string: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqMirroredSignalConfig_getActiveStreamingSource)(self.as_raw() as *mut _, &mut __streaming_connection_string) };
check(__code, "daqMirroredSignalConfig_getActiveStreamingSource")?;
Ok(unsafe { crate::marshal::take_string(__streaming_connection_string) })
}
/// Gets the Event that is triggered whenever the acknowledgment for signal subscription completion is received from the streaming server.
///
/// # Returns
/// - `event`: The Event representing the acknowledgment of signal subscription completion. A handler can be added to the event containing a callback function which is invoked whenever the event is triggered. The callback function requires two parameters - a MirroredSignalConfig object, as well as a "Subscription event args" object. The callback will be invoked with the MirroredSignalConfig object as the first argument, the second argument holds an event args object that contains the connection string of streaming and the event type (Subscribed).
///
/// Calls the openDAQ C function `daqMirroredSignalConfig_getOnSubscribeComplete()`.
pub fn on_subscribe_complete(&self) -> Result<Option<Event>> {
let mut __event: *mut sys::daqEvent = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqMirroredSignalConfig_getOnSubscribeComplete)(self.as_raw() as *mut _, &mut __event) };
check(__code, "daqMirroredSignalConfig_getOnSubscribeComplete")?;
Ok(unsafe { crate::marshal::take_object::<Event>(__event as *mut _) })
}
/// Gets the Event that is triggered whenever the acknowledgment for signal unsubscription completion is received from the streaming server.
///
/// # Returns
/// - `event`: The Event representing the acknowledgment of signal unsubscription completion. A handler can be added to the event containing a callback function which is invoked whenever the event is triggered. The callback function requires two parameters - a MirroredSignalConfig object, as well as a "Subscription event args" object. The callback will be invoked with the MirroredSignalConfig object as the first argument, the second argument holds an event args object that contains the connection string of streaming and the event type (Unsubscribed).
///
/// Calls the openDAQ C function `daqMirroredSignalConfig_getOnUnsubscribeComplete()`.
pub fn on_unsubscribe_complete(&self) -> Result<Option<Event>> {
let mut __event: *mut sys::daqEvent = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqMirroredSignalConfig_getOnUnsubscribeComplete)(self.as_raw() as *mut _, &mut __event) };
check(__code, "daqMirroredSignalConfig_getOnUnsubscribeComplete")?;
Ok(unsafe { crate::marshal::take_object::<Event>(__event as *mut _) })
}
/// Gets the global ID of the signal as it appears on the remote device.
///
/// # Returns
/// - `id`: The signal ID.
///
/// Calls the openDAQ C function `daqMirroredSignalConfig_getRemoteId()`.
pub fn remote_id(&self) -> Result<String> {
let mut __id: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqMirroredSignalConfig_getRemoteId)(self.as_raw() as *mut _, &mut __id) };
check(__code, "daqMirroredSignalConfig_getRemoteId")?;
Ok(unsafe { crate::marshal::take_string(__id) })
}
/// Gets a list of connection strings of all available streaming sources of the signal.
///
/// # Returns
/// - `streaming_connection_strings`: The list of streaming connection strings.
///
/// Calls the openDAQ C function `daqMirroredSignalConfig_getStreamingSources()`.
pub fn streaming_sources(&self) -> Result<Vec<String>> {
let mut __streaming_connection_strings: *mut sys::daqList = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqMirroredSignalConfig_getStreamingSources)(self.as_raw() as *mut _, &mut __streaming_connection_strings) };
check(__code, "daqMirroredSignalConfig_getStreamingSources")?;
Ok(unsafe { crate::marshal::take_list::<String>(__streaming_connection_strings as *mut _, "daqMirroredSignalConfig_getStreamingSources") }?)
}
/// Sets the active streaming source of the signal.
///
/// # Parameters
/// - `streaming_connection_string`: The connection string of streaming source to be set as active.
///
/// # Errors
/// - `OPENDAQ_ERR_NOTFOUND`: if the streaming source with the corresponding connection string is not part of the available streaming sources for the signal.
///
/// Calls the openDAQ C function `daqMirroredSignalConfig_setActiveStreamingSource()`.
pub fn set_active_streaming_source(&self, streaming_connection_string: &str) -> Result<()> {
let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
let __code = unsafe { (crate::sys::api().daqMirroredSignalConfig_setActiveStreamingSource)(self.as_raw() as *mut _, __streaming_connection_string.as_ptr() as *mut _) };
check(__code, "daqMirroredSignalConfig_setActiveStreamingSource")?;
Ok(())
}
}
impl MirroredSignalPrivate {
/// Adds streaming source for signal.
///
/// # Parameters
/// - `streaming`: The Streaming object representing the data source.
///
/// Calls the openDAQ C function `daqMirroredSignalPrivate_addStreamingSource()`.
pub fn add_streaming_source(&self, streaming: &Streaming) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_addStreamingSource)(self.as_raw() as *mut _, streaming.as_raw() as *mut _) };
check(__code, "daqMirroredSignalPrivate_addStreamingSource")?;
Ok(())
}
/// Calls the openDAQ C function `daqMirroredSignalPrivate_getMirroredDataDescriptor()`.
pub fn mirrored_data_descriptor(&self) -> Result<Option<DataDescriptor>> {
let mut __descriptor: *mut sys::daqDataDescriptor = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_getMirroredDataDescriptor)(self.as_raw() as *mut _, &mut __descriptor) };
check(__code, "daqMirroredSignalPrivate_getMirroredDataDescriptor")?;
Ok(unsafe { crate::marshal::take_object::<DataDescriptor>(__descriptor as *mut _) })
}
/// Calls the openDAQ C function `daqMirroredSignalPrivate_getMirroredDomainSignal()`.
pub fn mirrored_domain_signal(&self) -> Result<Option<MirroredSignalConfig>> {
let mut __domain_signals: *mut sys::daqMirroredSignalConfig = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_getMirroredDomainSignal)(self.as_raw() as *mut _, &mut __domain_signals) };
check(__code, "daqMirroredSignalPrivate_getMirroredDomainSignal")?;
Ok(unsafe { crate::marshal::take_object::<MirroredSignalConfig>(__domain_signals as *mut _) })
}
/// Removes streaming source for signal.
///
/// # Parameters
/// - `streaming_connection_string`: The connection string of streaming source to be removed.
///
/// Calls the openDAQ C function `daqMirroredSignalPrivate_removeStreamingSource()`.
pub fn remove_streaming_source(&self, streaming_connection_string: &str) -> Result<()> {
let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_removeStreamingSource)(self.as_raw() as *mut _, __streaming_connection_string.as_ptr() as *mut _) };
check(__code, "daqMirroredSignalPrivate_removeStreamingSource")?;
Ok(())
}
/// Calls the openDAQ C function `daqMirroredSignalPrivate_setMirroredDataDescriptor()`.
pub fn set_mirrored_data_descriptor(&self, descriptor: &DataDescriptor) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_setMirroredDataDescriptor)(self.as_raw() as *mut _, descriptor.as_raw() as *mut _) };
check(__code, "daqMirroredSignalPrivate_setMirroredDataDescriptor")?;
Ok(())
}
/// Calls the openDAQ C function `daqMirroredSignalPrivate_setMirroredDomainSignal()`.
pub fn set_mirrored_domain_signal(&self, domain_signal: &MirroredSignalConfig) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_setMirroredDomainSignal)(self.as_raw() as *mut _, domain_signal.as_raw() as *mut _) };
check(__code, "daqMirroredSignalPrivate_setMirroredDomainSignal")?;
Ok(())
}
/// Handles the completion of subscription acknowledged by the specified streaming source.
///
/// # Parameters
/// - `streaming_connection_string`: The connection string of the streaming source that completed the subscription for the signal.
///
/// Calls the openDAQ C function `daqMirroredSignalPrivate_subscribeCompleted()`.
pub fn subscribe_completed(&self, streaming_connection_string: &str) -> Result<()> {
let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_subscribeCompleted)(self.as_raw() as *mut _, __streaming_connection_string.as_ptr() as *mut _) };
check(__code, "daqMirroredSignalPrivate_subscribeCompleted")?;
Ok(())
}
/// Handles event packet e.g. packet with changes of the signals descriptors or signal properties
///
/// # Parameters
/// - `event_packet`: The event packet to be handled.
///
/// # Returns
/// True if the eventPacket should be sent along the signal path; False otherwise.
///
/// Calls the openDAQ C function `daqMirroredSignalPrivate_triggerEvent()`.
pub fn trigger_event(&self, event_packet: &EventPacket) -> Result<bool> {
let mut __forward: u8 = 0;
let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_triggerEvent)(self.as_raw() as *mut _, event_packet.as_raw() as *mut _, &mut __forward) };
check(__code, "daqMirroredSignalPrivate_triggerEvent")?;
Ok(__forward != 0)
}
/// Handles the completion of unsubscription acknowledged by the specified streaming source.
///
/// # Parameters
/// - `streaming_connection_string`: The connection string of the streaming source that completed the unsubscription for the signal.
///
/// Calls the openDAQ C function `daqMirroredSignalPrivate_unsubscribeCompleted()`.
pub fn unsubscribe_completed(&self, streaming_connection_string: &str) -> Result<()> {
let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_unsubscribeCompleted)(self.as_raw() as *mut _, __streaming_connection_string.as_ptr() as *mut _) };
check(__code, "daqMirroredSignalPrivate_unsubscribeCompleted")?;
Ok(())
}
/// Acts the same as unsubscribeCompleted() but does not enter a critical section.
///
/// # Parameters
/// - `streaming_connection_string`: The connection string of the streaming source that completed the unsubscription for the signal.
///
/// Calls the openDAQ C function `daqMirroredSignalPrivate_unsubscribeCompletedNoLock()`.
pub fn unsubscribe_completed_no_lock(&self, streaming_connection_string: &str) -> Result<()> {
let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_unsubscribeCompletedNoLock)(self.as_raw() as *mut _, __streaming_connection_string.as_ptr() as *mut _) };
check(__code, "daqMirroredSignalPrivate_unsubscribeCompletedNoLock")?;
Ok(())
}
}
impl StreamingType {
/// Creates a Streaming type object, with the id, name, description and optional defaultConfig.
///
/// # Parameters
/// - `id`: The unique type ID of the Streaming.
/// - `name`: The name of the Streaming. Eg. FFT.
/// - `description`: A short description of the Streaming and its behaviour.
/// - `default_config`: The property object, to be cloned and returned, each time user creates default configuration object. This way each instance of the Streaming has its own configuration object.
///
/// Calls the openDAQ C function `daqStreamingType_createStreamingType()`.
pub fn new(id: &str, name: &str, description: &str, prefix: &str, default_config: &PropertyObject) -> Result<StreamingType> {
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::daqStreamingType = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqStreamingType_createStreamingType)(&mut __obj, __id.as_ptr() as *mut _, __name.as_ptr() as *mut _, __description.as_ptr() as *mut _, __prefix.as_ptr() as *mut _, default_config.as_raw() as *mut _) };
check(__code, "daqStreamingType_createStreamingType")?;
Ok(unsafe { crate::marshal::require_object::<StreamingType>(__obj as *mut _, "daqStreamingType_createStreamingType") }?)
}
/// Calls the openDAQ C function `daqStreamingType_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().daqStreamingType_getConnectionStringPrefix)(self.as_raw() as *mut _, &mut __prefix) };
check(__code, "daqStreamingType_getConnectionStringPrefix")?;
Ok(unsafe { crate::marshal::take_string(__prefix) })
}
}
impl SubscriptionEventArgs {
/// Calls the openDAQ C function `daqSubscriptionEventArgs_createSubscriptionEventArgs()`.
pub fn new(streaming_connection_string: &str, type_: SubscriptionEventType) -> Result<SubscriptionEventArgs> {
let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
let mut __obj: *mut sys::daqSubscriptionEventArgs = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqSubscriptionEventArgs_createSubscriptionEventArgs)(&mut __obj, __streaming_connection_string.as_ptr() as *mut _, type_ as u32) };
check(__code, "daqSubscriptionEventArgs_createSubscriptionEventArgs")?;
Ok(unsafe { crate::marshal::require_object::<SubscriptionEventArgs>(__obj as *mut _, "daqSubscriptionEventArgs_createSubscriptionEventArgs") }?)
}
/// Calls the openDAQ C function `daqSubscriptionEventArgs_getStreamingConnectionString()`.
pub fn streaming_connection_string(&self) -> Result<String> {
let mut __streaming_connection_string: *mut sys::daqString = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqSubscriptionEventArgs_getStreamingConnectionString)(self.as_raw() as *mut _, &mut __streaming_connection_string) };
check(__code, "daqSubscriptionEventArgs_getStreamingConnectionString")?;
Ok(unsafe { crate::marshal::take_string(__streaming_connection_string) })
}
/// Calls the openDAQ C function `daqSubscriptionEventArgs_getSubscriptionEventType()`.
pub fn subscription_event_type(&self) -> Result<SubscriptionEventType> {
let mut __type_: u32 = 0;
let __code = unsafe { (crate::sys::api().daqSubscriptionEventArgs_getSubscriptionEventType)(self.as_raw() as *mut _, &mut __type_) };
check(__code, "daqSubscriptionEventArgs_getSubscriptionEventType")?;
Ok(crate::marshal::enum_out(SubscriptionEventType::from_raw(__type_), "daqSubscriptionEventArgs_getSubscriptionEventType")?)
}
}