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
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
// 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;

/// An allocator used to allocate memory.
/// The default BB allocator simply uses `malloc`, but the user can implement a custom allocator to
/// override this behavior (perhaps using a memory pool or different allocation strategy). An
/// example/reference implementation is provided which uses Microsoft `mimalloc`.
/// Wrapper over the openDAQ `daqAllocator` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Allocator(pub(crate) BaseObject);

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

/// Represents a connection between an Input port and Signal. Acts as a queue for packets sent by the signal, which can be read by the input port and the input port's owner.
/// The Connection provides standard queue methods, allowing for packets to be put at the back
/// of the queue, and popped from the front. Additionally, the front packet can be inspected via
/// `peek`, and the number of queued packets can be obtained through `getPacketCount`.
/// The Connection has a reference to the connected Signal and Input port.
/// Wrapper over the openDAQ `daqConnection` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Connection(pub(crate) BaseObject);

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

/// @ingroup opendaq_signal_path
/// @addtogroup opendaq_connection ConnectionInternal
/// Wrapper over the openDAQ `daqConnectionInternal` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ConnectionInternal(pub(crate) BaseObject);

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

/// Describes the data sent by a signal, defining how they are to be interpreted by anyone receiving the signal's packets.
/// The data descriptor provides all information required on how to process data buffers, and how to interpret the data.
/// It contains the following fields:
/// - `Name`: A descriptive name of the data being described. In example, when the values describe the amplitude of spectrum data, the name
/// would be `Amplitude`.
/// - `Dimensions`: A list of dimensions of the signal. A sample descriptor can have 0 or more dimensions. A signal with 1 dimension
/// has vector data. A signal with 2 dimensions has matrix data, a signal with 0 has a single value for each sample.
/// - `SampleType`: An enum value that specifies the underlying data type (eg. Float64, Int32, String,...)
/// - `Unit`: The unit of the data in the signal's packets.
/// - `ValueRange`: The value range of the data in a signal's packets defining the lowest and highest expected values. The range is not
/// enforced.
/// - `Rule`: The data rule that defines how a signal value is calculated from an implicit initialization value when the rule type is not
/// `Explicit`.
/// - `Origin`: Defines the starting point of the signal. If set, all values are added to the absolute origin when read.
/// - `TickResolution`: Used to scale signal ticks into their physical unit. In example, a resolution of 1/1000 with the unit being `seconds`
/// states that a value of 1 correlates to 1 millisecond.
/// - `PostScaling`: Defines a scaling transformation, which should be applied to data carried by the signal's packets when read. If
/// `PostScaling` is used, the `Rule`, `Resolution`, and `Origin` must not be configured. The `SampleType` must match the
/// `outputDataType` of the `PostScaling`.
/// - `StructFields`: A list of DataDescriptor. The descriptor list is used to define complex data samples. When defined, the sample
/// buffer is laid out so that the data described by the first DataDescriptor is at the start, followed by the data
/// described by the second and so on. If the list is not empty, all descriptor parameters except for `Name` and
/// `Dimensions` should not be configured. See below for a explanation of Structure data descriptors.
/// - `ReferenceDomainInfo`: If set, gives the common identifier of one domain group. Signals with the same Reference Domain ID share a
/// common synchronization source (all the signals in a group either come from the same device or are synchronized
/// using a protocol, such as PTP, NTP, IRIG, etc.). Those signals can always be read together, implying that a
/// Multi Reader can be used to read the signals if their sampling rates are compatible.
/// @subsection data_descriptor_dimensions Dimensions
/// The list of dimensions determines the rank of values described by the descriptor. In example, if the list contains 1 dimension, the data
/// values are vectors. If it contains 2, the data values are matrices, if 0, the descriptor describes a single value.
/// When the data is placed into packet buffers, the values are laid out in packet buffers linearly, where each value fills up
/// `sizeof(sampleType) * (dimensionSize1 * dimensionSize2 *...)` bytes.
/// Data descriptor objects implement the Struct methods internally and are Core type `ctStruct`.
/// @subsection data_descriptor_struct_fields Struct fields
/// A DataDescriptor with the `StructFields` field filled with other descriptors is used to represent signal data in the form of structures.
/// It allows for custom and complex structures to be described and sent by a signal.
/// When evaluating a struct descriptor, their struct field values are laid out in the packet buffers in the order they are placed in
/// the `structFields` list. Eg. a struct with 3 fields, of types \[int64_t, float, double\] will have a buffer composed of an int64_t value,
/// followed by a float, and lastly a double value.
/// Note that if the Dimensions field of the DataDescriptor is not empty, struct data can also be of a higher rank
/// (eg. a vector/matrix of structs).
/// @subsection data_descriptor_calculation_order Value calculation
/// Besides the struct fields and dimensions, the Value descriptor also provides 4 fields which need to be taken into account and calculated
/// when reading packet buffers: `Rule`, `Resolution`, `Origin`, and `PostScaling`.
/// @subsubsection data_descriptor_calculation_without_scaling Without `PostScaling`
/// 1. Check and apply `Rule`:
/// - If the rule is `explicit`, the values of a packet are present in the packet's data buffer
/// - If not `explicit`, the packet's values need to be calculated. To calculate them, take the PacketOffset and SampleCount of the
/// packet. Use the PacketOffset, as well as the index of the sample in a packet to calculate the rule's output value: `Value = PacketOffset + Rule(Index)`.
/// Eg. `Value = PacketOffset + Delta * Index + Start`
/// 2. Apply `TickResolution`:
/// - If the `TickResolution` is set, multiply the value from 1. with the `Resolution`. This scales the value into the `Unit` of the value
/// descriptor.
/// - If not set, keep the value from 1.
/// 3. Add `Origin`:
/// - If the `Origin` is set, take the value from 2. and add it to the `Origin`.
/// In example, if using the Unix Epoch, a value `1669279690` in seconds would mean Thursday, 24 November 2022 08:48:10 GMT.
/// - If not set, keep the value from 2.
/// @subsubsection data_descriptor_calculation_with_scaling With `PostScaling`
/// If `PostScaling` is set, the `Rule` must be explicit, while `Resolution` and `Origin` must not be configured.
/// To calculate the value with `PostScaling` configured, take the values of the packet's data buffer and apply the post scaling to each
/// value in the buffer: `Value = PostScaling(Value)`, eg. `Value = Value * Scale + Offset`
/// Wrapper over the openDAQ `daqDataDescriptor` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DataDescriptor(pub(crate) BaseObject);

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

/// Builder component of Data descriptor objects. Contains setter methods that allow for Data descriptor parameter configuration, and a `build` method that builds the Data descriptor.
/// Wrapper over the openDAQ `daqDataDescriptorBuilder` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DataDescriptorBuilder(pub(crate) BaseObject);

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

/// Packet that contains data sent by a signal. The data can be either explicit, or implicit.
/// Explicit data is contained within a signal's buffer, accessible through `getRawData`, while implicit
/// packets do not carry any data. Their values are calculated given a rule, packet offset, and the index of
/// a sample within the data buffer.
/// To obtain implicitly calculated, or scaled values, `getData` should be used. The data descriptor and sample
/// count provide information about the type and amount of data available at the obtained address.
/// Wrapper over the openDAQ `daqDataPacket` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DataPacket(pub(crate) Packet);

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

/// Rule that defines how a signal value is calculated from an implicit initialization value when the rule type is not `Explicit`.
/// Data rule objects implement the Struct methods internally and are Core type `ctStruct`.
/// @subsection data_rule_explicit Explicit rule
/// When the rule type of the Data rule is set to `Explicit`, the values passed through the signal path, described by
/// the Value descriptor are stored in packet buffers.
/// The Explicit rule can have 2 optional parameters:
/// - `minExpectedDelta`: Specifies the minimum difference in value between two subsequent samples
/// - `maxExpectedDelta`: Specifies the maximum difference in value between two subsequent samples
/// These are mostly used for domain signals to specify the expected rate of a signal, or the expected timeout of a signal.
/// The delta parameters should be configured to match the deltas in terms of the raw signal values (before scaling/resolution
/// are applied).
/// An explicit rule must have either both or none of these parameters. To use only one, the other must be set to 0.
/// @subsection data_rule_implicit Implicit rule
/// When the rule type of the Data rule is not `Explicit`, the buffers of packets are empty. The values must instead be
/// calculated via the Implicit value found in the packet buffers in conjunction with the parameters of the rule. Each
/// implicit rule type specifies its own required set of parameters.
/// @subsubsection data_rule_linear Linear rule
/// The parameters include a `delta` and `start` integer members. The values are calculated according to the following
/// equation: \<em\>packetOffset + sampleIndex * delta + start\</em\>.
/// @subsubsection data_rule_linear Constant rule
/// The parameters contain a `constant` number member. The value described by the constant rule is always equal to the
/// constant.
/// Wrapper over the openDAQ `daqDataRule` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DataRule(pub(crate) BaseObject);

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

/// Configuration component of Data rule objects. Contains setter methods that allow for Data rule parameter configuration, and a `build` method that builds the Data rule.
/// Wrapper over the openDAQ `daqDataRuleBuilder` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DataRuleBuilder(pub(crate) BaseObject);

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

/// Callback which is called when external memory is no longer needed and can be freed.
/// This interface is used with blueberry packets that are created with external memory. Provider
/// of external memory is responsible to provide a custom deleter, which is called when the packet is
/// destroyed.
/// Wrapper over the openDAQ `daqDeleter` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Deleter(pub(crate) BaseObject);

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

/// Describes a dimension of the signal's data. Eg. a column/row in a matrix.
/// Dimension objects define the size and labels of a single data dimension. Labels, in concert
/// with the unit, provide information about the position of data in a structure. For example, for vector
/// rank data in a frequency domain, the unit would be Hz, and the labels would range from the minimum to the maximum
/// frequency of the spectrum.
/// The number of dimensions a sample descriptor defines the rank of the signals data. When no dimensions are
/// present, one sample is a single value. When there's one dimension, a sample contains a vector of values,
/// when there are three a sample contains a matrix. Higher ranks of data can be represented by adding more
/// dimension objects to a sample descriptor.
/// The labels can be defined with a Rule (in example a linear rule with a coefficient and offset), where the
/// the data index is the input to the rule. In example
/// A Linear rule with coefficient = 5, offset = 10, size = 5 provides the following list of labels:
/// \[10, 15, 20, 25, 30\]
/// To specify the labels can explicitly, the List dimension rule can be used. The list rule allows for a list of
/// numbers, strings, or ranges to be used as the dimension labels.
/// Dimension objects implement the Struct methods internally and are Core type `ctStruct`.
/// Wrapper over the openDAQ `daqDimension` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Dimension(pub(crate) BaseObject);

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

/// Configuration component of Dimension objects. Contains setter methods that allow for Dimension parameter configuration, and a `build` method that builds the Dimension.
/// Wrapper over the openDAQ `daqDimensionBuilder` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DimensionBuilder(pub(crate) BaseObject);

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

/// Rule that defines the labels (alternatively called bins, ticks) of a dimension.
/// Each dimension has a rule, which is queried and parsed by the dimension `getLabels` and `getSize` calls.
/// Three different rule types are supported by openDAQ, with all others having to be set to `custom` type, requiring
/// anyone using them to parse them manually.
/// Dimension rule objects implement the Struct methods internally and are Core type `ctStruct`.
/// @subsection dimension_rule_types Rule types
/// @subsubsection linear_dimension_rule Linear dimension rule
/// The parameters include a `delta`, `start`, and `size` number members. The list of labels of size `size` is generated by
/// the equation: \<em\>index * delta + start\</em\>, where the index starts with 0 and goes up to `size - 1`.
/// In example: `delta = 10, start = 5, size = 5` produces the following list of samples -\> \[5, 15, 25, 35, 45\]
/// @subsubsection logarithmic_dimension_rule Logarithmic dimension rule
/// The parameters include a `delta`, `start`, `base` and `size` number members. The list of labels of size `size` is generated by
/// the equation: \<em\>base ^ (index * delta + start)\</em\>, where the index starts with 0 and goes up to `size - 1`.
/// In example: `delta = 1, start = -2, base = 10 size = 5` produces the following list of samples -\> \[0.01, 0.1, 1, 10, 20\]
/// @subsubsection list_dimension_rule List dimension rule
/// The parameters include a `list` list-typed member. The `list` contains labels, implicitly also defining the dimension size.
/// The labels in the list can be either strings, numbers, or ranges.
/// String example list: `list` = \["banana", "apple", "coconut"\]
/// Number example list: = \[1.2, 10.5, 20.2, 50.7\]
/// Range example list: \[1-10, 10-20, 20-30, 30-40, 40-50\]
/// Wrapper over the openDAQ `daqDimensionRule` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DimensionRule(pub(crate) BaseObject);

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

/// Configuration component of Dimension rule objects. Contains setter methods that allow for Dimension rule parameter configuration, and a `build` method that builds the Dimension rule.
/// Wrapper over the openDAQ `daqDimensionRuleBuilder` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct DimensionRuleBuilder(pub(crate) BaseObject);

