Skip to content

Conversation

@alien588
Copy link
Collaborator

Tree traversal example completed.

# Conflicts:
#	examples/4_filter_and_read_last_value_of_signal.c
#	examples/6_read_with_formatted_timestamps.c
#	examples/util_headers/daq_utils.h
misc: Added skeleton structure for application final iteration
It now displays the tree structure of the connected simulator
@alien588 alien588 requested a review from JakaMohorko January 16, 2026 07:56
@alien588 alien588 self-assigned this Jan 19, 2026
alien588 and others added 17 commits January 20, 2026 14:02
# Conflicts:
#	examples/7_print_data_descriptor_and_calculater_sample_rate.c
#	examples/8_create_and_read_sample_rate_buffers.c
#	examples/CMakeLists.txt
#	examples/util_headers/daq_utils.h
# Conflicts:
#	examples/4_filter_and_read_last_value_of_signal.c
#	examples/6_read_with_formatted_timestamps.c
#	examples/util_headers/daq_utils.h
It now displays the tree structure of the connected simulator

# Conflicts:
#	examples/2_0_tree_traversal.c
# Conflicts:
#	examples/CMakeLists.txt

enum ComponentType
{
Unk = 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should use full words where abbreviations are redundant.

Suggested change
Unk = 0,
Unknown = 0,

InputPort
};

void componentTreePrintOut(daqDevice* headDevice, daqDict** listOfAvailableDevices, daqBool printout);
Copy link
Contributor

Choose a reason for hiding this comment

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

printComponentTree to be consistent.

void addDaqComponentToDict(daqDict* listOfAvailableDevices, daqComponent* component);


void addDaqComponentToDict(daqDict* listOfAvailableDevices, daqComponent* component)
Copy link
Contributor

Choose a reason for hiding this comment

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

The last declaration is implemented first. The order of implementations should follow the declaration order.

Comment on lines +66 to +85
if (DAQ_SUPPORTS_INTERFACE(listMember, DAQ_DEVICE_INTF_ID) && (componentType == Unk))
componentType = Device;

if (DAQ_SUPPORTS_INTERFACE(listMember, DAQ_SERVER_INTF_ID) && (componentType == Unk))
componentType = Server;

if (DAQ_SUPPORTS_INTERFACE(listMember, DAQ_SYNC_COMPONENT_INTF_ID) && (componentType == Unk))
componentType = SyncComponent;

if (DAQ_SUPPORTS_INTERFACE(listMember, DAQ_FUNCTION_BLOCK_INTF_ID) && (componentType == Unk))
componentType = FunctionBlock;

if (DAQ_SUPPORTS_INTERFACE(listMember, DAQ_FOLDER_INTF_ID) && (componentType == Unk))
componentType = Folder;

if (DAQ_SUPPORTS_INTERFACE(listMember, DAQ_INPUT_PORT_INTF_ID) && (componentType == Unk))
componentType = InputPort;

if (DAQ_SUPPORTS_INTERFACE(listMember, DAQ_SIGNAL_INTF_ID) && (componentType == Unk))
componentType = Signal;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be in its own function getComponentType.

Comment on lines +98 to +102
daqDevice* device = NULL;
daqQueryInterface(listMember, DAQ_DEVICE_INTF_ID, &device);
printDaqDevice(device, listOfAvailableDevices, printout);
daqReleaseRef(device);
daqReleaseRef(listMember);
Copy link
Contributor

Choose a reason for hiding this comment

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

Move the query interfaces inside the print functions. It'll be more legible.

Comment on lines +41 to +44
daqComponent_getGlobalId(component, &globalId);
daqComponent_getDescription(component, &description);

daqDict_set(listOfAvailableDevices, globalId, description);
Copy link
Contributor

Choose a reason for hiding this comment

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

The description is never used.

daqDevice_getInputsOutputsFolder(device, &ioFolder);
if (ioFolder != NULL)
{
printDaqFolder(ioFolder, listOfAvailableDevices, printout);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just have a method called printIOComponent.

Comment on lines +26 to +28
void printDaqSignal(daqSignal* signal, daqDict* listOfAvailableDevices, daqBool printout);
void printInputPort(daqInputPort* inputPort, daqDict* listOfAvailableDevices, daqBool printout);
void printDaqSyncComponent(daqSyncComponent* syncComp, daqDict* listOfAvailableDevices, daqBool printout);
Copy link
Contributor

Choose a reason for hiding this comment

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

These are duplicates.

Comment on lines +357 to +360
daqList* keys = NULL;
daqDict_getKeyList(listOfComponents, &keys);
daqIterator* iterator = NULL;
daqList_createStartIterator(keys, &iterator);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this a dictionary if all that's being printed out are the global IDs?

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

daqDict* listOfComponents = NULL;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see the need why we would want to collect all components here. The goal is to do a DFS tree traversal and print out all component IDs and potentially names/other metadata.

Caching all global IDs only to later just print them out seems redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants