Add methods to receive and write raw FSD messages

This commit adds methods to register for live FSD message reception. The
amount of traffic can be quite high, therefore no normal signal is used -
which would be available via DBus. Instead one has to connect manually
by passing a functor. This guarantees that we communicate only in-process.
If someone tries to connect on the proxy side, the connection will fail.
This needs to be handled properly in client code.
This commit also adds a method to write the FSD message to a selected file.

Maniphest Tasks: T222
This commit is contained in:
Roland Winklmeier
2018-01-22 14:18:50 +01:00
parent 7b9ad0ea07
commit 704068d299
13 changed files with 236 additions and 2 deletions

View File

@@ -751,5 +751,16 @@ namespace BlackCore
rooms.push_back(s2.getVoiceRoom());
return rooms;
}
QMetaObject::Connection CContextNetwork::connectRawFsdMessageSignal(QObject *receiver, RawFsdMessageReceivedSlot rawFsdMessageReceivedSlot)
{
Q_ASSERT_X(receiver, Q_FUNC_INFO, "Missing receiver");
// bind does not allow to define connection type, so we use receiver as workaround
const QMetaObject::Connection uc; // unconnected
const QMetaObject::Connection c = rawFsdMessageReceivedSlot ? connect(m_network, &INetwork::rawFsdMessageReceived, receiver, rawFsdMessageReceivedSlot) : uc;
Q_ASSERT_X(c || !rawFsdMessageReceivedSlot, Q_FUNC_INFO, "connect failed");
return c;
}
} // namespace
} // namespace