impl std::ops::Deref for DimensionRuleBuilder {
    type Target = BaseObject;
    fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for DimensionRuleBuilder {}
unsafe impl Interface for DimensionRuleBuilder {
    const NAME: &'static str = "daqDimensionRuleBuilder";
    fn interface_id() -> Option<crate::IntfID> {
        let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
        unsafe { (crate::sys::api().daqDimensionRuleBuilder_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 DimensionRuleBuilder {
    #[doc(hidden)]
    pub(crate) fn __from_ref(r: Ref) -> Self { DimensionRuleBuilder(BaseObject(r)) }
}
impl std::fmt::Display for DimensionRuleBuilder {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(self.as_base_object(), f)
    }
}
impl From<&DimensionRuleBuilder> for Value {
    fn from(value: &DimensionRuleBuilder) -> Value { Value::Object(value.to_base_object()) }
}
impl From<DimensionRuleBuilder> for Value {
    fn from(value: DimensionRuleBuilder) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for DimensionRuleBuilder {
    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 `daqInputPortPrivate` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct InputPortPrivate(pub(crate) BaseObject);

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

/// Used to subscribe to packet destruction
/// Wrapper over the openDAQ `daqPacketDestructCallback` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct PacketDestructCallback(pub(crate) BaseObject);

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

/// Describes a range of values between the `lowValue` and `highValue` boundaries.
/// Range objects implement the Struct methods internally and are Core type `ctStruct`.
/// Wrapper over the openDAQ `daqRange` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Range(pub(crate) BaseObject);

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

/// Builder component of Reference Domain Info objects. Contains setter methods that allow for Reference Domain Info parameter configuration, and a `build` method that builds the Reference Domain Info.
/// Wrapper over the openDAQ `daqReferenceDomainInfoBuilder` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ReferenceDomainInfoBuilder(pub(crate) BaseObject);

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

/// @ingroup opendaq_packets
/// @addtogroup opendaq_reusable_data_packet Reusable Data packet
/// Wrapper over the openDAQ `daqReusableDataPacket` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ReusableDataPacket(pub(crate) BaseObject);

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

/// Private rule interface implemented by Dimension rules, Data rules and Scaling. Allows for parameter verification.
/// Wrapper over the openDAQ `daqRulePrivate` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct RulePrivate(pub(crate) BaseObject);

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

/// Signal descriptor field that defines a scaling transformation, which should be applied to data carried by the signal's packets when read.
/// Each scaling specifies its `scalingType` and parses the parameters accordingly. The parameters
/// are to be interpreted and used as specified by each specific scaling type as detailed below.
/// Additionally, each Scaling object states is input and output data types. The inputDataType
/// describes the raw data type of the signal value (that data is input into the scaling scaling),
/// while the outputDataType should match the sample type of the signal's value descriptor.
/// Scaling objects implement the Struct methods internally and are Core type `ctStruct`.
/// @subsection scaling_types Scaling types
/// @subsubsection scaling_types_linear Linear scaling
/// Linear scaling parameters must have two entries:
/// - Scale: coefficient by which the input data is to be multiplied
/// - Offset: a constant that is added to the \<em\>scale * value\</em\> multiplication result
/// The linear scaling output is calculated as follows: \<em\>inputValue * scale + offset\</em\>
/// Wrapper over the openDAQ `daqScaling` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct Scaling(pub(crate) BaseObject);

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

/// Configuration component of Scaling objects. Contains setter methods that allow for Scaling parameter configuration, and a `build` method that builds the Scaling object.
/// Wrapper over the openDAQ `daqScalingBuilder` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ScalingBuilder(pub(crate) BaseObject);

impl std::ops::Deref for ScalingBuilder {
    type Target = BaseObject;
    fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for ScalingBuilder {}
unsafe impl Interface for ScalingBuilder {
    const NAME: &'static str = "daqScalingBuilder";
    fn interface_id() -> Option<crate::IntfID> {
        let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
        unsafe { (crate::sys::api().daqScalingBuilder_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 ScalingBuilder {
    #[doc(hidden)]
    pub(crate) fn __from_ref(r: Ref) -> Self { ScalingBuilder(BaseObject(r)) }
}
impl std::fmt::Display for ScalingBuilder {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(self.as_base_object(), f)
    }
}
impl From<&ScalingBuilder> for Value {
    fn from(value: &ScalingBuilder) -> Value { Value::Object(value.to_base_object()) }
}
impl From<ScalingBuilder> for Value {
    fn from(value: ScalingBuilder) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for ScalingBuilder {
    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 `daqScalingCalcPrivate` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct ScalingCalcPrivate(pub(crate) BaseObject);

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

/// The configuration component of a Signal. Allows for configuration of its properties, managing its streaming sources, and sending packets through its connections.
/// The Signal config is most often accessible only to the devices or function blocks that own
/// the signal. They react on property, or input signal changes to modify a signal's data descriptor,
/// and send processed/acquired data down its signal path.
/// Wrapper over the openDAQ `daqSignalConfig` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct SignalConfig(pub(crate) Signal);

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

/// Internal functions of a signal containing event methods that are called on certain events. Eg. when a signal is connected to an input port, or when a signal is used as a domain signal of another.
/// Wrapper over the openDAQ `daqSignalEvents` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct SignalEvents(pub(crate) BaseObject);

impl std::ops::Deref for SignalEvents {
    type Target = BaseObject;
    fn deref(&self) -> &BaseObject { &self.0 }
}
impl crate::sealed::Sealed for SignalEvents {}
unsafe impl Interface for SignalEvents {
    const NAME: &'static str = "daqSignalEvents";
    fn interface_id() -> Option<crate::IntfID> {
        let mut id = crate::IntfID { Data1: 0, Data2: 0, Data3: 0, Data4: 0 };
        unsafe { (crate::sys::api().daqSignalEvents_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 SignalEvents {
    #[doc(hidden)]
    pub(crate) fn __from_ref(r: Ref) -> Self { SignalEvents(BaseObject(r)) }
}
impl std::fmt::Display for SignalEvents {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(self.as_base_object(), f)
    }
}
impl From<&SignalEvents> for Value {
    fn from(value: &SignalEvents) -> Value { Value::Object(value.to_base_object()) }
}
impl From<SignalEvents> for Value {
    fn from(value: SignalEvents) -> Value { Value::Object(value.to_base_object()) }
}
impl crate::value::FromDaqOwned for SignalEvents {
    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 `daqSignalPrivate` interface.
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct SignalPrivate(pub(crate) BaseObject);

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

impl Allocator {
    /// Calls the openDAQ C function `daqAllocator_createMallocAllocator()`.
    pub fn malloc() -> Result<Allocator> {
        let mut __obj: *mut sys::daqAllocator = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqAllocator_createMallocAllocator)(&mut __obj) };
        check(__code, "daqAllocator_createMallocAllocator")?;
        Ok(unsafe { crate::marshal::require_object::<Allocator>(__obj as *mut _, "daqAllocator_createMallocAllocator") }?)
    }

}

impl ConnectionInternal {
    /// Enqueues an event packet with the last descriptor at the front of the queue.
    ///
    /// Calls the openDAQ C function `daqConnectionInternal_enqueueLastDescriptor()`.
    pub fn enqueue_last_descriptor(&self) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqConnectionInternal_enqueueLastDescriptor)(self.as_raw() as *mut _) };
        check(__code, "daqConnectionInternal_enqueueLastDescriptor")?;
        Ok(())
    }

}

impl Connection {
    /// Calls the openDAQ C function `daqConnection_createConnection()`.
    pub fn new(input_port: &InputPort, signal: &Signal, context: &Context) -> Result<Connection> {
        let mut __obj: *mut sys::daqConnection = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqConnection_createConnection)(&mut __obj, input_port.as_raw() as *mut _, signal.as_raw() as *mut _, context.as_raw() as *mut _) };
        check(__code, "daqConnection_createConnection")?;
        Ok(unsafe { crate::marshal::require_object::<Connection>(__obj as *mut _, "daqConnection_createConnection") }?)
    }

    /// Removes the packet at the front of the queue and returns it.
    ///
    /// # Returns
    /// - `packet`: The removed packet or `nullptr` if the connection has no packets.
    ///
    /// # Errors
    /// - `OPENDAQ_NO_MORE_ITEMS`: When the connection does not hold any packets.
    ///
    /// Calls the openDAQ C function `daqConnection_dequeue()`.
    pub fn dequeue(&self) -> Result<Option<Packet>> {
        let mut __packet: *mut sys::daqPacket = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqConnection_dequeue)(self.as_raw() as *mut _, &mut __packet) };
        check(__code, "daqConnection_dequeue")?;
        Ok(unsafe { crate::marshal::take_object::<Packet>(__packet as *mut _) })
    }

    /// Removes all packets from the queue.
    ///
    /// # Returns
    /// - `packets`: The removed packets. Removing all packets can be more efficient than dequeuing packet by packet in heavily loaded systems.
    ///
    /// Calls the openDAQ C function `daqConnection_dequeueAll()`.
    pub fn dequeue_all(&self) -> Result<Vec<Packet>> {
        let mut __packets: *mut sys::daqList = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqConnection_dequeueAll)(self.as_raw() as *mut _, &mut __packets) };
        check(__code, "daqConnection_dequeueAll")?;
        Ok(unsafe { crate::marshal::take_list::<Packet>(__packets as *mut _, "daqConnection_dequeueAll") }?)
    }

    /// Places a packet at the back of the queue.
    ///
    /// # Parameters
    /// - `packet`: The packet to be enqueued.
    ///
    /// Calls the openDAQ C function `daqConnection_enqueue()`.
    pub fn enqueue(&self, packet: &Packet) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqConnection_enqueue)(self.as_raw() as *mut _, packet.as_raw() as *mut _) };
        check(__code, "daqConnection_enqueue")?;
        Ok(())
    }

    /// Places a packet at the back of the queue. The reference of the packet is stolen.
    ///
    /// # Parameters
    /// - `packet`: The packet to be enqueued. After calling the method, the packet should not be touched again. The ownership of the packet is taken by underlying connections and it could be destroyed before the function returns.
    ///
    /// Calls the openDAQ C function `daqConnection_enqueueAndStealRef()`.
    pub fn enqueue_and_steal_ref(&self, packet: &Packet) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqConnection_enqueueAndStealRef)(self.as_raw() as *mut _, packet.as_raw() as *mut _) };
        check(__code, "daqConnection_enqueueAndStealRef")?;
        Ok(())
    }

    /// Places multiple packets at the back of the queue.
    ///
    /// # Parameters
    /// - `packets`: The packets to be enqueued.
    ///
    /// Calls the openDAQ C function `daqConnection_enqueueMultiple()`.
    pub fn enqueue_multiple(&self, packets: &[Packet]) -> Result<()> {
        let __packets = crate::marshal::list_from_interfaces(packets)?;
        let __code = unsafe { (crate::sys::api().daqConnection_enqueueMultiple)(self.as_raw() as *mut _, __packets.as_ptr() as *mut _) };
        check(__code, "daqConnection_enqueueMultiple")?;
        Ok(())
    }

    /// Places multiple packets at the back of the queue. The references of the packets are stolen.
    ///
    /// # Parameters
    /// - `packets`: The packets to be enqueued. After calling the method, the packets should not be touched again. The ownership of the packets is taken by underlying connections and it could be destroyed before the function returns.
    ///
    /// Calls the openDAQ C function `daqConnection_enqueueMultipleAndStealRef()`.
    pub fn enqueue_multiple_and_steal_ref(&self, packets: &[Packet]) -> Result<()> {
        let __packets = crate::marshal::list_from_interfaces(packets)?;
        let __code = unsafe { (crate::sys::api().daqConnection_enqueueMultipleAndStealRef)(self.as_raw() as *mut _, __packets.as_ptr() as *mut _) };
        check(__code, "daqConnection_enqueueMultipleAndStealRef")?;
        Ok(())
    }

    /// Places a packet at the back of the queue.
    ///
    /// # Parameters
    /// - `packet`: The packet to be enqueued. The connection notifies the listener on the same thread that this method was called.
    ///
    /// Calls the openDAQ C function `daqConnection_enqueueOnThisThread()`.
    pub fn enqueue_on_this_thread(&self, packet: &Packet) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqConnection_enqueueOnThisThread)(self.as_raw() as *mut _, packet.as_raw() as *mut _) };
        check(__code, "daqConnection_enqueueOnThisThread")?;
        Ok(())
    }

    /// Places a packet at the back of the queue.
    ///
    /// # Parameters
    /// - `packet`: The packet to be enqueued. The connection schedules the `onPacketReceived` notification.
    ///
    /// Calls the openDAQ C function `daqConnection_enqueueWithScheduler()`.
    pub fn enqueue_with_scheduler(&self, packet: &Packet) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqConnection_enqueueWithScheduler)(self.as_raw() as *mut _, packet.as_raw() as *mut _) };
        check(__code, "daqConnection_enqueueWithScheduler")?;
        Ok(())
    }

    /// Gets the number of samples available in the queued packets. The returned value ignores any Sample-Descriptor changes.
    ///
    /// # Returns
    /// - `samples`: The total amount of samples currently available in the stored packets.
    ///
    /// Calls the openDAQ C function `daqConnection_getAvailableSamples()`.
    pub fn available_samples(&self) -> Result<usize> {
        let mut __samples: usize = Default::default();
        let __code = unsafe { (crate::sys::api().daqConnection_getAvailableSamples)(self.as_raw() as *mut _, &mut __samples) };
        check(__code, "daqConnection_getAvailableSamples")?;
        Ok(__samples)
    }

    /// Gets the Input port to which packets are being sent.
    ///
    /// # Returns
    /// - `input_port`: The input port.
    ///
    /// Calls the openDAQ C function `daqConnection_getInputPort()`.
    pub fn input_port(&self) -> Result<Option<InputPort>> {
        let mut __input_port: *mut sys::daqInputPort = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqConnection_getInputPort)(self.as_raw() as *mut _, &mut __input_port) };
        check(__code, "daqConnection_getInputPort")?;
        Ok(unsafe { crate::marshal::take_object::<InputPort>(__input_port as *mut _) })
    }

    /// Gets the number of queued packets.
    ///
    /// # Returns
    /// - `packet_count`: The number of queued packets.
    ///
    /// Calls the openDAQ C function `daqConnection_getPacketCount()`.
    pub fn packet_count(&self) -> Result<usize> {
        let mut __packet_count: usize = Default::default();
        let __code = unsafe { (crate::sys::api().daqConnection_getPacketCount)(self.as_raw() as *mut _, &mut __packet_count) };
        check(__code, "daqConnection_getPacketCount")?;
        Ok(__packet_count)
    }

    /// Gets the number of same-type samples available in the queued packets. The returned value is up-to the next Sample-Descriptor-Changed packet if any.
    ///
    /// # Returns
    /// - `samples`: The total amount of same-type samples currently available in the stored packets.
    ///
    /// Calls the openDAQ C function `daqConnection_getSamplesUntilNextDescriptor()`.
    pub fn samples_until_next_descriptor(&self) -> Result<usize> {
        let mut __samples: usize = Default::default();
        let __code = unsafe { (crate::sys::api().daqConnection_getSamplesUntilNextDescriptor)(self.as_raw() as *mut _, &mut __samples) };
        check(__code, "daqConnection_getSamplesUntilNextDescriptor")?;
        Ok(__samples)
    }

    /// Gets the number of samples available in the queued packets until the next event packet. The returned value is up-to the next Event packet if any.
    ///
    /// # Returns
    /// - `samples`: The total amount of samples currently available in the stored packets until the next event packet.
    ///
    /// Calls the openDAQ C function `daqConnection_getSamplesUntilNextEventPacket()`.
    pub fn samples_until_next_event_packet(&self) -> Result<usize> {
        let mut __samples: usize = Default::default();
        let __code = unsafe { (crate::sys::api().daqConnection_getSamplesUntilNextEventPacket)(self.as_raw() as *mut _, &mut __samples) };
        check(__code, "daqConnection_getSamplesUntilNextEventPacket")?;
        Ok(__samples)
    }

    /// Gets the number of samples available in the queued packets until the next gap packet. The returned value is up-to the next Gap packet if any.
    ///
    /// # Returns
    /// - `samples`: The total amount of samples currently available in the stored packets until the next gap packet.
    ///
    /// Calls the openDAQ C function `daqConnection_getSamplesUntilNextGapPacket()`.
    pub fn samples_until_next_gap_packet(&self) -> Result<usize> {
        let mut __samples: usize = Default::default();
        let __code = unsafe { (crate::sys::api().daqConnection_getSamplesUntilNextGapPacket)(self.as_raw() as *mut _, &mut __samples) };
        check(__code, "daqConnection_getSamplesUntilNextGapPacket")?;
        Ok(__samples)
    }

    /// Gets the Signal that is sending packets through the Connection.
    ///
    /// # Returns
    /// - `signal`: The Signal.
    ///
    /// Calls the openDAQ C function `daqConnection_getSignal()`.
    pub fn signal(&self) -> Result<Option<Signal>> {
        let mut __signal: *mut sys::daqSignal = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqConnection_getSignal)(self.as_raw() as *mut _, &mut __signal) };
        check(__code, "daqConnection_getSignal")?;
        Ok(unsafe { crate::marshal::take_object::<Signal>(__signal as *mut _) })
    }

    /// Queries if the connection has an event packet.
    ///
    /// # Returns
    /// - `has_event_packet`: True if the connection has an event packet.
    ///
    /// Calls the openDAQ C function `daqConnection_hasEventPacket()`.
    pub fn has_event_packet(&self) -> Result<bool> {
        let mut __has_event_packet: u8 = 0;
        let __code = unsafe { (crate::sys::api().daqConnection_hasEventPacket)(self.as_raw() as *mut _, &mut __has_event_packet) };
        check(__code, "daqConnection_hasEventPacket")?;
        Ok(__has_event_packet != 0)
    }

    /// Queries if the connection has a gap packet.
    ///
    /// # Returns
    /// - `has_gap_packet`: True if the connection has a gap packet.
    ///
    /// Calls the openDAQ C function `daqConnection_hasGapPacket()`.
    pub fn has_gap_packet(&self) -> Result<bool> {
        let mut __has_gap_packet: u8 = 0;
        let __code = unsafe { (crate::sys::api().daqConnection_hasGapPacket)(self.as_raw() as *mut _, &mut __has_gap_packet) };
        check(__code, "daqConnection_hasGapPacket")?;
        Ok(__has_gap_packet != 0)
    }

    /// Returns true if the type of connection is remote.
    ///
    /// # Returns
    /// - `remote`: True if connection is remote. Remote connections do not pass any packets. They represent the connection between input ports and signals on remote devices.
    ///
    /// Calls the openDAQ C function `daqConnection_isRemote()`.
    pub fn is_remote(&self) -> Result<bool> {
        let mut __remote: u8 = 0;
        let __code = unsafe { (crate::sys::api().daqConnection_isRemote)(self.as_raw() as *mut _, &mut __remote) };
        check(__code, "daqConnection_isRemote")?;
        Ok(__remote != 0)
    }

    /// Returns the packet at the front of the queue without removing it.
    ///
    /// # Returns
    /// - `packet`: The packet at the front of the queue or `nullptr` if the connection has no packets.
    ///
    /// # Errors
    /// - `OPENDAQ_NO_MORE_ITEMS`: When the connection does not hold any packets.
    ///
    /// Calls the openDAQ C function `daqConnection_peek()`.
    pub fn peek(&self) -> Result<Option<Packet>> {
        let mut __packet: *mut sys::daqPacket = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqConnection_peek)(self.as_raw() as *mut _, &mut __packet) };
        check(__code, "daqConnection_peek")?;
        Ok(unsafe { crate::marshal::take_object::<Packet>(__packet as *mut _) })
    }

}

