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
// Generated by tools/generate_bindings.py -- do not edit by hand.

// Mechanical output: lint findings here are the generator's business.
#![allow(clippy::all, unused_imports, rustdoc::bare_urls)]

use crate::error::{check, Error, Result};
use crate::object::{BaseObject, Interface, Ref};
use crate::sys;
use crate::value::{Complex, Ratio, Value};
use crate::generated::*;
use std::ffi::c_char;

/// Represents an openDAQ mirrored client device. Allows accessing streaming data sources associated with the device.
/// Wrapper over the openDAQ `daqMirroredDevice` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct MirroredDevice(pub(crate) Device);

impl std::ops::Deref for MirroredDevice {
    type Target = Device;
    fn deref(&self) -> &Device { &self.0 }
}
impl crate::sealed::Sealed for MirroredDevice {}
unsafe impl Interface for MirroredDevice {
    const NAME: &'static str = "daqMirroredDevice";
    fn interface_id() -> Option<crate::IntfID> {
        let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
        unsafe { (crate::sys::api().daqMirroredDevice_getInterfaceId)(&mut id) };
        Some(id)
    }
    unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
        Ref::from_owned(ptr).map(Self::__from_ref)
    }
    fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl MirroredDevice {
    #[doc(hidden)]
    pub(crate) fn __from_ref(r: Ref) -> Self { MirroredDevice(Device::__from_ref(r)) }
}
impl std::fmt::Display for MirroredDevice {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(self.as_base_object(), f)
    }
}
impl From<&MirroredDevice> for Value {
    fn from(value: &MirroredDevice) -> Value { Value::Object(value.to_base_object()) }
}
impl From<MirroredDevice> for Value {
    fn from(value: MirroredDevice) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for MirroredDevice {
    unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
        crate::value::cast_owned(ptr, op)
    }
}

/// Represents configuration interface for mirrored device. Allows attaching and removing streaming data sources associated with the device.
/// Wrapper over the openDAQ `daqMirroredDeviceConfig` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct MirroredDeviceConfig(pub(crate) MirroredDevice);

