#![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;
#[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)
}
}
#[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)
}
}
#[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)
}
}
#[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)
}
}
#[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 {
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 {
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") }?)
}
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(())
}
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(())
}
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 {
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(())
}
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(())
}
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 _) })
}
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 _) })
}
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 _) })
}
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") }?)
}
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") }?)
}
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 _) })
}
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 _) })
}
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 _) })
}
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 _) })
}
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 _) })
}
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 _) })
}
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") }?)
}
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") }?)
}
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") }?)
}
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") }?)
}
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 _) })
}
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 {
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)
}
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 _) })
}
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 _) })
}
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 _) })
}
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 _) })
}
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 _) })
}
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 _) })
}
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 _) })
}
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 _) })
}
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") }?)
}
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") }?)
}
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") }?)
}
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") }?)
}
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") }?)
}
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") }?)
}
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 _) })
}
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)
}
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)
}
}