impl DataDescriptorBuilder {
    /// Builds and returns a Data descriptor object using the currently set values of the Builder.
    ///
    /// # Returns
    /// - `data_descriptor`: The built Data descriptor.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_build()`.
    pub fn build(&self) -> Result<Option<DataDescriptor>> {
        let mut __data_descriptor: *mut sys::daqDataDescriptor = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_build)(self.as_raw() as *mut _, &mut __data_descriptor) };
        check(__code, "daqDataDescriptorBuilder_build")?;
        Ok(unsafe { crate::marshal::take_object::<DataDescriptor>(__data_descriptor as *mut _) })
    }

    /// Data descriptor builder factory that creates a builder object with no parameters configured.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_createDataDescriptorBuilder()`.
    pub fn new() -> Result<DataDescriptorBuilder> {
        let mut __obj: *mut sys::daqDataDescriptorBuilder = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_createDataDescriptorBuilder)(&mut __obj) };
        check(__code, "daqDataDescriptorBuilder_createDataDescriptorBuilder")?;
        Ok(unsafe { crate::marshal::require_object::<DataDescriptorBuilder>(__obj as *mut _, "daqDataDescriptorBuilder_createDataDescriptorBuilder") }?)
    }

    /// Data descriptor copy factory that creates a Data descriptor builder object from a different Data descriptor, copying its parameters.
    ///
    /// # Parameters
    /// - `descriptor_to_copy`: The Data descriptor of which configuration should be copied.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_createDataDescriptorBuilderFromExisting()`.
    pub fn from_existing(descriptor_to_copy: &DataDescriptor) -> Result<DataDescriptorBuilder> {
        let mut __obj: *mut sys::daqDataDescriptorBuilder = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_createDataDescriptorBuilderFromExisting)(&mut __obj, descriptor_to_copy.as_raw() as *mut _) };
        check(__code, "daqDataDescriptorBuilder_createDataDescriptorBuilderFromExisting")?;
        Ok(unsafe { crate::marshal::require_object::<DataDescriptorBuilder>(__obj as *mut _, "daqDataDescriptorBuilder_createDataDescriptorBuilderFromExisting") }?)
    }

    /// Gets the list of the descriptor's dimension's.
    ///
    /// # Returns
    /// - `dimensions`: The list of dimensions.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_getDimensions()`.
    pub fn dimensions(&self) -> Result<Vec<Dimension>> {
        let mut __dimensions: *mut sys::daqList = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_getDimensions)(self.as_raw() as *mut _, &mut __dimensions) };
        check(__code, "daqDataDescriptorBuilder_getDimensions")?;
        Ok(unsafe { crate::marshal::take_list::<Dimension>(__dimensions as *mut _, "daqDataDescriptorBuilder_getDimensions") }?)
    }

    /// Gets any extra metadata defined by the data descriptor.
    ///
    /// # Returns
    /// - `metadata`: Additional metadata of the descriptor as a dictionary.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_getMetadata()`.
    pub fn metadata(&self) -> Result<std::collections::HashMap<String, String>> {
        let mut __metadata: *mut sys::daqDict = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_getMetadata)(self.as_raw() as *mut _, &mut __metadata) };
        check(__code, "daqDataDescriptorBuilder_getMetadata")?;
        Ok(unsafe { crate::marshal::take_dict::<String, String>(__metadata as *mut _, "daqDataDescriptorBuilder_getMetadata") }?)
    }

    /// Gets a descriptive name for the signal's value.
    ///
    /// # Returns
    /// - `name`: The name of the signal value.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_getName()`.
    pub fn name(&self) -> Result<String> {
        let mut __name: *mut sys::daqString = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_getName)(self.as_raw() as *mut _, &mut __name) };
        check(__code, "daqDataDescriptorBuilder_getName")?;
        Ok(unsafe { crate::marshal::take_string(__name) })
    }

    /// Gets the absolute origin of a signal value component.
    ///
    /// # Returns
    /// - `origin`: The absolute origin.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_getOrigin()`.
    pub fn origin(&self) -> Result<String> {
        let mut __origin: *mut sys::daqString = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_getOrigin)(self.as_raw() as *mut _, &mut __origin) };
        check(__code, "daqDataDescriptorBuilder_getOrigin")?;
        Ok(unsafe { crate::marshal::take_string(__origin) })
    }

    /// Gets the scaling rule that needs to be applied to explicit/implicit data by readers.
    ///
    /// # Returns
    /// - `scaling`: The scaling rule.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_getPostScaling()`.
    pub fn post_scaling(&self) -> Result<Option<Scaling>> {
        let mut __scaling: *mut sys::daqScaling = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_getPostScaling)(self.as_raw() as *mut _, &mut __scaling) };
        check(__code, "daqDataDescriptorBuilder_getPostScaling")?;
        Ok(unsafe { crate::marshal::take_object::<Scaling>(__scaling as *mut _) })
    }

    /// Gets the Reference Domain Info.
    ///
    /// # Returns
    /// - `reference_domain_info`: The Reference Domain Info. If set, gives additional information about the reference domain.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_getReferenceDomainInfo()`.
    pub fn reference_domain_info(&self) -> Result<Option<ReferenceDomainInfo>> {
        let mut __reference_domain_info: *mut sys::daqReferenceDomainInfo = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_getReferenceDomainInfo)(self.as_raw() as *mut _, &mut __reference_domain_info) };
        check(__code, "daqDataDescriptorBuilder_getReferenceDomainInfo")?;
        Ok(unsafe { crate::marshal::take_object::<ReferenceDomainInfo>(__reference_domain_info as *mut _) })
    }

    /// Gets the value Data rule.
    ///
    /// # Returns
    /// - `rule`: The value Data rule.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_getRule()`.
    pub fn rule(&self) -> Result<Option<DataRule>> {
        let mut __rule: *mut sys::daqDataRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_getRule)(self.as_raw() as *mut _, &mut __rule) };
        check(__code, "daqDataDescriptorBuilder_getRule")?;
        Ok(unsafe { crate::marshal::take_object::<DataRule>(__rule as *mut _) })
    }

    /// Gets the descriptor's sample type.
    ///
    /// # Returns
    /// - `sample_type`: The descriptor's sample type.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_getSampleType()`.
    pub fn sample_type(&self) -> Result<SampleType> {
        let mut __sample_type: u32 = 0;
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_getSampleType)(self.as_raw() as *mut _, &mut __sample_type) };
        check(__code, "daqDataDescriptorBuilder_getSampleType")?;
        Ok(crate::marshal::enum_out(SampleType::from_raw(__sample_type), "daqDataDescriptorBuilder_getSampleType")?)
    }

    /// Gets the fields of the struct, forming a recursive value descriptor definition.
    ///
    /// # Returns
    /// - `struct_fields`: The list of data descriptors forming the struct fields.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_getStructFields()`.
    pub fn struct_fields(&self) -> Result<Vec<DataDescriptor>> {
        let mut __struct_fields: *mut sys::daqList = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_getStructFields)(self.as_raw() as *mut _, &mut __struct_fields) };
        check(__code, "daqDataDescriptorBuilder_getStructFields")?;
        Ok(unsafe { crate::marshal::take_list::<DataDescriptor>(__struct_fields as *mut _, "daqDataDescriptorBuilder_getStructFields") }?)
    }

    /// Gets the Resolution which scales the an explicit or implicit value to the physical unit defined in `unit`.
    ///
    /// # Returns
    /// - `tick_resolution`: The Resolution.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_getTickResolution()`.
    pub fn tick_resolution(&self) -> Result<Option<Ratio>> {
        let mut __tick_resolution: *mut sys::daqRatio = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_getTickResolution)(self.as_raw() as *mut _, &mut __tick_resolution) };
        check(__code, "daqDataDescriptorBuilder_getTickResolution")?;
        Ok(unsafe { crate::value::take_ratio(__tick_resolution, "daqDataDescriptorBuilder_getTickResolution") }?)
    }

    /// Gets the unit of the data in a signal's packets.
    ///
    /// # Returns
    /// - `unit`: The unit specified by the descriptor.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_getUnit()`.
    pub fn unit(&self) -> Result<Option<Unit>> {
        let mut __unit: *mut sys::daqUnit = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_getUnit)(self.as_raw() as *mut _, &mut __unit) };
        check(__code, "daqDataDescriptorBuilder_getUnit")?;
        Ok(unsafe { crate::marshal::take_object::<Unit>(__unit as *mut _) })
    }

    /// Gets the value range of the data in a signal's packets defining the lowest and highest expected values.
    ///
    /// # Returns
    /// - `range`: The value range the signal's data.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_getValueRange()`.
    pub fn value_range(&self) -> Result<Option<Range>> {
        let mut __range: *mut sys::daqRange = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_getValueRange)(self.as_raw() as *mut _, &mut __range) };
        check(__code, "daqDataDescriptorBuilder_getValueRange")?;
        Ok(unsafe { crate::marshal::take_object::<Range>(__range as *mut _) })
    }

    /// Sets the list of the descriptor's dimension's.
    ///
    /// # Parameters
    /// - `dimensions`: The list of dimensions. The number of dimensions defines the rank of the signal's data (eg. Vector, Matrix).
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_setDimensions()`.
    pub fn set_dimensions(&self, dimensions: &[Dimension]) -> Result<()> {
        let __dimensions = crate::marshal::list_from_interfaces(dimensions)?;
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_setDimensions)(self.as_raw() as *mut _, __dimensions.as_ptr() as *mut _) };
        check(__code, "daqDataDescriptorBuilder_setDimensions")?;
        Ok(())
    }

    /// Sets any extra metadata defined by the data descriptor.
    ///
    /// # Parameters
    /// - `metadata`: Additional metadata of the descriptor as a dictionary. All objects in the metadata dictionary must be serializable.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_setMetadata()`.
    pub fn set_metadata(&self, metadata: impl Into<Value>) -> Result<()> {
        let __metadata = crate::value::to_daq(&metadata.into())?;
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_setMetadata)(self.as_raw() as *mut _, crate::value::opt_ref_ptr(&__metadata) as *mut _) };
        check(__code, "daqDataDescriptorBuilder_setMetadata")?;
        Ok(())
    }

    /// Sets a descriptive name for the signal's value.
    ///
    /// # Parameters
    /// - `name`: The name of the signal value. When, for example, describing the amplitude values of spectrum data, the name would be `Amplitude`.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_setName()`.
    pub fn set_name(&self, name: &str) -> Result<()> {
        let __name = crate::marshal::make_string(name)?;
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_setName)(self.as_raw() as *mut _, __name.as_ptr() as *mut _) };
        check(__code, "daqDataDescriptorBuilder_setName")?;
        Ok(())
    }

    /// Sets the absolute origin of a signal value component.
    ///
    /// # Parameters
    /// - `origin`: The absolute origin. An origin can be an arbitrary string that determines the starting point of the signal data. All explicit or implicit values are multiplied by the resolution and added to the origin to obtain absolute data instead of relative. Most commonly a time epoch is used, in which case it should be formatted according to the ISO 8601 standard.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_setOrigin()`.
    pub fn set_origin(&self, origin: &str) -> Result<()> {
        let __origin = crate::marshal::make_string(origin)?;
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_setOrigin)(self.as_raw() as *mut _, __origin.as_ptr() as *mut _) };
        check(__code, "daqDataDescriptorBuilder_setOrigin")?;
        Ok(())
    }

    /// Sets the scaling rule that needs to be applied to explicit/implicit data by readers.
    ///
    /// # Parameters
    /// - `scaling`: The scaling rule. The OutputDataType of the rule matches the value descriptor's sample type. The InputDataType defines the sample type of either the explicit data in packet buffers, or the packet's implicit value's sample type.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_setPostScaling()`.
    pub fn set_post_scaling(&self, scaling: &Scaling) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_setPostScaling)(self.as_raw() as *mut _, scaling.as_raw() as *mut _) };
        check(__code, "daqDataDescriptorBuilder_setPostScaling")?;
        Ok(())
    }

    /// Sets the Reference Domain Info.
    ///
    /// # Parameters
    /// - `reference_domain_info`: The Reference Domain Info. If set, gives additional information about the reference domain.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_setReferenceDomainInfo()`.
    pub fn set_reference_domain_info(&self, reference_domain_info: &ReferenceDomainInfo) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_setReferenceDomainInfo)(self.as_raw() as *mut _, reference_domain_info.as_raw() as *mut _) };
        check(__code, "daqDataDescriptorBuilder_setReferenceDomainInfo")?;
        Ok(())
    }

    /// Sets the value Data rule.
    ///
    /// # Parameters
    /// - `rule`: The value Data rule. If explicit, the values will be contained in the packet buffer. Otherwise they are calculated using the packet parameter as the input into the rule.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_setRule()`.
    pub fn set_rule(&self, rule: &DataRule) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_setRule)(self.as_raw() as *mut _, rule.as_raw() as *mut _) };
        check(__code, "daqDataDescriptorBuilder_setRule")?;
        Ok(())
    }

    /// Sets the descriptor's sample type.
    ///
    /// # Parameters
    /// - `sample_type`: The descriptor's sample type.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_setSampleType()`.
    pub fn set_sample_type(&self, sample_type: SampleType) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_setSampleType)(self.as_raw() as *mut _, sample_type as u32) };
        check(__code, "daqDataDescriptorBuilder_setSampleType")?;
        Ok(())
    }

    /// Sets the fields of the struct, forming a recursive value descriptor definition.
    ///
    /// # Parameters
    /// - `struct_fields`: The list of data descriptors forming the struct fields. Contains a list of value descriptors, defining the data layout: the data described by the first DataDescriptor of the list is at the start, followed by the data described by the second and so on.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_setStructFields()`.
    pub fn set_struct_fields(&self, struct_fields: &[DataDescriptor]) -> Result<()> {
        let __struct_fields = crate::marshal::list_from_interfaces(struct_fields)?;
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_setStructFields)(self.as_raw() as *mut _, __struct_fields.as_ptr() as *mut _) };
        check(__code, "daqDataDescriptorBuilder_setStructFields")?;
        Ok(())
    }

    /// Sets the Resolution which scales the an explicit or implicit value to the physical unit defined in `unit`.
    ///
    /// # Parameters
    /// - `tick_resolution`: The Resolution.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_setTickResolution()`.
    pub fn set_tick_resolution(&self, tick_resolution: Ratio) -> Result<()> {
        let __tick_resolution = crate::value::ratio_to_ref(tick_resolution)?;
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_setTickResolution)(self.as_raw() as *mut _, __tick_resolution.as_ptr() as *mut _) };
        check(__code, "daqDataDescriptorBuilder_setTickResolution")?;
        Ok(())
    }

    /// Sets the unit of the data in a signal's packets.
    ///
    /// # Parameters
    /// - `unit`: The unit specified by the descriptor.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_setUnit()`.
    pub fn set_unit(&self, unit: &Unit) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_setUnit)(self.as_raw() as *mut _, unit.as_raw() as *mut _) };
        check(__code, "daqDataDescriptorBuilder_setUnit")?;
        Ok(())
    }

    /// Sets the value range of the data in a signal's packets defining the lowest and highest expected values.
    ///
    /// # Parameters
    /// - `range`: The value range the signal's data. The range is not enforced by openDAQ.
    ///
    /// Calls the openDAQ C function `daqDataDescriptorBuilder_setValueRange()`.
    pub fn set_value_range(&self, range: &Range) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqDataDescriptorBuilder_setValueRange)(self.as_raw() as *mut _, range.as_raw() as *mut _) };
        check(__code, "daqDataDescriptorBuilder_setValueRange")?;
        Ok(())
    }

}

impl DataDescriptor {
    /// Creates a Data Descriptor using Builder
    ///
    /// # Parameters
    /// - `builder`: Data Descriptor Builder
    ///
    /// Calls the openDAQ C function `daqDataDescriptor_createDataDescriptorFromBuilder()`.
    pub fn from_builder(builder: &DataDescriptorBuilder) -> Result<DataDescriptor> {
        let mut __obj: *mut sys::daqDataDescriptor = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptor_createDataDescriptorFromBuilder)(&mut __obj, builder.as_raw() as *mut _) };
        check(__code, "daqDataDescriptor_createDataDescriptorFromBuilder")?;
        Ok(unsafe { crate::marshal::require_object::<DataDescriptor>(__obj as *mut _, "daqDataDescriptor_createDataDescriptorFromBuilder") }?)
    }

    /// Gets the list of the descriptor's dimension's.
    ///
    /// # Returns
    /// - `dimensions`: The list of dimensions. The number of dimensions defines the rank of the signal's data (eg. Vector, Matrix).
    ///
    /// Calls the openDAQ C function `daqDataDescriptor_getDimensions()`.
    pub fn dimensions(&self) -> Result<Vec<Dimension>> {
        let mut __dimensions: *mut sys::daqList = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptor_getDimensions)(self.as_raw() as *mut _, &mut __dimensions) };
        check(__code, "daqDataDescriptor_getDimensions")?;
        Ok(unsafe { crate::marshal::take_list::<Dimension>(__dimensions as *mut _, "daqDataDescriptor_getDimensions") }?)
    }

    /// Gets any extra metadata defined by the data descriptor.
    ///
    /// # Returns
    /// - `metadata`: Additional metadata of the descriptor as a dictionary. All objects in the metadata dictionary must be key value pairs of \<String, String\>.
    ///
    /// Calls the openDAQ C function `daqDataDescriptor_getMetadata()`.
    pub fn metadata(&self) -> Result<std::collections::HashMap<String, String>> {
        let mut __metadata: *mut sys::daqDict = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptor_getMetadata)(self.as_raw() as *mut _, &mut __metadata) };
        check(__code, "daqDataDescriptor_getMetadata")?;
        Ok(unsafe { crate::marshal::take_dict::<String, String>(__metadata as *mut _, "daqDataDescriptor_getMetadata") }?)
    }

    /// Gets a descriptive name of the signal value.
    ///
    /// # Returns
    /// - `name`: The name of the signal value. When, for example, describing the amplitude values of spectrum data, the name would be `Amplitude`.
    ///
    /// Calls the openDAQ C function `daqDataDescriptor_getName()`.
    pub fn name(&self) -> Result<String> {
        let mut __name: *mut sys::daqString = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptor_getName)(self.as_raw() as *mut _, &mut __name) };
        check(__code, "daqDataDescriptor_getName")?;
        Ok(unsafe { crate::marshal::take_string(__name) })
    }

    /// Gets the absolute origin of a signal value component.
    ///
    /// # Returns
    /// - `origin`: The absolute origin. An origin can be an arbitrary string that determines the starting point of the signal data. All explicit or implicit values are multiplied by the resolution and added to the origin to obtain absolute data instead of relative. Most commonly a time reference is used, in which case it should be formatted according to the ISO 8601 standard.
    ///
    /// Calls the openDAQ C function `daqDataDescriptor_getOrigin()`.
    pub fn origin(&self) -> Result<String> {
        let mut __origin: *mut sys::daqString = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptor_getOrigin)(self.as_raw() as *mut _, &mut __origin) };
        check(__code, "daqDataDescriptor_getOrigin")?;
        Ok(unsafe { crate::marshal::take_string(__origin) })
    }

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

    /// Gets the actual sample size in buffer of one sample in bytes.
    ///
    /// # Returns
    /// - `sample_size`: The actual size of one sample in buffer in bytes. The actual size of one sample is calculated on constructor of the data descriptor object. Actual sample size is the sample size that is used in buffer. If the data descriptor includes implicitly generated samples, the actual sample size is less than sample size.
    ///
    /// Calls the openDAQ C function `daqDataDescriptor_getRawSampleSize()`.
    pub fn raw_sample_size(&self) -> Result<usize> {
        let mut __raw_sample_size: usize = Default::default();
        let __code = unsafe { (crate::sys::api().daqDataDescriptor_getRawSampleSize)(self.as_raw() as *mut _, &mut __raw_sample_size) };
        check(__code, "daqDataDescriptor_getRawSampleSize")?;
        Ok(__raw_sample_size)
    }

    /// Gets the Reference Domain Info.
    ///
    /// # Returns
    /// - `reference_domain_info`: The Reference Domain Info. If set, gives additional information about the reference domain.
    ///
    /// Calls the openDAQ C function `daqDataDescriptor_getReferenceDomainInfo()`.
    pub fn reference_domain_info(&self) -> Result<Option<ReferenceDomainInfo>> {
        let mut __reference_domain_info: *mut sys::daqReferenceDomainInfo = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptor_getReferenceDomainInfo)(self.as_raw() as *mut _, &mut __reference_domain_info) };
        check(__code, "daqDataDescriptor_getReferenceDomainInfo")?;
        Ok(unsafe { crate::marshal::take_object::<ReferenceDomainInfo>(__reference_domain_info as *mut _) })
    }

    /// Gets the value Data rule.
    ///
    /// # Returns
    /// - `rule`: The value Data rule. If explicit, the values will be contained in the packet buffer. Otherwise they are calculated using the offset packet parameter as the input into the rule.
    ///
    /// Calls the openDAQ C function `daqDataDescriptor_getRule()`.
    pub fn rule(&self) -> Result<Option<DataRule>> {
        let mut __rule: *mut sys::daqDataRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptor_getRule)(self.as_raw() as *mut _, &mut __rule) };
        check(__code, "daqDataDescriptor_getRule")?;
        Ok(unsafe { crate::marshal::take_object::<DataRule>(__rule as *mut _) })
    }

    /// Gets the size of one sample in bytes.
    ///
    /// # Returns
    /// - `sample_size`: The size of one sample in bytes. The size of one sample is calculated on constructor of the data descriptor object.
    ///
    /// Calls the openDAQ C function `daqDataDescriptor_getSampleSize()`.
    pub fn sample_size(&self) -> Result<usize> {
        let mut __sample_size: usize = Default::default();
        let __code = unsafe { (crate::sys::api().daqDataDescriptor_getSampleSize)(self.as_raw() as *mut _, &mut __sample_size) };
        check(__code, "daqDataDescriptor_getSampleSize")?;
        Ok(__sample_size)
    }

    /// Gets the descriptor's sample type.
    ///
    /// # Returns
    /// - `sample_type`: The descriptor's sample type.
    ///
    /// Calls the openDAQ C function `daqDataDescriptor_getSampleType()`.
    pub fn sample_type(&self) -> Result<SampleType> {
        let mut __sample_type: u32 = 0;
        let __code = unsafe { (crate::sys::api().daqDataDescriptor_getSampleType)(self.as_raw() as *mut _, &mut __sample_type) };
        check(__code, "daqDataDescriptor_getSampleType")?;
        Ok(crate::marshal::enum_out(SampleType::from_raw(__sample_type), "daqDataDescriptor_getSampleType")?)
    }

    /// Gets the fields of the struct, forming a recursive value descriptor definition.
    ///
    /// # Returns
    /// - `struct_fields`: The list of data descriptors forming the struct fields. Contains a list of value descriptors, defining the data layout: the data described by the first DataDescriptor of the list is at the start, followed by the data described by the second and so on.
    ///
    /// Calls the openDAQ C function `daqDataDescriptor_getStructFields()`.
    pub fn struct_fields(&self) -> Result<Vec<DataDescriptor>> {
        let mut __struct_fields: *mut sys::daqList = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptor_getStructFields)(self.as_raw() as *mut _, &mut __struct_fields) };
        check(__code, "daqDataDescriptor_getStructFields")?;
        Ok(unsafe { crate::marshal::take_list::<DataDescriptor>(__struct_fields as *mut _, "daqDataDescriptor_getStructFields") }?)
    }

    /// Gets the Resolution which scales the explicit or implicit value to the physical unit defined in `unit`. It is defined as domain (usually time) between two consecutive ticks.
    ///
    /// # Returns
    /// - `tick_resolution`: The Resolution.
    ///
    /// Calls the openDAQ C function `daqDataDescriptor_getTickResolution()`.
    pub fn tick_resolution(&self) -> Result<Option<Ratio>> {
        let mut __tick_resolution: *mut sys::daqRatio = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptor_getTickResolution)(self.as_raw() as *mut _, &mut __tick_resolution) };
        check(__code, "daqDataDescriptor_getTickResolution")?;
        Ok(unsafe { crate::value::take_ratio(__tick_resolution, "daqDataDescriptor_getTickResolution") }?)
    }

    /// Gets the unit of the data in a signal's packets.
    ///
    /// # Returns
    /// - `unit`: The unit specified by the descriptor.
    ///
    /// Calls the openDAQ C function `daqDataDescriptor_getUnit()`.
    pub fn unit(&self) -> Result<Option<Unit>> {
        let mut __unit: *mut sys::daqUnit = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptor_getUnit)(self.as_raw() as *mut _, &mut __unit) };
        check(__code, "daqDataDescriptor_getUnit")?;
        Ok(unsafe { crate::marshal::take_object::<Unit>(__unit as *mut _) })
    }

    /// Gets the value range of the data in a signal's packets defining the lowest and highest expected values.
    ///
    /// # Returns
    /// - `range`: The value range the signal's data. The range is not enforced by openDAQ.
    ///
    /// Calls the openDAQ C function `daqDataDescriptor_getValueRange()`.
    pub fn value_range(&self) -> Result<Option<Range>> {
        let mut __range: *mut sys::daqRange = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataDescriptor_getValueRange)(self.as_raw() as *mut _, &mut __range) };
        check(__code, "daqDataDescriptor_getValueRange")?;
        Ok(unsafe { crate::marshal::take_object::<Range>(__range as *mut _) })
    }

}