impl std::ops::Deref for MirroredDeviceConfig {
    type Target = MirroredDevice;
    fn deref(&self) -> &MirroredDevice { &self.0 }
}
impl crate::sealed::Sealed for MirroredDeviceConfig {}
unsafe impl Interface for MirroredDeviceConfig {
    const NAME: &'static str = "daqMirroredDeviceConfig";
    fn interface_id() -> Option<crate::IntfID> {
        let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
        unsafe { (crate::sys::api().daqMirroredDeviceConfig_getInterfaceId)(&mut id) };
        Some(id)
    }
    unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
        Ref::from_owned(ptr).map(Self::__from_ref)
    }
    fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl MirroredDeviceConfig {
    #[doc(hidden)]
    pub(crate) fn __from_ref(r: Ref) -> Self { MirroredDeviceConfig(MirroredDevice::__from_ref(r)) }
}
impl std::fmt::Display for MirroredDeviceConfig {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(self.as_base_object(), f)
    }
}
impl From<&MirroredDeviceConfig> for Value {
    fn from(value: &MirroredDeviceConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl From<MirroredDeviceConfig> for Value {
    fn from(value: MirroredDeviceConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for MirroredDeviceConfig {
    unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
        crate::value::cast_owned(ptr, op)
    }
}

/// Represents the configuration interface for mirrored input ports.
/// Allows listing available streaming sources and selecting the active source for a mirrored input port.
/// Only sources that support client-to-device streaming are allowed. The active sources sends client signal
/// (and the associated domain signal) data to the device, which is then consumed by the connection formed
/// by the input port origin and the mirrored signal connected to it.
/// Wrapper over the openDAQ `daqMirroredInputPortConfig` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct MirroredInputPortConfig(pub(crate) InputPortConfig);

impl std::ops::Deref for MirroredInputPortConfig {
    type Target = InputPortConfig;
    fn deref(&self) -> &InputPortConfig { &self.0 }
}
impl crate::sealed::Sealed for MirroredInputPortConfig {}
unsafe impl Interface for MirroredInputPortConfig {
    const NAME: &'static str = "daqMirroredInputPortConfig";
    fn interface_id() -> Option<crate::IntfID> {
        let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
        unsafe { (crate::sys::api().daqMirroredInputPortConfig_getInterfaceId)(&mut id) };
        Some(id)
    }
    unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
        Ref::from_owned(ptr).map(Self::__from_ref)
    }
    fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl MirroredInputPortConfig {
    #[doc(hidden)]
    pub(crate) fn __from_ref(r: Ref) -> Self { MirroredInputPortConfig(InputPortConfig::__from_ref(r)) }
}
impl std::fmt::Display for MirroredInputPortConfig {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(self.as_base_object(), f)
    }
}
impl From<&MirroredInputPortConfig> for Value {
    fn from(value: &MirroredInputPortConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl From<MirroredInputPortConfig> for Value {
    fn from(value: MirroredInputPortConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for MirroredInputPortConfig {
    unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
        crate::value::cast_owned(ptr, op)
    }
}

/// Represents configuration interface for mirrored signals. Allows selecting streaming data sources per signal.
/// Wrapper over the openDAQ `daqMirroredSignalConfig` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct MirroredSignalConfig(pub(crate) SignalConfig);

impl std::ops::Deref for MirroredSignalConfig {
    type Target = SignalConfig;
    fn deref(&self) -> &SignalConfig { &self.0 }
}
impl crate::sealed::Sealed for MirroredSignalConfig {}
unsafe impl Interface for MirroredSignalConfig {
    const NAME: &'static str = "daqMirroredSignalConfig";
    fn interface_id() -> Option<crate::IntfID> {
        let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
        unsafe { (crate::sys::api().daqMirroredSignalConfig_getInterfaceId)(&mut id) };
        Some(id)
    }
    unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
        Ref::from_owned(ptr).map(Self::__from_ref)
    }
    fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl MirroredSignalConfig {
    #[doc(hidden)]
    pub(crate) fn __from_ref(r: Ref) -> Self { MirroredSignalConfig(SignalConfig::__from_ref(r)) }
}
impl std::fmt::Display for MirroredSignalConfig {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(self.as_base_object(), f)
    }
}
impl From<&MirroredSignalConfig> for Value {
    fn from(value: &MirroredSignalConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl From<MirroredSignalConfig> for Value {
    fn from(value: MirroredSignalConfig) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for MirroredSignalConfig {
    unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
        crate::value::cast_owned(ptr, op)
    }
}

/// Internal functions used by openDAQ core. This interface should never be used in client SDK or module code.
/// Wrapper over the openDAQ `daqMirroredSignalPrivate` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct MirroredSignalPrivate(pub(crate) BaseObject);

impl std::ops::Deref for MirroredSignalPrivate {
    type Target = BaseObject;
    fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for MirroredSignalPrivate {}
unsafe impl Interface for MirroredSignalPrivate {
    const NAME: &'static str = "daqMirroredSignalPrivate";
    fn interface_id() -> Option<crate::IntfID> {
        let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
        unsafe { (crate::sys::api().daqMirroredSignalPrivate_getInterfaceId)(&mut id) };
        Some(id)
    }
    unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
        Ref::from_owned(ptr).map(Self::__from_ref)
    }
    fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl MirroredSignalPrivate {
    #[doc(hidden)]
    pub(crate) fn __from_ref(r: Ref) -> Self { MirroredSignalPrivate(BaseObject(r)) }
}
impl std::fmt::Display for MirroredSignalPrivate {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(self.as_base_object(), f)
    }
}
impl From<&MirroredSignalPrivate> for Value {
    fn from(value: &MirroredSignalPrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl From<MirroredSignalPrivate> for Value {
    fn from(value: MirroredSignalPrivate) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for MirroredSignalPrivate {
    unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
        crate::value::cast_owned(ptr, op)
    }
}

/// Provides information on what streaming type can be created by a given module. Can be used to obtain the default configuration used when either adding/creating a new device, or establishing a new streaming connection.
/// Wrapper over the openDAQ `daqStreamingType` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct StreamingType(pub(crate) ComponentType);

impl std::ops::Deref for StreamingType {
    type Target = ComponentType;
    fn deref(&self) -> &ComponentType { &self.0 }
}
impl crate::sealed::Sealed for StreamingType {}
unsafe impl Interface for StreamingType {
    const NAME: &'static str = "daqStreamingType";
    fn interface_id() -> Option<crate::IntfID> {
        let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
        unsafe { (crate::sys::api().daqStreamingType_getInterfaceId)(&mut id) };
        Some(id)
    }
    unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
        Ref::from_owned(ptr).map(Self::__from_ref)
    }
    fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl StreamingType {
    #[doc(hidden)]
    pub(crate) fn __from_ref(r: Ref) -> Self { StreamingType(ComponentType::__from_ref(r)) }
}
impl std::fmt::Display for StreamingType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(self.as_base_object(), f)
    }
}
impl From<&StreamingType> for Value {
    fn from(value: &StreamingType) -> Value { Value::Object(value.to_base_object()) }
}
impl From<StreamingType> for Value {
    fn from(value: StreamingType) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for StreamingType {
    unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
        crate::value::cast_owned(ptr, op)
    }
}

/// Wrapper over the openDAQ `daqSubscriptionEventArgs` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct SubscriptionEventArgs(pub(crate) EventArgs);

impl std::ops::Deref for SubscriptionEventArgs {
    type Target = EventArgs;
    fn deref(&self) -> &EventArgs { &self.0 }
}
impl crate::sealed::Sealed for SubscriptionEventArgs {}
unsafe impl Interface for SubscriptionEventArgs {
    const NAME: &'static str = "daqSubscriptionEventArgs";
    fn interface_id() -> Option<crate::IntfID> {
        let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
        unsafe { (crate::sys::api().daqSubscriptionEventArgs_getInterfaceId)(&mut id) };
        Some(id)
    }
    unsafe fn from_raw(ptr: *mut std::ffi::c_void) -> Option<Self> {
        Ref::from_owned(ptr).map(Self::__from_ref)
    }
    fn as_base_object(&self) -> &BaseObject { &self.0 }
}
impl SubscriptionEventArgs {
    #[doc(hidden)]
    pub(crate) fn __from_ref(r: Ref) -> Self { SubscriptionEventArgs(EventArgs::__from_ref(r)) }
}
impl std::fmt::Display for SubscriptionEventArgs {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(self.as_base_object(), f)
    }
}
impl From<&SubscriptionEventArgs> for Value {
    fn from(value: &SubscriptionEventArgs) -> Value { Value::Object(value.to_base_object()) }
}
impl From<SubscriptionEventArgs> for Value {
    fn from(value: SubscriptionEventArgs) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for SubscriptionEventArgs {
    unsafe fn from_daq_owned(ptr: *mut std::ffi::c_void, op: &'static str) -> Result<Self> {
        crate::value::cast_owned(ptr, op)
    }
}

impl MirroredDeviceConfig {
    /// Adds streaming source for device.
    ///
    /// # Parameters
    /// - `streaming`: The Streaming object representing the data source.
    ///
    /// Calls the openDAQ C function `daqMirroredDeviceConfig_addStreamingSource()`.
    pub fn add_streaming_source(&self, streaming_source: &Streaming) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqMirroredDeviceConfig_addStreamingSource)(self.as_raw() as *mut _, streaming_source.as_raw() as *mut _) };
        check(__code, "daqMirroredDeviceConfig_addStreamingSource")?;
        Ok(())
    }

    /// Removes streaming source for device e.g. when the streaming source is no longer available.
    ///
    /// # Parameters
    /// - `streaming_connection_string`: The connection string of streaming source to be removed.
    ///
    /// Calls the openDAQ C function `daqMirroredDeviceConfig_removeStreamingSource()`.
    pub fn remove_streaming_source(&self, streaming_connection_string: &str) -> Result<()> {
        let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
        let __code = unsafe { (crate::sys::api().daqMirroredDeviceConfig_removeStreamingSource)(self.as_raw() as *mut _, __streaming_connection_string.as_ptr() as *mut _) };
        check(__code, "daqMirroredDeviceConfig_removeStreamingSource")?;
        Ok(())
    }

    /// Sets the device's type that corresponds to the client-side device module.
    ///
    /// # Parameters
    /// - `type`: The device's type.
    ///
    /// Calls the openDAQ C function `daqMirroredDeviceConfig_setMirroredDeviceType()`.
    pub fn set_mirrored_device_type(&self, type_: &DeviceType) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqMirroredDeviceConfig_setMirroredDeviceType)(self.as_raw() as *mut _, type_.as_raw() as *mut _) };
        check(__code, "daqMirroredDeviceConfig_setMirroredDeviceType")?;
        Ok(())
    }

}

