Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+64
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* MeteoDataManagement - Static Meteo Data Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2016-10-17
|
||||
*/
|
||||
|
||||
#include "esc_convert_to_tab.h"
|
||||
#include <LtsUtilsCore/qbytearray_byteaccess.h>
|
||||
#include <LtsUtilsCore/dds_vector.h>
|
||||
#include <QByteArray>
|
||||
|
||||
|
||||
namespace EffectShowClient
|
||||
{
|
||||
namespace ConvertToTab
|
||||
{
|
||||
//=============================================================================
|
||||
std::vector<uint8_t> convertOrderConfirmation(const OrderConfirmation_t &orderConfirmation)
|
||||
{
|
||||
QByteArray ba;
|
||||
ba.reserve(45);
|
||||
|
||||
LtsUtils::set1Byte(120, ba);
|
||||
LtsUtils::set1Byte(int(orderConfirmation.orderType), ba);
|
||||
LtsUtils::set2Byte(orderConfirmation.orderId, ba);
|
||||
LtsUtils::set1Byte(orderConfirmation.confirmation.underlying(), ba);
|
||||
|
||||
const QByteArray txt = orderConfirmation.answerText.toUtf8();
|
||||
const int len = txt.length() > 39 ? 39 : txt.length();
|
||||
for (int i = 0; i < len; ++i)
|
||||
LtsUtils::set1Byte(txt.at(i), ba);
|
||||
|
||||
return LtsUtils::convert<std::vector<uint8_t>>(ba);
|
||||
}
|
||||
//=============================================================================
|
||||
std::vector<uint8_t> convertVehicleStatus(const VehicleStatus_t &vehicleStatus)
|
||||
{
|
||||
QByteArray ba;
|
||||
ba.reserve(5);
|
||||
|
||||
LtsUtils::set1Byte(121, ba);
|
||||
LtsUtils::set1Byte(vehicleStatus.operational ? 1 : 0, ba);
|
||||
LtsUtils::set1Byte(vehicleStatus.ammunitionMagazine, ba);
|
||||
LtsUtils::set1Byte(vehicleStatus.ammunitionAvailable, ba);
|
||||
|
||||
uint8_t byte = 0;
|
||||
if (vehicleStatus.inclinationSensorFail) byte = byte | 0x80;
|
||||
if (vehicleStatus.navigationFail) byte = byte | 0x40;
|
||||
if (vehicleStatus.airSpeedMeterFail) byte = byte | 0x20;
|
||||
if (vehicleStatus.controlComputerFail) byte = byte | 0x10;
|
||||
if (vehicleStatus.magazineFail) byte = byte | 0x08;
|
||||
|
||||
byte = byte | ((uint8_t)vehicleStatus.feature << 1);
|
||||
LtsUtils::set1Byte(byte, ba);
|
||||
|
||||
return LtsUtils::convert<std::vector<uint8_t>>(ba);
|
||||
}
|
||||
|
||||
} // namespace ConvertToTab
|
||||
|
||||
} // namespace EffectShowClient
|
||||
Reference in new issue
Block a user