6 #ifndef SWIFT_SIMPLUGIN_FSXCOMMON_SIMCONNECTOBJECT_H
7 #define SWIFT_SIMPLUGIN_FSXCOMMON_SIMCONNECTOBJECT_H
10 #include <QSharedPointer>
11 #include <QStringList>
18 namespace swift::simplugin::fsxcommon
28 AircraftSimulatedObject,
53 bool hasCallsign()
const {
return !this->getCallsign().isEmpty(); }
73 return this->getType() == AircraftNonAtc || this->getType() == AircraftSimulatedObject;
92 void setAircraftModelString(
const QString &modelString);
100 return m_currentLightsInSim;
109 m_currentLightsInSim = lights;
128 void setRequestId(
DWORD id);
137 void setObjectId(
DWORD id);
152 bool isPendingAdded()
const;
155 bool isOutdatedPendingAdded(qint64 thresholdMs = 5000, qint64 currentMsSinceEpoch = -1)
const;
158 bool isConfirmedAdded()
const;
162 void setConfirmedAdded(
bool confirm);
167 void setAddedWhileRemoving(
bool addedWileRemoved);
169 void setRemovedWhileAdding(
bool removedWhileAdding);
176 bool isReadyToSend()
const;
179 void setPendingRemoved(
bool pending);
182 bool isPending()
const {
return this->isPendingAdded() || this->isPendingRemoved(); }
188 void resetCameraPositions();
199 m_cameraPosition = position;
200 m_cameraRotation = rotation;
226 void resetToAddAgain();
232 bool isVtol()
const {
return m_aircraft.isVtol(); }
235 bool isValid()
const {
return !this->isInvalid(); }
238 bool isInvalid()
const {
return !this->hasValidObjectId() && !this->hasValidRequestId(); }
250 bool hasValidRequestAndObjectId()
const;
264 if (m_addingExceptions > 0) { m_addingExceptions--; }
291 getInterpolation(qint64 currentTimeSinceEpoch,
293 uint32_t aircraftNumber)
const;
307 QString toQString()
const;
310 static SimObjectType requestIdToType(
DWORD requestId);
313 static const QString &typeToString(SimObjectType type);
316 static bool isSameTypeGroup(SimObjectType t1, SimObjectType t2);
319 static bool isAircraft(SimObjectType type);
323 SimObjectType m_type = AircraftNonAtc;
324 DWORD m_requestId = 0;
325 DWORD m_objectId = 0;
326 bool m_validRequestId =
false;
327 bool m_validObjectId =
false;
328 bool m_confirmedAdded =
false;
329 bool m_pendingRemoved =
false;
330 bool m_camera =
false;
331 bool m_removedWhileAdding =
false;
332 bool m_addedWhileRemoving =
false;
333 int m_addingExceptions = 0;
334 int m_addingDirectlyRemoved = 0;
335 qint64 m_tsCreated = -1;
337 SIMCONNECT_DATA_XYZ m_cameraPosition;
339 QByteArray m_callsignByteArray;
340 QString m_observerName;
345 SIMCONNECT_PERIOD m_requestSimDataPeriod = SIMCONNECT_PERIOD_NEVER;
346 QSharedPointer<swift::misc::simulation::CInterpolatorMulti>
427 QList<CSimConnectObject>
getProbes()
const {
return this->
getByType(CSimConnectObject::TerrainProbe); }
Status messages, e.g. from Core -> GUI.
Value object encapsulating information about aircraft's lights.
Value object encapsulating information of an aircraft's situation.
Value object encapsulating information of a callsign.
Value object for a set of callsigns.
Physical unit length (length)
Aircraft model (used by another pilot, my models on disk)
InterpolatorMode
Interpolator type.
Value object for interpolator and rendering per callsign.
Record internal state of interpolator for debugging.
Multiplexed interpolator which allows switching between modes at runtime.
Comprehensive information of an aircraft.
Direct in memory access to interpolation setup, normally implemented by simulator.
Direct thread safe in memory access to remote aircraft.
Direct in memory access to elevation data.
SimObjectRequest
SimObject requests used for AI aircraft and probes.
Class representing a SimConnect object.
void setCameraPositionAndRotation(const SIMCONNECT_DATA_XYZ &position, const SIMCONNECT_DATA_PBH &rotation)
Camera position/rotation.
bool hasValidRequestId() const
Valid request id?
const SIMCONNECT_DATA_PBH & cameraRotation() const
Camera rotation;.
bool hasCamera() const
Has camera?
bool isInvalid() const
Invalid?
DWORD getObjectId() const
Get SimConnect object id.
void setCameraGUID(GUID guid)
Set camera GUID.
void setAddingExceptions(int number)
Set adding failed before.
bool isAddedWhileRemoving()
Special states.
bool hasCurrentLightsInSimulator() const
Received lights in simulator.
void resetTimestampToNow()
Reset the timestamp.
const SIMCONNECT_DATA_XYZ & cameraPosition() const
Camera position.
bool isAircraftSimulatedObject() const
Aircraft simulated object?
bool isPending() const
Pending added or removed?
bool isRemovedWhileAdding() const
Special states.
void setSimDataPeriod(SIMCONNECT_PERIOD period)
How often do we request data from simulator for this remote aircraft.
const swift::misc::aviation::CAircraftLights & getLightsAsSent() const
Lights as sent to simulator.
void decreaseAddingExceptions()
Decrease adding exception.
const swift::misc::simulation::CSimulatedAircraft & getAircraft() const
Simulated aircraft (as added)
void setLightsAsSent(const swift::misc::aviation::CAircraftLights &lights)
Lights as sent to simulator.
const QString & getCallsignAsString() const
Get callsign.
DWORD getRequestId() const
Get SimConnect request id.
void removeCamera()
No camera anymore.
bool isAircraftNonAtc() const
Aircraft NON ATC?
bool isValid() const
Valid?
int getEngineCount() const
Engine count.
swift::misc::simulation::CInterpolatorMulti * getInterpolator() const
Interpolator.
const QByteArray & getCallsignByteArray() const
Callsign as LATIN1.
const swift::misc::aviation::CCallsign & getCallsign() const
Get callsign.
const QString & getAircraftModelString() const
Simulated aircraft model string.
void increaseAddingDirectlyRemoved()
Increase adding and directly removed.
SIMCONNECT_PERIOD getSimDataPeriod() const
How often do we request data from simulator for this remote aircraft.
int getAddingDirectlyRemoved() const
Adding and directly removed.
void setObserverName(const QString &observer)
Set observer.
void setAddingDirectlyRemoved(int number)
Set adding and directly removed.
qint64 getCreatedTimestamp() const
Created timestamp.
int getAddingExceptions() const
Adding has been failed before.
void setType(SimObjectType type)
Set the type.
bool isTerrainProbe() const
Probe?
const QString & getObserverName() const
Observer name.
bool isPendingRemoved() const
Removing is pending.
void setCurrentLightsInSimulator(const swift::misc::aviation::CAircraftLights &lights)
Set current lights when received from simulator.
void fakeCurrentLightsInSimulator()
Pretend to have received lights from simulator.
const QString & getTypeAsString() const
Type as string.
bool hasCreatedTimestamp() const
Created timestamp?
void increaseAddingExceptions()
Increase adding exception.
SimObjectType getType() const
Object type.
bool isAircraft() const
Aircraft?
const swift::misc::aviation::CAircraftLights & getCurrentLightsInSimulator() const
Get current lights (requested from simulator)
bool hasCallsign() const
Callsign?
QString getObjectIdAsString() const
Get SimConnect object id.
bool hasValidObjectId() const
Valid object id?
const swift::misc::simulation::CAircraftModel & getAircraftModel() const
Simulated aircraft model.
GUID getCameraGUID() const
Camera GUID.
Simulator objects (aka AI aircraft)
bool containsPendingRemoved() const
Pending removed condition.
CSimConnectObject getSimObjectForRequestId(DWORD requestId) const
Get object per request id.
bool removeByOtherSimObject(const CSimConnectObject &otherSimObj)
Remove by object id or request id.
int countPendingAdded() const
Number of pending added.
int countPendingRemoved() const
Number of pending removed.
swift::misc::aviation::CCallsignSet getAllCallsigns(bool withoutProbes=true) const
Get all callsigns.
CSimConnectObject getSimObjectForObjectId(DWORD objectId) const
Get object per object id.
bool removeByObjectId(DWORD objectId)
Remove by id.
int countConfirmedAdded()
Objects not pending.
bool insert(const CSimConnectObject &simObject, bool updateTimestamp=false)
Insert.
swift::misc::aviation::CCallsignSet getPendingRemovedCallsigns() const
Callsigns of pending removed callsigns.
CSimConnectObject getSimObjectForOtherSimObject(const CSimConnectObject &otherSimObj) const
Get by request or object id, just as possible.
bool setSimConnectObjectIdForRequestId(DWORD requestId, DWORD objectId)
Set ID of a SimConnect object, so far we only have an request id in the object.
CSimConnectObject getOldestNotPendingProbe() const
Get a non pending probe.
CSimConnectObject getNotPendingProbe() const
Get a non pending probe.
bool containsAircraft() const
Aircraft?
swift::misc::aviation::CCallsignSet getPendingAddedCallsigns() const
Callsigns of pending added callsigns.
QList< CSimConnectObject > getByType(CSimConnectObject::SimObjectType type) const
Get by type.
CSimConnectObject getOldestObject() const
Get the oldest object.
bool containsType(CSimConnectObject::SimObjectType type) const
Contains object of type.
bool isKnownSimObjectId(DWORD objectId) const
Is the object id one of our AI objects?
QString getAllCallsignStringsAsString(bool sorted=false, const QString &separator=", ") const
Get all callsign strings as string.
bool containsPendingAdded() const
Pending add condition.
int removeAllProbes()
Remove all the probes.
bool containsProbe() const
Probe?
int removeCallsigns(const swift::misc::aviation::CCallsignSet &callsigns)
Remove callsigns.
QList< CSimConnectObject > getProbes() const
All probes.
CSimConnectObjects removeOutdatedPendingAdded(CSimConnectObject::SimObjectType type)
Remove all pending added objects.
QList< CSimConnectObject > getAircraft() const
All aircraft.
swift::misc::aviation::CCallsign getCallsignForObjectId(DWORD objectId) const
Find which callsign belongs to the object id.
QStringList getAllCallsignStrings(bool sorted=false, bool withoutProbes=true) const
Get all callsign strings.
#define FSXCOMMON_EXPORT
FSXCommon Export Macro.
unsigned long DWORD
Fake Windows DWORD.
adding struct SIMCONNECT_DATA_PBH not existing in SimConnect FSX