impl DataPacket {
    /// Creates a Data packet with a given descriptor, sample count, memory size of each sample, and an optional packet offset.
    ///
    /// # Parameters
    /// - `descriptor`: The descriptor of the signal sending the data.
    /// - `sample_count`: The number of samples in the packet.
    /// - `offset`: Optional packet offset parameter, used to calculate the data of the packet if the Data rule of the Signal descriptor is not explicit.
    ///
    /// Calls the openDAQ C function `daqDataPacket_createDataPacket()`.
    pub fn new(descriptor: &DataDescriptor, sample_count: usize, offset: impl Into<Value>) -> Result<DataPacket> {
        let __offset = crate::value::to_daq_number(&offset.into())?;
        let mut __obj: *mut sys::daqDataPacket = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataPacket_createDataPacket)(&mut __obj, descriptor.as_raw() as *mut _, sample_count, crate::value::opt_ref_ptr(&__offset) as *mut _) };
        check(__code, "daqDataPacket_createDataPacket")?;
        Ok(unsafe { crate::marshal::require_object::<DataPacket>(__obj as *mut _, "daqDataPacket_createDataPacket") }?)
    }

    /// Creates a Data packet with a given descriptor, sample count, memory size of each sample, and an optional implicit value.
    ///
    /// # Parameters
    /// - `domain_packet`: The Data packet carrying domain data.
    /// - `descriptor`: The descriptor of the signal sending the data.
    /// - `sample_count`: The number of samples in the packet.
    /// - `offset`: Optional packet offset parameter, used to calculate the data of the packet if the Data rule of the Signal descriptor is not explicit.
    ///
    /// Calls the openDAQ C function `daqDataPacket_createDataPacketWithDomain()`.
    pub fn with_domain(domain_packet: &DataPacket, descriptor: &DataDescriptor, sample_count: usize, offset: impl Into<Value>) -> Result<DataPacket> {
        let __offset = crate::value::to_daq_number(&offset.into())?;
        let mut __obj: *mut sys::daqDataPacket = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataPacket_createDataPacketWithDomain)(&mut __obj, domain_packet.as_raw() as *mut _, descriptor.as_raw() as *mut _, sample_count, crate::value::opt_ref_ptr(&__offset) as *mut _) };
        check(__code, "daqDataPacket_createDataPacketWithDomain")?;
        Ok(unsafe { crate::marshal::require_object::<DataPacket>(__obj as *mut _, "daqDataPacket_createDataPacketWithDomain") }?)
    }

    /// Gets the signal descriptor of the signal that sent the packet at the time of sending.
    ///
    /// # Returns
    /// - `descriptor`: The signal descriptor.
    ///
    /// Calls the openDAQ C function `daqDataPacket_getDataDescriptor()`.
    pub fn data_descriptor(&self) -> Result<Option<DataDescriptor>> {
        let mut __descriptor: *mut sys::daqDataDescriptor = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataPacket_getDataDescriptor)(self.as_raw() as *mut _, &mut __descriptor) };
        check(__code, "daqDataPacket_getDataDescriptor")?;
        Ok(unsafe { crate::marshal::take_object::<DataDescriptor>(__descriptor as *mut _) })
    }

    /// Gets size of data buffer in bytes.
    ///
    /// # Returns
    /// - `data_size`: the size of data buffer in bytes.
    ///
    /// Calls the openDAQ C function `daqDataPacket_getDataSize()`.
    pub fn data_size(&self) -> Result<usize> {
        let mut __data_size: usize = Default::default();
        let __code = unsafe { (crate::sys::api().daqDataPacket_getDataSize)(self.as_raw() as *mut _, &mut __data_size) };
        check(__code, "daqDataPacket_getDataSize")?;
        Ok(__data_size)
    }

    /// Gets the associated domain Data packet.
    ///
    /// # Returns
    /// - `packet`: The domain data packet.
    ///
    /// Calls the openDAQ C function `daqDataPacket_getDomainPacket()`.
    pub fn domain_packet(&self) -> Result<Option<DataPacket>> {
        let mut __packet: *mut sys::daqDataPacket = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataPacket_getDomainPacket)(self.as_raw() as *mut _, &mut __packet) };
        check(__code, "daqDataPacket_getDomainPacket")?;
        Ok(unsafe { crate::marshal::take_object::<DataPacket>(__packet as *mut _) })
    }

    /// Gets the data packet last value.
    ///
    /// # Parameters
    /// - `type_manager`: Optional ITypeManager value can be provided to enable getLastValue for IStruct. If a value is assigned, it can be cast based on the signal description to IFloat if the type is Float32 or Float64, to IInteger if the type is Int8 through Int64 or UInt8 through UInt64, to IComplexNumber if the type is ComplexFloat32 or ComplexFloat64, to IRange if the type is RangeInt64, to IString if the type is String, to IStruct if the type is Struct, and to IList of the forementioned types if there is exactly one dimension. For String type signals in binary data packets, the string data must be encoded as UTF-8 strings. The string length is determined by the sample size, and the string does not need to be null-terminated. The method extracts the string value from the packet data and returns it as an IString object.
    ///
    /// # Returns
    /// - `value`: The IBaseObject value can be a nullptr if there is no value, or if the data type is not supported by the function.
    ///
    /// Calls the openDAQ C function `daqDataPacket_getLastValue()`.
    pub fn last_value(&self) -> Result<Value> {
        let mut __value: *mut sys::daqBaseObject = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataPacket_getLastValue)(self.as_raw() as *mut _, &mut __value, std::ptr::null_mut()) };
        check(__code, "daqDataPacket_getLastValue")?;
        Ok(unsafe { crate::value::take_value(__value, "daqDataPacket_getLastValue") }?)
    }

    /// Gets the data packet last value.
    ///
    /// # Parameters
    /// - `type_manager`: Optional ITypeManager value can be provided to enable getLastValue for IStruct. If a value is assigned, it can be cast based on the signal description to IFloat if the type is Float32 or Float64, to IInteger if the type is Int8 through Int64 or UInt8 through UInt64, to IComplexNumber if the type is ComplexFloat32 or ComplexFloat64, to IRange if the type is RangeInt64, to IString if the type is String, to IStruct if the type is Struct, and to IList of the forementioned types if there is exactly one dimension. For String type signals in binary data packets, the string data must be encoded as UTF-8 strings. The string length is determined by the sample size, and the string does not need to be null-terminated. The method extracts the string value from the packet data and returns it as an IString object.
    ///
    /// # Returns
    /// - `value`: The IBaseObject value can be a nullptr if there is no value, or if the data type is not supported by the function.
    ///
    /// Calls the openDAQ C function `daqDataPacket_getLastValue()`.
    pub fn last_value_with(&self, type_manager: Option<&TypeManager>) -> Result<Value> {
        let mut __value: *mut sys::daqBaseObject = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataPacket_getLastValue)(self.as_raw() as *mut _, &mut __value, type_manager.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
        check(__code, "daqDataPacket_getLastValue")?;
        Ok(unsafe { crate::value::take_value(__value, "daqDataPacket_getLastValue") }?)
    }

    /// Gets current packet offset. This offset is later applied to the data rule used by a signal to calculate actual data value. This value is usually a time or other domain value. Packet offset is particularly useful when one wants to transfer a gap in otherwise equidistant samples. If we have a linear data rule, defined by equation f(x) = k*x + n, then the data value will be calculated by the equation g(x) = offset + f(x).
    ///
    /// # Returns
    /// - `offset`: The packet offset
    ///
    /// Calls the openDAQ C function `daqDataPacket_getOffset()`.
    pub fn offset(&self) -> Result<Option<f64>> {
        let mut __offset: *mut sys::daqNumber = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataPacket_getOffset)(self.as_raw() as *mut _, &mut __offset) };
        check(__code, "daqDataPacket_getOffset")?;
        Ok(unsafe { crate::value::take_number(__offset, "daqDataPacket_getOffset") }?)
    }

    /// Gets the unique packet id.
    ///
    /// # Returns
    /// - `packet_id`: The packet unique id. The packet id is automatically created on packet construction.
    ///
    /// Calls the openDAQ C function `daqDataPacket_getPacketId()`.
    pub fn packet_id(&self) -> Result<i64> {
        let mut __packet_id: i64 = Default::default();
        let __code = unsafe { (crate::sys::api().daqDataPacket_getPacketId)(self.as_raw() as *mut _, &mut __packet_id) };
        check(__code, "daqDataPacket_getPacketId")?;
        Ok(__packet_id)
    }

    /// Gets size of raw data buffer in bytes.
    ///
    /// # Returns
    /// - `data_size`: the size of raw data buffer in bytes. Raw data size is 0 if signal's data rule is implicit.
    ///
    /// Calls the openDAQ C function `daqDataPacket_getRawDataSize()`.
    pub fn raw_data_size(&self) -> Result<usize> {
        let mut __raw_data_size: usize = Default::default();
        let __code = unsafe { (crate::sys::api().daqDataPacket_getRawDataSize)(self.as_raw() as *mut _, &mut __raw_data_size) };
        check(__code, "daqDataPacket_getRawDataSize")?;
        Ok(__raw_data_size)
    }

    /// Gets the number of samples in the packet.
    ///
    /// # Returns
    /// - `sample_count`: the number of samples.
    ///
    /// Calls the openDAQ C function `daqDataPacket_getSampleCount()`.
    pub fn sample_count(&self) -> Result<usize> {
        let mut __sample_count: usize = Default::default();
        let __code = unsafe { (crate::sys::api().daqDataPacket_getSampleCount)(self.as_raw() as *mut _, &mut __sample_count) };
        check(__code, "daqDataPacket_getSampleCount")?;
        Ok(__sample_count)
    }

    /// Gets the data packet value at the specified index.
    ///
    /// # Parameters
    /// - `index`: Index of the sample to obtain.
    /// - `type_manager`: Optional ITypeManager value can be provided to enable getLastValue for IStruct. If a value is assigned, it can be cast based on the signal description to IFloat if the type is Float32 or Float64, to IInteger if the type is Int8 through Int64 or UInt8 through UInt64, to IComplexNumber if the type is ComplexFloat32 or ComplexFloat64, to IRange if the type is RangeInt64, to IString if the type is String, to IStruct if the type is Struct, and to IList of the forementioned types if there is exactly one dimension. For String type signals in binary data packets, the string data must be encoded as UTF-8 strings. The string length is determined by the sample size, and the string does not need to be null-terminated. The method extracts the string value from the packet data and returns it as an IString object.
    ///
    /// # Returns
    /// - `value`: The IBaseObject value can be a nullptr if there is no value, or if the data type is not supported by the function.
    ///
    /// Calls the openDAQ C function `daqDataPacket_getValueByIndex()`.
    pub fn value_by_index(&self, index: usize) -> Result<Value> {
        let mut __value: *mut sys::daqBaseObject = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataPacket_getValueByIndex)(self.as_raw() as *mut _, &mut __value, index, std::ptr::null_mut()) };
        check(__code, "daqDataPacket_getValueByIndex")?;
        Ok(unsafe { crate::value::take_value(__value, "daqDataPacket_getValueByIndex") }?)
    }

    /// Gets the data packet value at the specified index.
    ///
    /// # Parameters
    /// - `index`: Index of the sample to obtain.
    /// - `type_manager`: Optional ITypeManager value can be provided to enable getLastValue for IStruct. If a value is assigned, it can be cast based on the signal description to IFloat if the type is Float32 or Float64, to IInteger if the type is Int8 through Int64 or UInt8 through UInt64, to IComplexNumber if the type is ComplexFloat32 or ComplexFloat64, to IRange if the type is RangeInt64, to IString if the type is String, to IStruct if the type is Struct, and to IList of the forementioned types if there is exactly one dimension. For String type signals in binary data packets, the string data must be encoded as UTF-8 strings. The string length is determined by the sample size, and the string does not need to be null-terminated. The method extracts the string value from the packet data and returns it as an IString object.
    ///
    /// # Returns
    /// - `value`: The IBaseObject value can be a nullptr if there is no value, or if the data type is not supported by the function.
    ///
    /// Calls the openDAQ C function `daqDataPacket_getValueByIndex()`.
    pub fn value_by_index_with(&self, index: usize, type_manager: Option<&TypeManager>) -> Result<Value> {
        let mut __value: *mut sys::daqBaseObject = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataPacket_getValueByIndex)(self.as_raw() as *mut _, &mut __value, index, type_manager.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _)) };
        check(__code, "daqDataPacket_getValueByIndex")?;
        Ok(unsafe { crate::value::take_value(__value, "daqDataPacket_getValueByIndex") }?)
    }

}

impl DataRuleBuilder {
    /// Adds a string-object pair parameter to the Dictionary of Data rule parameters.
    ///
    /// # Parameters
    /// - `name`: The string-type name of the parameter.
    /// - `parameter`: The object-type parameter.
    ///
    /// Calls the openDAQ C function `daqDataRuleBuilder_addParameter()`.
    pub fn add_parameter(&self, name: &str, parameter: impl Into<Value>) -> Result<()> {
        let __name = crate::marshal::make_string(name)?;
        let __parameter = crate::value::to_daq(&parameter.into())?;
        let __code = unsafe { (crate::sys::api().daqDataRuleBuilder_addParameter)(self.as_raw() as *mut _, __name.as_ptr() as *mut _, crate::value::opt_ref_ptr(&__parameter) as *mut _) };
        check(__code, "daqDataRuleBuilder_addParameter")?;
        Ok(())
    }

    /// Builds and returns a Data rule object using the currently set values of the Builder.
    ///
    /// # Returns
    /// - `data_rule`: The built Data rule.
    ///
    /// Calls the openDAQ C function `daqDataRuleBuilder_build()`.
    pub fn build(&self) -> Result<Option<DataRule>> {
        let mut __data_rule: *mut sys::daqDataRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataRuleBuilder_build)(self.as_raw() as *mut _, &mut __data_rule) };
        check(__code, "daqDataRuleBuilder_build")?;
        Ok(unsafe { crate::marshal::take_object::<DataRule>(__data_rule as *mut _) })
    }

    /// Creates a Data rule builder with no parameters.
    ///
    /// Calls the openDAQ C function `daqDataRuleBuilder_createDataRuleBuilder()`.
    pub fn new() -> Result<DataRuleBuilder> {
        let mut __obj: *mut sys::daqDataRuleBuilder = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataRuleBuilder_createDataRuleBuilder)(&mut __obj) };
        check(__code, "daqDataRuleBuilder_createDataRuleBuilder")?;
        Ok(unsafe { crate::marshal::require_object::<DataRuleBuilder>(__obj as *mut _, "daqDataRuleBuilder_createDataRuleBuilder") }?)
    }

    /// Data rule copy factory that creates a configurable Data rule builder object from a possibly non-configurable Data rule.
    ///
    /// # Parameters
    /// - `rule_to_copy`: The rule of which configuration should be copied.
    ///
    /// Calls the openDAQ C function `daqDataRuleBuilder_createDataRuleBuilderFromExisting()`.
    pub fn from_existing(rule_to_copy: &DataRule) -> Result<DataRuleBuilder> {
        let mut __obj: *mut sys::daqDataRuleBuilder = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataRuleBuilder_createDataRuleBuilderFromExisting)(&mut __obj, rule_to_copy.as_raw() as *mut _) };
        check(__code, "daqDataRuleBuilder_createDataRuleBuilderFromExisting")?;
        Ok(unsafe { crate::marshal::require_object::<DataRuleBuilder>(__obj as *mut _, "daqDataRuleBuilder_createDataRuleBuilderFromExisting") }?)
    }

    /// Gets a dictionary of string-object key-value pairs representing the parameters used to evaluate the rule.
    ///
    /// # Returns
    /// - `parameters`: The dictionary containing the rule parameter members.
    ///
    /// Calls the openDAQ C function `daqDataRuleBuilder_getParameters()`.
    pub fn parameters(&self) -> Result<std::collections::HashMap<String, Value>> {
        let mut __parameters: *mut sys::daqDict = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataRuleBuilder_getParameters)(self.as_raw() as *mut _, &mut __parameters) };
        check(__code, "daqDataRuleBuilder_getParameters")?;
        Ok(unsafe { crate::marshal::take_dict::<String, Value>(__parameters as *mut _, "daqDataRuleBuilder_getParameters") }?)
    }

    /// Gets the type of the data rule.
    ///
    /// # Returns
    /// - `type`: The type of the data rule.
    ///
    /// Calls the openDAQ C function `daqDataRuleBuilder_getType()`.
    pub fn type_(&self) -> Result<DataRuleType> {
        let mut __type_: u32 = 0;
        let __code = unsafe { (crate::sys::api().daqDataRuleBuilder_getType)(self.as_raw() as *mut _, &mut __type_) };
        check(__code, "daqDataRuleBuilder_getType")?;
        Ok(crate::marshal::enum_out(DataRuleType::from_raw(__type_), "daqDataRuleBuilder_getType")?)
    }

    /// Removes the parameter with the given name from the Dictionary of Data rule parameters.
    ///
    /// Calls the openDAQ C function `daqDataRuleBuilder_removeParameter()`.
    pub fn remove_parameter(&self, name: &str) -> Result<()> {
        let __name = crate::marshal::make_string(name)?;
        let __code = unsafe { (crate::sys::api().daqDataRuleBuilder_removeParameter)(self.as_raw() as *mut _, __name.as_ptr() as *mut _) };
        check(__code, "daqDataRuleBuilder_removeParameter")?;
        Ok(())
    }

    /// Sets a dictionary of string-object key-value pairs representing the parameters used to evaluate the rule.
    ///
    /// # Parameters
    /// - `parameters`: The dictionary containing the rule parameter members.
    ///
    /// Calls the openDAQ C function `daqDataRuleBuilder_setParameters()`.
    pub fn set_parameters(&self, parameters: impl Into<Value>) -> Result<()> {
        let __parameters = crate::value::to_daq(&parameters.into())?;
        let __code = unsafe { (crate::sys::api().daqDataRuleBuilder_setParameters)(self.as_raw() as *mut _, crate::value::opt_ref_ptr(&__parameters) as *mut _) };
        check(__code, "daqDataRuleBuilder_setParameters")?;
        Ok(())
    }

    /// Sets the type of the data rule.
    ///
    /// # Parameters
    /// - `type`: The type of the data rule.
    ///
    /// Calls the openDAQ C function `daqDataRuleBuilder_setType()`.
    pub fn set_type(&self, type_: DataRuleType) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqDataRuleBuilder_setType)(self.as_raw() as *mut _, type_ as u32) };
        check(__code, "daqDataRuleBuilder_setType")?;
        Ok(())
    }

}

