Skip to content

TBBAS-2923, TBBAS-2924#6

Merged
viacheslauK merged 5 commits intomainfrom
TBBAS-2923-2924
Dec 23, 2025
Merged

TBBAS-2923, TBBAS-2924#6
viacheslauK merged 5 commits intomainfrom
TBBAS-2923-2924

Conversation

@viacheslauK
Copy link
Copy Markdown
Collaborator

@viacheslauK viacheslauK commented Dec 10, 2025

  • Reworking the MQTT daq::Device into a MQTT daq::FunctionBlock;
  • Implemented ConnectionStatus for MQTT root FB ("Connected", "Reconnecting", "Disconnected");

@viacheslauK viacheslauK marked this pull request as ready for review December 15, 2025 08:16
Copy link
Copy Markdown

@NikolaiShipilov NikolaiShipilov left a comment

Choose a reason for hiding this comment

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

lgtm, just added few suggestions.

And also maybe a general note on statuses - currently the state while client is trying to reconnect to the broker isn't really informative for python GUI users - because only ComponentStatus is visible in main window (additional statuses are displayed in separate windows) - and it is always OK.
The best approach to address this would be to show all statuses (or just important ones) in main window. However, we should keep in mind if this won't be possible for some reason then the making the ComponentStatus be dependent on ConnectionStatus is a solution.

Comment thread README.md

void MqttRootFbImpl::initProperties(const PropertyObjectPtr& config)
{
for (const auto& prop : config.getAllProperties())
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

To simplify implementation here I suggest to make the whole config object to be a single object-type property (nested property object) of FB

    auto prop = ObjectPropertyBuilder("Config", config).setReadOnly(true).build();
    objPtr.addProperty(prop);

subscriber->setConnectionLostCb(
[this](std::string msg)
{
setConnectionStatus(ConnectionStatus::Reconnecting, msg);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since paho itself does not provide anything as info message for disconnection callbacks it makes sense to add a short descriptive message default into our paho wrapper:

void MqttAsyncClient::onConnectionLost(void* context, char* cause)
{
    std::string msg((cause) ? cause : "some descriptive message");
    // Reconnect procedure here!
    if (context != nullptr)
    {
        auto clienttInst = (MqttAsyncClient*)context;
        clienttInst->pendingConnect = false;
        auto lock = clienttInst->getCbLock();
        if (clienttInst->onConnectionLostCb)
            clienttInst->onConnectionLostCb(msg);
    }
}

@viacheslauK viacheslauK merged commit 86915c6 into main Dec 23, 2025
@viacheslauK viacheslauK deleted the TBBAS-2923-2924 branch January 28, 2026 10:15
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.

2 participants