// 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;
/// Internal Context interface used for transferring the Module Manager reference to a new owner.
/// Wrapper over the openDAQ `daqContextInternal` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ContextInternal(pub(crate) BaseObject);
impl std::ops::Deref for ContextInternal {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ContextInternal {}
unsafe impl Interface for ContextInternal {
const NAME: &'static str = "daqContextInternal";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqContextInternal_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 ContextInternal {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ContextInternal(BaseObject(r)) }
}
impl std::fmt::Display for ContextInternal {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ContextInternal> for Value {
fn from(value: &ContextInternal) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ContextInternal> for Value {
fn from(value: ContextInternal) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ContextInternal {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// @ingroup opendaq_utility
/// @addtogroup opendaq_discovery_service Discovery service
/// Wrapper over the openDAQ `daqDiscoveryServer` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DiscoveryServer(pub(crate) BaseObject);
impl std::ops::Deref for DiscoveryServer {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for DiscoveryServer {}
unsafe impl Interface for DiscoveryServer {
const NAME: &'static str = "daqDiscoveryServer";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqDiscoveryServer_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 DiscoveryServer {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { DiscoveryServer(BaseObject(r)) }
}
impl std::fmt::Display for DiscoveryServer {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&DiscoveryServer> for Value {
fn from(value: &DiscoveryServer) -> Value { Value::Object(value.to_base_object()) }
}
impl From<DiscoveryServer> for Value {
fn from(value: DiscoveryServer) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for DiscoveryServer {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// A module is an object that provides device and function block factories. The object is usually implemented in an external dynamic link / shared library. IModuleManager is responsible for loading all modules.
/// Wrapper over the openDAQ `daqModule` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Module(pub(crate) BaseObject);
impl std::ops::Deref for Module {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for Module {}
unsafe impl Interface for Module {
const NAME: &'static str = "daqModule";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqModule_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 Module {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { Module(BaseObject(r)) }
}
impl std::fmt::Display for Module {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&Module> for Value {
fn from(value: &Module) -> Value { Value::Object(value.to_base_object()) }
}
impl From<Module> for Value {
fn from(value: Module) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for Module {
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 `daqModuleAuthenticator` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ModuleAuthenticator(pub(crate) BaseObject);
impl std::ops::Deref for ModuleAuthenticator {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ModuleAuthenticator {}
unsafe impl Interface for ModuleAuthenticator {
const NAME: &'static str = "daqModuleAuthenticator";
fn interface_id() -> Option<crate::IntfID> { None }
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 ModuleAuthenticator {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ModuleAuthenticator(BaseObject(r)) }
}
impl std::fmt::Display for ModuleAuthenticator {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ModuleAuthenticator> for Value {
fn from(value: &ModuleAuthenticator) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ModuleAuthenticator> for Value {
fn from(value: ModuleAuthenticator) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ModuleAuthenticator {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
/// @ingroup opendaq_modules
/// @addtogroup opendaq_module_manager Module manager utils
/// Wrapper over the openDAQ `daqModuleManagerUtils` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ModuleManagerUtils(pub(crate) BaseObject);
impl std::ops::Deref for ModuleManagerUtils {
type Target = BaseObject;
fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ModuleManagerUtils {}
unsafe impl Interface for ModuleManagerUtils {
const NAME: &'static str = "daqModuleManagerUtils";
fn interface_id() -> Option<crate::IntfID> {
let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
unsafe { (crate::sys::api().daqModuleManagerUtils_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 ModuleManagerUtils {
#[doc(hidden)]
pub(crate) fn __from_ref(r: Ref) -> Self { ModuleManagerUtils(BaseObject(r)) }
}
impl std::fmt::Display for ModuleManagerUtils {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.as_base_object(), f)
}
}
impl From<&ModuleManagerUtils> for Value {
fn from(value: &ModuleManagerUtils) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ModuleManagerUtils> for Value {
fn from(value: ModuleManagerUtils) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ModuleManagerUtils {
unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
crate::value::cast_owned(ptr, op)
}
}
impl ContextInternal {
/// Gets the Module Manager. Moves the strong reference to the manager to the first caller and retains a weak reference internally.
///
/// # Returns
/// - `manager`: The module manager. Returns a nullptr on subsequent invocations, and if the manager is not assigned.
///
/// Calls the openDAQ C function `daqContextInternal_moveModuleManager()`.
pub fn move_module_manager(&self) -> Result<Option<ModuleManager>> {
let mut __manager: *mut sys::daqModuleManager = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqContextInternal_moveModuleManager)(self.as_raw() as *mut _, &mut __manager) };
check(__code, "daqContextInternal_moveModuleManager")?;
Ok(unsafe { crate::marshal::take_object::<ModuleManager>(__manager as *mut _) })
}
}
impl DiscoveryServer {
/// Calls the openDAQ C function `daqDiscoveryServer_createMdnsDiscoveryServer()`.
pub fn mdns(logger: &Logger) -> Result<DiscoveryServer> {
let mut __obj: *mut sys::daqDiscoveryServer = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqDiscoveryServer_createMdnsDiscoveryServer)(&mut __obj, logger.as_raw() as *mut _) };
check(__code, "daqDiscoveryServer_createMdnsDiscoveryServer")?;
Ok(unsafe { crate::marshal::require_object::<DiscoveryServer>(__obj as *mut _, "daqDiscoveryServer_createMdnsDiscoveryServer") }?)
}
/// Calls the openDAQ C function `daqDiscoveryServer_registerService()`.
pub fn register_service(&self, id: &str, config: &PropertyObject, device_info: &DeviceInfo) -> Result<()> {
let __id = crate::marshal::make_string(id)?;
let __code = unsafe { (crate::sys::api().daqDiscoveryServer_registerService)(self.as_raw() as *mut _, __id.as_ptr() as *mut _, config.as_raw() as *mut _, device_info.as_raw() as *mut _) };
check(__code, "daqDiscoveryServer_registerService")?;
Ok(())
}
/// Calls the openDAQ C function `daqDiscoveryServer_setRootDevice()`.
pub fn set_root_device(&self, device: &Device) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqDiscoveryServer_setRootDevice)(self.as_raw() as *mut _, device.as_raw() as *mut _) };
check(__code, "daqDiscoveryServer_setRootDevice")?;
Ok(())
}
/// Calls the openDAQ C function `daqDiscoveryServer_unregisterService()`.
pub fn unregister_service(&self, id: &str) -> Result<()> {
let __id = crate::marshal::make_string(id)?;
let __code = unsafe { (crate::sys::api().daqDiscoveryServer_unregisterService)(self.as_raw() as *mut _, __id.as_ptr() as *mut _) };
check(__code, "daqDiscoveryServer_unregisterService")?;
Ok(())
}
}
impl ModuleManagerUtils {
/// Initiates the modification of IP configuration parameters for a specified network interface associated with a target device.
///
/// # Parameters
/// - `iface`: The name of the network interface whose IP configuration parameters need to be updated.
/// - `manufacturer`: The manufacturer's name identifying the device owning the network interface.
/// - `serial_number`: The serial number of the device owning the network interface.
/// - `config`: A property object containing the configuration parameters to be applied. The manufacturer name and serial number are used to uniquely identify the target device. Once the config modification is invoked, the new config parameters are advertised via multicast to all devices in the subnet. The target device compares the received identification parameters with its own and, if they match, attempts to apply the new configuration parameters for the specified interface.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_changeIpConfig()`.
pub fn change_ip_config(&self, iface: &str, manufacturer: &str, serial_number: &str, config: &PropertyObject) -> Result<()> {
let __iface = crate::marshal::make_string(iface)?;
let __manufacturer = crate::marshal::make_string(manufacturer)?;
let __serial_number = crate::marshal::make_string(serial_number)?;
let __code = unsafe { (crate::sys::api().daqModuleManagerUtils_changeIpConfig)(self.as_raw() as *mut _, __iface.as_ptr() as *mut _, __manufacturer.as_ptr() as *mut _, __serial_number.as_ptr() as *mut _, config.as_raw() as *mut _) };
check(__code, "daqModuleManagerUtils_changeIpConfig")?;
Ok(())
}
/// Completes the DeviceInfo's ServerCapabilities of existing device with the information obtained from device discovery.
///
/// # Parameters
/// - `device`: The device whose ServerCapabilities should be completed.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_completeDeviceCapabilities()`.
pub fn complete_device_capabilities(&self, device: &Device) -> Result<()> {
let __code = unsafe { (crate::sys::api().daqModuleManagerUtils_completeDeviceCapabilities)(self.as_raw() as *mut _, device.as_raw() as *mut _) };
check(__code, "daqModuleManagerUtils_completeDeviceCapabilities")?;
Ok(())
}
/// Calls the openDAQ C function `daqModuleManagerUtils_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().daqModuleManagerUtils_createDefaultAddDeviceConfig)(self.as_raw() as *mut _, &mut __default_config) };
check(__code, "daqModuleManagerUtils_createDefaultAddDeviceConfig")?;
Ok(unsafe { crate::marshal::take_object::<PropertyObject>(__default_config as *mut _) })
}
/// Creates a device object that can communicate with the device described in the specified connection string. The device object is not automatically added as a sub-device of the caller, but only returned by reference.
///
/// # Parameters
/// - `connection_string`: Describes the connection info of the device to connect to.
/// - `parent`: The parent component/device to which the device attaches.
/// - `config`: A configuration object that contains parameters used to configure a device in the form of key-value pairs. Iterates through all loaded modules and creates a device with the first module that accepts the provided connection string.
///
/// # Returns
/// - `device`: The device object created to communicate with and control the device.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_createDevice()`.
pub fn create_device(&self, connection_string: &str, parent: &Component) -> 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().daqModuleManagerUtils_createDevice)(self.as_raw() as *mut _, &mut __device, __connection_string.as_ptr() as *mut _, parent.as_raw() as *mut _, std::ptr::null_mut()) };
check(__code, "daqModuleManagerUtils_createDevice")?;
Ok(unsafe { crate::marshal::take_object::<Device>(__device as *mut _) })
}
/// Creates a device object that can communicate with the device described in the specified connection string. The device object is not automatically added as a sub-device of the caller, but only returned by reference.
///
/// # Parameters
/// - `connection_string`: Describes the connection info of the device to connect to.
/// - `parent`: The parent component/device to which the device attaches.
/// - `config`: A configuration object that contains parameters used to configure a device in the form of key-value pairs. Iterates through all loaded modules and creates a device with the first module that accepts the provided connection string.
///
/// # Returns
/// - `device`: The device object created to communicate with and control the device.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_createDevice()`.
pub fn create_device_with(&self, connection_string: &str, parent: &Component, 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().daqModuleManagerUtils_createDevice)(self.as_raw() as *mut _, &mut __device, __connection_string.as_ptr() as *mut _, parent.as_raw() as *mut _, config.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqModuleManagerUtils_createDevice")?;
Ok(unsafe { crate::marshal::take_object::<Device>(__device as *mut _) })
}
/// Creates multiple device objects in parallel using the specified connection strings. Each device is created concurrently. None of the created device object are automatically added as a sub-device of the caller, but only returned by reference.
///
/// # 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.
/// - `parent`: The parent component/device to which the created devices attach.
/// - `err_codes`: An optional dictionary to populate error codes for failed connections. For each failed connection, the key is the connection string, and the value contains error code.
/// - `error_infos`: An optional dictionary to populate error info details for failed connections. For each failed connection, the key is the connection string, and the value contains error info object.
///
/// # Returns
/// OPENDAQ_PARTIAL_SUCCESS if at least one device was successfully created, but not all of them; OPENDAQ_ERR_GENERALERROR if no devices were created.
/// - `devices`: A dictionary which maps each connection string to the corresponding created device object. If a device creation attempt fails, the value will be `nullptr` for that entry.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_createDevices()`.
pub fn create_devices(&self, connection_args: impl Into<Value>, parent: &Component) -> 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().daqModuleManagerUtils_createDevices)(self.as_raw() as *mut _, &mut __devices, crate::value::opt_ref_ptr(&__connection_args) as *mut _, parent.as_raw() as *mut _, std::ptr::null_mut(), std::ptr::null_mut()) };
check(__code, "daqModuleManagerUtils_createDevices")?;
Ok(unsafe { crate::marshal::take_dict::<String, Device>(__devices as *mut _, "daqModuleManagerUtils_createDevices") }?)
}
/// Creates multiple device objects in parallel using the specified connection strings. Each device is created concurrently. None of the created device object are automatically added as a sub-device of the caller, but only returned by reference.
///
/// # 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.
/// - `parent`: The parent component/device to which the created devices attach.
/// - `err_codes`: An optional dictionary to populate error codes for failed connections. For each failed connection, the key is the connection string, and the value contains error code.
/// - `error_infos`: An optional dictionary to populate error info details for failed connections. For each failed connection, the key is the connection string, and the value contains error info object.
///
/// # Returns
/// OPENDAQ_PARTIAL_SUCCESS if at least one device was successfully created, but not all of them; OPENDAQ_ERR_GENERALERROR if no devices were created.
/// - `devices`: A dictionary which maps each connection string to the corresponding created device object. If a device creation attempt fails, the value will be `nullptr` for that entry.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_createDevices()`.
pub fn create_devices_with(&self, connection_args: impl Into<Value>, parent: &Component, 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().daqModuleManagerUtils_createDevices)(self.as_raw() as *mut _, &mut __devices, crate::value::opt_ref_ptr(&__connection_args) as *mut _, parent.as_raw() as *mut _, crate::value::opt_ref_ptr(&__err_codes) as *mut _, crate::value::opt_ref_ptr(&__error_infos) as *mut _) };
check(__code, "daqModuleManagerUtils_createDevices")?;
Ok(unsafe { crate::marshal::take_dict::<String, Device>(__devices as *mut _, "daqModuleManagerUtils_createDevices") }?)
}
/// Creates and returns a function block with the specified id. The function block is not automatically added to the FB list of the caller.
///
/// # Parameters
/// - `id`: The id of the function block to create. Ids can be retrieved by calling `getAvailableFunctionBlockTypes()`.
/// - `parent`: The parent component/device to which the function block attaches.
/// - `config`: Function block configuration. In case of a null value, implementation should use default configuration.
/// - `local_id`: Custom local ID for the function block. Overrides the "LocalId" property of the "config" object, if present.
///
/// # Returns
/// - `function_block`: The created function block. Iterates through all loaded modules and creates a function block with the first module that accepts the provided connection string. The local ID is equal to the name of the function block type with a "_n" suffix, where "n" is an integer, equal to that of the greatest integer suffix amongst the function blocks of the same function block type already added to a given parent. The initial value of "n" is 0. A custom local ID can be provided by adding a "LocalId" string property to the `config` property object input parameter, or by providing the localId string argument.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_createFunctionBlock()`.
pub fn create_function_block(&self, id: &str, parent: &Component) -> Result<Option<FunctionBlock>> {
let __id = crate::marshal::make_string(id)?;
let mut __function_block: *mut sys::daqFunctionBlock = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModuleManagerUtils_createFunctionBlock)(self.as_raw() as *mut _, &mut __function_block, __id.as_ptr() as *mut _, parent.as_raw() as *mut _, std::ptr::null_mut(), std::ptr::null_mut()) };
check(__code, "daqModuleManagerUtils_createFunctionBlock")?;
Ok(unsafe { crate::marshal::take_object::<FunctionBlock>(__function_block as *mut _) })
}
/// Creates and returns a function block with the specified id. The function block is not automatically added to the FB list of the caller.
///
/// # Parameters
/// - `id`: The id of the function block to create. Ids can be retrieved by calling `getAvailableFunctionBlockTypes()`.
/// - `parent`: The parent component/device to which the function block attaches.
/// - `config`: Function block configuration. In case of a null value, implementation should use default configuration.
/// - `local_id`: Custom local ID for the function block. Overrides the "LocalId" property of the "config" object, if present.
///
/// # Returns
/// - `function_block`: The created function block. Iterates through all loaded modules and creates a function block with the first module that accepts the provided connection string. The local ID is equal to the name of the function block type with a "_n" suffix, where "n" is an integer, equal to that of the greatest integer suffix amongst the function blocks of the same function block type already added to a given parent. The initial value of "n" is 0. A custom local ID can be provided by adding a "LocalId" string property to the `config` property object input parameter, or by providing the localId string argument.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_createFunctionBlock()`.
pub fn create_function_block_with(&self, id: &str, parent: &Component, config: Option<&PropertyObject>, local_id: &str) -> Result<Option<FunctionBlock>> {
let __id = crate::marshal::make_string(id)?;
let __local_id = crate::marshal::make_string(local_id)?;
let mut __function_block: *mut sys::daqFunctionBlock = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModuleManagerUtils_createFunctionBlock)(self.as_raw() as *mut _, &mut __function_block, __id.as_ptr() as *mut _, parent.as_raw() as *mut _, config.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _), __local_id.as_ptr() as *mut _) };
check(__code, "daqModuleManagerUtils_createFunctionBlock")?;
Ok(unsafe { crate::marshal::take_object::<FunctionBlock>(__function_block as *mut _) })
}
/// Creates and returns a server with the provided serverType and configuration.
///
/// # Parameters
/// - `server_type_id`: Type id of the server. Can be obtained from its corresponding Server type object.
/// - `root_device`: The root device
/// - `server_config`: Config of the server. Can be created from its corresponding Server type object. In case of a null value, it will use the default configuration.
///
/// # Returns
/// - `server`: The created server. Iterates through all loaded modules and creates a server with the first module that accepts the provided serverTypeId. The servers folder of the root device is automatically assigned as parent for created server component. The local ID of created server component is equal to the name of the server type.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_createServer()`.
pub fn create_server(&self, server_type_id: &str, root_device: &Device) -> Result<Option<Server>> {
let __server_type_id = crate::marshal::make_string(server_type_id)?;
let mut __server: *mut sys::daqServer = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModuleManagerUtils_createServer)(self.as_raw() as *mut _, &mut __server, __server_type_id.as_ptr() as *mut _, root_device.as_raw() as *mut _, std::ptr::null_mut()) };
check(__code, "daqModuleManagerUtils_createServer")?;
Ok(unsafe { crate::marshal::take_object::<Server>(__server as *mut _) })
}
/// Creates and returns a server with the provided serverType and configuration.
///
/// # Parameters
/// - `server_type_id`: Type id of the server. Can be obtained from its corresponding Server type object.
/// - `root_device`: The root device
/// - `server_config`: Config of the server. Can be created from its corresponding Server type object. In case of a null value, it will use the default configuration.
///
/// # Returns
/// - `server`: The created server. Iterates through all loaded modules and creates a server with the first module that accepts the provided serverTypeId. The servers folder of the root device is automatically assigned as parent for created server component. The local ID of created server component is equal to the name of the server type.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_createServer()`.
pub fn create_server_with(&self, server_type_id: &str, root_device: &Device, server_config: Option<&PropertyObject>) -> Result<Option<Server>> {
let __server_type_id = crate::marshal::make_string(server_type_id)?;
let mut __server: *mut sys::daqServer = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModuleManagerUtils_createServer)(self.as_raw() as *mut _, &mut __server, __server_type_id.as_ptr() as *mut _, root_device.as_raw() as *mut _, server_config.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqModuleManagerUtils_createServer")?;
Ok(unsafe { crate::marshal::take_object::<Server>(__server as *mut _) })
}
/// Creates a streaming object using the specified connection string and config object.
///
/// # Parameters
/// - `connection_string`: Describes the connection parameters of the streaming.
/// - `config`: A configuration object that contains parameters used to configure a streaming connection in the form of key-value pairs. Iterates through all loaded modules and creates a streaming connection with the first module that accepts the provided connection string.
///
/// # Returns
/// - `streaming`: The created streaming object.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_createStreaming()`.
pub fn create_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().daqModuleManagerUtils_createStreaming)(self.as_raw() as *mut _, &mut __streaming, __connection_string.as_ptr() as *mut _, std::ptr::null_mut()) };
check(__code, "daqModuleManagerUtils_createStreaming")?;
Ok(unsafe { crate::marshal::take_object::<Streaming>(__streaming as *mut _) })
}
/// Creates a streaming object using the specified connection string and config object.
///
/// # Parameters
/// - `connection_string`: Describes the connection parameters of the streaming.
/// - `config`: A configuration object that contains parameters used to configure a streaming connection in the form of key-value pairs. Iterates through all loaded modules and creates a streaming connection with the first module that accepts the provided connection string.
///
/// # Returns
/// - `streaming`: The created streaming object.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_createStreaming()`.
pub fn create_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().daqModuleManagerUtils_createStreaming)(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, "daqModuleManagerUtils_createStreaming")?;
Ok(unsafe { crate::marshal::take_object::<Streaming>(__streaming as *mut _) })
}
/// Returns a dictionary of known and available device types this module can create.
///
/// # Returns
/// - `device_types`: The dictionary of known device types. Contains information on devices available in all loaded modules.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_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().daqModuleManagerUtils_getAvailableDeviceTypes)(self.as_raw() as *mut _, &mut __device_types) };
check(__code, "daqModuleManagerUtils_getAvailableDeviceTypes")?;
Ok(unsafe { crate::marshal::take_dict::<String, DeviceType>(__device_types as *mut _, "daqModuleManagerUtils_getAvailableDeviceTypes") }?)
}
/// Returns a list of known devices info. The implementation can start discovery in background and only return the results in this function.
///
/// # Returns
/// - `available_devices`: The list of known devices information. Contains information on devices available in all loaded modules.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_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().daqModuleManagerUtils_getAvailableDevices)(self.as_raw() as *mut _, &mut __available_devices) };
check(__code, "daqModuleManagerUtils_getAvailableDevices")?;
Ok(unsafe { crate::marshal::take_list::<DeviceInfo>(__available_devices as *mut _, "daqModuleManagerUtils_getAvailableDevices") }?)
}
/// Returns a dictionary of known and available function block types this module can create.
///
/// # Returns
/// - `function_block_types`: The dictionary of known function block types. Contains information on function blocks available in all loaded modules.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_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().daqModuleManagerUtils_getAvailableFunctionBlockTypes)(self.as_raw() as *mut _, &mut __function_block_types) };
check(__code, "daqModuleManagerUtils_getAvailableFunctionBlockTypes")?;
Ok(unsafe { crate::marshal::take_dict::<String, FunctionBlockType>(__function_block_types as *mut _, "daqModuleManagerUtils_getAvailableFunctionBlockTypes") }?)
}
/// Calls the openDAQ C function `daqModuleManagerUtils_getAvailableStreamingTypes()`.
pub fn available_streaming_types(&self) -> Result<std::collections::HashMap<String, StreamingType>> {
let mut __streaming_types: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModuleManagerUtils_getAvailableStreamingTypes)(self.as_raw() as *mut _, &mut __streaming_types) };
check(__code, "daqModuleManagerUtils_getAvailableStreamingTypes")?;
Ok(unsafe { crate::marshal::take_dict::<String, StreamingType>(__streaming_types as *mut _, "daqModuleManagerUtils_getAvailableStreamingTypes") }?)
}
/// Retrieves discovery information for a device identified by manufacturer and serial number.
///
/// # Parameters
/// - `manufacturer`: The manufacturer's name identifying the device.
/// - `serial_number`: The serial number of the device. The manufacturer name and serial number are used to uniquely identify the target device. This method searches through the available devices discovered during the last scan.
///
/// # Returns
/// - `device_info`: The device information object containing discovery data.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_getDiscoveryInfo()`.
pub fn discovery_info(&self, manufacturer: &str, serial_number: &str) -> Result<Option<DeviceInfo>> {
let __manufacturer = crate::marshal::make_string(manufacturer)?;
let __serial_number = crate::marshal::make_string(serial_number)?;
let mut __device_info: *mut sys::daqDeviceInfo = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModuleManagerUtils_getDiscoveryInfo)(self.as_raw() as *mut _, &mut __device_info, __manufacturer.as_ptr() as *mut _, __serial_number.as_ptr() as *mut _) };
check(__code, "daqModuleManagerUtils_getDiscoveryInfo")?;
Ok(unsafe { crate::marshal::take_object::<DeviceInfo>(__device_info as *mut _) })
}
/// Attempts to retrieve the current IP configuration parameters for a specified network interface associated with a target device.
///
/// # Parameters
/// - `iface`: The name of the network interface whose IP configuration parameters are to be retrieved.
/// - `manufacturer`: The manufacturer's name identifying the device owning the network interface.
/// - `serial_number`: The serial number of the device owning the network interface.
///
/// # Returns
/// - `config`: A property object where the retrieved configuration parameters are stored. The manufacturer name and serial number are used to uniquely identify the target device. The method queries the current IP configuration parameters of the specified network interface via multicast addressing query to all devices in the subnet. The target device compares the received identification parameters with its own and, if they match, attempts to retrieve the currently active configuration parameters for the specified interface.
///
/// Calls the openDAQ C function `daqModuleManagerUtils_requestIpConfig()`.
pub fn request_ip_config(&self, iface: &str, manufacturer: &str, serial_number: &str) -> Result<Option<PropertyObject>> {
let __iface = crate::marshal::make_string(iface)?;
let __manufacturer = crate::marshal::make_string(manufacturer)?;
let __serial_number = crate::marshal::make_string(serial_number)?;
let mut __config: *mut sys::daqPropertyObject = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModuleManagerUtils_requestIpConfig)(self.as_raw() as *mut _, __iface.as_ptr() as *mut _, __manufacturer.as_ptr() as *mut _, __serial_number.as_ptr() as *mut _, &mut __config) };
check(__code, "daqModuleManagerUtils_requestIpConfig")?;
Ok(unsafe { crate::marshal::take_object::<PropertyObject>(__config as *mut _) })
}
}
impl Module {
/// Calls the openDAQ C function `daqModule_completeServerCapability()`.
pub fn complete_server_capability(&self, source: &ServerCapability, target: &ServerCapabilityConfig) -> Result<bool> {
let mut __succeeded: u8 = 0;
let __code = unsafe { (crate::sys::api().daqModule_completeServerCapability)(self.as_raw() as *mut _, &mut __succeeded, source.as_raw() as *mut _, target.as_raw() as *mut _) };
check(__code, "daqModule_completeServerCapability")?;
Ok(__succeeded != 0)
}
/// Creates a device object that can communicate with the device described in the specified connection string. The device object is not automatically added as a sub-device of the caller, but only returned by reference.
///
/// # Parameters
/// - `connection_string`: Describes the connection info of the device to connect to.
/// - `parent`: The parent component/device to which the device attaches.
/// - `config`: A configuration object that contains parameters used to configure a device in the form of key-value pairs.
///
/// # Returns
/// - `device`: The device object created to communicate with and control the device.
///
/// Calls the openDAQ C function `daqModule_createDevice()`.
pub fn create_device(&self, connection_string: &str, parent: &Component) -> 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().daqModule_createDevice)(self.as_raw() as *mut _, &mut __device, __connection_string.as_ptr() as *mut _, parent.as_raw() as *mut _, std::ptr::null_mut()) };
check(__code, "daqModule_createDevice")?;
Ok(unsafe { crate::marshal::take_object::<Device>(__device as *mut _) })
}
/// Creates a device object that can communicate with the device described in the specified connection string. The device object is not automatically added as a sub-device of the caller, but only returned by reference.
///
/// # Parameters
/// - `connection_string`: Describes the connection info of the device to connect to.
/// - `parent`: The parent component/device to which the device attaches.
/// - `config`: A configuration object that contains parameters used to configure a device in the form of key-value pairs.
///
/// # Returns
/// - `device`: The device object created to communicate with and control the device.
///
/// Calls the openDAQ C function `daqModule_createDevice()`.
pub fn create_device_with(&self, connection_string: &str, parent: &Component, 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().daqModule_createDevice)(self.as_raw() as *mut _, &mut __device, __connection_string.as_ptr() as *mut _, parent.as_raw() as *mut _, config.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqModule_createDevice")?;
Ok(unsafe { crate::marshal::take_object::<Device>(__device as *mut _) })
}
/// Creates and returns a function block with the specified id. The function block is not automatically added to the FB list of the caller.
///
/// # Parameters
/// - `id`: The id of the function block to create. Ids can be retrieved by calling `getAvailableFunctionBlockTypes()`.
/// - `parent`: The parent component/device to which the device attaches.
/// - `local_id`: The local id of the function block.
/// - `config`: Function block configuration. In case of a null value, implementation should use default configuration.
///
/// # Returns
/// - `function_block`: The created function block.
///
/// Calls the openDAQ C function `daqModule_createFunctionBlock()`.
pub fn create_function_block(&self, id: &str, parent: &Component, local_id: &str) -> Result<Option<FunctionBlock>> {
let __id = crate::marshal::make_string(id)?;
let __local_id = crate::marshal::make_string(local_id)?;
let mut __function_block: *mut sys::daqFunctionBlock = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModule_createFunctionBlock)(self.as_raw() as *mut _, &mut __function_block, __id.as_ptr() as *mut _, parent.as_raw() as *mut _, __local_id.as_ptr() as *mut _, std::ptr::null_mut()) };
check(__code, "daqModule_createFunctionBlock")?;
Ok(unsafe { crate::marshal::take_object::<FunctionBlock>(__function_block as *mut _) })
}
/// Creates and returns a function block with the specified id. The function block is not automatically added to the FB list of the caller.
///
/// # Parameters
/// - `id`: The id of the function block to create. Ids can be retrieved by calling `getAvailableFunctionBlockTypes()`.
/// - `parent`: The parent component/device to which the device attaches.
/// - `local_id`: The local id of the function block.
/// - `config`: Function block configuration. In case of a null value, implementation should use default configuration.
///
/// # Returns
/// - `function_block`: The created function block.
///
/// Calls the openDAQ C function `daqModule_createFunctionBlock()`.
pub fn create_function_block_with(&self, id: &str, parent: &Component, local_id: &str, config: Option<&PropertyObject>) -> Result<Option<FunctionBlock>> {
let __id = crate::marshal::make_string(id)?;
let __local_id = crate::marshal::make_string(local_id)?;
let mut __function_block: *mut sys::daqFunctionBlock = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModule_createFunctionBlock)(self.as_raw() as *mut _, &mut __function_block, __id.as_ptr() as *mut _, parent.as_raw() as *mut _, __local_id.as_ptr() as *mut _, config.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqModule_createFunctionBlock")?;
Ok(unsafe { crate::marshal::take_object::<FunctionBlock>(__function_block as *mut _) })
}
/// Creates and returns a server with the specified server type.
///
/// # Parameters
/// - `server_type_id`: The id of the server type to create. ServerType can be retrieved by calling `getAvailableServerTypes()`.
/// - `config`: Server configuration. In case of a null value, implementation should use default configuration.
/// - `root_device`: Root device.
///
/// # Returns
/// - `server`: The created server.
///
/// Calls the openDAQ C function `daqModule_createServer()`.
pub fn create_server(&self, server_type_id: &str, root_device: &Device) -> Result<Option<Server>> {
let __server_type_id = crate::marshal::make_string(server_type_id)?;
let mut __server: *mut sys::daqServer = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModule_createServer)(self.as_raw() as *mut _, &mut __server, __server_type_id.as_ptr() as *mut _, root_device.as_raw() as *mut _, std::ptr::null_mut()) };
check(__code, "daqModule_createServer")?;
Ok(unsafe { crate::marshal::take_object::<Server>(__server as *mut _) })
}
/// Creates and returns a server with the specified server type.
///
/// # Parameters
/// - `server_type_id`: The id of the server type to create. ServerType can be retrieved by calling `getAvailableServerTypes()`.
/// - `config`: Server configuration. In case of a null value, implementation should use default configuration.
/// - `root_device`: Root device.
///
/// # Returns
/// - `server`: The created server.
///
/// Calls the openDAQ C function `daqModule_createServer()`.
pub fn create_server_with(&self, server_type_id: &str, root_device: &Device, config: Option<&PropertyObject>) -> Result<Option<Server>> {
let __server_type_id = crate::marshal::make_string(server_type_id)?;
let mut __server: *mut sys::daqServer = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModule_createServer)(self.as_raw() as *mut _, &mut __server, __server_type_id.as_ptr() as *mut _, root_device.as_raw() as *mut _, config.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
check(__code, "daqModule_createServer")?;
Ok(unsafe { crate::marshal::take_object::<Server>(__server as *mut _) })
}
/// Creates and returns a streaming object using the specified connection string and config object.
///
/// # Parameters
/// - `connection_string`: Typically a connection string usually has a well known prefix, such as `daq.lt//`.
/// - `config`: A config object that contains parameters used to configure a streaming connection. In case of a null value, implementation should use default configuration.
///
/// # Returns
/// - `streaming`: The created streaming object.
///
/// Calls the openDAQ C function `daqModule_createStreaming()`.
pub fn create_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().daqModule_createStreaming)(self.as_raw() as *mut _, &mut __streaming, __connection_string.as_ptr() as *mut _, std::ptr::null_mut()) };
check(__code, "daqModule_createStreaming")?;
Ok(unsafe { crate::marshal::take_object::<Streaming>(__streaming as *mut _) })
}
/// Creates and returns a streaming object using the specified connection string and config object.
///
/// # Parameters
/// - `connection_string`: Typically a connection string usually has a well known prefix, such as `daq.lt//`.
/// - `config`: A config object that contains parameters used to configure a streaming connection. In case of a null value, implementation should use default configuration.
///
/// # Returns
/// - `streaming`: The created streaming object.
///
/// Calls the openDAQ C function `daqModule_createStreaming()`.
pub fn create_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().daqModule_createStreaming)(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, "daqModule_createStreaming")?;
Ok(unsafe { crate::marshal::take_object::<Streaming>(__streaming as *mut _) })
}
/// Returns a dictionary of known and available device types this module can create.
///
/// # Returns
/// - `device_types`: The dictionary of known device types.
///
/// Calls the openDAQ C function `daqModule_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().daqModule_getAvailableDeviceTypes)(self.as_raw() as *mut _, &mut __device_types) };
check(__code, "daqModule_getAvailableDeviceTypes")?;
Ok(unsafe { crate::marshal::take_dict::<String, DeviceType>(__device_types as *mut _, "daqModule_getAvailableDeviceTypes") }?)
}
/// Returns a list of known devices info. The implementation can start discovery in background and only return the results in this function.
///
/// # Returns
/// - `available_devices`: The list of known devices information.
///
/// Calls the openDAQ C function `daqModule_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().daqModule_getAvailableDevices)(self.as_raw() as *mut _, &mut __available_devices) };
check(__code, "daqModule_getAvailableDevices")?;
Ok(unsafe { crate::marshal::take_list::<DeviceInfo>(__available_devices as *mut _, "daqModule_getAvailableDevices") }?)
}
/// Returns a dictionary of known and available function block types this module can create.
///
/// # Returns
/// - `function_block_types`: The dictionary of known function block types.
///
/// Calls the openDAQ C function `daqModule_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().daqModule_getAvailableFunctionBlockTypes)(self.as_raw() as *mut _, &mut __function_block_types) };
check(__code, "daqModule_getAvailableFunctionBlockTypes")?;
Ok(unsafe { crate::marshal::take_dict::<String, FunctionBlockType>(__function_block_types as *mut _, "daqModule_getAvailableFunctionBlockTypes") }?)
}
/// Returns a dictionary of known and available servers types that this module can create.
///
/// # Returns
/// - `server_types`: The dictionary of known server types.
///
/// Calls the openDAQ C function `daqModule_getAvailableServerTypes()`.
pub fn available_server_types(&self) -> Result<std::collections::HashMap<String, ServerType>> {
let mut __server_types: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModule_getAvailableServerTypes)(self.as_raw() as *mut _, &mut __server_types) };
check(__code, "daqModule_getAvailableServerTypes")?;
Ok(unsafe { crate::marshal::take_dict::<String, ServerType>(__server_types as *mut _, "daqModule_getAvailableServerTypes") }?)
}
/// Returns a dictionary of known and available streaming types that this module (client) can create.
///
/// # Returns
/// - `streaming_types`: The dictionary of known streaming types.
///
/// Calls the openDAQ C function `daqModule_getAvailableStreamingTypes()`.
pub fn available_streaming_types(&self) -> Result<std::collections::HashMap<String, StreamingType>> {
let mut __streaming_types: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModule_getAvailableStreamingTypes)(self.as_raw() as *mut _, &mut __streaming_types) };
check(__code, "daqModule_getAvailableStreamingTypes")?;
Ok(unsafe { crate::marshal::take_dict::<String, StreamingType>(__streaming_types as *mut _, "daqModule_getAvailableStreamingTypes") }?)
}
/// Used to retrieve the license config template.
///
/// # Returns
/// - `license_config`: Previously used config.
///
/// Calls the openDAQ C function `daqModule_getLicenseConfig()`.
pub fn license_config(&self) -> Result<std::collections::HashMap<String, String>> {
let mut __license_config: *mut sys::daqDict = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModule_getLicenseConfig)(self.as_raw() as *mut _, &mut __license_config) };
check(__code, "daqModule_getLicenseConfig")?;
Ok(unsafe { crate::marshal::take_dict::<String, String>(__license_config as *mut _, "daqModule_getLicenseConfig") }?)
}
/// Retrieves the module information.
///
/// # Returns
/// - `info`: The module information.
///
/// Calls the openDAQ C function `daqModule_getModuleInfo()`.
pub fn module_info(&self) -> Result<Option<ModuleInfo>> {
let mut __info: *mut sys::daqModuleInfo = std::ptr::null_mut();
let __code = unsafe { (crate::sys::api().daqModule_getModuleInfo)(self.as_raw() as *mut _, &mut __info) };
check(__code, "daqModule_getModuleInfo")?;
Ok(unsafe { crate::marshal::take_object::<ModuleInfo>(__info as *mut _) })
}
/// Check whether the module license is loaded.
///
/// # Returns
/// - `loaded`: True, if the module license is loaded. Always return True if no license is required by the module.
///
/// Calls the openDAQ C function `daqModule_licenseLoaded()`.
pub fn license_loaded(&self) -> Result<bool> {
let mut __loaded: u8 = 0;
let __code = unsafe { (crate::sys::api().daqModule_licenseLoaded)(self.as_raw() as *mut _, &mut __loaded) };
check(__code, "daqModule_licenseLoaded")?;
Ok(__loaded != 0)
}
/// Used for loading a license, when the module requires one. Licenses can specify the degree to which the module is unlocked to the user (i.e. which and/or how many concurrent function blocks from this modules are accessible with the license).
///
/// # Parameters
/// - `license_config`: Any information relevant to load the license (i.e. a path to the license file).
///
/// # Returns
/// - `succeeded`: License was accepted.
///
/// Calls the openDAQ C function `daqModule_loadLicense()`.
pub fn load_license(&self, license_config: impl Into<Value>) -> Result<bool> {
let __license_config = crate::value::to_daq(&license_config.into())?;
let mut __succeeded: u8 = 0;
let __code = unsafe { (crate::sys::api().daqModule_loadLicense)(self.as_raw() as *mut _, &mut __succeeded, crate::value::opt_ref_ptr(&__license_config) as *mut _) };
check(__code, "daqModule_loadLicense")?;
Ok(__succeeded != 0)
}
}