impl DataRule {
    /// Creates a DataRule with a Constant rule type configuration.
    ///
    /// Calls the openDAQ C function `daqDataRule_createConstantDataRule()`.
    pub fn constant() -> Result<DataRule> {
        let mut __obj: *mut sys::daqDataRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataRule_createConstantDataRule)(&mut __obj) };
        check(__code, "daqDataRule_createConstantDataRule")?;
        Ok(unsafe { crate::marshal::require_object::<DataRule>(__obj as *mut _, "daqDataRule_createConstantDataRule") }?)
    }

    /// Creates a DataRule with an Explicit rule type configuration and parameters.
    ///
    /// # Parameters
    /// - `rule_type`: .
    /// - `parameters`: .
    ///
    /// Calls the openDAQ C function `daqDataRule_createDataRule()`.
    pub fn new(rule_type: DataRuleType, parameters: impl Into<Value>) -> Result<DataRule> {
        let __parameters = crate::value::to_daq(&parameters.into())?;
        let mut __obj: *mut sys::daqDataRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataRule_createDataRule)(&mut __obj, rule_type as u32, crate::value::opt_ref_ptr(&__parameters) as *mut _) };
        check(__code, "daqDataRule_createDataRule")?;
        Ok(unsafe { crate::marshal::require_object::<DataRule>(__obj as *mut _, "daqDataRule_createDataRule") }?)
    }

    /// Creates a DataRulePtr from Builder.
    ///
    /// # Parameters
    /// - `builder`: DataRule Builder
    ///
    /// Calls the openDAQ C function `daqDataRule_createDataRuleFromBuilder()`.
    pub fn from_builder(builder: &DataRuleBuilder) -> Result<DataRule> {
        let mut __obj: *mut sys::daqDataRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataRule_createDataRuleFromBuilder)(&mut __obj, builder.as_raw() as *mut _) };
        check(__code, "daqDataRule_createDataRuleFromBuilder")?;
        Ok(unsafe { crate::marshal::require_object::<DataRule>(__obj as *mut _, "daqDataRule_createDataRuleFromBuilder") }?)
    }

    /// Creates a DataRule with an Explicit rule type configuration and no parameters.
    ///
    /// Calls the openDAQ C function `daqDataRule_createExplicitDataRule()`.
    pub fn explicit() -> Result<DataRule> {
        let mut __obj: *mut sys::daqDataRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataRule_createExplicitDataRule)(&mut __obj) };
        check(__code, "daqDataRule_createExplicitDataRule")?;
        Ok(unsafe { crate::marshal::require_object::<DataRule>(__obj as *mut _, "daqDataRule_createExplicitDataRule") }?)
    }

    /// Creates a DataRule with an Explicit rule type configuration two optional parameters.
    ///
    /// # Parameters
    /// - `min_expected_delta`: The lowest expected distance between two samples.
    /// - `max_expected_delta`: The highest expected distance between two samples. Most often used for domain signals to specify estimates on how close together/far apart two subsequent samples might be.
    ///
    /// Calls the openDAQ C function `daqDataRule_createExplicitDomainDataRule()`.
    pub fn explicit_domain(min_expected_delta: impl Into<Value>, max_expected_delta: impl Into<Value>) -> Result<DataRule> {
        let __min_expected_delta = crate::value::to_daq_number(&min_expected_delta.into())?;
        let __max_expected_delta = crate::value::to_daq_number(&max_expected_delta.into())?;
        let mut __obj: *mut sys::daqDataRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataRule_createExplicitDomainDataRule)(&mut __obj, crate::value::opt_ref_ptr(&__min_expected_delta) as *mut _, crate::value::opt_ref_ptr(&__max_expected_delta) as *mut _) };
        check(__code, "daqDataRule_createExplicitDomainDataRule")?;
        Ok(unsafe { crate::marshal::require_object::<DataRule>(__obj as *mut _, "daqDataRule_createExplicitDomainDataRule") }?)
    }

    /// Creates a DataRule with a Linear rule type configuration.
    ///
    /// # Parameters
    /// - `delta`: Coefficient by which the input data is to be multiplied.
    /// - `start`: Constant that is added to the \<em\>scale * value\</em\> multiplication result. The scale and offset are stored within the `parameters` member of the Rule object with the scale being at the first position of the list, and the offset at the second.
    ///
    /// Calls the openDAQ C function `daqDataRule_createLinearDataRule()`.
    pub fn linear(delta: impl Into<Value>, start: impl Into<Value>) -> Result<DataRule> {
        let __delta = crate::value::to_daq_number(&delta.into())?;
        let __start = crate::value::to_daq_number(&start.into())?;
        let mut __obj: *mut sys::daqDataRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataRule_createLinearDataRule)(&mut __obj, crate::value::opt_ref_ptr(&__delta) as *mut _, crate::value::opt_ref_ptr(&__start) as *mut _) };
        check(__code, "daqDataRule_createLinearDataRule")?;
        Ok(unsafe { crate::marshal::require_object::<DataRule>(__obj as *mut _, "daqDataRule_createLinearDataRule") }?)
    }

    /// Gets a dictionary of string-object key-value pairs representing the parameters used to evaluate the rule.
    ///
    /// # Returns
    /// - `parameters`: The dictionary containing the rule parameter members.
    ///
    /// Calls the openDAQ C function `daqDataRule_getParameters()`.
    pub fn parameters(&self) -> Result<std::collections::HashMap<String, Value>> {
        let mut __parameters: *mut sys::daqDict = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDataRule_getParameters)(self.as_raw() as *mut _, &mut __parameters) };
        check(__code, "daqDataRule_getParameters")?;
        Ok(unsafe { crate::marshal::take_dict::<String, Value>(__parameters as *mut _, "daqDataRule_getParameters") }?)
    }

    /// Gets the type of the data rule.
    ///
    /// # Returns
    /// - `type`: The type of the data rule.
    ///
    /// Calls the openDAQ C function `daqDataRule_getType()`.
    pub fn type_(&self) -> Result<DataRuleType> {
        let mut __type_: u32 = 0;
        let __code = unsafe { (crate::sys::api().daqDataRule_getType)(self.as_raw() as *mut _, &mut __type_) };
        check(__code, "daqDataRule_getType")?;
        Ok(crate::marshal::enum_out(DataRuleType::from_raw(__type_), "daqDataRule_getType")?)
    }

}

impl DimensionBuilder {
    /// Builds and returns a Dimension object using the currently set values of the Builder.
    ///
    /// # Returns
    /// - `dimension`: The built Dimension.
    ///
    /// Calls the openDAQ C function `daqDimensionBuilder_build()`.
    pub fn build(&self) -> Result<Option<Dimension>> {
        let mut __dimension: *mut sys::daqDimension = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionBuilder_build)(self.as_raw() as *mut _, &mut __dimension) };
        check(__code, "daqDimensionBuilder_build")?;
        Ok(unsafe { crate::marshal::take_object::<Dimension>(__dimension as *mut _) })
    }

    /// Creates a Dimension builder object with no configuration parameters.
    ///
    /// Calls the openDAQ C function `daqDimensionBuilder_createDimensionBuilder()`.
    pub fn new() -> Result<DimensionBuilder> {
        let mut __obj: *mut sys::daqDimensionBuilder = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionBuilder_createDimensionBuilder)(&mut __obj) };
        check(__code, "daqDimensionBuilder_createDimensionBuilder")?;
        Ok(unsafe { crate::marshal::require_object::<DimensionBuilder>(__obj as *mut _, "daqDimensionBuilder_createDimensionBuilder") }?)
    }

    /// Creates a builder copy of the dimension object passed as parameter.
    ///
    /// # Parameters
    /// - `dimension_to_copy`: The dimension object to be copied.
    ///
    /// Calls the openDAQ C function `daqDimensionBuilder_createDimensionBuilderFromExisting()`.
    pub fn from_existing(dimension_to_copy: &Dimension) -> Result<DimensionBuilder> {
        let mut __obj: *mut sys::daqDimensionBuilder = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionBuilder_createDimensionBuilderFromExisting)(&mut __obj, dimension_to_copy.as_raw() as *mut _) };
        check(__code, "daqDimensionBuilder_createDimensionBuilderFromExisting")?;
        Ok(unsafe { crate::marshal::require_object::<DimensionBuilder>(__obj as *mut _, "daqDimensionBuilder_createDimensionBuilderFromExisting") }?)
    }

    /// Gets the name of the dimension.
    ///
    /// # Returns
    /// - `name`: The name of the dimension.
    ///
    /// Calls the openDAQ C function `daqDimensionBuilder_getName()`.
    pub fn name(&self) -> Result<String> {
        let mut __name: *mut sys::daqString = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionBuilder_getName)(self.as_raw() as *mut _, &mut __name) };
        check(__code, "daqDimensionBuilder_getName")?;
        Ok(unsafe { crate::marshal::take_string(__name) })
    }

    /// Gets the rule that defines the labels and size of the dimension.
    ///
    /// # Returns
    /// - `rule`: The dimension rule.
    ///
    /// Calls the openDAQ C function `daqDimensionBuilder_getRule()`.
    pub fn rule(&self) -> Result<Option<DimensionRule>> {
        let mut __rule: *mut sys::daqDimensionRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionBuilder_getRule)(self.as_raw() as *mut _, &mut __rule) };
        check(__code, "daqDimensionBuilder_getRule")?;
        Ok(unsafe { crate::marshal::take_object::<DimensionRule>(__rule as *mut _) })
    }

    /// Gets the unit of the dimension's labels.
    ///
    /// # Returns
    /// - `unit`: The unit of the dimension.
    ///
    /// Calls the openDAQ C function `daqDimensionBuilder_getUnit()`.
    pub fn unit(&self) -> Result<Option<Unit>> {
        let mut __unit: *mut sys::daqUnit = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionBuilder_getUnit)(self.as_raw() as *mut _, &mut __unit) };
        check(__code, "daqDimensionBuilder_getUnit")?;
        Ok(unsafe { crate::marshal::take_object::<Unit>(__unit as *mut _) })
    }

    /// Sets the name of the dimension.
    ///
    /// # Parameters
    /// - `name`: The name of the dimension. The name that best describes the dimension, in example "Frequency" for spectrum data.
    ///
    /// Calls the openDAQ C function `daqDimensionBuilder_setName()`.
    pub fn set_name(&self, name: &str) -> Result<()> {
        let __name = crate::marshal::make_string(name)?;
        let __code = unsafe { (crate::sys::api().daqDimensionBuilder_setName)(self.as_raw() as *mut _, __name.as_ptr() as *mut _) };
        check(__code, "daqDimensionBuilder_setName")?;
        Ok(())
    }

    /// Sets the rule that defines the labels and size of the dimension.
    ///
    /// # Parameters
    /// - `rule`: The dimension rule.
    ///
    /// # Errors
    /// - `OPENDAQ_ERR_FROZEN`: if the dimension object is frozen. The rule takes as input the index of data value in a sample and produces a label associated with that index.
    ///
    /// Calls the openDAQ C function `daqDimensionBuilder_setRule()`.
    pub fn set_rule(&self, rule: &DimensionRule) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqDimensionBuilder_setRule)(self.as_raw() as *mut _, rule.as_raw() as *mut _) };
        check(__code, "daqDimensionBuilder_setRule")?;
        Ok(())
    }

    /// Sets the unit of the dimension's labels.
    ///
    /// # Parameters
    /// - `unit`: The unit of the dimension.
    ///
    /// Calls the openDAQ C function `daqDimensionBuilder_setUnit()`.
    pub fn set_unit(&self, unit: &Unit) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqDimensionBuilder_setUnit)(self.as_raw() as *mut _, unit.as_raw() as *mut _) };
        check(__code, "daqDimensionBuilder_setUnit")?;
        Ok(())
    }

}

impl DimensionRuleBuilder {
    /// Adds a string-object pair parameter to the Dictionary of Dimension rule parameters.
    ///
    /// # Parameters
    /// - `name`: The string-type name of the parameter.
    /// - `parameter`: The object-type parameter.
    ///
    /// Calls the openDAQ C function `daqDimensionRuleBuilder_addParameter()`.
    pub fn add_parameter(&self, name: &str, parameter: impl Into<Value>) -> Result<()> {
        let __name = crate::marshal::make_string(name)?;
        let __parameter = crate::value::to_daq(&parameter.into())?;
        let __code = unsafe { (crate::sys::api().daqDimensionRuleBuilder_addParameter)(self.as_raw() as *mut _, __name.as_ptr() as *mut _, crate::value::opt_ref_ptr(&__parameter) as *mut _) };
        check(__code, "daqDimensionRuleBuilder_addParameter")?;
        Ok(())
    }

    /// Builds and returns a Dimension rule object using the currently set values of the Builder.
    ///
    /// # Returns
    /// - `data_rule`: The built Dimension rule.
    ///
    /// Calls the openDAQ C function `daqDimensionRuleBuilder_build()`.
    pub fn build(&self) -> Result<Option<DimensionRule>> {
        let mut __dimension_rule: *mut sys::daqDimensionRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionRuleBuilder_build)(self.as_raw() as *mut _, &mut __dimension_rule) };
        check(__code, "daqDimensionRuleBuilder_build")?;
        Ok(unsafe { crate::marshal::take_object::<DimensionRule>(__dimension_rule as *mut _) })
    }

    /// Creates a DataRuleConfig with no parameters.
    ///
    /// Calls the openDAQ C function `daqDimensionRuleBuilder_createDimensionRuleBuilder()`.
    pub fn new() -> Result<DimensionRuleBuilder> {
        let mut __obj: *mut sys::daqDimensionRuleBuilder = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionRuleBuilder_createDimensionRuleBuilder)(&mut __obj) };
        check(__code, "daqDimensionRuleBuilder_createDimensionRuleBuilder")?;
        Ok(unsafe { crate::marshal::require_object::<DimensionRuleBuilder>(__obj as *mut _, "daqDimensionRuleBuilder_createDimensionRuleBuilder") }?)
    }

    /// Dimension rule copy factory that creates a builder Rule object from a possibly non-configurable Rule.
    ///
    /// # Parameters
    /// - `rule_to_copy`: The rule of which configuration should be copied.
    ///
    /// Calls the openDAQ C function `daqDimensionRuleBuilder_createDimensionRuleBuilderFromExisting()`.
    pub fn from_existing(rule_to_copy: &DimensionRule) -> Result<DimensionRuleBuilder> {
        let mut __obj: *mut sys::daqDimensionRuleBuilder = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionRuleBuilder_createDimensionRuleBuilderFromExisting)(&mut __obj, rule_to_copy.as_raw() as *mut _) };
        check(__code, "daqDimensionRuleBuilder_createDimensionRuleBuilderFromExisting")?;
        Ok(unsafe { crate::marshal::require_object::<DimensionRuleBuilder>(__obj as *mut _, "daqDimensionRuleBuilder_createDimensionRuleBuilderFromExisting") }?)
    }

    /// Gets a dictionary of string-object key-value pairs representing the parameters used to evaluate the rule.
    ///
    /// # Returns
    /// - `parameters`: The dictionary containing the rule parameter members.
    ///
    /// Calls the openDAQ C function `daqDimensionRuleBuilder_getParameters()`.
    pub fn parameters(&self) -> Result<std::collections::HashMap<String, Value>> {
        let mut __parameters: *mut sys::daqDict = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionRuleBuilder_getParameters)(self.as_raw() as *mut _, &mut __parameters) };
        check(__code, "daqDimensionRuleBuilder_getParameters")?;
        Ok(unsafe { crate::marshal::take_dict::<String, Value>(__parameters as *mut _, "daqDimensionRuleBuilder_getParameters") }?)
    }

    /// Gets the type of the dimension rule.
    ///
    /// # Returns
    /// - `type`: The type of the dimension rule.
    ///
    /// Calls the openDAQ C function `daqDimensionRuleBuilder_getType()`.
    pub fn type_(&self) -> Result<DimensionRuleType> {
        let mut __type_: u32 = 0;
        let __code = unsafe { (crate::sys::api().daqDimensionRuleBuilder_getType)(self.as_raw() as *mut _, &mut __type_) };
        check(__code, "daqDimensionRuleBuilder_getType")?;
        Ok(crate::marshal::enum_out(DimensionRuleType::from_raw(__type_), "daqDimensionRuleBuilder_getType")?)
    }

    /// Removes the parameter with the given name from the Dictionary of Dimension rule parameters.
    ///
    /// Calls the openDAQ C function `daqDimensionRuleBuilder_removeParameter()`.
    pub fn remove_parameter(&self, name: &str) -> Result<()> {
        let __name = crate::marshal::make_string(name)?;
        let __code = unsafe { (crate::sys::api().daqDimensionRuleBuilder_removeParameter)(self.as_raw() as *mut _, __name.as_ptr() as *mut _) };
        check(__code, "daqDimensionRuleBuilder_removeParameter")?;
        Ok(())
    }

    /// Sets a dictionary of string-object key-value pairs representing the parameters used to evaluate the rule.
    ///
    /// # Parameters
    /// - `parameters`: The dictionary containing the rule parameter members.
    ///
    /// Calls the openDAQ C function `daqDimensionRuleBuilder_setParameters()`.
    pub fn set_parameters(&self, parameters: impl Into<Value>) -> Result<()> {
        let __parameters = crate::value::to_daq(&parameters.into())?;
        let __code = unsafe { (crate::sys::api().daqDimensionRuleBuilder_setParameters)(self.as_raw() as *mut _, crate::value::opt_ref_ptr(&__parameters) as *mut _) };
        check(__code, "daqDimensionRuleBuilder_setParameters")?;
        Ok(())
    }

    /// Sets the type of the dimension rule. Rule parameters must be configured to match the requirements of the rule type.
    ///
    /// # Parameters
    /// - `type`: The type of the dimension rule. The required rule parameters are as follows: - Linear: `delta`, `start`, and `size` number parameters. Calculated as: \<em\>index * delta + start\</em\> for `size` number of elements. - Logarithmic: `delta`, `start`, `base`, and `size` number parameters. Calculated as: \<em\>base ^ (index * delta + start)\</em\> for `size` number of elements. - List: `list` parameter. The list contains all dimension labels.
    ///
    /// Calls the openDAQ C function `daqDimensionRuleBuilder_setType()`.
    pub fn set_type(&self, type_: DimensionRuleType) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqDimensionRuleBuilder_setType)(self.as_raw() as *mut _, type_ as u32) };
        check(__code, "daqDimensionRuleBuilder_setType")?;
        Ok(())
    }

}

