Files
qt5-legatus-legacy/Lts/Services/CentralEffectSimulation/Plugins/GeoPairing/GeoPairingImpl/GeoPairingDataFireReport.cpp
T
2026-08-13 18:33:10 +02:00

123 lines
4.3 KiB
C++
Executable File

// **************************************************************************
//
// (C) Copyright 2009 Swiss SIMTEC AG
//
// **************************************************************************
//
// $HeadURL$
// $LastChangedBy$
// $LastChangedDate$
// $LastChangedRevision$
//
// **************************************************************************
// manual class headers
#include "GeoPairingDataFireReport.hpp"
namespace N_GeoPairingImpl
{
GeoPairingDataFireReport::GeoPairingDataFireReport()
: GeoPairingDataBase("GeoPairingDataFireReport")
{
m_Size = 18;
}
// ---------------------------------------------------------------
bool GeoPairingDataFireReport::parse(const QByteArray& a_transparentData)
{
if (!GeoPairingDataBase::parse(a_transparentData))
{
ERROR_LOG(m_logger) << "Couldn't parse Header";
return false;
}
//char *l_Buffer = (char *) a_transparentData;
const char *l_Buffer = a_transparentData.constData();
int l_StreamPosition = 2;
memcpy(&m_TimerTick, l_Buffer + l_StreamPosition, sizeof(m_TimerTick));
l_StreamPosition += sizeof(m_TimerTick);
INFO_LOG(m_logger) << "Stream -> TimerTick : " << (int) m_TimerTick;
memcpy(&m_Ammunition, l_Buffer + l_StreamPosition, sizeof(m_Ammunition));
l_StreamPosition += sizeof(m_Ammunition);
INFO_LOG(m_logger) << "Stream -> Ammunition : " << (int) m_Ammunition;
memcpy(&m_Pitch, l_Buffer + l_StreamPosition, sizeof(m_Pitch));
memcpy(&m_PitchMin, l_Buffer + l_StreamPosition, sizeof(m_PitchMin));
memcpy(&m_PitchMax, l_Buffer + l_StreamPosition + sizeof(m_PitchMin), sizeof(m_PitchMax));
l_StreamPosition += sizeof(m_Pitch);
INFO_LOG(m_logger) << "Stream -> Elevation : " << (int) m_Pitch;
memcpy(&m_Heading, l_Buffer + l_StreamPosition, sizeof(m_Heading));
memcpy(&m_HeadingMin, l_Buffer + l_StreamPosition, sizeof(m_HeadingMin));
memcpy(&m_HeadingMax, l_Buffer + l_StreamPosition + sizeof(m_HeadingMin), sizeof(m_HeadingMax));
l_StreamPosition += sizeof(m_Heading);
INFO_LOG(m_logger) << "Stream -> Azimuth : " << (int) m_Heading;
memcpy(&m_Temperature, l_Buffer + l_StreamPosition, sizeof(m_Temperature));
l_StreamPosition += sizeof(m_Temperature);
INFO_LOG(m_logger) << "Stream -> Temperature : " << (int) m_Temperature;
memcpy(&m_TimeToDetonate, l_Buffer + l_StreamPosition, sizeof(m_TimeToDetonate));
l_StreamPosition += sizeof(m_TimeToDetonate);
INFO_LOG(m_logger) << "Stream -> TimeToDetonate : " << (int) m_TimeToDetonate;
UInt8 l_WeaponSpecific = 0;
memcpy(&l_WeaponSpecific, l_Buffer + l_StreamPosition, sizeof(l_WeaponSpecific));
l_StreamPosition += sizeof(l_WeaponSpecific);
INFO_LOG(m_logger) << "Stream -> WeaponSpecific : " << (int) l_WeaponSpecific;
switch (m_DeviceID)
{
case PAN_GP_REPORT_MK19:
{
m_MK19NbrRounds = l_WeaponSpecific;
m_Pitch = m_PitchMin;
m_Heading = m_HeadingMin;
m_UseMinMax = true;
INFO_LOG(m_logger) << "--> MK19NbrRounds : " << (int) m_MK19NbrRounds;
INFO_LOG(m_logger) << "--> Pitch (avg) : " << (int) m_Pitch;
INFO_LOG(m_logger) << "--> PitchMin : " << (int) m_PitchMin;
INFO_LOG(m_logger) << "--> PitchMax : " << (int) m_PitchMax;
INFO_LOG(m_logger) << "--> Heading (avg) : " << (int) m_Heading;
INFO_LOG(m_logger) << "--> HeadingMin : " << (int) m_HeadingMin;
INFO_LOG(m_logger) << "--> HeadingMax : " << (int) m_HeadingMax;
break;
}
case PAN_GP_REPORT_IGLA:
case PAN_GP_REQUEST_IGLA:
{
m_IGLAModeAuto = l_WeaponSpecific & PAN_GP_IGLA_MODE_MASK;
INFO_LOG(m_logger) << "--> IGLAModeAuto : " << m_IGLAModeAuto;
m_IGLAChangeOverPressed = l_WeaponSpecific & PAN_GP_IGLA_CHANGEOVER_MASK;
INFO_LOG(m_logger) << "--> IGLAChangeOverPressed : " << m_IGLAChangeOverPressed;
m_IGLARequestNbr = l_WeaponSpecific >> 2;
INFO_LOG(m_logger) << "--> IGLARequestNbr : " << (int) m_IGLARequestNbr;
break;
}
case PAN_GP_REPORT_MORTAR:
case PAN_GP_REPORT_G5_G6:
case PAN_GP_REPORT_M109:
break;
default:
{
ERROR_LOG(m_logger) << "--> Weapon with id " << m_DeviceID << " not implemented yet !";
return false;
}
}
UInt8 l_Reserved = 0;
memcpy(&l_Reserved, l_Buffer + l_StreamPosition, sizeof(l_Reserved));
INFO_LOG(m_logger) << "Stream -> Reserved : " << (int) l_Reserved;
//l_StreamPosition += sizeof(l_Reserved);
return true;
}
} // namespace N_GeoPairingImpl