Skip to content

Commit a28afd8

Browse files
committed
DPL MCP: add ability to start a stopped topology
1 parent 401d04c commit a28afd8

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Framework/Core/src/StatusWebSocketHandler.cxx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "DPLWebSocket.h"
1414
#include "DriverServerContext.h"
1515
#include "Framework/DeviceControl.h"
16+
#include <csignal>
17+
#include <unistd.h>
1618
#include "Framework/DeviceController.h"
1719
#include "Framework/DeviceInfo.h"
1820
#include "Framework/DeviceMetricsInfo.h"
@@ -254,6 +256,8 @@ void StatusWebSocketHandler::frame(char const* data, size_t s)
254256
handleSubscribeLogs(deviceName);
255257
} else if (cmd == "unsubscribe_logs") {
256258
handleUnsubscribeLogs(deviceName);
259+
} else if (cmd == "start_devices") {
260+
handleStartDevices();
257261
} else if (cmd == "enable_signpost") {
258262
handleEnableSignpost(deviceName, extractArrayField(msg, "streams"));
259263
} else if (cmd == "disable_signpost") {
@@ -441,6 +445,15 @@ size_t StatusWebSocketHandler::findDeviceIndex(std::string_view name) const
441445
return SIZE_MAX;
442446
}
443447

448+
void StatusWebSocketHandler::handleStartDevices()
449+
{
450+
for (auto const& info : *mContext.infos) {
451+
if (info.active) {
452+
kill(info.pid, SIGCONT);
453+
}
454+
}
455+
}
456+
444457
void StatusWebSocketHandler::handleEnableSignpost(std::string_view deviceName, std::string_view streamsArr)
445458
{
446459
if (streamsArr.empty()) {

Framework/Core/src/StatusWebSocketHandler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ struct StatusWebSocketHandler : public WebSocketHandler {
9595
void handleUnsubscribe(std::string_view deviceName, std::string_view metricsJson);
9696
void handleSubscribeLogs(std::string_view deviceName);
9797
void handleUnsubscribeLogs(std::string_view deviceName);
98+
void handleStartDevices();
9899
void handleEnableSignpost(std::string_view deviceName, std::string_view streamsArr);
99100
void handleDisableSignpost(std::string_view deviceName, std::string_view streamsArr);
100101
size_t findDeviceIndex(std::string_view name) const;

0 commit comments

Comments
 (0)