mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-09 21:45:34 +08:00
refs #396, move subproject BlackSim into BlackMisc::Simulation
* removed unused samples / tests * fixed found Doxygen issues * removed blacksimfreefunctions, now in BlackMisc::Simulation::registerMetadata() * samples_vetcor_geo to samples_geo
This commit is contained in:
committed by
Roland Winklmeier
parent
a6ca57265e
commit
32f60722c8
54
src/blackmisc/simulation/fscommon/bcdconversions.h
Normal file
54
src/blackmisc/simulation/fscommon/bcdconversions.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* Copyright (C) 2013
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_SIMULATION_FSCOMMON_BCDCONVERSIONS_H
|
||||
#define BLACKMISC_SIMULATION_FSCOMMON_BCDCONVERSIONS_H
|
||||
|
||||
#include "blackmisc/pqfrequency.h"
|
||||
#include "blackmisc/aviation/transponder.h"
|
||||
#include <QtGlobal>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
namespace FsCommon
|
||||
{
|
||||
|
||||
//! BCD conversions for FS
|
||||
class CBcdConversions
|
||||
{
|
||||
public:
|
||||
//! BCD -> decimal
|
||||
static quint32 bcd2Dec(quint32 bcdNum) { return hornerScheme(bcdNum, 0x10, 10); }
|
||||
|
||||
//! Decimal -> BCD
|
||||
static quint32 dec2Bcd(quint32 decNum) { return hornerScheme(decNum, 10, 0x10); }
|
||||
|
||||
//! COM Frequency to BCD
|
||||
static quint32 comFrequencyToBcdHz(const BlackMisc::PhysicalQuantities::CFrequency &comFrequency);
|
||||
|
||||
//! Transponder code to BCD
|
||||
static quint32 transponderCodeToBcd(const BlackMisc::Aviation::CTransponder &transponder);
|
||||
|
||||
private:
|
||||
//! Constructor, only static methods
|
||||
CBcdConversions() {}
|
||||
|
||||
//! Horner scheme
|
||||
static quint32 hornerScheme(quint32 num, quint32 divider, quint32 factor);
|
||||
};
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user