Skip to content

Commit

Permalink
Move prefix/port messages from on-detection to on-connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Dewb committed Sep 28, 2024
1 parent 16827b0 commit 47ade47
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 0 additions & 3 deletions lib/serialosc/SerialOsc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,6 @@ void SerialOsc::ProcessMessage(const osc::ReceivedMessage& m, const IpEndpointNa
// wait until after size message recieved -MD
// listener->deviceFound(device);
sendDeviceInfoMessage(device->port);

sendDevicePrefixMessage(port);
sendDevicePortMessage(port);
}
else if (address == "/serialosc/remove")
{
Expand Down
10 changes: 10 additions & 0 deletions src/common/core/GridConnection/GridConnection.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "GridConnection.hpp"
#include "SerialOscInterface.hpp"

void GridConnectionManager::registerGrid(Grid* grid)
{
Expand Down Expand Up @@ -76,6 +77,15 @@ void GridConnectionManager::connect(Grid* grid, IGridConsumer* consumer)
consumerToGridMap[consumer] = grid;
idToConsumerMap[grid->getDevice().id] = consumer;
consumer->gridConnected(grid);

// If serialosc is managing the grid (e.g. it's a hardware grid), inform serialosc about new grid owner
auto port = grid->getDevice().port;
auto so = SerialOscInterface::get();
if (port > 0 && so != nullptr && so->driver != nullptr)
{
so->driver->sendDevicePrefixMessage(port);
so->driver->sendDevicePortMessage(port);
}
}

bool GridConnectionManager::isConnected(IGridConsumer* consumer)
Expand Down

0 comments on commit 47ade47

Please sign in to comment.