impl MirroredDevice {
    /// Gets the device's type that corresponds to the client-side device module.
    ///
    /// # Parameters
    /// - `type`: The device's type.
    ///
    /// Calls the openDAQ C function `daqMirroredDevice_getMirroredDeviceType()`.
    pub fn mirrored_device_type(&self) -> Result<Option<DeviceType>> {
        let mut __type_: *mut sys::daqDeviceType = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqMirroredDevice_getMirroredDeviceType)(self.as_raw() as *mut _, &mut __type_) };
        check(__code, "daqMirroredDevice_getMirroredDeviceType")?;
        Ok(unsafe { crate::marshal::take_object::<DeviceType>(__type_ as *mut _) })
    }

    /// Gets the global ID of the device as it appears on the remote instance.
    ///
    /// # Returns
    /// - `id`: The device ID.
    ///
    /// Calls the openDAQ C function `daqMirroredDevice_getRemoteId()`.
    pub fn remote_id(&self) -> Result<String> {
        let mut __id: *mut sys::daqString = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqMirroredDevice_getRemoteId)(self.as_raw() as *mut _, &mut __id) };
        check(__code, "daqMirroredDevice_getRemoteId")?;
        Ok(unsafe { crate::marshal::take_string(__id) })
    }

    /// Gets a list of streaming objects representing all streaming sources of the device.
    ///
    /// # Returns
    /// - `streaming_sources`: The list of streaming objects.
    ///
    /// Calls the openDAQ C function `daqMirroredDevice_getStreamingSources()`.
    pub fn streaming_sources(&self) -> Result<Vec<Streaming>> {
        let mut __streaming_sources: *mut sys::daqList = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqMirroredDevice_getStreamingSources)(self.as_raw() as *mut _, &mut __streaming_sources) };
        check(__code, "daqMirroredDevice_getStreamingSources")?;
        Ok(unsafe { crate::marshal::take_list::<Streaming>(__streaming_sources as *mut _, "daqMirroredDevice_getStreamingSources") }?)
    }

}

