6#ifndef SWIFT_SIMPLUGIN_FSXCOMMON_SIMCONNECTOBJECT_H
7#define SWIFT_SIMPLUGIN_FSXCOMMON_SIMCONNECTOBJECT_H
10#include <QSharedPointer>
18namespace swift::simplugin::fsxcommon
28 AircraftSimulatedObject,
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);
188 void resetCameraPositions();
199 m_cameraPosition = position;
200 m_cameraRotation = rotation;
226 void resetToAddAgain();
232 bool isVtol()
const {
return m_aircraft.isVtol(); }
250 bool hasValidRequestAndObjectId()
const;
264 if (m_addingExceptions > 0)
266 m_addingExceptions--;
294 getInterpolation(qint64 currentTimeSinceEpoch,
296 uint32_t aircraftNumber)
const;
313 static SimObjectType requestIdToType(
DWORD requestId);
316 static const QString &typeToString(SimObjectType type);
319 static bool isSameTypeGroup(SimObjectType t1, SimObjectType t2);
322 static bool isAircraft(SimObjectType type);
326 SimObjectType m_type = AircraftNonAtc;
327 DWORD m_requestId = 0;
328 DWORD m_objectId = 0;
329 bool m_validRequestId =
false;
330 bool m_validObjectId =
false;
331 bool m_confirmedAdded =
false;
332 bool m_pendingRemoved =
false;
333 bool m_camera =
false;
334 bool m_removedWhileAdding =
false;
335 bool m_addedWhileRemoving =
false;
336 int m_addingExceptions = 0;
337 int m_addingDirectlyRemoved = 0;
338 qint64 m_tsCreated = -1;
340 SIMCONNECT_DATA_XYZ m_cameraPosition;
348 SIMCONNECT_PERIOD m_requestSimDataPeriod = SIMCONNECT_PERIOD_NEVER;
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.
bool isPendingAdded() const
Object is requested in simulator, not yet confirmed added.
void setCameraPositionAndRotation(const SIMCONNECT_DATA_XYZ &position, const SIMCONNECT_DATA_PBH &rotation)
Camera position/rotation.
const swift::misc::aviation::CAircraftLights & getLightsAsSent() const
Lights as sent to simulator.
bool hasValidRequestId() const
Valid request id?
const swift::misc::aviation::CAircraftLights & getCurrentLightsInSimulator() const
Get current lights (requested from simulator).
const swift::misc::aviation::CCallsign & getCallsign() const
Get callsign.
const QString & getCallsignAsString() const
Get callsign.
const QByteArray & getCallsignByteArray() const
Callsign as LATIN1.
bool hasCamera() const
Has camera?
const SIMCONNECT_DATA_XYZ & cameraPosition() const
Camera position.
const SIMCONNECT_DATA_PBH & cameraRotation() const
Camera rotation;.
bool isInvalid() const
Invalid?
swift::misc::simulation::CInterpolatorMulti * getInterpolator() const
Interpolator.
DWORD getObjectId() const
Get SimConnect object id.
void setCameraGUID(GUID guid)
Set camera GUID.
void setAddingExceptions(int number)
Set adding failed before.
const QString & getAircraftModelString() const
Simulated aircraft model string.
bool isAddedWhileRemoving()
Special states.
bool hasCurrentLightsInSimulator() const
Received lights in simulator.
void resetTimestampToNow()
Reset the timestamp.
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::simulation::CAircraftModel & getAircraftModel() const
Simulated aircraft model.
void decreaseAddingExceptions()
Decrease adding exception.
void setLightsAsSent(const swift::misc::aviation::CAircraftLights &lights)
Lights as sent to simulator.
static const QString & typeToString(SimObjectType type)
Type to string.
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.
const QString & getObserverName() const
Observer name.
const swift::misc::simulation::CSimulatedAircraft & getAircraft() const
Simulated aircraft (as added).
void increaseAddingDirectlyRemoved()
Increase adding and directly removed.
SIMCONNECT_PERIOD getSimDataPeriod() const
How often do we request data from simulator for this remote aircraft.
CSimConnectObject()
Constructor.
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?
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.
bool hasCreatedTimestamp() const
Created timestamp?
void increaseAddingExceptions()
Increase adding exception.
SimObjectType getType() const
Object type.
bool isAircraft() const
Aircraft?
const QString & getTypeAsString() const
Type as string.
bool hasCallsign() const
Callsign?
QString getObjectIdAsString() const
Get SimConnect object id.
bool hasValidObjectId() const
Valid object id?
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.
QList< CSimConnectObject > getProbes() const
All probes.
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.
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.
qint64 currentMSecsSinceEpoch()
QString number(double n, char format, int precision)
unsigned long DWORD
Fake Windows DWORD.
adding struct SIMCONNECT_DATA_PBH not existing in SimConnect FSX