* @brief Broadcasts a lifecycle event to all connected API clients. */
| 735 | * @brief Broadcasts a lifecycle event to all connected API clients. |
| 736 | */ |
| 737 | void API::Server::broadcastLifecycleEvent(const QString& eventName) |
| 738 | { |
| 739 | Q_ASSERT(!eventName.isEmpty()); |
| 740 | Q_ASSERT(m_worker); |
| 741 | |
| 742 | if (!enabled()) |
| 743 | return; |
| 744 | |
| 745 | QJsonObject event; |
| 746 | event.insert(QStringLiteral("event"), eventName); |
| 747 | |
| 748 | auto* worker = static_cast<ServerWorker*>(m_worker); |
| 749 | QMetaObject::invokeMethod( |
| 750 | worker, "broadcastEvent", Qt::QueuedConnection, Q_ARG(QJsonObject, event)); |
| 751 | } |
| 752 | |
| 753 | //-------------------------------------------------------------------------------------------------- |
| 754 | // Server: data reception helpers |
no test coverage detected