impl MirroredInputPortConfig {
    /// Gets a connection strings of the active streaming source of the input port.
    ///
    /// # Returns
    /// - `streaming_connection_string`: The connection string of active streaming source.
    ///
    /// Calls the openDAQ C function `daqMirroredInputPortConfig_getActiveStreamingSource()`.
    pub fn active_streaming_source(&self) -> Result<String> {
        let mut __streaming_connection_string: *mut sys::daqString = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqMirroredInputPortConfig_getActiveStreamingSource)(self.as_raw() as *mut _, &mut __streaming_connection_string) };
        check(__code, "daqMirroredInputPortConfig_getActiveStreamingSource")?;
        Ok(unsafe { crate::marshal::take_string(__streaming_connection_string) })
    }

    /// Gets the global ID of the input port as it appears on the remote device.
    ///
    /// # Returns
    /// - `id`: The input port ID.
    ///
    /// Calls the openDAQ C function `daqMirroredInputPortConfig_getRemoteId()`.
    pub fn remote_id(&self) -> Result<String> {
        let mut __id: *mut sys::daqString = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqMirroredInputPortConfig_getRemoteId)(self.as_raw() as *mut _, &mut __id) };
        check(__code, "daqMirroredInputPortConfig_getRemoteId")?;
        Ok(unsafe { crate::marshal::take_string(__id) })
    }

    /// Gets a list of connection strings of all available streaming sources of the input port.
    ///
    /// # Returns
    /// - `streaming_connection_strings`: The list of streaming connection strings.
    ///
    /// Calls the openDAQ C function `daqMirroredInputPortConfig_getStreamingSources()`.
    pub fn streaming_sources(&self) -> Result<Vec<String>> {
        let mut __streaming_connection_strings: *mut sys::daqList = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqMirroredInputPortConfig_getStreamingSources)(self.as_raw() as *mut _, &mut __streaming_connection_strings) };
        check(__code, "daqMirroredInputPortConfig_getStreamingSources")?;
        Ok(unsafe { crate::marshal::take_list::<String>(__streaming_connection_strings as *mut _, "daqMirroredInputPortConfig_getStreamingSources") }?)
    }

    /// Sets the active streaming source of the input port.
    ///
    /// # Parameters
    /// - `streaming_connection_string`: The connection string of streaming source to be set as active.
    ///
    /// # Errors
    /// - `OPENDAQ_ERR_NOTFOUND`: if the streaming source with the corresponding connection string is not part of the available streaming sources for the input port.
    ///
    /// Calls the openDAQ C function `daqMirroredInputPortConfig_setActiveStreamingSource()`.
    pub fn set_active_streaming_source(&self, streaming_connection_string: &str) -> Result<()> {
        let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
        let __code = unsafe { (crate::sys::api().daqMirroredInputPortConfig_setActiveStreamingSource)(self.as_raw() as *mut _, __streaming_connection_string.as_ptr() as *mut _) };
        check(__code, "daqMirroredInputPortConfig_setActiveStreamingSource")?;
        Ok(())
    }

}

