This commit is contained in:
Roland Rossgotterer
2019-10-11 17:01:32 +02:00
committed by Mat Sutcliffe
parent 2c89275ea6
commit 11ee2413b5
38 changed files with 501 additions and 324 deletions

View File

@@ -21,16 +21,21 @@ namespace BlackCore
{
namespace Fsd
{
//! FSD Message: ATC data update
class BLACKCORE_EXPORT AtcDataUpdate : public MessageBase
{
public:
//! Constructor
AtcDataUpdate(const QString &sender, int frequencykHz, BlackMisc::Network::CFacilityType facility, int visibleRange, AtcRating rating,
double latitude, double longitude, int elevation);
virtual ~AtcDataUpdate() {}
double latitude, double longitude, int elevation);
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static AtcDataUpdate fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "%"; }
int m_frequencykHz = 0.0;
@@ -45,6 +50,7 @@ namespace BlackCore
AtcDataUpdate();
};
//! Equal to operator
inline bool operator==(const AtcDataUpdate &lhs, const AtcDataUpdate &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -58,6 +64,7 @@ namespace BlackCore
lhs.m_elevation == rhs.m_elevation;
}
//! Not equal to operator
inline bool operator!=(const AtcDataUpdate &lhs, const AtcDataUpdate &rhs)
{
return !(lhs == rhs);

View File

@@ -17,15 +17,20 @@ namespace BlackCore
{
namespace Fsd
{
//! FSD Message: auth challenge
class BLACKCORE_EXPORT AuthChallenge : public MessageBase
{
public:
//! Constructor
AuthChallenge(const QString &sender, const QString &target, const QString &challengeKey);
virtual ~AuthChallenge() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static AuthChallenge fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return QStringLiteral("$ZC"); }
QString m_challengeKey;
@@ -34,6 +39,7 @@ namespace BlackCore
AuthChallenge();
};
//! Equal to operator
inline bool operator==(const AuthChallenge &lhs, const AuthChallenge &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -41,6 +47,7 @@ namespace BlackCore
lhs.m_challengeKey == rhs.m_challengeKey;
}
//! Not equal to operator
inline bool operator!=(const AuthChallenge &lhs, const AuthChallenge &rhs)
{
return !(lhs == rhs);

View File

@@ -22,12 +22,16 @@ namespace BlackCore
class BLACKCORE_EXPORT AuthResponse : public MessageBase
{
public:
//! Constructor
AuthResponse(const QString &sender, const QString &receiver, const QString &response);
virtual ~AuthResponse() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static AuthResponse fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return QStringLiteral("$ZR"); }
QString m_response;
@@ -36,6 +40,7 @@ namespace BlackCore
AuthResponse();
};
//! Equal to operator
inline bool operator==(const AuthResponse &lhs, const AuthResponse &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -43,6 +48,7 @@ namespace BlackCore
lhs.m_response == rhs.m_response;
}
//! Not equal to operator
inline bool operator!=(const AuthResponse &lhs, const AuthResponse &rhs)
{
return !(lhs == rhs);

View File

@@ -24,13 +24,17 @@ namespace BlackCore
class BLACKCORE_EXPORT ClientIdentification : public MessageBase
{
public:
//! Constructor
ClientIdentification(const QString &sender, quint16 clientId, const QString &clientName, int clientVersionMajor, int clientVersionMinor,
const QString &userCid, const QString &sysUid, const QString &initialChallenge);
virtual ~ClientIdentification() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static ClientIdentification fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "$ID"; }
std::uint16_t m_clientId;
@@ -45,6 +49,7 @@ namespace BlackCore
ClientIdentification();
};
//! Equal to operator
inline bool operator==(const ClientIdentification &lhs, const ClientIdentification &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -58,6 +63,7 @@ namespace BlackCore
lhs.m_initialChallenge == rhs.m_initialChallenge;
}
//! Not equal to operator
inline bool operator!=(const ClientIdentification &lhs, const ClientIdentification &rhs)
{
return !(lhs == rhs);

View File

@@ -27,11 +27,16 @@ namespace BlackCore
class BLACKCORE_EXPORT ClientQuery : public MessageBase
{
public:
//! Constructor
ClientQuery(const QString &sender, const QString &clientToBeQueried, ClientQueryType queryType, const QStringList &queryData = {});
virtual ~ClientQuery() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static ClientQuery fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "$CQ"; }
ClientQueryType m_queryType = ClientQueryType::Unknown;
@@ -41,6 +46,7 @@ namespace BlackCore
ClientQuery();
};
//! Equal to operator
inline bool operator==(const ClientQuery &lhs, const ClientQuery &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -49,6 +55,7 @@ namespace BlackCore
lhs.m_queryData == rhs.m_queryData;
}
//! Not equal to operator
inline bool operator!=(const ClientQuery &lhs, const ClientQuery &rhs)
{
return !(lhs == rhs);

View File

@@ -22,14 +22,18 @@ namespace BlackCore
class BLACKCORE_EXPORT ClientResponse : public MessageBase
{
public:
//! Constructor
ClientResponse(const QString &sender, const QString &receiver, ClientQueryType queryType, const QStringList &responseData);
virtual ~ClientResponse() {}
bool isUnknownQuery() const { return m_queryType == ClientQueryType::Unknown; }
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static ClientResponse fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "$CR"; }
ClientQueryType m_queryType;
@@ -39,6 +43,7 @@ namespace BlackCore
ClientResponse();
};
//! Equal to operator
inline bool operator==(const ClientResponse &lhs, const ClientResponse &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -47,6 +52,7 @@ namespace BlackCore
lhs.m_responseData == rhs.m_responseData;
}
//! Not equal to operator
inline bool operator!=(const ClientResponse &lhs, const ClientResponse &rhs)
{
return !(lhs == rhs);

View File

@@ -17,14 +17,21 @@ namespace BlackCore
{
namespace Fsd
{
//! FSD Message Delete ATC
class BLACKCORE_EXPORT DeleteAtc : public MessageBase
{
public:
//! Constructor
DeleteAtc(const QString &sender, const QString &cid);
virtual ~DeleteAtc() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static DeleteAtc fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "#DA"; }
QString m_cid;
@@ -33,6 +40,7 @@ namespace BlackCore
DeleteAtc();
};
//! Equal to operator
inline bool operator==(const DeleteAtc &lhs, const DeleteAtc &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -40,6 +48,7 @@ namespace BlackCore
lhs.m_cid == rhs.m_cid;
}
//! Not equal to operator
inline bool operator!=(const DeleteAtc &lhs, const DeleteAtc &rhs)
{
return !(lhs == rhs);

View File

@@ -22,11 +22,16 @@ namespace BlackCore
class BLACKCORE_EXPORT DeletePilot : public MessageBase
{
public:
//! Constructor
DeletePilot(const QString &sender, const QString &cid);
virtual ~DeletePilot() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static DeletePilot fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return QStringLiteral("#DP"); }
QString m_cid;
@@ -35,14 +40,16 @@ namespace BlackCore
DeletePilot();
};
inline bool operator==(const DeletePilot& lhs, const DeletePilot& rhs)
//! Equal to operator
inline bool operator==(const DeletePilot &lhs, const DeletePilot &rhs)
{
return lhs.sender() == rhs.sender() &&
lhs.receiver() == rhs.receiver() &&
lhs.m_cid == rhs.m_cid;
}
inline bool operator!=(const DeletePilot& lhs, const DeletePilot& rhs)
//! Not equal to operator
inline bool operator!=(const DeletePilot &lhs, const DeletePilot &rhs)
{
return !(lhs == rhs);
}

View File

@@ -18,18 +18,23 @@ namespace BlackCore
{
namespace Fsd
{
//! FSD Message: flightplan
class BLACKCORE_EXPORT FlightPlan : public MessageBase
{
public:
//! Constructor
FlightPlan(const QString &sender, const QString &receiver, FlightType flightType, const QString &aircraftIcaoType,
int trueCruisingSpeed, const QString &depAirport, int estimatedDepTime, int actualDepTime, const QString &cruiseAlt,
const QString &destAirport, int hoursEnroute, int minutesEnroute, int fuelAvailHours, int fuelAvailMinutes,
const QString &altAirport, const QString &remarks, const QString &route);
virtual ~FlightPlan() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static FlightPlan fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "$FP"; }
FlightType m_flightType;
@@ -52,6 +57,7 @@ namespace BlackCore
FlightPlan();
};
//! Equal to operator
inline bool operator==(const FlightPlan &lhs, const FlightPlan &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -73,6 +79,7 @@ namespace BlackCore
lhs.m_route == rhs.m_route;
}
//! Not equal to operator
inline bool operator!=(const FlightPlan &lhs, const FlightPlan &rhs)
{
return !(lhs == rhs);

View File

@@ -21,12 +21,16 @@ namespace BlackCore
class BLACKCORE_EXPORT FSDIdentification : public MessageBase
{
public:
//! Constructor
FSDIdentification(const QString &callsign, const QString &receiver, const QString &serverVersion, const QString &initialChallenge);
virtual ~FSDIdentification() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static FSDIdentification fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "$DI"; }
QString m_serverVersion;

View File

@@ -17,18 +17,22 @@ namespace BlackCore
{
namespace Fsd
{
//! Interim pilot data update sent to specific receivers faster than
//! the standard broadcast update.
class BLACKCORE_EXPORT InterimPilotDataUpdate : public MessageBase
{
public:
//! Constructor
InterimPilotDataUpdate(const QString &sender, const QString &receiver, double latitude, double longitude, int altitudeTrue,
int groundSpeed, double pitch, double bank, double heading, bool onGround);
virtual ~InterimPilotDataUpdate() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static InterimPilotDataUpdate fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "#SB"; }
double m_latitude = 0.0;
@@ -44,6 +48,7 @@ namespace BlackCore
InterimPilotDataUpdate();
};
//! Equal to operator
inline bool operator==(const InterimPilotDataUpdate &lhs, const InterimPilotDataUpdate &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -57,6 +62,7 @@ namespace BlackCore
lhs.m_onGround == rhs.m_onGround;
}
//! Not equal to operator
inline bool operator!=(const InterimPilotDataUpdate &lhs, const InterimPilotDataUpdate &rhs)
{
return !(lhs == rhs);

View File

@@ -17,15 +17,21 @@ namespace BlackCore
{
namespace Fsd
{
//! Kill request initiated from the server or supervisor.
//! Client needs to disconnect immediatly upon receiving it.
class BLACKCORE_EXPORT KillRequest : public MessageBase
{
public:
//! Constructor
KillRequest(const QString &sender, const QString &receiver, const QString &reason);
virtual ~KillRequest() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static KillRequest fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "$!!"; }
QString m_reason;
@@ -34,6 +40,7 @@ namespace BlackCore
KillRequest();
};
//! Equal to operator
inline bool operator==(const KillRequest &lhs, const KillRequest &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -41,6 +48,7 @@ namespace BlackCore
lhs.m_reason == rhs.m_reason;
}
//! Not equal to operator
inline bool operator!=(const KillRequest &lhs, const KillRequest &rhs)
{
return !(lhs == rhs);

View File

@@ -44,22 +44,36 @@ namespace BlackCore
{
namespace Fsd
{
//! FSD message base class
class BLACKCORE_EXPORT MessageBase
{
public:
//! Default Constructor
MessageBase() {}
//! Constructor
MessageBase(const QString &sender);
//! Constructor
MessageBase(const QString &sender, const QString &receiver);
virtual ~MessageBase() {}
//! Set callsign
void setCallsign(const QString &sender) { m_sender = sender; }
//! get message sender
QString sender() const { return m_sender; }
//! Set message receiver
void setReceiver(const QString &receiver) { m_receiver = receiver; }
//! Get message receiver
QString receiver() const { return m_receiver; }
//! Is message valid?
bool isValid() const { return m_isValid; }
//! set message valid
void setValid(bool isValid) { m_isValid = isValid; }
protected:
@@ -67,10 +81,10 @@ namespace BlackCore
// Meta data
// MessageType messageType = MessageType::Unknown;
QString m_sender;
QString m_receiver;
QString m_sender; //!< message sender
QString m_receiver; //!< message receiver
bool m_isValid = true;
bool m_isValid = true; //!< is valid?
};
}
}

View File

@@ -18,7 +18,7 @@ namespace BlackCore
{
namespace Fsd
{
//! Pitch bank heading union
union PBH
{
unsigned int pbh = 0; //!< Pitch/Bank/Heading as integer value
@@ -32,21 +32,25 @@ namespace BlackCore
};
};
//! Pitch multiplier
constexpr double pitchMultiplier()
{
return 256.0 / 90.0;
}
//! Bank multiplier
constexpr double bankMultiplier()
{
return 512.0 / 180.0;
}
//! Heading multiplier
constexpr double headingMultiplier()
{
return 1024.0 / 360.0;
}
//! Pack pitch, bank, heading and onGround into 32 bit integer
inline void packPBH(double pitch, double bank, double heading, bool onGround, quint32 &pbh)
{
PBH pbhstrct;
@@ -63,6 +67,7 @@ namespace BlackCore
pbh = pbhstrct.pbh;
}
//! Unpack pitch, bank, heading and onGround from 32 bit integer
inline void unpackPBH(quint32 pbh, double &pitch, double &bank, double &heading, bool &onGround)
{
PBH pbhstrct;

View File

@@ -19,17 +19,21 @@ namespace BlackCore
{
namespace Fsd
{
//! Pilot data update broadcasted to all clients in range every 5 seconds.
class BLACKCORE_EXPORT PilotDataUpdate : public MessageBase
{
public:
//! Constructor
PilotDataUpdate(BlackMisc::Aviation::CTransponder::TransponderMode transponderMode, const QString &sender, int transponderCode, PilotRating rating, double latitude, double longitude, int altitudeTrue, int altitudePressure, int groundSpeed,
double pitch, double bank, double heading, bool onGround);
virtual ~PilotDataUpdate() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static PilotDataUpdate fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "@"; }
BlackMisc::Aviation::CTransponder::TransponderMode m_transponderMode = BlackMisc::Aviation::CTransponder::StateStandby;
@@ -49,6 +53,7 @@ namespace BlackCore
PilotDataUpdate();
};
//! Equal to operator
inline bool operator==(const PilotDataUpdate &lhs, const PilotDataUpdate &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -67,6 +72,7 @@ namespace BlackCore
lhs.m_onGround == rhs.m_onGround;
}
//! Not equal to operator
inline bool operator!=(const PilotDataUpdate &lhs, const PilotDataUpdate &rhs)
{
return !(lhs == rhs);

View File

@@ -17,14 +17,20 @@ namespace BlackCore
{
namespace Fsd
{
//! Ping. Needs to be answered with a pong.
class BLACKCORE_EXPORT Ping : public MessageBase
{
public:
//! Constructor
Ping(const QString &sender, const QString &receiver, const QString &timestamp);
virtual ~Ping() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static Ping fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "$PI"; }
QString m_timestamp;
@@ -33,6 +39,7 @@ namespace BlackCore
Ping();
};
//! Equal to operator
inline bool operator==(const Ping &lhs, const Ping &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -40,6 +47,7 @@ namespace BlackCore
lhs.m_timestamp == rhs.m_timestamp;
}
//! Not equal to operator
inline bool operator!=(const Ping &lhs, const Ping &rhs)
{
return !(lhs == rhs);

View File

@@ -17,6 +17,8 @@ namespace BlackCore
{
namespace Fsd
{
//! Request to send plane information.
//! Shall be answered by a PlaneInformation message.
class BLACKCORE_EXPORT PlaneInfoRequest : public MessageBase
{
public:
@@ -24,20 +26,27 @@ namespace BlackCore
virtual ~PlaneInfoRequest() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static PlaneInfoRequest fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return QStringLiteral("#SB"); }
private:
PlaneInfoRequest();
};
//! Equal to operator
inline bool operator==(const PlaneInfoRequest &lhs, const PlaneInfoRequest &rhs)
{
return lhs.sender() == rhs.sender() &&
lhs.receiver() == rhs.receiver();
}
//! Not equal to operator
inline bool operator!=(const PlaneInfoRequest &lhs, const PlaneInfoRequest &rhs)
{
return !(lhs == rhs);

View File

@@ -17,9 +17,11 @@ namespace BlackCore
{
namespace Fsd
{
//! FSinn specific version of plane information request
class BLACKCORE_EXPORT PlaneInfoRequestFsinn : public MessageBase
{
public:
//! Constructor
PlaneInfoRequestFsinn(const QString &sender,
const QString &receiver,
const QString &airlineIcao,
@@ -29,8 +31,13 @@ namespace BlackCore
virtual ~PlaneInfoRequestFsinn() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static PlaneInfoRequestFsinn fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return QStringLiteral("#SB"); }
QString m_airlineIcao;
@@ -42,6 +49,7 @@ namespace BlackCore
PlaneInfoRequestFsinn();
};
//! Equal to operator
inline bool operator==(const PlaneInfoRequestFsinn &lhs, const PlaneInfoRequestFsinn &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -52,6 +60,7 @@ namespace BlackCore
lhs.m_sendMModelString == rhs.m_sendMModelString;
}
//! Not equal to operator
inline bool operator!=(const PlaneInfoRequestFsinn &lhs, const PlaneInfoRequestFsinn &rhs)
{
return !(lhs == rhs);

View File

@@ -22,12 +22,16 @@ namespace BlackCore
class BLACKCORE_EXPORT PlaneInformation : public MessageBase
{
public:
//! Constructor
PlaneInformation(const QString &sender, const QString &receiver, const QString &aircraft, const QString &airline, const QString &livery);
virtual ~PlaneInformation() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static PlaneInformation fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "#SB"; }
QString m_aircraft;
@@ -39,6 +43,7 @@ namespace BlackCore
PlaneInformation();
};
//! Equal to operator
inline bool operator==(const PlaneInformation &lhs, const PlaneInformation &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -48,6 +53,7 @@ namespace BlackCore
lhs.m_livery == rhs.m_livery;
}
//! Not equal to operator
inline bool operator!=(const PlaneInformation &lhs, const PlaneInformation &rhs)
{
return !(lhs == rhs);

View File

@@ -21,6 +21,7 @@ namespace BlackCore
class BLACKCORE_EXPORT PlaneInformationFsinn : public MessageBase
{
public:
//! Constructor
PlaneInformationFsinn(const QString &sender,
const QString &receiver,
const QString &airlineIcao,
@@ -28,10 +29,13 @@ namespace BlackCore
const QString &aircraftIcaoCombinedType,
const QString &sendMModelString);
virtual ~PlaneInformationFsinn() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static PlaneInformationFsinn fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "#SB"; }
QString m_airlineIcao;
@@ -43,6 +47,7 @@ namespace BlackCore
PlaneInformationFsinn();
};
//! Equal to operator
inline bool operator==(const PlaneInformationFsinn &lhs, const PlaneInformationFsinn &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -53,6 +58,7 @@ namespace BlackCore
lhs.m_sendMModelString == rhs.m_sendMModelString;
}
//! Not equal to operator
inline bool operator!=(const PlaneInformationFsinn &lhs, const PlaneInformationFsinn &rhs)
{
return !(lhs == rhs);

View File

@@ -17,15 +17,20 @@ namespace BlackCore
{
namespace Fsd
{
//! Sent or received as reply to a ping.
class BLACKCORE_EXPORT Pong : public MessageBase
{
public:
//! Constructor
Pong(const QString &sender, const QString &receiver, const QString &timestamp);
virtual ~Pong() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static Pong fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "$PO"; }
QString m_timestamp;
@@ -34,6 +39,7 @@ namespace BlackCore
Pong();
};
//! Equal to operator
inline bool operator==(const Pong &lhs, const Pong &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -41,6 +47,7 @@ namespace BlackCore
lhs.m_timestamp == rhs.m_timestamp;
}
//! Not equal to operator
inline bool operator!=(const Pong &lhs, const Pong &rhs)
{
return !(lhs == rhs);

View File

@@ -18,17 +18,22 @@ namespace BlackCore
{
namespace Fsd
{
//! FSD Message Server Error
class BLACKCORE_EXPORT ServerError : public MessageBase
{
public:
//! Constructor
ServerError(const QString &sender, const QString &receiver, ServerErrorCode errorCode, const QString &causingParameter, const QString &description);
virtual ~ServerError() {}
bool isFatalError () const;
bool isFatalError() const;
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static ServerError fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "$ER"; }
ServerErrorCode m_errorNumber;
@@ -39,6 +44,7 @@ namespace BlackCore
ServerError();
};
//! Equal to operator
inline bool operator==(const ServerError &lhs, const ServerError &rhs)
{
return lhs.sender() == rhs.sender() &&
@@ -48,6 +54,7 @@ namespace BlackCore
lhs.m_description == rhs.m_description;
}
//! Not equal to operator
inline bool operator!=(const ServerError &lhs, const ServerError &rhs)
{
return !(lhs == rhs);

View File

@@ -21,25 +21,32 @@ namespace BlackCore
{
namespace Fsd
{
//! Text, radio or private message
class BLACKCORE_EXPORT TextMessage : public MessageBase
{
public:
//! Message type
enum Type
{
PrivateMessage,
RadioMessage,
};
//! Constructor
TextMessage(const QString &sender, const QString &receiver, const QString &message);
virtual ~TextMessage() {}
//! Message converted to tokens
QStringList toTokens() const;
//! Construct from tokens
static TextMessage fromTokens(const QStringList &tokens);
//! PDU identifier
static QString pdu() { return "#TM"; }
QString m_message;
Type m_type = PrivateMessage;
QVector<int> m_frequencies;
QString m_message; //!< message text
Type m_type = PrivateMessage; //!< message type
QVector<int> m_frequencies; //!< frequencies in case of radio message.
private:
TextMessage();