Issue #94 Implement $SF packet to toggle visual pilot data sending

Still send a visual pilot data update at the slow rate of
every 5 seconds when visual pilot data update is disabled.
This commit is contained in:
Mat Sutcliffe
2022-01-23 19:33:09 +00:00
parent 872f546881
commit a4448dddc6
7 changed files with 173 additions and 20 deletions

View File

@@ -38,6 +38,7 @@
#include "blackcore/fsd/servererror.h"
#include "blackcore/fsd/interimpilotdataupdate.h"
#include "blackcore/fsd/visualpilotdataupdate.h"
#include "blackcore/fsd/visualpilotdatatoggle.h"
#include "blackcore/fsd/planeinforequest.h"
#include "blackcore/fsd/planeinformation.h"
#include "blackcore/fsd/planeinforequestfsinn.h"
@@ -86,6 +87,7 @@ namespace BlackMiscTest
void testPBH();
void testPilotDataUpdate();
void testVisualPilotDataUpdate();
void testVisualPilotDataToggle();
void testPing();
void testPlaneInfoRequest();
void testPlaneInformation();
@@ -543,6 +545,25 @@ namespace BlackMiscTest
QCOMPARE(0.0, messageFromTokens.m_noseGearAngle);
}
void CTestFsdMessages::testVisualPilotDataToggle()
{
const VisualPilotDataToggle message("SERVER", "ABCD", true);
QCOMPARE(QString("SERVER"), message.sender());
QCOMPARE(QString("ABCD"), message.m_client);
QCOMPARE(true, message.m_active);
QString stringRef("SERVER:ABCD:1");
QString str = message.toTokens().join(":");
QCOMPARE(str, stringRef);
QStringList tokens = QString("SERVER:ABCD:1").split(':');
auto messageFromTokens = VisualPilotDataToggle::fromTokens(tokens);
QCOMPARE(QString("SERVER"), messageFromTokens.sender());
QCOMPARE(QString("ABCD"), messageFromTokens.m_client);
QCOMPARE(true, messageFromTokens.m_active);
}
void CTestFsdMessages::testPing()
{
const Ping message("ABCD", "SERVER", "85275222");