impl MirroredSignalConfig {
    /// Stops the streaming and clears the active streaming source of the signal.
    ///
    /// Calls the openDAQ C function `daqMirroredSignalConfig_deactivateStreaming()`.
    pub fn deactivate_streaming(&self) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqMirroredSignalConfig_deactivateStreaming)(self.as_raw() as *mut _) };
        check(__code, "daqMirroredSignalConfig_deactivateStreaming")?;
        Ok(())
    }

    /// Gets a connection strings of the active streaming source of the signal.
    ///
    /// # Returns
    /// - `streaming_connection_string`: The connection string of active streaming source.
    ///
    /// Calls the openDAQ C function `daqMirroredSignalConfig_getActiveStreamingSource()`.
    pub fn active_streaming_source(&self) -> Result<String> {
        let mut __streaming_connection_string: *mut sys::daqString = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqMirroredSignalConfig_getActiveStreamingSource)(self.as_raw() as *mut _, &mut __streaming_connection_string) };
        check(__code, "daqMirroredSignalConfig_getActiveStreamingSource")?;
        Ok(unsafe { crate::marshal::take_string(__streaming_connection_string) })
    }

    /// Gets the Event that is triggered whenever the acknowledgment for signal subscription completion is received from the streaming server.
    ///
    /// # Returns
    /// - `event`: The Event representing the acknowledgment of signal subscription completion. A handler can be added to the event containing a callback function which is invoked whenever the event is triggered. The callback function requires two parameters - a MirroredSignalConfig object, as well as a "Subscription event args" object. The callback will be invoked with the MirroredSignalConfig object as the first argument, the second argument holds an event args object that contains the connection string of streaming and the event type (Subscribed).
    ///
    /// Calls the openDAQ C function `daqMirroredSignalConfig_getOnSubscribeComplete()`.
    pub fn on_subscribe_complete(&self) -> Result<Option<Event>> {
        let mut __event: *mut sys::daqEvent = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqMirroredSignalConfig_getOnSubscribeComplete)(self.as_raw() as *mut _, &mut __event) };
        check(__code, "daqMirroredSignalConfig_getOnSubscribeComplete")?;
        Ok(unsafe { crate::marshal::take_object::<Event>(__event as *mut _) })
    }

    /// Gets the Event that is triggered whenever the acknowledgment for signal unsubscription completion is received from the streaming server.
    ///
    /// # Returns
    /// - `event`: The Event representing the acknowledgment of signal unsubscription completion. A handler can be added to the event containing a callback function which is invoked whenever the event is triggered. The callback function requires two parameters - a MirroredSignalConfig object, as well as a "Subscription event args" object. The callback will be invoked with the MirroredSignalConfig object as the first argument, the second argument holds an event args object that contains the connection string of streaming and the event type (Unsubscribed).
    ///
    /// Calls the openDAQ C function `daqMirroredSignalConfig_getOnUnsubscribeComplete()`.
    pub fn on_unsubscribe_complete(&self) -> Result<Option<Event>> {
        let mut __event: *mut sys::daqEvent = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqMirroredSignalConfig_getOnUnsubscribeComplete)(self.as_raw() as *mut _, &mut __event) };
        check(__code, "daqMirroredSignalConfig_getOnUnsubscribeComplete")?;
        Ok(unsafe { crate::marshal::take_object::<Event>(__event as *mut _) })
    }

    /// Gets the global ID of the signal as it appears on the remote device.
    ///
    /// # Returns
    /// - `id`: The signal ID.
    ///
    /// Calls the openDAQ C function `daqMirroredSignalConfig_getRemoteId()`.
    pub fn remote_id(&self) -> Result<String> {
        let mut __id: *mut sys::daqString = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqMirroredSignalConfig_getRemoteId)(self.as_raw() as *mut _, &mut __id) };
        check(__code, "daqMirroredSignalConfig_getRemoteId")?;
        Ok(unsafe { crate::marshal::take_string(__id) })
    }

    /// Gets a list of connection strings of all available streaming sources of the signal.
    ///
    /// # Returns
    /// - `streaming_connection_strings`: The list of streaming connection strings.
    ///
    /// Calls the openDAQ C function `daqMirroredSignalConfig_getStreamingSources()`.
    pub fn streaming_sources(&self) -> Result<Vec<String>> {
        let mut __streaming_connection_strings: *mut sys::daqList = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqMirroredSignalConfig_getStreamingSources)(self.as_raw() as *mut _, &mut __streaming_connection_strings) };
        check(__code, "daqMirroredSignalConfig_getStreamingSources")?;
        Ok(unsafe { crate::marshal::take_list::<String>(__streaming_connection_strings as *mut _, "daqMirroredSignalConfig_getStreamingSources") }?)
    }

    /// Sets the active streaming source of the signal.
    ///
    /// # Parameters
    /// - `streaming_connection_string`: The connection string of streaming source to be set as active.
    ///
    /// # Errors
    /// - `OPENDAQ_ERR_NOTFOUND`: if the streaming source with the corresponding connection string is not part of the available streaming sources for the signal.
    ///
    /// Calls the openDAQ C function `daqMirroredSignalConfig_setActiveStreamingSource()`.
    pub fn set_active_streaming_source(&self, streaming_connection_string: &str) -> Result<()> {
        let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
        let __code = unsafe { (crate::sys::api().daqMirroredSignalConfig_setActiveStreamingSource)(self.as_raw() as *mut _, __streaming_connection_string.as_ptr() as *mut _) };
        check(__code, "daqMirroredSignalConfig_setActiveStreamingSource")?;
        Ok(())
    }

}

