Root client FB as a device - #21
Merged
Merged
Conversation
viacheslauK
force-pushed
the
mqtt-as-device
branch
from
August 26, 2026 09:58
649b5f1 to
16e7c6d
Compare
…qtt:// connection string
viacheslauK
force-pushed
the
mqtt-as-device
branch
from
August 26, 2026 10:08
16e7c6d to
1b33caa
Compare
viacheslauK
marked this pull request as ready for review
August 26, 2026 10:08
There was a problem hiding this comment.
looks good to me. just one note
I created the device. and subscriber fb
then when im trying to remove the subscriber fb I have an exception
Exception in Tkinter callback
Traceback (most recent call last):
File "/opt/homebrew/Cellar/python@3.13/3.13.7/Frameworks/Python.framework/Versions/3.13/lib/python3.13/tkinter/__init__.py", line 2074, in __call__
return self.func(*args)
~~~~~~~~~^^^^^^^
File "/Users/deniserokhin/projects/openDAQ/examples/applications/python/GUI Application/gui_demo.py", line 704, in <lambda>
command=lambda: self.handle_tree_menu_remove_function_block(node)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/Users/deniserokhin/projects/openDAQ/examples/applications/python/GUI Application/gui_demo.py", line 1018, in handle_tree_menu_remove_function_block
parent_fb.remove_function_block(node)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
RuntimeError: Device does not allow adding/removing function blocks. [ /root/opendaq/build/_deps/opendaq-src/core/opendaq/device/include/opendaq/device_impl.h:886 ]
- Caused by: [ /root/opendaq/build/_deps/opendaq-src/core/opendaq/signal/include/opendaq/signal_container_impl.h:640 ]
- Caused by: [ /Users/deniserokhin/projects/openDAQ/core/opendaq/signal/include/opendaq/signal_container_impl.h:640 ]
with publisher the same issue
to fix it you have override void onRemoveFunctionBlock(const FunctionBlockPtr& functionBlock) method
another question can Publisher create JSONConfig, so it will be easier to check subcriber?
denise-opendaq
approved these changes
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Converts the MQTT broker connection point from a top-level function block (
MQTTClientFB) into an openDAQ device (OpenDAQMQTTDevice) added viainstance.addDevice("daq.mqtt://<host>[:<port>]"). The publisher, subscriber and JSON decoder FBs are unchanged.Changes
MqttStreamingModuleimplementsonGetAvailableDeviceTypes/onCreateDevicein place of the function-block pair.Portproperty and is written back into it.MqttClientFbImpl : FunctionBlock→MqttClientDeviceImpl : Device(files renamed), with aDeviceType, a separateCreateDefaultConfig(), andonGetInfo. Nested FB offering is unchanged.addConfigurationConnectionStatus, surfaced asConfigurationStatus).BrokerAddressremoved (host comes from the connection string),BrokerPortrenamed toPortand documented as the fallback when the connection string has no port.test_mqtt_client_fb.cpp→test_mqtt_client_device.cpp, rewritten aroundaddDeviceand extended with connection-string,DeviceInfoandConfigurationStatuscases.Notes
addFunctionBlock("MQTTClientFB", ...)no longer works andBrokerAddressis gone; callers must useaddDevice("daq.mqtt://...").