-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/examples v0.6 #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
# 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
# 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, |
There was a problem hiding this comment.
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.
| Unk = 0, | |
| Unknown = 0, |
| InputPort | ||
| }; | ||
|
|
||
| void componentTreePrintOut(daqDevice* headDevice, daqDict** listOfAvailableDevices, daqBool printout); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
| 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; |
There was a problem hiding this comment.
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.
| daqDevice* device = NULL; | ||
| daqQueryInterface(listMember, DAQ_DEVICE_INTF_ID, &device); | ||
| printDaqDevice(device, listOfAvailableDevices, printout); | ||
| daqReleaseRef(device); | ||
| daqReleaseRef(listMember); |
There was a problem hiding this comment.
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.
| daqComponent_getGlobalId(component, &globalId); | ||
| daqComponent_getDescription(component, &description); | ||
|
|
||
| daqDict_set(listOfAvailableDevices, globalId, description); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
| void printDaqSignal(daqSignal* signal, daqDict* listOfAvailableDevices, daqBool printout); | ||
| void printInputPort(daqInputPort* inputPort, daqDict* listOfAvailableDevices, daqBool printout); | ||
| void printDaqSyncComponent(daqSyncComponent* syncComp, daqDict* listOfAvailableDevices, daqBool printout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are duplicates.
| daqList* keys = NULL; | ||
| daqDict_getKeyList(listOfComponents, &keys); | ||
| daqIterator* iterator = NULL; | ||
| daqList_createStartIterator(keys, &iterator); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
Tree traversal example completed.