impl DimensionRule {
    /// Creates a Rule with a given type and parameters.
    ///
    /// # Parameters
    /// - `type`: The type of the Dimension rule
    /// - `parameters`: Tha parameters of the Dimension rule
    ///
    /// Calls the openDAQ C function `daqDimensionRule_createDimensionRule()`.
    pub fn new(type_: DimensionRuleType, parameters: impl Into<Value>) -> Result<DimensionRule> {
        let __parameters = crate::value::to_daq(&parameters.into())?;
        let mut __obj: *mut sys::daqDimensionRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionRule_createDimensionRule)(&mut __obj, type_ as u32, crate::value::opt_ref_ptr(&__parameters) as *mut _) };
        check(__code, "daqDimensionRule_createDimensionRule")?;
        Ok(unsafe { crate::marshal::require_object::<DimensionRule>(__obj as *mut _, "daqDimensionRule_createDimensionRule") }?)
    }

    /// Creates a DimensionRule using Builder
    ///
    /// # Parameters
    /// - `builder`: DimensionRule Builder
    ///
    /// Calls the openDAQ C function `daqDimensionRule_createDimensionRuleFromBuilder()`.
    pub fn from_builder(builder: &DimensionRuleBuilder) -> Result<DimensionRule> {
        let mut __obj: *mut sys::daqDimensionRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionRule_createDimensionRuleFromBuilder)(&mut __obj, builder.as_raw() as *mut _) };
        check(__code, "daqDimensionRule_createDimensionRuleFromBuilder")?;
        Ok(unsafe { crate::marshal::require_object::<DimensionRule>(__obj as *mut _, "daqDimensionRule_createDimensionRuleFromBuilder") }?)
    }

    /// Creates a Rule with a Linear rule type configuration.
    ///
    /// # Parameters
    /// - `delta`: Coefficient by which the input data is to be multiplied.
    /// - `start`: Constant that is added to the \<em\>scale * value\</em\> multiplication result.
    /// - `size`: The size of the dimension described by the rule The scale and offset are stored within the `parameters` member of the Rule object with the scale being at the first position of the list, and the offset at the second.
    ///
    /// Calls the openDAQ C function `daqDimensionRule_createLinearDimensionRule()`.
    pub fn linear(delta: impl Into<Value>, start: impl Into<Value>, size: usize) -> Result<DimensionRule> {
        let __delta = crate::value::to_daq_number(&delta.into())?;
        let __start = crate::value::to_daq_number(&start.into())?;
        let mut __obj: *mut sys::daqDimensionRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionRule_createLinearDimensionRule)(&mut __obj, crate::value::opt_ref_ptr(&__delta) as *mut _, crate::value::opt_ref_ptr(&__start) as *mut _, size) };
        check(__code, "daqDimensionRule_createLinearDimensionRule")?;
        Ok(unsafe { crate::marshal::require_object::<DimensionRule>(__obj as *mut _, "daqDimensionRule_createLinearDimensionRule") }?)
    }

    /// Creates a Rule with a List rule type configuration.
    ///
    /// # Parameters
    /// - `list`: The list of dimension labels. The list is stored within the `parameters` member of the Rule object.
    ///
    /// Calls the openDAQ C function `daqDimensionRule_createListDimensionRule()`.
    pub fn list(list: impl Into<Value>) -> Result<DimensionRule> {
        let __list = crate::value::to_daq(&list.into())?;
        let mut __obj: *mut sys::daqDimensionRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionRule_createListDimensionRule)(&mut __obj, crate::value::opt_ref_ptr(&__list) as *mut _) };
        check(__code, "daqDimensionRule_createListDimensionRule")?;
        Ok(unsafe { crate::marshal::require_object::<DimensionRule>(__obj as *mut _, "daqDimensionRule_createListDimensionRule") }?)
    }

    /// Creates a Rule with a Logarithmic rule type configuration.
    ///
    /// # Parameters
    /// - `delta`: Coefficient by which the input data is to be multiplied.
    /// - `start`: Constant that is added to the \<em\>scale * value\</em\> multiplication result.
    /// - `base`: The base of the logarithm.
    /// - `size`: The size of the dimension described by the rule.
    ///
    /// Calls the openDAQ C function `daqDimensionRule_createLogarithmicDimensionRule()`.
    pub fn logarithmic(delta: impl Into<Value>, start: impl Into<Value>, base: impl Into<Value>, size: usize) -> Result<DimensionRule> {
        let __delta = crate::value::to_daq_number(&delta.into())?;
        let __start = crate::value::to_daq_number(&start.into())?;
        let __base = crate::value::to_daq_number(&base.into())?;
        let mut __obj: *mut sys::daqDimensionRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionRule_createLogarithmicDimensionRule)(&mut __obj, crate::value::opt_ref_ptr(&__delta) as *mut _, crate::value::opt_ref_ptr(&__start) as *mut _, crate::value::opt_ref_ptr(&__base) as *mut _, size) };
        check(__code, "daqDimensionRule_createLogarithmicDimensionRule")?;
        Ok(unsafe { crate::marshal::require_object::<DimensionRule>(__obj as *mut _, "daqDimensionRule_createLogarithmicDimensionRule") }?)
    }

    /// Gets a dictionary of string-object key-value pairs representing the parameters used to evaluate the rule.
    ///
    /// # Returns
    /// - `parameters`: The dictionary containing the rule parameter members.
    ///
    /// Calls the openDAQ C function `daqDimensionRule_getParameters()`.
    pub fn parameters(&self) -> Result<std::collections::HashMap<String, Value>> {
        let mut __parameters: *mut sys::daqDict = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimensionRule_getParameters)(self.as_raw() as *mut _, &mut __parameters) };
        check(__code, "daqDimensionRule_getParameters")?;
        Ok(unsafe { crate::marshal::take_dict::<String, Value>(__parameters as *mut _, "daqDimensionRule_getParameters") }?)
    }

    /// Gets the type of the dimension rule.
    ///
    /// # Returns
    /// - `type`: The type of the dimension rule.
    ///
    /// Calls the openDAQ C function `daqDimensionRule_getType()`.
    pub fn type_(&self) -> Result<DimensionRuleType> {
        let mut __type_: u32 = 0;
        let __code = unsafe { (crate::sys::api().daqDimensionRule_getType)(self.as_raw() as *mut _, &mut __type_) };
        check(__code, "daqDimensionRule_getType")?;
        Ok(crate::marshal::enum_out(DimensionRuleType::from_raw(__type_), "daqDimensionRule_getType")?)
    }

}

impl Dimension {
    /// Creates a dimension object of which labels and size are defined via rule.
    ///
    /// # Parameters
    /// - `rule`: The rule via which labels are defined.
    /// - `unit`: The unit of the dimension's labels.
    /// - `name`: The name the dimension.
    ///
    /// Calls the openDAQ C function `daqDimension_createDimension()`.
    pub fn new(rule: &DimensionRule, unit: &Unit, name: &str) -> Result<Dimension> {
        let __name = crate::marshal::make_string(name)?;
        let mut __obj: *mut sys::daqDimension = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimension_createDimension)(&mut __obj, rule.as_raw() as *mut _, unit.as_raw() as *mut _, __name.as_ptr() as *mut _) };
        check(__code, "daqDimension_createDimension")?;
        Ok(unsafe { crate::marshal::require_object::<Dimension>(__obj as *mut _, "daqDimension_createDimension") }?)
    }

    /// Creates a Dimension using Builder
    ///
    /// # Parameters
    /// - `builder`: Dimension Builder
    ///
    /// Calls the openDAQ C function `daqDimension_createDimensionFromBuilder()`.
    pub fn from_builder(builder: &DimensionBuilder) -> Result<Dimension> {
        let mut __obj: *mut sys::daqDimension = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimension_createDimensionFromBuilder)(&mut __obj, builder.as_raw() as *mut _) };
        check(__code, "daqDimension_createDimensionFromBuilder")?;
        Ok(unsafe { crate::marshal::require_object::<Dimension>(__obj as *mut _, "daqDimension_createDimensionFromBuilder") }?)
    }

    /// Gets a list of labels that defines the dimension.
    ///
    /// # Returns
    /// - `labels`: The list of labels. The list is obtained from the dimension rule parameters by parsing and evaluating the parameters in conjunction with the rule type.
    ///
    /// Calls the openDAQ C function `daqDimension_getLabels()`.
    pub fn labels(&self) -> Result<Vec<Value>> {
        let mut __labels: *mut sys::daqList = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimension_getLabels)(self.as_raw() as *mut _, &mut __labels) };
        check(__code, "daqDimension_getLabels")?;
        Ok(unsafe { crate::marshal::take_list::<Value>(__labels as *mut _, "daqDimension_getLabels") }?)
    }

    /// Gets the name of the dimension.
    ///
    /// # Returns
    /// - `name`: The name of the dimension. The name that best describes the dimension, in example "Frequency" for spectrum data.
    ///
    /// Calls the openDAQ C function `daqDimension_getName()`.
    pub fn name(&self) -> Result<String> {
        let mut __name: *mut sys::daqString = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimension_getName)(self.as_raw() as *mut _, &mut __name) };
        check(__code, "daqDimension_getName")?;
        Ok(unsafe { crate::marshal::take_string(__name) })
    }

    /// Gets the rule that defines the labels and size of the dimension.
    ///
    /// # Returns
    /// - `rule`: The dimension rule. The rule takes as input the index of data value in a sample and produces a label associated with that index.
    ///
    /// Calls the openDAQ C function `daqDimension_getRule()`.
    pub fn rule(&self) -> Result<Option<DimensionRule>> {
        let mut __rule: *mut sys::daqDimensionRule = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimension_getRule)(self.as_raw() as *mut _, &mut __rule) };
        check(__code, "daqDimension_getRule")?;
        Ok(unsafe { crate::marshal::take_object::<DimensionRule>(__rule as *mut _) })
    }

    /// Gets the size of the dimension.
    ///
    /// # Returns
    /// - `size`: The size of the dimension. The size is obtained from the dimension rule parameters - either from the `size` parameter, or the count of elements in the `list` parameter.
    ///
    /// Calls the openDAQ C function `daqDimension_getSize()`.
    pub fn size(&self) -> Result<usize> {
        let mut __size: usize = Default::default();
        let __code = unsafe { (crate::sys::api().daqDimension_getSize)(self.as_raw() as *mut _, &mut __size) };
        check(__code, "daqDimension_getSize")?;
        Ok(__size)
    }

    /// Gets the unit of the dimension's labels.
    ///
    /// # Returns
    /// - `unit`: The unit of the dimension.
    ///
    /// Calls the openDAQ C function `daqDimension_getUnit()`.
    pub fn unit(&self) -> Result<Option<Unit>> {
        let mut __unit: *mut sys::daqUnit = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqDimension_getUnit)(self.as_raw() as *mut _, &mut __unit) };
        check(__code, "daqDimension_getUnit")?;
        Ok(unsafe { crate::marshal::take_object::<Unit>(__unit as *mut _) })
    }

}

impl InputPortPrivate {
    /// Connects the signal to the input port, forming a Connection.
    ///
    /// # Parameters
    /// - `signal`: The signal to be connected to the input port. On connect, an event packet is enqueued in the connection. This method schedules the `onPacketReceived` notification instead of invoking it on the same thread.
    ///
    /// Calls the openDAQ C function `daqInputPortPrivate_connectSignalSchedulerNotification()`.
    pub fn connect_signal_scheduler_notification(&self, signal: &Signal) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqInputPortPrivate_connectSignalSchedulerNotification)(self.as_raw() as *mut _, signal.as_raw() as *mut _) };
        check(__code, "daqInputPortPrivate_connectSignalSchedulerNotification")?;
        Ok(())
    }

    /// Disconnects the signal without notification to the signal.
    ///
    /// Calls the openDAQ C function `daqInputPortPrivate_disconnectWithoutSignalNotification()`.
    pub fn disconnect_without_signal_notification(&self) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqInputPortPrivate_disconnectWithoutSignalNotification)(self.as_raw() as *mut _) };
        check(__code, "daqInputPortPrivate_disconnectWithoutSignalNotification")?;
        Ok(())
    }

}

impl PacketDestructCallback {
    /// Called when packet is destroyed.
    ///
    /// Calls the openDAQ C function `daqPacketDestructCallback_onPacketDestroyed()`.
    pub fn on_packet_destroyed(&self) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqPacketDestructCallback_onPacketDestroyed)(self.as_raw() as *mut _) };
        check(__code, "daqPacketDestructCallback_onPacketDestroyed")?;
        Ok(())
    }

}

impl Range {
    /// Creates a range object with specified low and high boundary values.
    ///
    /// # Parameters
    /// - `low_value`: The lower boundary of the range.
    /// - `high_value`: The upper boundary of the range.
    ///
    /// # Errors
    /// - `OPENDAQ_ERR_RANGE_BOUNDARIES_INVALID`: if lowValue \> highValue.
    ///
    /// Calls the openDAQ C function `daqRange_createRange()`.
    pub fn new(low_value: impl Into<Value>, high_value: impl Into<Value>) -> Result<Range> {
        let __low_value = crate::value::to_daq_number(&low_value.into())?;
        let __high_value = crate::value::to_daq_number(&high_value.into())?;
        let mut __obj: *mut sys::daqRange = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqRange_createRange)(&mut __obj, crate::value::opt_ref_ptr(&__low_value) as *mut _, crate::value::opt_ref_ptr(&__high_value) as *mut _) };
        check(__code, "daqRange_createRange")?;
        Ok(unsafe { crate::marshal::require_object::<Range>(__obj as *mut _, "daqRange_createRange") }?)
    }

    /// Gets the upper boundary value of the range.
    ///
    /// Calls the openDAQ C function `daqRange_getHighValue()`.
    pub fn high_value(&self) -> Result<Option<f64>> {
        let mut __value: *mut sys::daqNumber = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqRange_getHighValue)(self.as_raw() as *mut _, &mut __value) };
        check(__code, "daqRange_getHighValue")?;
        Ok(unsafe { crate::value::take_number(__value, "daqRange_getHighValue") }?)
    }

    /// Gets the lower boundary value of the range.
    ///
    /// Calls the openDAQ C function `daqRange_getLowValue()`.
    pub fn low_value(&self) -> Result<Option<f64>> {
        let mut __value: *mut sys::daqNumber = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqRange_getLowValue)(self.as_raw() as *mut _, &mut __value) };
        check(__code, "daqRange_getLowValue")?;
        Ok(unsafe { crate::value::take_number(__value, "daqRange_getLowValue") }?)
    }

}

