opendaq 0.1.1

Safe Rust bindings for openDAQ, the open-source data acquisition SDK
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
// 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)
    }

}