impl MirroredSignalPrivate {
    /// Adds streaming source for signal.
    ///
    /// # Parameters
    /// - `streaming`: The Streaming object representing the data source.
    ///
    /// Calls the openDAQ C function `daqMirroredSignalPrivate_addStreamingSource()`.
    pub fn add_streaming_source(&self, streaming: &Streaming) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_addStreamingSource)(self.as_raw() as *mut _, streaming.as_raw() as *mut _) };
        check(__code, "daqMirroredSignalPrivate_addStreamingSource")?;
        Ok(())
    }

    /// Calls the openDAQ C function `daqMirroredSignalPrivate_getMirroredDataDescriptor()`.
    pub fn mirrored_data_descriptor(&self) -> Result<Option<DataDescriptor>> {
        let mut __descriptor: *mut sys::daqDataDescriptor = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_getMirroredDataDescriptor)(self.as_raw() as *mut _, &mut __descriptor) };
        check(__code, "daqMirroredSignalPrivate_getMirroredDataDescriptor")?;
        Ok(unsafe { crate::marshal::take_object::<DataDescriptor>(__descriptor as *mut _) })
    }

    /// Calls the openDAQ C function `daqMirroredSignalPrivate_getMirroredDomainSignal()`.
    pub fn mirrored_domain_signal(&self) -> Result<Option<MirroredSignalConfig>> {
        let mut __domain_signals: *mut sys::daqMirroredSignalConfig = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_getMirroredDomainSignal)(self.as_raw() as *mut _, &mut __domain_signals) };
        check(__code, "daqMirroredSignalPrivate_getMirroredDomainSignal")?;
        Ok(unsafe { crate::marshal::take_object::<MirroredSignalConfig>(__domain_signals as *mut _) })
    }

    /// Removes streaming source for signal.
    ///
    /// # Parameters
    /// - `streaming_connection_string`: The connection string of streaming source to be removed.
    ///
    /// Calls the openDAQ C function `daqMirroredSignalPrivate_removeStreamingSource()`.
    pub fn remove_streaming_source(&self, streaming_connection_string: &str) -> Result<()> {
        let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
        let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_removeStreamingSource)(self.as_raw() as *mut _, __streaming_connection_string.as_ptr() as *mut _) };
        check(__code, "daqMirroredSignalPrivate_removeStreamingSource")?;
        Ok(())
    }

    /// Calls the openDAQ C function `daqMirroredSignalPrivate_setMirroredDataDescriptor()`.
    pub fn set_mirrored_data_descriptor(&self, descriptor: &DataDescriptor) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_setMirroredDataDescriptor)(self.as_raw() as *mut _, descriptor.as_raw() as *mut _) };
        check(__code, "daqMirroredSignalPrivate_setMirroredDataDescriptor")?;
        Ok(())
    }

    /// Calls the openDAQ C function `daqMirroredSignalPrivate_setMirroredDomainSignal()`.
    pub fn set_mirrored_domain_signal(&self, domain_signal: &MirroredSignalConfig) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_setMirroredDomainSignal)(self.as_raw() as *mut _, domain_signal.as_raw() as *mut _) };
        check(__code, "daqMirroredSignalPrivate_setMirroredDomainSignal")?;
        Ok(())
    }

    /// Handles the completion of subscription acknowledged by the specified streaming source.
    ///
    /// # Parameters
    /// - `streaming_connection_string`: The connection string of the streaming source that completed the subscription for the signal.
    ///
    /// Calls the openDAQ C function `daqMirroredSignalPrivate_subscribeCompleted()`.
    pub fn subscribe_completed(&self, streaming_connection_string: &str) -> Result<()> {
        let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
        let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_subscribeCompleted)(self.as_raw() as *mut _, __streaming_connection_string.as_ptr() as *mut _) };
        check(__code, "daqMirroredSignalPrivate_subscribeCompleted")?;
        Ok(())
    }

    /// Handles event packet e.g. packet with changes of the signals descriptors or signal properties
    ///
    /// # Parameters
    /// - `event_packet`: The event packet to be handled.
    ///
    /// # Returns
    /// True if the eventPacket should be sent along the signal path; False otherwise.
    ///
    /// Calls the openDAQ C function `daqMirroredSignalPrivate_triggerEvent()`.
    pub fn trigger_event(&self, event_packet: &EventPacket) -> Result<bool> {
        let mut __forward: u8 = 0;
        let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_triggerEvent)(self.as_raw() as *mut _, event_packet.as_raw() as *mut _, &mut __forward) };
        check(__code, "daqMirroredSignalPrivate_triggerEvent")?;
        Ok(__forward != 0)
    }

    /// Handles the completion of unsubscription acknowledged by the specified streaming source.
    ///
    /// # Parameters
    /// - `streaming_connection_string`: The connection string of the streaming source that completed the unsubscription for the signal.
    ///
    /// Calls the openDAQ C function `daqMirroredSignalPrivate_unsubscribeCompleted()`.
    pub fn unsubscribe_completed(&self, streaming_connection_string: &str) -> Result<()> {
        let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
        let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_unsubscribeCompleted)(self.as_raw() as *mut _, __streaming_connection_string.as_ptr() as *mut _) };
        check(__code, "daqMirroredSignalPrivate_unsubscribeCompleted")?;
        Ok(())
    }

    /// Acts the same as unsubscribeCompleted() but does not enter a critical section.
    ///
    /// # Parameters
    /// - `streaming_connection_string`: The connection string of the streaming source that completed the unsubscription for the signal.
    ///
    /// Calls the openDAQ C function `daqMirroredSignalPrivate_unsubscribeCompletedNoLock()`.
    pub fn unsubscribe_completed_no_lock(&self, streaming_connection_string: &str) -> Result<()> {
        let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
        let __code = unsafe { (crate::sys::api().daqMirroredSignalPrivate_unsubscribeCompletedNoLock)(self.as_raw() as *mut _, __streaming_connection_string.as_ptr() as *mut _) };
        check(__code, "daqMirroredSignalPrivate_unsubscribeCompletedNoLock")?;
        Ok(())
    }

}