impl ReferenceDomainInfoBuilder {
    /// Builds and returns a Reference Domain Info object using the currently set values of the Builder.
    ///
    /// # Returns
    /// - `reference_domain_info`: The built Reference Domain Info.
    ///
    /// Calls the openDAQ C function `daqReferenceDomainInfoBuilder_build()`.
    pub fn build(&self) -> Result<Option<ReferenceDomainInfo>> {
        let mut __reference_domain_info: *mut sys::daqReferenceDomainInfo = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqReferenceDomainInfoBuilder_build)(self.as_raw() as *mut _, &mut __reference_domain_info) };
        check(__code, "daqReferenceDomainInfoBuilder_build")?;
        Ok(unsafe { crate::marshal::take_object::<ReferenceDomainInfo>(__reference_domain_info as *mut _) })
    }

    /// Reference Domain Info builder factory that creates a builder object with no parameters configured.
    ///
    /// Calls the openDAQ C function `daqReferenceDomainInfoBuilder_createReferenceDomainInfoBuilder()`.
    pub fn new() -> Result<ReferenceDomainInfoBuilder> {
        let mut __obj: *mut sys::daqReferenceDomainInfoBuilder = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqReferenceDomainInfoBuilder_createReferenceDomainInfoBuilder)(&mut __obj) };
        check(__code, "daqReferenceDomainInfoBuilder_createReferenceDomainInfoBuilder")?;
        Ok(unsafe { crate::marshal::require_object::<ReferenceDomainInfoBuilder>(__obj as *mut _, "daqReferenceDomainInfoBuilder_createReferenceDomainInfoBuilder") }?)
    }

    /// Reference Domain Info copy factory that creates a Reference Domain Info builder object from a different Reference Domain Info, copying its parameters.
    ///
    /// # Parameters
    /// - `reference_domain_info_to_copy`: The Reference Domain Info of which configuration should be copied.
    ///
    /// Calls the openDAQ C function `daqReferenceDomainInfoBuilder_createReferenceDomainInfoBuilderFromExisting()`.
    pub fn from_existing(reference_domain_info_to_copy: &ReferenceDomainInfo) -> Result<ReferenceDomainInfoBuilder> {
        let mut __obj: *mut sys::daqReferenceDomainInfoBuilder = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqReferenceDomainInfoBuilder_createReferenceDomainInfoBuilderFromExisting)(&mut __obj, reference_domain_info_to_copy.as_raw() as *mut _) };
        check(__code, "daqReferenceDomainInfoBuilder_createReferenceDomainInfoBuilderFromExisting")?;
        Ok(unsafe { crate::marshal::require_object::<ReferenceDomainInfoBuilder>(__obj as *mut _, "daqReferenceDomainInfoBuilder_createReferenceDomainInfoBuilderFromExisting") }?)
    }

    /// Gets the Reference Domain ID.
    ///
    /// # Returns
    /// - `reference_domain_id`: The Reference Domain ID. If set, gives the common identifier of one domain group. Signals with the same Reference Domain ID share a common synchronization source (all the signals in a group either come from the same device or are synchronized using a protocol, such as PTP, NTP, IRIG, etc.). Those signals can always be read together, implying that a Multi Reader can be used to read the signals if their sampling rates are compatible.
    ///
    /// Calls the openDAQ C function `daqReferenceDomainInfoBuilder_getReferenceDomainId()`.
    pub fn reference_domain_id(&self) -> Result<String> {
        let mut __reference_domain_id: *mut sys::daqString = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqReferenceDomainInfoBuilder_getReferenceDomainId)(self.as_raw() as *mut _, &mut __reference_domain_id) };
        check(__code, "daqReferenceDomainInfoBuilder_getReferenceDomainId")?;
        Ok(unsafe { crate::marshal::take_string(__reference_domain_id) })
    }

    /// Gets the Reference Domain Offset.
    ///
    /// # Returns
    /// - `reference_domain_offset`: The Reference Domain Offset. If set, denotes the offset in ticks that must be added to the domain values of the signal for them to be equal to that of the sync source. The sync source will always have an offset of 0. This offset is changed only if the sync source changes and should be kept at 0 otherwise, allowing clients to differentiate between data loss and resync events. Any device can choose to always keep the offset at 0, representing changes in the offset in the domain packet values instead. This implementation prevents clients from differentiating between errors (data loss) and resync events. Additionally, if the offset is not configured, clients have no way of detecting a resync event in the case of asynchronous signals.
    ///
    /// Calls the openDAQ C function `daqReferenceDomainInfoBuilder_getReferenceDomainOffset()`.
    pub fn reference_domain_offset(&self) -> Result<Option<i64>> {
        let mut __reference_domain_offset: *mut sys::daqInteger = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqReferenceDomainInfoBuilder_getReferenceDomainOffset)(self.as_raw() as *mut _, &mut __reference_domain_offset) };
        check(__code, "daqReferenceDomainInfoBuilder_getReferenceDomainOffset")?;
        Ok(unsafe { crate::value::take_boxed_int(__reference_domain_offset, "daqReferenceDomainInfoBuilder_getReferenceDomainOffset") }?)
    }

    /// Gets the value that indicates the Reference Time Source.
    ///
    /// # Returns
    /// - `reference_time_protocol`: The value that indicates the Reference Time Source. If not set to Unknown, the domain quantity is “time”, and the timestamps are absolute according to the chosen time standard. The possible values are Gps, Tai, and Utc. This field is used to determine if two signals with different Domain IDs can be read together. Signals that have configured a Reference Time Source are trusted to have absolute time stamps that correlate to the chosen time standard (eg. two separate PTP networks, both driven through GPS can be read together, as their absolute time is the same).
    ///
    /// Calls the openDAQ C function `daqReferenceDomainInfoBuilder_getReferenceTimeProtocol()`.
    pub fn reference_time_protocol(&self) -> Result<TimeProtocol> {
        let mut __reference_time_protocol: u32 = 0;
        let __code = unsafe { (crate::sys::api().daqReferenceDomainInfoBuilder_getReferenceTimeProtocol)(self.as_raw() as *mut _, &mut __reference_time_protocol) };
        check(__code, "daqReferenceDomainInfoBuilder_getReferenceTimeProtocol")?;
        Ok(crate::marshal::enum_out(TimeProtocol::from_raw(__reference_time_protocol), "daqReferenceDomainInfoBuilder_getReferenceTimeProtocol")?)
    }

    /// Gets the value that indicates if offset is used.
    ///
    /// # Returns
    /// - `uses_offset`: The value that indicates if offset is used. If False, a device will contain time jumps due to resync in the domain signal data.
    ///
    /// Calls the openDAQ C function `daqReferenceDomainInfoBuilder_getUsesOffset()`.
    pub fn uses_offset(&self) -> Result<UsesOffset> {
        let mut __uses_offset: u32 = 0;
        let __code = unsafe { (crate::sys::api().daqReferenceDomainInfoBuilder_getUsesOffset)(self.as_raw() as *mut _, &mut __uses_offset) };
        check(__code, "daqReferenceDomainInfoBuilder_getUsesOffset")?;
        Ok(crate::marshal::enum_out(UsesOffset::from_raw(__uses_offset), "daqReferenceDomainInfoBuilder_getUsesOffset")?)
    }

    /// Sets the Reference Domain ID.
    ///
    /// # Parameters
    /// - `reference_domain_id`: The Reference Domain ID. If set, gives the common identifier of one domain group. Signals with the same Reference Domain ID share a common synchronization source (all the signals in a group either come from the same device or are synchronized using a protocol, such as PTP, NTP, IRIG, etc.). Those signals can always be read together, implying that a Multi Reader can be used to read the signals if their sampling rates are compatible.
    ///
    /// Calls the openDAQ C function `daqReferenceDomainInfoBuilder_setReferenceDomainId()`.
    pub fn set_reference_domain_id(&self, reference_domain_id: &str) -> Result<()> {
        let __reference_domain_id = crate::marshal::make_string(reference_domain_id)?;
        let __code = unsafe { (crate::sys::api().daqReferenceDomainInfoBuilder_setReferenceDomainId)(self.as_raw() as *mut _, __reference_domain_id.as_ptr() as *mut _) };
        check(__code, "daqReferenceDomainInfoBuilder_setReferenceDomainId")?;
        Ok(())
    }

    /// Sets the Reference Domain Offset.
    ///
    /// # Parameters
    /// - `reference_domain_offset`: The Reference Domain Offset. If set, denotes the offset in ticks that must be added to the domain values of the signal for them to be equal to that of the sync source. The sync source will always have an offset of 0. This offset is changed only if the sync source changes and should be kept at 0 otherwise, allowing clients to differentiate between data loss and resync events. Any device can choose to always keep the offset at 0, representing changes in the offset in the domain packet values instead. This implementation prevents clients from differentiating between errors (data loss) and resync events. Additionally, if the offset is not configured, clients have no way of detecting a resync event in the case of asynchronous signals.
    ///
    /// Calls the openDAQ C function `daqReferenceDomainInfoBuilder_setReferenceDomainOffset()`.
    pub fn set_reference_domain_offset(&self, reference_domain_offset: i64) -> Result<()> {
        let __reference_domain_offset = crate::value::int_to_ref(reference_domain_offset)?;
        let __code = unsafe { (crate::sys::api().daqReferenceDomainInfoBuilder_setReferenceDomainOffset)(self.as_raw() as *mut _, __reference_domain_offset.as_ptr() as *mut _) };
        check(__code, "daqReferenceDomainInfoBuilder_setReferenceDomainOffset")?;
        Ok(())
    }

    /// Sets the value that indicates the Reference Time Source.
    ///
    /// # Parameters
    /// - `reference_time_protocol`: The value that indicates the Reference Time Source. If not set to Unknown, the domain quantity is “time”, and the timestamps are absolute according to the chosen time standard. The possible values are Gps, Tai, and Utc. This field is used to determine if two signals with different Domain IDs can be read together. Signals that have configured a Reference Time Source are trusted to have absolute time stamps that correlate to the chosen time standard (eg. two separate PTP networks, both driven through GPS can be read together, as their absolute time is the same).
    ///
    /// Calls the openDAQ C function `daqReferenceDomainInfoBuilder_setReferenceTimeProtocol()`.
    pub fn set_reference_time_protocol(&self, reference_time_protocol: TimeProtocol) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqReferenceDomainInfoBuilder_setReferenceTimeProtocol)(self.as_raw() as *mut _, reference_time_protocol as u32) };
        check(__code, "daqReferenceDomainInfoBuilder_setReferenceTimeProtocol")?;
        Ok(())
    }

    /// Sets the value that indicates if offset is used.
    ///
    /// # Returns
    /// - `uses_offset`: The value that indicates if offset is used. If False, a device will contain time jumps due to resync in the domain signal data.
    ///
    /// Calls the openDAQ C function `daqReferenceDomainInfoBuilder_setUsesOffset()`.
    pub fn set_uses_offset(&self, uses_offset: UsesOffset) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqReferenceDomainInfoBuilder_setUsesOffset)(self.as_raw() as *mut _, uses_offset as u32) };
        check(__code, "daqReferenceDomainInfoBuilder_setUsesOffset")?;
        Ok(())
    }

}

impl ReusableDataPacket {
    /// Calls the openDAQ C function `daqReusableDataPacket_reuse()`.
    pub fn reuse(&self, new_descriptor: &DataDescriptor, new_sample_count: usize, new_offset: impl Into<Value>, new_domain_packet: &DataPacket, can_realloc_memory: bool) -> Result<bool> {
        let __new_offset = crate::value::to_daq_number(&new_offset.into())?;
        let mut __success: u8 = 0;
        let __code = unsafe { (crate::sys::api().daqReusableDataPacket_reuse)(self.as_raw() as *mut _, new_descriptor.as_raw() as *mut _, new_sample_count, crate::value::opt_ref_ptr(&__new_offset) as *mut _, new_domain_packet.as_raw() as *mut _, u8::from(can_realloc_memory), &mut __success) };
        check(__code, "daqReusableDataPacket_reuse")?;
        Ok(__success != 0)
    }

}

impl RulePrivate {
    /// Checks whether the parameters are valid and returns an appropriate error code if not.
    ///
    /// # Errors
    /// - `OPENDAQ_ERR_INVALID_PARAMETERS`: If the parameters are invalid for the specific rule type.
    ///
    /// Calls the openDAQ C function `daqRulePrivate_verifyParameters()`.
    pub fn verify_parameters(&self) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqRulePrivate_verifyParameters)(self.as_raw() as *mut _) };
        check(__code, "daqRulePrivate_verifyParameters")?;
        Ok(())
    }

}

impl ScalingBuilder {
    /// Adds a string-object pair parameter to the Dictionary of Scaling parameters.
    ///
    /// # Parameters
    /// - `name`: The string-type name of the parameter.
    /// - `parameter`: The object-type parameter.
    ///
    /// Calls the openDAQ C function `daqScalingBuilder_addParameter()`.
    pub fn add_parameter(&self, name: &str, parameter: impl Into<Value>) -> Result<()> {
        let __name = crate::marshal::make_string(name)?;
        let __parameter = crate::value::to_daq(&parameter.into())?;
        let __code = unsafe { (crate::sys::api().daqScalingBuilder_addParameter)(self.as_raw() as *mut _, __name.as_ptr() as *mut _, crate::value::opt_ref_ptr(&__parameter) as *mut _) };
        check(__code, "daqScalingBuilder_addParameter")?;
        Ok(())
    }

    /// Builds and returns a Scaling object using the currently set values of the Builder.
    ///
    /// # Returns
    /// - `scaling`: The built Scaling object.
    ///
    /// Calls the openDAQ C function `daqScalingBuilder_build()`.
    pub fn build(&self) -> Result<Option<Scaling>> {
        let mut __scaling: *mut sys::daqScaling = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqScalingBuilder_build)(self.as_raw() as *mut _, &mut __scaling) };
        check(__code, "daqScalingBuilder_build")?;
        Ok(unsafe { crate::marshal::take_object::<Scaling>(__scaling as *mut _) })
    }

    /// Creates a Scaling builder object with no parameters configured.
    ///
    /// Calls the openDAQ C function `daqScalingBuilder_createScalingBuilder()`.
    pub fn new() -> Result<ScalingBuilder> {
        let mut __obj: *mut sys::daqScalingBuilder = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqScalingBuilder_createScalingBuilder)(&mut __obj) };
        check(__code, "daqScalingBuilder_createScalingBuilder")?;
        Ok(unsafe { crate::marshal::require_object::<ScalingBuilder>(__obj as *mut _, "daqScalingBuilder_createScalingBuilder") }?)
    }

    /// Scaling builder copy factory that creates a configurable Scaling object from a non-configurable one.
    ///
    /// # Parameters
    /// - `scaling_to_copy`: The scaling of which configuration should be copied.
    ///
    /// Calls the openDAQ C function `daqScalingBuilder_createScalingBuilderFromExisting()`.
    pub fn from_existing(scaling_to_copy: &Scaling) -> Result<ScalingBuilder> {
        let mut __obj: *mut sys::daqScalingBuilder = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqScalingBuilder_createScalingBuilderFromExisting)(&mut __obj, scaling_to_copy.as_raw() as *mut _) };
        check(__code, "daqScalingBuilder_createScalingBuilderFromExisting")?;
        Ok(unsafe { crate::marshal::require_object::<ScalingBuilder>(__obj as *mut _, "daqScalingBuilder_createScalingBuilderFromExisting") }?)
    }

    /// Gets the scaling's input data type.
    ///
    /// # Returns
    /// - `type`: The input data type.
    ///
    /// Calls the openDAQ C function `daqScalingBuilder_getInputDataType()`.
    pub fn input_data_type(&self) -> Result<SampleType> {
        let mut __type_: u32 = 0;
        let __code = unsafe { (crate::sys::api().daqScalingBuilder_getInputDataType)(self.as_raw() as *mut _, &mut __type_) };
        check(__code, "daqScalingBuilder_getInputDataType")?;
        Ok(crate::marshal::enum_out(SampleType::from_raw(__type_), "daqScalingBuilder_getInputDataType")?)
    }

    /// Gets the scaling's output data type.
    ///
    /// # Returns
    /// - `type`: The output data type
    ///
    /// Calls the openDAQ C function `daqScalingBuilder_getOutputDataType()`.
    pub fn output_data_type(&self) -> Result<ScaledSampleType> {
        let mut __type_: u32 = 0;
        let __code = unsafe { (crate::sys::api().daqScalingBuilder_getOutputDataType)(self.as_raw() as *mut _, &mut __type_) };
        check(__code, "daqScalingBuilder_getOutputDataType")?;
        Ok(crate::marshal::enum_out(ScaledSampleType::from_raw(__type_), "daqScalingBuilder_getOutputDataType")?)
    }

    /// Gets the list of parameters that are used to calculate the scaling in conjunction with the input data.
    ///
    /// # Returns
    /// - `parameters`: The list of parameters. All elements are Number types.
    ///
    /// Calls the openDAQ C function `daqScalingBuilder_getParameters()`.
    pub fn parameters(&self) -> Result<std::collections::HashMap<String, Value>> {
        let mut __parameters: *mut sys::daqDict = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqScalingBuilder_getParameters)(self.as_raw() as *mut _, &mut __parameters) };
        check(__code, "daqScalingBuilder_getParameters")?;
        Ok(unsafe { crate::marshal::take_dict::<String, Value>(__parameters as *mut _, "daqScalingBuilder_getParameters") }?)
    }

    /// Gets the type of the scaling that determines how the scaling parameters should be interpreted and how the scaling should be calculated.
    ///
    /// # Returns
    /// - `type`: The type of the scaling.
    ///
    /// Calls the openDAQ C function `daqScalingBuilder_getScalingType()`.
    pub fn scaling_type(&self) -> Result<ScalingType> {
        let mut __type_: u32 = 0;
        let __code = unsafe { (crate::sys::api().daqScalingBuilder_getScalingType)(self.as_raw() as *mut _, &mut __type_) };
        check(__code, "daqScalingBuilder_getScalingType")?;
        Ok(crate::marshal::enum_out(ScalingType::from_raw(__type_), "daqScalingBuilder_getScalingType")?)
    }

    /// Removes the parameter with the given name from the Dictionary of Scaling parameters.
    ///
    /// Calls the openDAQ C function `daqScalingBuilder_removeParameter()`.
    pub fn remove_parameter(&self, name: &str) -> Result<()> {
        let __name = crate::marshal::make_string(name)?;
        let __code = unsafe { (crate::sys::api().daqScalingBuilder_removeParameter)(self.as_raw() as *mut _, __name.as_ptr() as *mut _) };
        check(__code, "daqScalingBuilder_removeParameter")?;
        Ok(())
    }

    /// Sets the scaling's input data type.
    ///
    /// # Parameters
    /// - `type`: The input data type. The input data type corresponds to the raw data passed through the signal path in data packets.
    ///
    /// Calls the openDAQ C function `daqScalingBuilder_setInputDataType()`.
    pub fn set_input_data_type(&self, type_: SampleType) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqScalingBuilder_setInputDataType)(self.as_raw() as *mut _, type_ as u32) };
        check(__code, "daqScalingBuilder_setInputDataType")?;
        Ok(())
    }

    /// Sets the scaling's output data type.
    ///
    /// # Parameters
    /// - `type`: The output data type The output data type corresponds to the type specified in the value descriptor of a signal, and is the type in which said signal's data should be read in after having the scaling applied to it.
    ///
    /// Calls the openDAQ C function `daqScalingBuilder_setOutputDataType()`.
    pub fn set_output_data_type(&self, type_: ScaledSampleType) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqScalingBuilder_setOutputDataType)(self.as_raw() as *mut _, type_ as u32) };
        check(__code, "daqScalingBuilder_setOutputDataType")?;
        Ok(())
    }

    /// Gets the list of parameters that are used to calculate the scaling in conjunction with the input data.
    ///
    /// # Parameters
    /// - `parameters`: The list of parameters. All elements are Number types.
    ///
    /// # Errors
    /// - `OPENDAQ_ERR_FROZEN`: if the object is frozen.
    ///
    /// Calls the openDAQ C function `daqScalingBuilder_setParameters()`.
    pub fn set_parameters(&self, parameters: impl Into<Value>) -> Result<()> {
        let __parameters = crate::value::to_daq(&parameters.into())?;
        let __code = unsafe { (crate::sys::api().daqScalingBuilder_setParameters)(self.as_raw() as *mut _, crate::value::opt_ref_ptr(&__parameters) as *mut _) };
        check(__code, "daqScalingBuilder_setParameters")?;
        Ok(())
    }

    /// Sets the type of the scaling that determines how the scaling parameters should be interpreted and how the scaling should be calculated.
    ///
    /// # Parameters
    /// - `type`: The type of the scaling.
    ///
    /// Calls the openDAQ C function `daqScalingBuilder_setScalingType()`.
    pub fn set_scaling_type(&self, type_: ScalingType) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqScalingBuilder_setScalingType)(self.as_raw() as *mut _, type_ as u32) };
        check(__code, "daqScalingBuilder_setScalingType")?;
        Ok(())
    }

}

