Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
5271c1a
Updated iteration to for loop style from while iteration
alien588 Dec 24, 2025
44da1ba
Added a utility method for retrieval of sample rate from domain data …
alien588 Dec 24, 2025
d4b9472
2.0 example draft
alien588 Jan 6, 2026
1e67a95
tree_traversal example update
alien588 Jan 7, 2026
6b346c1
Updated Tree traversal example
alien588 Jan 7, 2026
eb83099
Added first iteration of tree traversal
alien588 Jan 9, 2026
0fafd54
Updated framework of the example
alien588 Jan 12, 2026
b5a15c3
Updated numenclatire and creted a simple version of the display sctript
alien588 Jan 12, 2026
33b3752
Addressed code review
alien588 Dec 9, 2025
cca8ea5
Missing changes required by the code review
alien588 Dec 9, 2025
ed39e4f
Removed use of block reader
alien588 Jan 6, 2026
ad407d5
Mssing dots
alien588 Jan 6, 2026
f4b2a53
Updated comment
alien588 Jan 6, 2026
a5f03dc
Updated calculation of sampleRate
alien588 Jan 6, 2026
ec07eb5
Fixed sampleRate calculation function in daq_utils
alien588 Jan 6, 2026
d02ccae
Addressing a code review
alien588 Jan 7, 2026
d27e326
Added a new utility method for checking if the data rule is linear
alien588 Jan 7, 2026
cd757d5
Refactored sample rate calculation method
alien588 Jan 7, 2026
a0d2f18
Fixed a typo
alien588 Jan 7, 2026
b4ed30e
Renaming functions and misc printout format fix
alien588 Jan 8, 2026
2d836d1
Added basic information display for nodes when traversing the tree
alien588 Jan 12, 2026
7f63be8
Updated structure
alien588 Jan 13, 2026
d2b0566
Added sceleton for globalID search
alien588 Jan 13, 2026
1a84ccd
Removed hanging TODO comments and misc.
alien588 Jan 14, 2026
c9cbf11
Removed unnecesary comments
alien588 Jan 14, 2026
2591238
Missed it
alien588 Jan 14, 2026
36bcb0e
Updated exaple to a working state
alien588 Jan 15, 2026
39204d3
Remowed access new line
alien588 Jan 15, 2026
568f656
Updated example and removed dangling comments
alien588 Jan 16, 2026
f1c6d9a
Added the new example
alien588 Jan 16, 2026
b38ad57
Introduced the enum for property separation
alien588 Jan 16, 2026
d65e190
Updated Structure of the example
alien588 Jan 16, 2026
9ece61f
Updated structure for the example
alien588 Jan 20, 2026
b00df6e
Merge branch 'main' into feature/examples-v0.6
alien588 Jan 20, 2026
481bbdb
Updated the example
alien588 Jan 20, 2026
72c0eb7
Renamed example
alien588 Jan 20, 2026
27b7ded
Renamed variable for greater clarity
alien588 Jan 20, 2026
0c8b358
Updated example description
alien588 Jan 21, 2026
4033bfe
Set required openDAQ CMake flags
JakaMohorko Jan 21, 2026
e5d530f
Disable logging, use instance builder and module path
JakaMohorko Jan 21, 2026
ef7e4af
Added a utility method for retrieval of sample rate from domain data …
alien588 Dec 24, 2025
9a1c2a7
2.0 example draft
alien588 Jan 6, 2026
e645142
Addressed code review
alien588 Dec 9, 2025
8d033ba
Missing changes required by the code review
alien588 Dec 9, 2025
034ddbb
Updated exaple to a working state
alien588 Jan 15, 2026
72765da
Updated example and removed dangling comments
alien588 Jan 16, 2026
a0ed3af
Renamed example
alien588 Jan 20, 2026
bf54bf4
Merge branch 'main' into feature/examples-v0.6
alien588 Jan 21, 2026
a5fd85e
Removing merging artifacts
alien588 Jan 21, 2026
ced9806
Removing artifacts 2.0
alien588 Jan 21, 2026
21815c5
Merge branch 'feature/examples-v0.6' into feature/examples-v0.7
alien588 Jan 21, 2026
262ef1a
Added basic handling for some attributes
alien588 Jan 21, 2026
75f63e5
Added int property
alien588 Jan 21, 2026
1a8c7b2
Updated state of prop visualization example
alien588 Jan 21, 2026
93cfbb9
Updated and added metada_c_converters
alien588 Jan 22, 2026
c317fc5
Update to the metadata example
alien588 Jan 23, 2026
beff957
Added hooks for comments, added example workflow
alien588 Jan 26, 2026
7890b1a
Missing hooks
alien588 Jan 26, 2026
aab8d7c
Added range type creation and its test
alien588 Jan 26, 2026
da35652
Removed redundant comment
alien588 Jan 26, 2026
40a2a9f
Adjusted file structure
alien588 Jan 27, 2026
b92eff6
1st iteration of C wrappers for core types
alien588 Jan 27, 2026
d961cb9
Fixed enumeration implementation
alien588 Jan 27, 2026
fe91866
Updated
alien588 Jan 27, 2026
6524936
Added header openDAQ C conversions
alien588 Jan 28, 2026
1acda8b
Minor facelift
alien588 Jan 28, 2026
37f12bc
Addressed code review
alien588 Jan 29, 2026
94f6e6c
Fixed handling of structs
alien588 Jan 29, 2026
cbcaddb
Updated enumeration handling
alien588 Jan 29, 2026
f37fef9
Added top of header description for helpers
alien588 Jan 29, 2026
44ccd00
Grammar fixes
alien588 Jan 29, 2026
e4c40ce
Merge branch 'feature/examples-v7.1' into feature/examples-v0.7
alien588 Jan 29, 2026
f64c2f6
Added Common metadata prints and default string printing
alien588 Jan 29, 2026
655de8b
Updated some displays
alien588 Jan 30, 2026
a0cf83a
Added processing for Strings and objects
alien588 Feb 2, 2026
06f4278
Added a simplified display for properties
alien588 Feb 2, 2026
badb1fb
Updated structure for PR
alien588 Feb 2, 2026
5bd6255
Added missing processing
alien588 Feb 5, 2026
300610d
Moved custom struct type into its own example
alien588 Jan 30, 2026
187ba2e
Fixed memory leak when using conversion into openDAQ
alien588 Feb 4, 2026
d47e28b
Removed redundant enumeration addition and Updated comment in String …
alien588 Feb 5, 2026
652e12f
Updated exaple to a working state
alien588 Jan 15, 2026
8b9c0b5
Updated example and removed dangling comments
alien588 Jan 16, 2026
42adc9c
Added the new example
alien588 Jan 16, 2026
f739863
Updated and added metada_c_converters
alien588 Jan 22, 2026
d66dad1
Adjusted file structure
alien588 Jan 27, 2026
0df6c6f
Updated some displays
alien588 Jan 30, 2026
6e4ffe8
Added a simplified display for properties
alien588 Feb 2, 2026
541282a
Updated structure for PR
alien588 Feb 2, 2026
0453cd2
Cmake update
alien588 Feb 5, 2026
85352f5
Updated the structure of daq_c_conversions
alien588 Feb 5, 2026
90e4287
Updated example structure
alien588 Feb 5, 2026
40085e8
Basic_conversion_example finished
alien588 Feb 5, 2026
28c6c75
Advanced conversion examples done
alien588 Feb 6, 2026
da3fb60
Added a few property parsing functions (need to be moved into their o…
alien588 Feb 6, 2026
8a6eb33
Preperation for rewrite
alien588 Feb 9, 2026
68d80d3
Updated state
alien588 Feb 10, 2026
2df4952
Added missing utils
alien588 Feb 11, 2026
8173143
Updated PR structure
alien588 Feb 11, 2026
40396ba
Pretty print updates and updated example
alien588 Feb 11, 2026
66630b2
Adjusted printing and naming style
alien588 Feb 11, 2026
dba5b55
Updated naming schemes in examples and removed redundant file
alien588 Feb 11, 2026
404d520
Updated structure of the advanced converisons example
alien588 Feb 11, 2026
708af6c
Merge branch 'main' into feature/examples-v0.7.1
alien588 Feb 11, 2026
823ec87
Addressing code review pt.1
alien588 Feb 12, 2026
cf1ab74
Addressed core review
alien588 Feb 12, 2026
c5ffbb8
Code review addressed
alien588 Feb 13, 2026
628ed9b
Renaming in progress
alien588 Feb 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ set(EXAMPLE_SOURCES
read_with_formatted_timestamps.c
print_data_descriptor_and_calculater_sample_rate.c
create_and_read_sample_rate_buffers.c
simple_properties_display_handling.c
basic_conversions_example.c
advanced_conversions_example.c
multi_reader_read_same_rates.c)


foreach(src ${EXAMPLE_SOURCES})
get_filename_component(exec_name ${src} NAME_WLE)
add_executable(${exec_name} ${src})
Expand Down
156 changes: 156 additions & 0 deletions examples/advanced_conversions_example.c
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing defined in this file should have a exdaq_ prefix. This is purely an example, not meant to be reused. Remove the prefix from the functions defined here (the used enums and structs from the header of course keep the prefix).

Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
/*
* Example that shows how to create conversion functions for custom defined in openDAQ.
* Functions demonstrate conversions to and from openDAQ structure to its
* equivalent in native C.
*/
#include <daq_example_utils.h>

// Struct conversion
/*
* Conversion from and to daqStruct objects to C style structs.
* Warning: These types of conversions require prior knowledge of
* the struct structure and its definition in C. For conversion
* from C to openDAQ a pointer to the TypeManager is needed because
* of the way openDAQ structs are implemented.
*/
struct daqExample_Coordinates daqExample_fromDaqCoordinates(daqStruct* daq)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These converters should really not use the name daq and native for variable names. They should all be changed to a more descriptive name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the conversion methods I suggested that we always use daq and native as names for input/output variables since the main purpose of these functions is the process from input argument to output variable. With native and daq it is clear where we start and what the result is. We don't necessarily know the contents of these variables and in my opinion any other names would just refer to their type (daqStruct daqStructure or similar is just dancing around keywords and type names without adding any additional information).

{
struct daqExample_Coordinates native = { 0,0,0 };

daqBaseObject* value = NULL;
daqBaseObject* integerValue = NULL;

daqString* fieldName = exdaq_toDaqString("x");
daqStruct_get(daq, fieldName, &value);
daqQueryInterface(value, DAQ_INTEGER_INTF_ID, &integerValue);
native.x = exdaq_fromDaqInteger((daqInteger*) integerValue);
daqReleaseRef(integerValue);
daqReleaseRef(value);
daqReleaseRef(fieldName);

fieldName = exdaq_toDaqString("y");
daqStruct_get(daq, fieldName, &value);
daqQueryInterface(value, DAQ_INTEGER_INTF_ID, &integerValue);
native.y = exdaq_fromDaqInteger((daqInteger*) integerValue);
daqReleaseRef(integerValue);
daqReleaseRef(value);
daqReleaseRef(fieldName);

fieldName = exdaq_toDaqString("z");
daqStruct_get(daq, fieldName, &value);
daqQueryInterface(value, DAQ_INTEGER_INTF_ID, &integerValue);
native.z = exdaq_fromDaqInteger((daqInteger*) integerValue);
daqReleaseRef(integerValue);
daqReleaseRef(value);
daqReleaseRef(fieldName);

return native;
}

daqStruct* daqExample_toDaqCoordinates(struct daqExample_Coordinates native, daqTypeManager* typeManager)
{
daqStructBuilder* builder = NULL;
daqStructBuilder_createStructBuilder(&builder, exdaq_toDaqString("DAQ_Coordinates"), typeManager);

daqString* fieldName = NULL;
daqInteger* fieldValue = NULL;

fieldName = exdaq_toDaqString("x");
fieldValue = exdaq_toDaqInteger(native.x);
daqStructBuilder_set(builder, fieldName, (daqBaseObject*) fieldValue);
daqReleaseRef(fieldName);
daqReleaseRef(fieldValue);

fieldName = exdaq_toDaqString("y");
fieldValue = exdaq_toDaqInteger(native.y);
daqStructBuilder_set(builder, fieldName, (daqBaseObject*) fieldValue);
daqReleaseRef(fieldName);
daqReleaseRef(fieldValue);

fieldName = exdaq_toDaqString("z");
fieldValue = exdaq_toDaqInteger(native.z);
daqStructBuilder_set(builder, fieldName, (daqBaseObject*) fieldValue);
daqReleaseRef(fieldName);
daqReleaseRef(fieldValue);

daqStruct* daq = NULL;
daqStructBuilder_build(builder, &daq);
daqReleaseRef(builder);

return daq;
}

// Enumeration conversion
/*
* Conversion from and to openDAQ String (daqEnumeration) core type
* from C language (enum ComponentStutesTypeEnum).
* Warning: These types of conversions require prior knowledge of
* the enumeration structure and its definition in C. For conversion
* from C to openDAQ a pointer to the TypeManager is needed because
* of the way openDAQ enumeration is implemented.
*/
enum daqExample_ComponentStatusTypeEnum daqExample_fromDaqCompStatusTypeEnum(daqEnumeration* daq)
{
int64_t intValue = -1;
daqEnumeration_getIntValue(daq, &intValue);

return intValue;
}

daqEnumeration* daqExample_toCompStatusTypeEnum(enum daqExample_ComponentStatusTypeEnum native, daqTypeManager* typeManager)
{
daqEnumeration* daq = NULL;
daqInteger* valueInt = exdaq_toDaqInteger(native);
daqString* valueName = exdaq_toDaqString("ComponentStatusType");

daqEnumeration_createEnumerationWithIntValue(&daq, valueName, valueInt, typeManager);

daqReleaseRef(valueName);
daqReleaseRef(valueInt);
return daq;
}

int main()
{
daqInstance* simulatorInstance = NULL;
setupSimulator(&simulatorInstance);
daqExmaple_addCustomTypes(simulatorInstance);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo.


daqInstance* instance = NULL;
daqDevice* simulator = NULL;
addSimulator(&simulator, &instance);

daqContext* context = NULL;
daqComponent_getContext((daqComponent*)simulator, &context);
daqTypeManager* typeManager = NULL;
daqContext_getTypeManager(context, &typeManager);

enum daqExample_ComponentStatusTypeEnum enumStatusType = daqExample_ComponentStatusType_Error;
daqEnumeration* daqEnum = daqExample_toCompStatusTypeEnum(enumStatusType, typeManager);
enum daqExample_ComponentStatusTypeEnum enumStatusType2 = daqExample_fromDaqCompStatusTypeEnum(daqEnum);

if (enumStatusType == enumStatusType2)
printf("Structs are the same after transforming them to and from openDAQ.\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enumeration, not struct.

else
printf("Structs are different!\n");

struct daqExample_Coordinates nativeCoordinates = {4, 4, 4};
daqStruct* tempStruct = daqExample_toDaqCoordinates(nativeCoordinates, typeManager);
struct daqExample_Coordinates nativeCoordinates2 = daqExample_fromDaqCoordinates(tempStruct);

if (nativeCoordinates.x == nativeCoordinates2.x &&
nativeCoordinates.y == nativeCoordinates2.y &&
nativeCoordinates.z == nativeCoordinates2.z)
printf("Enums are the same after transforming them to and from openDAQ.\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Struct, not enum.

else
printf("Enums are different!\n");

daqReleaseRef(typeManager);
daqReleaseRef(tempStruct);

daqReleaseRef(simulator);
daqReleaseRef(instance);
daqReleaseRef(simulatorInstance);

return 0;
}
50 changes: 50 additions & 0 deletions examples/basic_conversions_example.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Example that demonstrates conversions between native C types
* and their openDAQ equvalents.
*/
#include <daq_c_conversions.h>

int main()
{
// Integer example
int64_t i = 10;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ijklmn? Especially when used for different type variables. Use representative names.

daqInteger* daqIn = exdaq_toDaqInteger(i);
int64_t i2 = daqExample_fromDaqInteger(daqIn);
printf("Integer is equal: %s\n", i == i2 ? "True": "False");
daqReleaseRef(daqIn);

// Float example
double j = 1.0;
daqFloatObject* daqFl = exdaq_toDaqFloat(j);
double j2 = exdaq_fromDaqFloat(daqFl);
printf("Float is equal: %s\n", j == j2 ? "True" : "False");
daqReleaseRef(daqFl);

// String example
char* k = "check";
daqString* daqStr = exdaq_toDaqString(k);
char* k2 = exdaq_fromDaqString(daqStr);
printf("String is equal: %s\n", strcmp(k, k2) == 0 ? "True" : "False");
daqReleaseRef(daqStr);

// Bool example
uint8_t l = True;
daqBoolean* daqBl = exdaq_toDaqBoolean(l);
uint8_t l2 = exdaq_fromDaqBoolean(daqBl);
printf("Boolean is equal: %s\n", l == l2 ? "True" : "False");
daqReleaseRef(daqBl);

// Complex Number example
struct exdaq_ComplexNumber m = { 1,5 };
daqComplexNumber* daqComplex = exdaq_toDaqComplex(&m);
struct exdaq_ComplexNumber m2 = exdaq_fromDaqComplex(daqComplex);
printf("Complex Number is equal: %s\n", ((m.imaginary == m2.imaginary) && (m.real == m2.real)) ? "True" : "False");
daqReleaseRef(daqComplex);

// Range example
struct daqExample_Range n = { 1,10 };
daqRange* daqRng = exdaq_toDaqRange(n);
struct daqExample_Range n2 = exdaq_fromDaqRange(daqRng);
printf("Range is equal: %s\n", ((n.max == n2.max) && (n.min == n2.min)) ? "True" : "False");
daqReleaseRef(daqRng);
}
70 changes: 70 additions & 0 deletions examples/simple_properties_display_handling.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Example that show how to properly display all relevant attributes and
* metadata in properties.
*/
#include <daq_property_utils.h>

void printPropertyTree(daqPropertyObject* propertyObject)
{
daqList* visibleProperties = NULL;
daqPropertyObject_getVisibleProperties(propertyObject, &visibleProperties);

daqSizeT count = 0;
daqList_getCount(visibleProperties, &count);

for (daqSizeT i = 0; i < count; i++)
{
daqBaseObject* listItem = NULL;
daqProperty* property = NULL;

daqList_getItemAt(visibleProperties, i, &listItem);
daqQueryInterface(listItem, DAQ_PROPERTY_INTF_ID, &property);
daqReleaseRef(listItem);

daqCoreType valueType = daqCtUndefined;
daqProperty_getValueType(property, &valueType);

daqBaseObject* propertyValue;
daqProperty_getValue(property, &propertyValue);

printPropertyMetadata(property);

if (valueType == daqCtObject)
{
printf("---\n");
daqPropertyObject* childPropertyObject = NULL;
daqQueryInterface(propertyValue, DAQ_PROPERTY_OBJECT_INTF_ID, &childPropertyObject);
printPropertyTree(childPropertyObject);
printf("---\n\n");
daqReleaseRef(childPropertyObject);
}
else
{
printf("- Value: ");
printPropertyValueOrDefault(property, False);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As said above, should use the propertyValue as input.

printf("\n");
}

daqReleaseRef(propertyValue);
daqReleaseRef(property);
}

daqReleaseRef(visibleProperties);
}

int main()
{
daqInstance* simulatorInstance = NULL;
setupSimulator(&simulatorInstance);

daqInstance* instance = NULL;
daqDevice* simulator = NULL;
addSimulator(&simulator, &instance);

printPropertyTree((daqPropertyObject*) simulator);

daqReleaseRef(simulator);
daqReleaseRef(instance);
daqReleaseRef(simulatorInstance);
return 0;
}
Loading