impl StreamingType {
    /// Creates a Streaming type object, with the id, name, description and optional defaultConfig.
    ///
    /// # Parameters
    /// - `id`: The unique type ID of the Streaming.
    /// - `name`: The name of the Streaming. Eg. FFT.
    /// - `description`: A short description of the Streaming and its behaviour.
    /// - `default_config`: The property object, to be cloned and returned, each time user creates default configuration object. This way each instance of the Streaming has its own configuration object.
    ///
    /// Calls the openDAQ C function `daqStreamingType_createStreamingType()`.
    pub fn new(id: &str, name: &str, description: &str, prefix: &str, default_config: &PropertyObject) -> Result<StreamingType> {
        let __id = crate::marshal::make_string(id)?;
        let __name = crate::marshal::make_string(name)?;
        let __description = crate::marshal::make_string(description)?;
        let __prefix = crate::marshal::make_string(prefix)?;
        let mut __obj: *mut sys::daqStreamingType = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqStreamingType_createStreamingType)(&mut __obj, __id.as_ptr() as *mut _, __name.as_ptr() as *mut _, __description.as_ptr() as *mut _, __prefix.as_ptr() as *mut _, default_config.as_raw() as *mut _) };
        check(__code, "daqStreamingType_createStreamingType")?;
        Ok(unsafe { crate::marshal::require_object::<StreamingType>(__obj as *mut _, "daqStreamingType_createStreamingType") }?)
    }

    /// Calls the openDAQ C function `daqStreamingType_getConnectionStringPrefix()`.
    pub fn connection_string_prefix(&self) -> Result<String> {
        let mut __prefix: *mut sys::daqString = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqStreamingType_getConnectionStringPrefix)(self.as_raw() as *mut _, &mut __prefix) };
        check(__code, "daqStreamingType_getConnectionStringPrefix")?;
        Ok(unsafe { crate::marshal::take_string(__prefix) })
    }

}