impl Scaling {
    /// Creates a Scaling with a Linear scaling type configuration. The returned Scaling object is already frozen.
    ///
    /// # Parameters
    /// - `scale`: Coefficient by which the input data is to be multiplied.
    /// - `offset`: Constant that is added to the \<em\>scale * value\</em\> multiplication result.
    /// - `input_data_type`: The scaling's input data type.
    /// - `output_data_type`: The scaling's output data type.
    ///
    /// Calls the openDAQ C function `daqScaling_createLinearScaling()`.
    pub fn linear(scale: impl Into<Value>, offset: impl Into<Value>, input_data_type: SampleType, output_data_type: ScaledSampleType) -> Result<Scaling> {
        let __scale = crate::value::to_daq_number(&scale.into())?;
        let __offset = crate::value::to_daq_number(&offset.into())?;
        let mut __obj: *mut sys::daqScaling = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqScaling_createLinearScaling)(&mut __obj, crate::value::opt_ref_ptr(&__scale) as *mut _, crate::value::opt_ref_ptr(&__offset) as *mut _, input_data_type as u32, output_data_type as u32) };
        check(__code, "daqScaling_createLinearScaling")?;
        Ok(unsafe { crate::marshal::require_object::<Scaling>(__obj as *mut _, "daqScaling_createLinearScaling") }?)
    }

    /// Creates a Scaling object with given input/output types, Scaling type and parameters.
    ///
    /// # Parameters
    /// - `input_data_type`: The type of input data expected by the rule.
    /// - `output_data_type`: The data type output by the rule after calculation.
    /// - `scaling_type`: The type of the scaling.
    /// - `parameters`: Tha parameters of the Dimension rule.
    ///
    /// Calls the openDAQ C function `daqScaling_createScaling()`.
    pub fn new(input_data_type: SampleType, output_data_type: ScaledSampleType, scaling_type: ScalingType, parameters: impl Into<Value>) -> Result<Scaling> {
        let __parameters = crate::value::to_daq(&parameters.into())?;
        let mut __obj: *mut sys::daqScaling = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqScaling_createScaling)(&mut __obj, input_data_type as u32, output_data_type as u32, scaling_type as u32, crate::value::opt_ref_ptr(&__parameters) as *mut _) };
        check(__code, "daqScaling_createScaling")?;
        Ok(unsafe { crate::marshal::require_object::<Scaling>(__obj as *mut _, "daqScaling_createScaling") }?)
    }

    /// Creates a Scaling object from Builder
    ///
    /// # Parameters
    /// - `builder`: Scaling Builder
    ///
    /// Calls the openDAQ C function `daqScaling_createScalingFromBuilder()`.
    pub fn from_builder(builder: &ScalingBuilder) -> Result<Scaling> {
        let mut __obj: *mut sys::daqScaling = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqScaling_createScalingFromBuilder)(&mut __obj, builder.as_raw() as *mut _) };
        check(__code, "daqScaling_createScalingFromBuilder")?;
        Ok(unsafe { crate::marshal::require_object::<Scaling>(__obj as *mut _, "daqScaling_createScalingFromBuilder") }?)
    }

    /// Gets the scaling's input data type.
    ///
    /// # Returns
    /// - `type`: The input data type The input data type corresponds to the raw values passed through the signal path in data packets.
    ///
    /// Calls the openDAQ C function `daqScaling_getInputSampleType()`.
    pub fn input_sample_type(&self) -> Result<SampleType> {
        let mut __type_: u32 = 0;
        let __code = unsafe { (crate::sys::api().daqScaling_getInputSampleType)(self.as_raw() as *mut _, &mut __type_) };
        check(__code, "daqScaling_getInputSampleType")?;
        Ok(crate::marshal::enum_out(SampleType::from_raw(__type_), "daqScaling_getInputSampleType")?)
    }

    /// Gets the scaling's output data type.
    ///
    /// # Returns
    /// - `type`: The output data type The output data type corresponds to the sample type specified in the value descriptor of a signal, and is the type in which said signal's data should be read in after having the scaling applied to it.
    ///
    /// Calls the openDAQ C function `daqScaling_getOutputSampleType()`.
    pub fn output_sample_type(&self) -> Result<ScaledSampleType> {
        let mut __type_: u32 = 0;
        let __code = unsafe { (crate::sys::api().daqScaling_getOutputSampleType)(self.as_raw() as *mut _, &mut __type_) };
        check(__code, "daqScaling_getOutputSampleType")?;
        Ok(crate::marshal::enum_out(ScaledSampleType::from_raw(__type_), "daqScaling_getOutputSampleType")?)
    }

    /// Gets the dictionary of parameters that are used to calculate the scaling in conjunction with the input data.
    ///
    /// # Returns
    /// - `parameters`: The dictionary of parameters.
    ///
    /// Calls the openDAQ C function `daqScaling_getParameters()`.
    pub fn parameters(&self) -> Result<std::collections::HashMap<String, Value>> {
        let mut __parameters: *mut sys::daqDict = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqScaling_getParameters)(self.as_raw() as *mut _, &mut __parameters) };
        check(__code, "daqScaling_getParameters")?;
        Ok(unsafe { crate::marshal::take_dict::<String, Value>(__parameters as *mut _, "daqScaling_getParameters") }?)
    }

    /// Gets the type of the scaling that determines how the scaling parameters should be interpreted and how the scaling should be calculated.
    ///
    /// # Returns
    /// - `type`: The type of the scaling.
    ///
    /// Calls the openDAQ C function `daqScaling_getType()`.
    pub fn type_(&self) -> Result<ScalingType> {
        let mut __type_: u32 = 0;
        let __code = unsafe { (crate::sys::api().daqScaling_getType)(self.as_raw() as *mut _, &mut __type_) };
        check(__code, "daqScaling_getType")?;
        Ok(crate::marshal::enum_out(ScalingType::from_raw(__type_), "daqScaling_getType")?)
    }

}

impl SignalConfig {
    /// Adds a related signal to the list of related signals.
    ///
    /// # Parameters
    /// - `signal`: The signal to be added.
    ///
    /// # Errors
    /// - `OPENDAQ_ERR_DUPLICATEITEM`: if the signal is already present in the list.
    ///
    /// Calls the openDAQ C function `daqSignalConfig_addRelatedSignal()`.
    pub fn add_related_signal(&self, signal: &Signal) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqSignalConfig_addRelatedSignal)(self.as_raw() as *mut _, signal.as_raw() as *mut _) };
        check(__code, "daqSignalConfig_addRelatedSignal")?;
        Ok(())
    }

    /// Clears the list of related signals.
    ///
    /// Calls the openDAQ C function `daqSignalConfig_clearRelatedSignals()`.
    pub fn clear_related_signals(&self) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqSignalConfig_clearRelatedSignals)(self.as_raw() as *mut _) };
        check(__code, "daqSignalConfig_clearRelatedSignals")?;
        Ok(())
    }

    /// Calls the openDAQ C function `daqSignalConfig_createSignal()`.
    pub fn signal(context: &Context, parent: Option<&Component>, local_id: &str, class_name: Option<&str>) -> Result<SignalConfig> {
        let __local_id = crate::marshal::make_string(local_id)?;
        let __class_name = match class_name { Some(s) => Some(crate::marshal::make_string(s)?), None => None };
        let mut __obj: *mut sys::daqSignalConfig = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqSignalConfig_createSignal)(&mut __obj, context.as_raw() as *mut _, parent.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _), __local_id.as_ptr() as *mut _, __class_name.as_ref().map_or(std::ptr::null_mut(), |r| r.as_ptr()) as *mut _) };
        check(__code, "daqSignalConfig_createSignal")?;
        Ok(unsafe { crate::marshal::require_object::<SignalConfig>(__obj as *mut _, "daqSignalConfig_createSignal") }?)
    }

    /// Calls the openDAQ C function `daqSignalConfig_createSignalWithDescriptor()`.
    pub fn with_descriptor(context: &Context, descriptor: &DataDescriptor, parent: Option<&Component>, local_id: &str, class_name: Option<&str>) -> Result<SignalConfig> {
        let __local_id = crate::marshal::make_string(local_id)?;
        let __class_name = match class_name { Some(s) => Some(crate::marshal::make_string(s)?), None => None };
        let mut __obj: *mut sys::daqSignalConfig = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqSignalConfig_createSignalWithDescriptor)(&mut __obj, context.as_raw() as *mut _, descriptor.as_raw() as *mut _, parent.map_or(std::ptr::null_mut(), |o| o.as_raw() as *mut _), __local_id.as_ptr() as *mut _, __class_name.as_ref().map_or(std::ptr::null_mut(), |r| r.as_ptr()) as *mut _) };
        check(__code, "daqSignalConfig_createSignalWithDescriptor")?;
        Ok(unsafe { crate::marshal::require_object::<SignalConfig>(__obj as *mut _, "daqSignalConfig_createSignalWithDescriptor") }?)
    }

    /// Removes a signal from the list of related signal.
    ///
    /// # Parameters
    /// - `signal`: The signal to be removed.
    ///
    /// # Errors
    /// - `OPENDAQ_ERR_NOTFOUND`: if the signal is not part of the list.
    ///
    /// Calls the openDAQ C function `daqSignalConfig_removeRelatedSignal()`.
    pub fn remove_related_signal(&self, signal: &Signal) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqSignalConfig_removeRelatedSignal)(self.as_raw() as *mut _, signal.as_raw() as *mut _) };
        check(__code, "daqSignalConfig_removeRelatedSignal")?;
        Ok(())
    }

    /// Sends a packet through all connections of the signal.
    ///
    /// # Parameters
    /// - `packet`: The packet to be sent.
    ///
    /// Calls the openDAQ C function `daqSignalConfig_sendPacket()`.
    pub fn send_packet(&self, packet: &Packet) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqSignalConfig_sendPacket)(self.as_raw() as *mut _, packet.as_raw() as *mut _) };
        check(__code, "daqSignalConfig_sendPacket")?;
        Ok(())
    }

    /// Sends a packet through all connections of the signal. Ownership of the packet is transfered.
    ///
    /// # Parameters
    /// - `packet`: The packet to be sent. After calling the method, the packet should not be touched again. The ownership of the packet is taken by underlying connections and it could be destroyed before the function returns.
    ///
    /// Calls the openDAQ C function `daqSignalConfig_sendPacketAndStealRef()`.
    pub fn send_packet_and_steal_ref(&self, packet: &Packet) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqSignalConfig_sendPacketAndStealRef)(self.as_raw() as *mut _, packet.as_raw() as *mut _) };
        check(__code, "daqSignalConfig_sendPacketAndStealRef")?;
        Ok(())
    }

    /// Sends multiple packets through all connections of the signal.
    ///
    /// # Parameters
    /// - `packets`: The packets to be sent. Sending multiple packets creates a single notification to input port.
    ///
    /// Calls the openDAQ C function `daqSignalConfig_sendPackets()`.
    pub fn send_packets(&self, packets: &[Packet]) -> Result<()> {
        let __packets = crate::marshal::list_from_interfaces(packets)?;
        let __code = unsafe { (crate::sys::api().daqSignalConfig_sendPackets)(self.as_raw() as *mut _, __packets.as_ptr() as *mut _) };
        check(__code, "daqSignalConfig_sendPackets")?;
        Ok(())
    }

    /// Sends multiple packets through all connections of the signal. Ownership of the packets is transfered.
    ///
    /// # Parameters
    /// - `packets`: The packets to be sent. After calling the method, the packets should not be touched again. The ownership of the packets is taken by underlying connections and they could be destroyed before the function returns.
    ///
    /// Calls the openDAQ C function `daqSignalConfig_sendPacketsAndStealRef()`.
    pub fn send_packets_and_steal_ref(&self, packets: &[Packet]) -> Result<()> {
        let __packets = crate::marshal::list_from_interfaces(packets)?;
        let __code = unsafe { (crate::sys::api().daqSignalConfig_sendPacketsAndStealRef)(self.as_raw() as *mut _, __packets.as_ptr() as *mut _) };
        check(__code, "daqSignalConfig_sendPacketsAndStealRef")?;
        Ok(())
    }

    /// Sets the data descriptor.
    ///
    /// # Parameters
    /// - `descriptor`: The data descriptor. Setting the data descriptor triggers a Descriptor changed event packet to be sent to all connections of the signal. If the signal is a domain signal of another, that signal also sends a Descriptor changed event to all its connections.
    ///
    /// Calls the openDAQ C function `daqSignalConfig_setDescriptor()`.
    pub fn set_descriptor(&self, descriptor: &DataDescriptor) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqSignalConfig_setDescriptor)(self.as_raw() as *mut _, descriptor.as_raw() as *mut _) };
        check(__code, "daqSignalConfig_setDescriptor")?;
        Ok(())
    }

    /// Sets the domain signal reference.
    ///
    /// # Parameters
    /// - `signal`: The domain signal. Setting a new domain signal triggers a Descriptor changed event packet to be sent to all connections of the signal.
    ///
    /// Calls the openDAQ C function `daqSignalConfig_setDomainSignal()`.
    pub fn set_domain_signal(&self, signal: &Signal) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqSignalConfig_setDomainSignal)(self.as_raw() as *mut _, signal.as_raw() as *mut _) };
        check(__code, "daqSignalConfig_setDomainSignal")?;
        Ok(())
    }

    /// Sets the last value of the signal.
    ///
    /// # Parameters
    /// - `last_value`: The lastValue. This method is used to manually set the last value of the signal. Useful when automatic calculation of last value is disabled, usually due to performance reasons.
    ///
    /// Calls the openDAQ C function `daqSignalConfig_setLastValue()`.
    pub fn set_last_value(&self, last_value: impl Into<Value>) -> Result<()> {
        let __last_value = crate::value::to_daq(&last_value.into())?;
        let __code = unsafe { (crate::sys::api().daqSignalConfig_setLastValue)(self.as_raw() as *mut _, crate::value::opt_ref_ptr(&__last_value) as *mut _) };
        check(__code, "daqSignalConfig_setLastValue")?;
        Ok(())
    }

    /// Sets the list of related signals.
    ///
    /// # Parameters
    /// - `signals`: The list of related signals.
    ///
    /// Calls the openDAQ C function `daqSignalConfig_setRelatedSignals()`.
    pub fn set_related_signals(&self, signals: &[Signal]) -> Result<()> {
        let __signals = crate::marshal::list_from_interfaces(signals)?;
        let __code = unsafe { (crate::sys::api().daqSignalConfig_setRelatedSignals)(self.as_raw() as *mut _, __signals.as_ptr() as *mut _) };
        check(__code, "daqSignalConfig_setRelatedSignals")?;
        Ok(())
    }

}

impl SignalEvents {
    /// Notifies the signal that it is no longer being used as a domain signal by the signal passed as the function argument.
    ///
    /// # Parameters
    /// - `signal`: The callee signal on which the domain signal reference has been removed.
    ///
    /// Calls the openDAQ C function `daqSignalEvents_domainSignalReferenceRemoved()`.
    pub fn domain_signal_reference_removed(&self, signal: &Signal) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqSignalEvents_domainSignalReferenceRemoved)(self.as_raw() as *mut _, signal.as_raw() as *mut _) };
        check(__code, "daqSignalEvents_domainSignalReferenceRemoved")?;
        Ok(())
    }

    /// Notifies the signal that it is being used as a domain signal by the signal passed as the function argument.
    ///
    /// # Parameters
    /// - `signal`: The callee signal on which the domain signal reference has been set.
    ///
    /// Calls the openDAQ C function `daqSignalEvents_domainSignalReferenceSet()`.
    pub fn domain_signal_reference_set(&self, signal: &Signal) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqSignalEvents_domainSignalReferenceSet)(self.as_raw() as *mut _, signal.as_raw() as *mut _) };
        check(__code, "daqSignalEvents_domainSignalReferenceSet")?;
        Ok(())
    }

    /// Notifies the signal that it has been connected to an input port forming a new connection.
    ///
    /// # Parameters
    /// - `connection`: The formed connection. The data descriptor of the signal is enqueued on the connection, triggering the `onPacketReceived` callback on the same thread.
    ///
    /// Calls the openDAQ C function `daqSignalEvents_listenerConnected()`.
    pub fn listener_connected(&self, connection: &Connection) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqSignalEvents_listenerConnected)(self.as_raw() as *mut _, connection.as_raw() as *mut _) };
        check(__code, "daqSignalEvents_listenerConnected")?;
        Ok(())
    }

    /// Notifies the signal that it has been connected to an input port forming a new connection.
    ///
    /// # Parameters
    /// - `connection`: The formed connection. The data descriptor of the signal is enqueued on the connection, scheduling the `onPacketReceived` callback.
    ///
    /// Calls the openDAQ C function `daqSignalEvents_listenerConnectedScheduled()`.
    pub fn listener_connected_scheduled(&self, connection: &Connection) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqSignalEvents_listenerConnectedScheduled)(self.as_raw() as *mut _, connection.as_raw() as *mut _) };
        check(__code, "daqSignalEvents_listenerConnectedScheduled")?;
        Ok(())
    }

    /// Notifies the signal that it has been disconnected from an input port with the given connection.
    ///
    /// # Parameters
    /// - `connection`: The connection that was broken.
    ///
    /// Calls the openDAQ C function `daqSignalEvents_listenerDisconnected()`.
    pub fn listener_disconnected(&self, connection: &Connection) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqSignalEvents_listenerDisconnected)(self.as_raw() as *mut _, connection.as_raw() as *mut _) };
        check(__code, "daqSignalEvents_listenerDisconnected")?;
        Ok(())
    }

}

impl SignalPrivate {
    /// Sets the domain signal to null without notifying the domain signal
    ///
    /// Calls the openDAQ C function `daqSignalPrivate_clearDomainSignalWithoutNotification()`.
    pub fn clear_domain_signal_without_notification(&self) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqSignalPrivate_clearDomainSignalWithoutNotification)(self.as_raw() as *mut _) };
        check(__code, "daqSignalPrivate_clearDomainSignalWithoutNotification")?;
        Ok(())
    }

    /// Enable or disable keeping last data packet which is using by Signal method `getLastValue`
    ///
    /// # Parameters
    /// - `enabled`: Option for enabling method getLastValue
    ///
    /// Calls the openDAQ C function `daqSignalPrivate_enableKeepLastValue()`.
    pub fn enable_keep_last_value(&self, enabled: bool) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqSignalPrivate_enableKeepLastValue)(self.as_raw() as *mut _, u8::from(enabled)) };
        check(__code, "daqSignalPrivate_enableKeepLastValue")?;
        Ok(())
    }

    /// Returns True if last value calculation is enabled on the signal.
    ///
    /// # Returns
    /// - `keep_last_value`: True if enabled.
    ///
    /// Calls the openDAQ C function `daqSignalPrivate_getKeepLastValue()`.
    pub fn keep_last_value(&self) -> Result<bool> {
        let mut __keep_last_value: u8 = 0;
        let __code = unsafe { (crate::sys::api().daqSignalPrivate_getKeepLastValue)(self.as_raw() as *mut _, &mut __keep_last_value) };
        check(__code, "daqSignalPrivate_getKeepLastValue")?;
        Ok(__keep_last_value != 0)
    }

    /// Gets the signal serilized id. In local device the serilized id matached the signal global id. For remote id it is the signal id in the remote device.
    ///
    /// # Returns
    /// - `serialize_id`: The signal serilized id.
    ///
    /// Calls the openDAQ C function `daqSignalPrivate_getSignalSerializeId()`.
    pub fn signal_serialize_id(&self) -> Result<String> {
        let mut __serialize_id: *mut sys::daqString = std::ptr::null_mut();
        let __code = unsafe { (crate::sys::api().daqSignalPrivate_getSignalSerializeId)(self.as_raw() as *mut _, &mut __serialize_id) };
        check(__code, "daqSignalPrivate_getSignalSerializeId")?;
        Ok(unsafe { crate::marshal::take_string(__serialize_id) })
    }

    /// Sends a packet through all connections of the signal, acquiring a recursive lock instead of an acquisition lock.
    ///
    /// # Parameters
    /// - `packet`: The packet to be sent.
    ///
    /// Calls the openDAQ C function `daqSignalPrivate_sendPacketRecursiveLock()`.
    pub fn send_packet_recursive_lock(&self, packet: &Packet) -> Result<()> {
        let __code = unsafe { (crate::sys::api().daqSignalPrivate_sendPacketRecursiveLock)(self.as_raw() as *mut _, packet.as_raw() as *mut _) };
        check(__code, "daqSignalPrivate_sendPacketRecursiveLock")?;
        Ok(())
    }

}