impl SubscriptionEventArgs {
    /// Calls the openDAQ C function `daqSubscriptionEventArgs_createSubscriptionEventArgs()`.
    pub fn new(streaming_connection_string: &str, type_: SubscriptionEventType) -> Result<SubscriptionEventArgs> {
        let __streaming_connection_string = crate::marshal::make_string(streaming_connection_string)?;
        let mut __obj: *mut sys::daqSubscriptionEventArgs = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqSubscriptionEventArgs_createSubscriptionEventArgs)(&mut __obj, __streaming_connection_string.as_ptr() as *mut _, type_ as u32) };
        check(__code, "daqSubscriptionEventArgs_createSubscriptionEventArgs")?;
        Ok(unsafe { crate::marshal::require_object::<SubscriptionEventArgs>(__obj as *mut _, "daqSubscriptionEventArgs_createSubscriptionEventArgs") }?)
    }

    /// Calls the openDAQ C function `daqSubscriptionEventArgs_getStreamingConnectionString()`.
    pub fn streaming_connection_string(&self) -> Result<String> {
        let mut __streaming_connection_string: *mut sys::daqString = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqSubscriptionEventArgs_getStreamingConnectionString)(self.as_raw() as *mut _, &mut __streaming_connection_string) };
        check(__code, "daqSubscriptionEventArgs_getStreamingConnectionString")?;
        Ok(unsafe { crate::marshal::take_string(__streaming_connection_string) })
    }

    /// Calls the openDAQ C function `daqSubscriptionEventArgs_getSubscriptionEventType()`.
    pub fn subscription_event_type(&self) -> Result<SubscriptionEventType> {
        let mut __type_: u32 = 0;
        let __code = unsafe { (crate::sys::api().daqSubscriptionEventArgs_getSubscriptionEventType)(self.as_raw() as *mut _, &mut __type_) };
        check(__code, "daqSubscriptionEventArgs_getSubscriptionEventType")?;
        Ok(crate::marshal::enum_out(SubscriptionEventType::from_raw(__type_), "daqSubscriptionEventArgs_getSubscriptionEventType")?)
    }

}