From 3e0f3d2c3204283a94a2c27ff3ee54a17f15ec67 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sun, 30 Jul 2017 15:52:39 +1000 Subject: [PATCH 01/29] Cosmetic fix to README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 57020a7..db77dcf 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ allows cherry-picking limited number of the selected messages the product requir which provides a great flexibility in terms of the final code size. Full [doxygen](www.doxygen.org) generated documentation with the full tutorial inside can be -downloaded as zip archive from [Dropbox](https://www.dropbox.com/s/6hl6nyqjnjhh5bo/doc_ublox_v0.8.zip?dl=1) or +downloaded as **doc_ublox** zip archive from [release artefacts](https://github.com/arobenko/ublox/releases). The "example" folder contains simple example application showing how to use the [UBLOX Library](#ublox-library). From 00d2b38e8ad49628cbcffea23f1419f909760036 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Tue, 8 Aug 2017 08:49:19 +1000 Subject: [PATCH 02/29] Minor code cleanup in CFG-NVS. --- CMakeLists.txt | 2 +- include/ublox/message/CfgNvs.h | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e2c7e86..9e92a57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,7 +68,7 @@ set (CC_EXTERNAL_TGT "comms_champion_external") macro (externals install_dir build_cc) include(ExternalProject) - set (cc_tag "v0.20") + set (cc_tag "develop") set (cc_main_dir "${CMAKE_BINARY_DIR}/comms_champion") set (cc_src_dir "${cc_main_dir}/src") set (cc_bin_dir "${cc_main_dir}/build") diff --git a/include/ublox/message/CfgNvs.h b/include/ublox/message/CfgNvs.h index f51e810..ba2b3fc 100644 --- a/include/ublox/message/CfgNvs.h +++ b/include/ublox/message/CfgNvs.h @@ -33,16 +33,6 @@ namespace message /// @see CfgNvs struct CfgNvsFields { - /// @brief Bits access enumeration for @ref deviceMask bitmask field - enum - { - deviceMask_devBBR, ///< b devBBR bit index - deviceMask_devFlash, ///< b devFlash bit index - deviceMask_devEEPROM, ///< b devEEPROM bit index - deviceMask_devSpiFlash = 4, ///< b devSpiFlash bit index - deviceMask_numOfValues ///< upper limit for available bits - }; - /// @brief Common mask field definition for @ref clearMask, @ref saveMask, /// and @ref loadMask struct mask : public From 9e8ed1f02a0d04e3d811d555732eb884ab4802a3 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Tue, 8 Aug 2017 09:24:19 +1000 Subject: [PATCH 03/29] Added missing CFG-DGNSS message. --- cc_plugin/AllMessages.h | 4 + cc_plugin/CMakeLists.txt | 2 + cc_plugin/Ublox8Messages.h | 4 + cc_plugin/field/MsgId.cpp | 1 + cc_plugin/message/CfgCfg.cpp | 3 +- cc_plugin/message/CfgDgnss.cpp | 94 +++++++++++++++++++++ cc_plugin/message/CfgDgnss.h | 64 ++++++++++++++ cc_plugin/message/CfgDgnssPoll.cpp | 57 +++++++++++++ cc_plugin/message/CfgDgnssPoll.h | 63 ++++++++++++++ cc_plugin/message/CfgDoscPoll.h | 2 +- include/ublox/MsgId.h | 1 + include/ublox/field/MsgId.h | 1 + include/ublox/message/AidEph.h | 2 +- include/ublox/message/CfgCfg.h | 6 +- include/ublox/message/CfgDgnss.h | 119 +++++++++++++++++++++++++++ include/ublox/message/CfgDgnssPoll.h | 77 +++++++++++++++++ include/ublox/message/CfgDoscPoll.h | 6 +- 17 files changed, 497 insertions(+), 9 deletions(-) create mode 100644 cc_plugin/message/CfgDgnss.cpp create mode 100644 cc_plugin/message/CfgDgnss.h create mode 100644 cc_plugin/message/CfgDgnssPoll.cpp create mode 100644 cc_plugin/message/CfgDgnssPoll.h create mode 100644 include/ublox/message/CfgDgnss.h create mode 100644 include/ublox/message/CfgDgnssPoll.h diff --git a/cc_plugin/AllMessages.h b/cc_plugin/AllMessages.h index cd39338..7f89047 100644 --- a/cc_plugin/AllMessages.h +++ b/cc_plugin/AllMessages.h @@ -179,6 +179,8 @@ #include "cc_plugin/message/CfgSmgrPoll.h" #include "cc_plugin/message/CfgGeofence.h" #include "cc_plugin/message/CfgGeofencePoll.h" +#include "cc_plugin/message/CfgDgnss.h" +#include "cc_plugin/message/CfgDgnssPoll.h" #include "cc_plugin/message/CfgFixseed.h" #include "cc_plugin/message/CfgDynseed.h" #include "cc_plugin/message/CfgPms.h" @@ -467,6 +469,8 @@ using AllMessages = std::tuple< cc_plugin::message::CfgSmgrPoll, cc_plugin::message::CfgGeofence, cc_plugin::message::CfgGeofencePoll, + cc_plugin::message::CfgDgnss, + cc_plugin::message::CfgDgnssPoll, cc_plugin::message::CfgFixseed, cc_plugin::message::CfgDynseed, cc_plugin::message::CfgPms, diff --git a/cc_plugin/CMakeLists.txt b/cc_plugin/CMakeLists.txt index 1a3a23f..c971701 100644 --- a/cc_plugin/CMakeLists.txt +++ b/cc_plugin/CMakeLists.txt @@ -161,6 +161,8 @@ function (cc_plugin_ublox_all_messages) message/CfgSmgrPoll.cpp message/CfgGeofence.cpp message/CfgGeofencePoll.cpp + message/CfgDgnss.cpp + message/CfgDgnssPoll.cpp message/CfgFixseed.cpp message/CfgDynseed.cpp message/CfgPms.cpp diff --git a/cc_plugin/Ublox8Messages.h b/cc_plugin/Ublox8Messages.h index 2a38c9a..ab31039 100644 --- a/cc_plugin/Ublox8Messages.h +++ b/cc_plugin/Ublox8Messages.h @@ -155,6 +155,8 @@ #include "cc_plugin/message/CfgSmgrPoll.h" #include "cc_plugin/message/CfgGeofence.h" #include "cc_plugin/message/CfgGeofencePoll.h" +#include "cc_plugin/message/CfgDgnss.h" +#include "cc_plugin/message/CfgDgnssPoll.h" #include "cc_plugin/message/CfgFixseed.h" #include "cc_plugin/message/CfgDynseed.h" #include "cc_plugin/message/CfgPms.h" @@ -411,6 +413,8 @@ using Ublox8Messages = std::tuple< cc_plugin::message::CfgSmgrPoll, cc_plugin::message::CfgGeofence, cc_plugin::message::CfgGeofencePoll, + cc_plugin::message::CfgDgnss, + cc_plugin::message::CfgDgnssPoll, cc_plugin::message::CfgFixseed, cc_plugin::message::CfgDynseed, cc_plugin::message::CfgPms, diff --git a/cc_plugin/field/MsgId.cpp b/cc_plugin/field/MsgId.cpp index cdfedd7..408fcea 100644 --- a/cc_plugin/field/MsgId.cpp +++ b/cc_plugin/field/MsgId.cpp @@ -123,6 +123,7 @@ QVariantMap createMsgIdProperties() .add("CFG-DOSC", MsgId_CFG_DOSC) .add("CFG-SMGR", MsgId_CFG_SMGR) .add("CFG-GEOFENCE", MsgId_CFG_GEOFENCE) + .add("CFG-DGNSS", MsgId_CFG_GNSS) .add("CFG-FIXSEED", MsgId_CFG_FIXSEED) .add("CFG-DYNSEED", MsgId_CFG_DYNSEED) .add("CFG-PMS", MsgId_CFG_PMS) diff --git a/cc_plugin/message/CfgCfg.cpp b/cc_plugin/message/CfgCfg.cpp index fa3affc..e2a9e60 100644 --- a/cc_plugin/message/CfgCfg.cpp +++ b/cc_plugin/message/CfgCfg.cpp @@ -49,7 +49,8 @@ QVariantMap createProps_mask(const char* name) .add("infMsg") .add("navConf") .add("rxmConf") - .add(CfgCfgFields::mask::BitIdx_rinvConf, "rinvConf") + .add(CfgCfgFields::mask::BitIdx_senConf, "senConf") + .add("rinvConf") .add("antConf") .add("logConf") .add("ftsConf") diff --git a/cc_plugin/message/CfgDgnss.cpp b/cc_plugin/message/CfgDgnss.cpp new file mode 100644 index 0000000..04faf66 --- /dev/null +++ b/cc_plugin/message/CfgDgnss.cpp @@ -0,0 +1,94 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "CfgDgnss.h" + +#include + +#include "cc_plugin/field/common.h" + +template class ublox::message::CfgDgnss; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::CfgDgnss, + ublox::cc_plugin::message::CfgDgnss>; + + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +namespace +{ + +using ublox::message::CfgDgnssFields; + +QVariantMap createProps_dgnssMode() +{ + using Field = CfgDgnssFields::dgnssMode; + auto props = + cc::property::field::ForField() + .name("dngssMode") + .add("RTK float") + .add("RTK fixed") + ; + assert(props.values().size() == (int)Field::ValueType::NumOfValues); + return props.asMap(); +} + +QVariantList createFieldsProperties() +{ + QVariantList props; + props.append(createProps_dgnssMode()); + props.append(cc_plugin::field::common::props_reserved(1)); + + assert(props.size() == CfgDgnss::FieldIdx_numOfValues); + return props; +} + +} // namespace + +CfgDgnss::CfgDgnss() = default; +CfgDgnss::~CfgDgnss() = default; + +CfgDgnss& CfgDgnss::operator=(const CfgDgnss&) = default; +CfgDgnss& CfgDgnss::operator=(CfgDgnss&&) = default; + +const char* CfgDgnss::nameImpl() const +{ + static const char* Str = "CFG-DGNSS"; + return Str; +} + +const QVariantList& CfgDgnss::fieldsPropertiesImpl() const +{ + static const auto Props = createFieldsProperties(); + return Props; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/CfgDgnss.h b/cc_plugin/message/CfgDgnss.h new file mode 100644 index 0000000..859e39b --- /dev/null +++ b/cc_plugin/message/CfgDgnss.h @@ -0,0 +1,64 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/CfgDgnss.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class CfgDgnss : public + ProtocolMessageBase< + ublox::message::CfgDgnss, + CfgDgnss> +{ +public: + CfgDgnss(); + CfgDgnss(const CfgDgnss&) = delete; + CfgDgnss(CfgDgnss&&) = delete; + virtual ~CfgDgnss(); + + CfgDgnss& operator=(const CfgDgnss&); + CfgDgnss& operator=(CfgDgnss&&); + +protected: + virtual const char* nameImpl() const override; + virtual const QVariantList& fieldsPropertiesImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::CfgDgnss; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::CfgDgnss, + ublox::cc_plugin::message::CfgDgnss>; + diff --git a/cc_plugin/message/CfgDgnssPoll.cpp b/cc_plugin/message/CfgDgnssPoll.cpp new file mode 100644 index 0000000..7dcc5f4 --- /dev/null +++ b/cc_plugin/message/CfgDgnssPoll.cpp @@ -0,0 +1,57 @@ +// +// Copyright 2015 - 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include "CfgDgnssPoll.h" + +template class ublox::message::CfgDgnssPoll; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::CfgDgnssPoll, + ublox::cc_plugin::message::CfgDgnssPoll>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +CfgDgnssPoll::CfgDgnssPoll() = default; +CfgDgnssPoll::~CfgDgnssPoll() = default; + +CfgDgnssPoll& CfgDgnssPoll::operator=(const CfgDgnssPoll&) = default; +CfgDgnssPoll& CfgDgnssPoll::operator=(CfgDgnssPoll&&) = default; + + +const char* CfgDgnssPoll::nameImpl() const +{ + static const char* Str = "CFG-DGNSS (Poll)"; + return Str; +} + + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/CfgDgnssPoll.h b/cc_plugin/message/CfgDgnssPoll.h new file mode 100644 index 0000000..e9d4518 --- /dev/null +++ b/cc_plugin/message/CfgDgnssPoll.h @@ -0,0 +1,63 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/CfgDgnssPoll.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class CfgDgnssPoll : public + ProtocolMessageBase< + ublox::message::CfgDgnssPoll, + CfgDgnssPoll> +{ +public: + CfgDgnssPoll(); + CfgDgnssPoll(const CfgDgnssPoll&) = delete; + CfgDgnssPoll(CfgDgnssPoll&&) = delete; + virtual ~CfgDgnssPoll(); + + CfgDgnssPoll& operator=(const CfgDgnssPoll&); + CfgDgnssPoll& operator=(CfgDgnssPoll&&); + +protected: + virtual const char* nameImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::CfgDgnssPoll; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::CfgDgnssPoll, + ublox::cc_plugin::message::CfgDgnssPoll>; + diff --git a/cc_plugin/message/CfgDoscPoll.h b/cc_plugin/message/CfgDoscPoll.h index b4f1f9f..efadeb2 100644 --- a/cc_plugin/message/CfgDoscPoll.h +++ b/cc_plugin/message/CfgDoscPoll.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2017 (C). Alex Robenko. All rights reserved. +// Copyright 2017 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/include/ublox/MsgId.h b/include/ublox/MsgId.h index 7afc8ab..757b2c8 100644 --- a/include/ublox/MsgId.h +++ b/include/ublox/MsgId.h @@ -111,6 +111,7 @@ enum MsgId : std::uint16_t MsgId_CFG_DOSC = 0x0661, ///< ID of CFG-DOSC message MsgId_CFG_SMGR = 0x0662, ///< ID of CFG-SMGR message MsgId_CFG_GEOFENCE = 0x0669, ///< ID of CFG-GEOFENCE message + MsgId_CFG_DGNSS = 0x0670, ///< ID of CFG-DGNSS message MsgId_CFG_FIXSEED = 0x0684, ///< ID of CFG-FIXSEED message MsgId_CFG_DYNSEED = 0x0685, ///< ID of CFG-DYNSEED message MsgId_CFG_PMS = 0x0686, ///< ID of CFG-PMS message diff --git a/include/ublox/field/MsgId.h b/include/ublox/field/MsgId.h index 4dab8d1..e5275fb 100644 --- a/include/ublox/field/MsgId.h +++ b/include/ublox/field/MsgId.h @@ -195,6 +195,7 @@ struct MsgIdValueValidator MsgId_CFG_DOSC, MsgId_CFG_SMGR, MsgId_CFG_GEOFENCE, + MsgId_CFG_DGNSS, MsgId_CFG_FIXSEED, MsgId_CFG_DYNSEED, MsgId_CFG_PMS diff --git a/include/ublox/message/AidEph.h b/include/ublox/message/AidEph.h index b4f2598..573de82 100644 --- a/include/ublox/message/AidEph.h +++ b/include/ublox/message/AidEph.h @@ -40,7 +40,7 @@ struct AidEphFields using how = field::common::U4; /// @brief Definition of "sf1d" field. - /// @tparam TOpt Extra option(s) + /// @tparam TOpt Extra option(s) to be passed to the "list" definition template using sf1d = field::common::OptionalT< diff --git a/include/ublox/message/CfgCfg.h b/include/ublox/message/CfgCfg.h index 36f25c9..6d587bc 100644 --- a/include/ublox/message/CfgCfg.h +++ b/include/ublox/message/CfgCfg.h @@ -37,20 +37,20 @@ struct CfgCfgFields /// @brief common definition for @ref clearMask, @ref saveMask, and @ref loadMask fields struct mask : public field::common::X4T< - comms::option::BitmaskReservedBits<0xffffe1e0, 0> + comms::option::BitmaskReservedBits<0xffffe0e0, 0> > { /// @brief Provide names for internal bits. /// @details See definition of @b COMMS_BITMASK_BITS macro /// related to @b comms::field::BitmaskValue class from COMMS library /// for details. - COMMS_BITMASK_BITS(ioPort, msgConf, infMsg, navConf, rxmConf, rinvConf=9, antConf, logConf, ftsConf); + COMMS_BITMASK_BITS(ioPort, msgConf, infMsg, navConf, rxmConf, senConf=8, rinvConf, antConf, logConf, ftsConf); /// @brief Provide convenience access functions for internal bits. /// @details See definition of @b COMMS_BITMASK_BITS_ACCESS macro /// related to @b comms::field::BitmaskValue class from COMMS library /// for details. - COMMS_BITMASK_BITS_ACCESS(ioPort, msgConf, infMsg, navConf, rxmConf, rinvConf, antConf, logConf, ftsConf); + COMMS_BITMASK_BITS_ACCESS(ioPort, msgConf, infMsg, navConf, rxmConf, senConf, rinvConf, antConf, logConf, ftsConf); }; /// @brief Definition of "clearMask" field. diff --git a/include/ublox/message/CfgDgnss.h b/include/ublox/message/CfgDgnss.h new file mode 100644 index 0000000..401590f --- /dev/null +++ b/include/ublox/message/CfgDgnss.h @@ -0,0 +1,119 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of CFG-DGNSS message and its fields. + +#pragma once + +#include "ublox/Message.h" +#include "ublox/field/common.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the CFG-DGNSS message fields. +/// @see CfgDgnss +struct CfgDgnssFields +{ + /// @brief Value enumeration for @ref dgnssMode field. + enum class DgnssMode : std::uint8_t + { + RtkFloat, ///< No attempts are made to fix ambiguities. + RtkFixed, ///< Ambiguities are fixed whenever possible. + NumOfValues /// number of available values + }; + + /// @brief Definition of "dgnssMode" field. + using dgnssMode = + field::common::EnumT< + DgnssMode, + comms::option::ValidNumValueRange<0, (int)DgnssMode::NumOfValues - 1> + >; + + /// @brief Definition of "reserved1" field. + using reserved1 = field::common::res3; + + /// @brief All the fields bundled in std::tuple. + using All = std::tuple< + dgnssMode, + reserved1 + >; +}; + +/// @brief Definition of CFG-DGNSS message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref CfgDgnssFields and for definition of the fields this message contains +/// and COMMS_MSG_FIELDS_ACCESS() for fields access details. +/// @tparam TMsgBase Common interface class for all the messages. +/// @tparam TDataOpt Extra option(s) for @b data field +template +class CfgDgnss : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl >, + comms::option::MsgType > + > +{ +public: + + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_MSG_FIELDS_ACCESS macro + /// related to @b comms::MessageBase class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b version for @ref CfgDgnssFields::version field + /// @li @b numOsc for @ref CfgDgnssFields::numOsc field + /// @li @b reserved1 for @ref CfgDgnssFields::reserved1 field + /// @li @b data for @ref CfgDgnssFields::data field + COMMS_MSG_FIELDS_ACCESS(dgnssMode, reserved1); + + /// @brief Default constructor + CfgDgnss() = default; + + /// @brief Copy constructor + CfgDgnss(const CfgDgnss&) = default; + + /// @brief Move constructor + CfgDgnss(CfgDgnss&& other) = default; + + /// @brief Destructor + ~CfgDgnss() = default; + + /// @brief Copy assignment + CfgDgnss& operator=(const CfgDgnss&) = default; + + /// @brief Move assignment + CfgDgnss& operator=(CfgDgnss&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + diff --git a/include/ublox/message/CfgDgnssPoll.h b/include/ublox/message/CfgDgnssPoll.h new file mode 100644 index 0000000..7db9004 --- /dev/null +++ b/include/ublox/message/CfgDgnssPoll.h @@ -0,0 +1,77 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of CFG-DGNSS (@b poll) message and its fields. + +#pragma once + +#include "ublox/Message.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the CFG-DGNSS (@b poll) message fields. +/// @see CfgDgnssPoll +struct CfgDgnssPollFields +{ + using All = std::tuple<>; +}; + +/// @brief Definition of CFG-DGNSS (@b poll) message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref CfgDgnssPollFields and for definition of the fields this message contains. +/// @tparam TMsgBase Common interface class for all the messages. +template +class CfgDgnssPoll : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + /// @brief Default constructor + CfgDgnssPoll() = default; + + /// @brief Copy constructor + CfgDgnssPoll(const CfgDgnssPoll&) = default; + + /// @brief Move constructor + CfgDgnssPoll(CfgDgnssPoll&& other) = default; + + /// @brief Destructor + ~CfgDgnssPoll() = default; + + /// @brief Copy assignment + CfgDgnssPoll& operator=(const CfgDgnssPoll&) = default; + + /// @brief Move assignment + CfgDgnssPoll& operator=(CfgDgnssPoll&&) = default; +}; + + +} // namespace message + +} // namespace ublox + diff --git a/include/ublox/message/CfgDoscPoll.h b/include/ublox/message/CfgDoscPoll.h index 88d31e9..3161d37 100644 --- a/include/ublox/message/CfgDoscPoll.h +++ b/include/ublox/message/CfgDoscPoll.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2017 (C). Alex Robenko. All rights reserved. +// Copyright 2017 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -8,8 +8,8 @@ // (at your option) any later version. // // This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRDOSCY; without even the implied warranty of -// MERCHDOSCABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License From 2363fd193a8a9354c60da9986a680917030e94fd Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Tue, 8 Aug 2017 17:54:01 +1000 Subject: [PATCH 04/29] Implemented missing CFG-HNR message. --- cc_plugin/AllMessages.h | 4 ++ cc_plugin/CMakeLists.txt | 2 + cc_plugin/Ublox8Messages.h | 4 ++ cc_plugin/field/MsgId.cpp | 1 + cc_plugin/message/CfgDgnssPoll.cpp | 2 +- cc_plugin/message/CfgHnr.cpp | 81 +++++++++++++++++++++ cc_plugin/message/CfgHnr.h | 64 +++++++++++++++++ cc_plugin/message/CfgHnrPoll.cpp | 57 +++++++++++++++ cc_plugin/message/CfgHnrPoll.h | 63 +++++++++++++++++ include/ublox/InputMessages.h | 4 ++ include/ublox/MsgId.h | 1 + include/ublox/field/MsgId.h | 1 + include/ublox/message/CfgDgnss.h | 10 ++- include/ublox/message/CfgDosc.h | 2 +- include/ublox/message/CfgHnr.h | 109 +++++++++++++++++++++++++++++ include/ublox/message/CfgHnrPoll.h | 79 +++++++++++++++++++++ 16 files changed, 476 insertions(+), 8 deletions(-) create mode 100644 cc_plugin/message/CfgHnr.cpp create mode 100644 cc_plugin/message/CfgHnr.h create mode 100644 cc_plugin/message/CfgHnrPoll.cpp create mode 100644 cc_plugin/message/CfgHnrPoll.h create mode 100644 include/ublox/message/CfgHnr.h create mode 100644 include/ublox/message/CfgHnrPoll.h diff --git a/cc_plugin/AllMessages.h b/cc_plugin/AllMessages.h index 7f89047..b0ea518 100644 --- a/cc_plugin/AllMessages.h +++ b/cc_plugin/AllMessages.h @@ -171,6 +171,8 @@ #include "cc_plugin/message/CfgLogfilterPoll.h" #include "cc_plugin/message/CfgTxslot.h" #include "cc_plugin/message/CfgPwr.h" +#include "cc_plugin/message/CfgHnr.h" +#include "cc_plugin/message/CfgHnrPoll.h" #include "cc_plugin/message/CfgEsrc.h" #include "cc_plugin/message/CfgEsrcPoll.h" #include "cc_plugin/message/CfgDosc.h" @@ -461,6 +463,8 @@ using AllMessages = std::tuple< cc_plugin::message::CfgLogfilterPoll, cc_plugin::message::CfgTxslot, cc_plugin::message::CfgPwr, + cc_plugin::message::CfgHnr, + cc_plugin::message::CfgHnrPoll, cc_plugin::message::CfgEsrc, cc_plugin::message::CfgEsrcPoll, cc_plugin::message::CfgDosc, diff --git a/cc_plugin/CMakeLists.txt b/cc_plugin/CMakeLists.txt index c971701..939bafa 100644 --- a/cc_plugin/CMakeLists.txt +++ b/cc_plugin/CMakeLists.txt @@ -153,6 +153,8 @@ function (cc_plugin_ublox_all_messages) message/CfgLogfilterPoll.cpp message/CfgTxslot.cpp message/CfgPwr.cpp + message/CfgHnr.cpp + message/CfgHnrPoll.cpp message/CfgEsrc.cpp message/CfgEsrcPoll.cpp message/CfgDosc.cpp diff --git a/cc_plugin/Ublox8Messages.h b/cc_plugin/Ublox8Messages.h index ab31039..d63a32e 100644 --- a/cc_plugin/Ublox8Messages.h +++ b/cc_plugin/Ublox8Messages.h @@ -147,6 +147,8 @@ #include "cc_plugin/message/CfgLogfilterPoll.h" #include "cc_plugin/message/CfgTxslot.h" #include "cc_plugin/message/CfgPwr.h" +#include "cc_plugin/message/CfgHnr.h" +#include "cc_plugin/message/CfgHnrPoll.h" #include "cc_plugin/message/CfgEsrc.h" #include "cc_plugin/message/CfgEsrcPoll.h" #include "cc_plugin/message/CfgDosc.h" @@ -405,6 +407,8 @@ using Ublox8Messages = std::tuple< cc_plugin::message::CfgLogfilterPoll, cc_plugin::message::CfgTxslot, cc_plugin::message::CfgPwr, + cc_plugin::message::CfgHnr, + cc_plugin::message::CfgHnrPoll, cc_plugin::message::CfgEsrc, cc_plugin::message::CfgEsrcPoll, cc_plugin::message::CfgDosc, diff --git a/cc_plugin/field/MsgId.cpp b/cc_plugin/field/MsgId.cpp index 408fcea..899074f 100644 --- a/cc_plugin/field/MsgId.cpp +++ b/cc_plugin/field/MsgId.cpp @@ -119,6 +119,7 @@ QVariantMap createMsgIdProperties() .add("CFG-LOGFILTER", MsgId_CFG_LOGFILTER) .add("CFG-TXSLOT", MsgId_CFG_TXSLOT) .add("CFG-PWR", MsgId_CFG_PWR) + .add("CFG-HNR", MsgId_CFG_HNR) .add("CFG-ESRC", MsgId_CFG_ESRC) .add("CFG-DOSC", MsgId_CFG_DOSC) .add("CFG-SMGR", MsgId_CFG_SMGR) diff --git a/cc_plugin/message/CfgDgnssPoll.cpp b/cc_plugin/message/CfgDgnssPoll.cpp index 7dcc5f4..ba24b04 100644 --- a/cc_plugin/message/CfgDgnssPoll.cpp +++ b/cc_plugin/message/CfgDgnssPoll.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2017 (C). Alex Robenko. All rights reserved. +// Copyright 2017 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/cc_plugin/message/CfgHnr.cpp b/cc_plugin/message/CfgHnr.cpp new file mode 100644 index 0000000..7e75561 --- /dev/null +++ b/cc_plugin/message/CfgHnr.cpp @@ -0,0 +1,81 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "CfgHnr.h" + +#include + +#include "cc_plugin/field/common.h" + +template class ublox::message::CfgHnr; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::CfgHnr, + ublox::cc_plugin::message::CfgHnr>; + + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +namespace +{ + +using ublox::message::CfgHnrFields; + +QVariantList createFieldsProperties() +{ + QVariantList props; + props.append(cc::property::field::ForField().name("highNavRate").asMap()); + props.append(cc_plugin::field::common::props_reserved(1)); + + assert(props.size() == CfgHnr::FieldIdx_numOfValues); + return props; +} + +} // namespace + +CfgHnr::CfgHnr() = default; +CfgHnr::~CfgHnr() = default; + +CfgHnr& CfgHnr::operator=(const CfgHnr&) = default; +CfgHnr& CfgHnr::operator=(CfgHnr&&) = default; + +const char* CfgHnr::nameImpl() const +{ + static const char* Str = "CFG-HNR"; + return Str; +} + +const QVariantList& CfgHnr::fieldsPropertiesImpl() const +{ + static const auto Props = createFieldsProperties(); + return Props; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/CfgHnr.h b/cc_plugin/message/CfgHnr.h new file mode 100644 index 0000000..62c803d --- /dev/null +++ b/cc_plugin/message/CfgHnr.h @@ -0,0 +1,64 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/CfgHnr.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class CfgHnr : public + ProtocolMessageBase< + ublox::message::CfgHnr, + CfgHnr> +{ +public: + CfgHnr(); + CfgHnr(const CfgHnr&) = delete; + CfgHnr(CfgHnr&&) = delete; + virtual ~CfgHnr(); + + CfgHnr& operator=(const CfgHnr&); + CfgHnr& operator=(CfgHnr&&); + +protected: + virtual const char* nameImpl() const override; + virtual const QVariantList& fieldsPropertiesImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::CfgHnr; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::CfgHnr, + ublox::cc_plugin::message::CfgHnr>; + diff --git a/cc_plugin/message/CfgHnrPoll.cpp b/cc_plugin/message/CfgHnrPoll.cpp new file mode 100644 index 0000000..25ea741 --- /dev/null +++ b/cc_plugin/message/CfgHnrPoll.cpp @@ -0,0 +1,57 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include "CfgHnrPoll.h" + +template class ublox::message::CfgHnrPoll; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::CfgHnrPoll, + ublox::cc_plugin::message::CfgHnrPoll>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +CfgHnrPoll::CfgHnrPoll() = default; +CfgHnrPoll::~CfgHnrPoll() = default; + +CfgHnrPoll& CfgHnrPoll::operator=(const CfgHnrPoll&) = default; +CfgHnrPoll& CfgHnrPoll::operator=(CfgHnrPoll&&) = default; + + +const char* CfgHnrPoll::nameImpl() const +{ + static const char* Str = "CFG-HNR (Poll)"; + return Str; +} + + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/CfgHnrPoll.h b/cc_plugin/message/CfgHnrPoll.h new file mode 100644 index 0000000..d964108 --- /dev/null +++ b/cc_plugin/message/CfgHnrPoll.h @@ -0,0 +1,63 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/CfgHnrPoll.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class CfgHnrPoll : public + ProtocolMessageBase< + ublox::message::CfgHnrPoll, + CfgHnrPoll> +{ +public: + CfgHnrPoll(); + CfgHnrPoll(const CfgHnrPoll&) = delete; + CfgHnrPoll(CfgHnrPoll&&) = delete; + virtual ~CfgHnrPoll(); + + CfgHnrPoll& operator=(const CfgHnrPoll&); + CfgHnrPoll& operator=(CfgHnrPoll&&); + +protected: + virtual const char* nameImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::CfgHnrPoll; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::CfgHnrPoll, + ublox::cc_plugin::message::CfgHnrPoll>; + diff --git a/include/ublox/InputMessages.h b/include/ublox/InputMessages.h index 64eaff9..5bc238e 100644 --- a/include/ublox/InputMessages.h +++ b/include/ublox/InputMessages.h @@ -103,10 +103,12 @@ #include "message/CfgTmode2.h" #include "message/CfgGnss.h" #include "message/CfgLogfilter.h" +#include "message/CfgHnr.h" #include "message/CfgEsrc.h" #include "message/CfgDosc.h" #include "message/CfgSmgr.h" #include "message/CfgGeofence.h" +#include "message/CfgDgnss.h" #include "message/CfgPms.h" #include "message/UpdSosRestored.h" @@ -243,10 +245,12 @@ using InputMessages = message::CfgTmode2, message::CfgGnss, message::CfgLogfilter, + message::CfgHnr, message::CfgEsrc, message::CfgDosc, message::CfgSmgr, message::CfgGeofence, + message::CfgDgnss, message::CfgPms, message::UpdSosRestored, message::UpdSosAck, diff --git a/include/ublox/MsgId.h b/include/ublox/MsgId.h index 757b2c8..8ab1a63 100644 --- a/include/ublox/MsgId.h +++ b/include/ublox/MsgId.h @@ -107,6 +107,7 @@ enum MsgId : std::uint16_t MsgId_CFG_LOGFILTER = 0x0647, ///< ID of CFG-LOGFILTER message MsgId_CFG_TXSLOT = 0x0653, ///< ID of CFG-TXSLOT message MsgId_CFG_PWR = 0x0657, ///< ID of CFG-PWR message + MsgId_CFG_HNR = 0x065C, ///< ID of CFG-HNR message MsgId_CFG_ESRC = 0x0660, ///< ID of CFG-ESRC message MsgId_CFG_DOSC = 0x0661, ///< ID of CFG-DOSC message MsgId_CFG_SMGR = 0x0662, ///< ID of CFG-SMGR message diff --git a/include/ublox/field/MsgId.h b/include/ublox/field/MsgId.h index e5275fb..24f887b 100644 --- a/include/ublox/field/MsgId.h +++ b/include/ublox/field/MsgId.h @@ -191,6 +191,7 @@ struct MsgIdValueValidator MsgId_CFG_LOGFILTER, MsgId_CFG_TXSLOT, MsgId_CFG_PWR, + MsgId_CFG_HNR, MsgId_CFG_ESRC, MsgId_CFG_DOSC, MsgId_CFG_SMGR, diff --git a/include/ublox/message/CfgDgnss.h b/include/ublox/message/CfgDgnss.h index 401590f..d946dea 100644 --- a/include/ublox/message/CfgDgnss.h +++ b/include/ublox/message/CfgDgnss.h @@ -66,13 +66,13 @@ struct CfgDgnssFields /// and COMMS_MSG_FIELDS_ACCESS() for fields access details. /// @tparam TMsgBase Common interface class for all the messages. /// @tparam TDataOpt Extra option(s) for @b data field -template +template class CfgDgnss : public comms::MessageBase< TMsgBase, comms::option::StaticNumIdImpl, - comms::option::FieldsImpl >, - comms::option::MsgType > + comms::option::FieldsImpl, + comms::option::MsgType > > { public: @@ -83,10 +83,8 @@ class CfgDgnss : public /// for details. /// /// The field names are: - /// @li @b version for @ref CfgDgnssFields::version field - /// @li @b numOsc for @ref CfgDgnssFields::numOsc field + /// @li @b dgnssMode for @ref CfgDgnssFields::dgnssMode field /// @li @b reserved1 for @ref CfgDgnssFields::reserved1 field - /// @li @b data for @ref CfgDgnssFields::data field COMMS_MSG_FIELDS_ACCESS(dgnssMode, reserved1); /// @brief Default constructor diff --git a/include/ublox/message/CfgDosc.h b/include/ublox/message/CfgDosc.h index 4851ebd..f99e7a4 100644 --- a/include/ublox/message/CfgDosc.h +++ b/include/ublox/message/CfgDosc.h @@ -126,7 +126,7 @@ struct CfgDoscFields /// @brief Definition of "freq" field. using freq = field::common::U4T< - comms::option::ScalingRatio<1, 2>, + comms::option::ScalingRatio<1, 4>, comms::option::UnitsHertz >; diff --git a/include/ublox/message/CfgHnr.h b/include/ublox/message/CfgHnr.h new file mode 100644 index 0000000..87c2d48 --- /dev/null +++ b/include/ublox/message/CfgHnr.h @@ -0,0 +1,109 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of CFG-HNR message and its fields. + +#pragma once + +#include + +#include "ublox/Message.h" +#include "ublox/field/common.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the CFG-HNR message fields. +/// @see CfgHnr +struct CfgHnrFields +{ + /// @brief Definition of "highNavRate" field. + using highNavRate = + field::common::U1T< + comms::option::UnitsHertz + >; + + /// @brief Definition of "reserved1" field. + using reserved1 = field::common::res3; + + + /// @brief All the fields bundled in std::tuple. + using All = std::tuple< + highNavRate, + reserved1 + >; + +}; + +/// @brief Definition of CFG-HNR message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref CfgHnrFields and for definition of the fields this message contains +/// and COMMS_MSG_FIELDS_ACCESS() for fields access details. +/// @tparam TMsgBase Common interface class for all the messages. +/// @tparam TBlocksListOpt Extra option(s) for @b blocksList field +template +class CfgHnr : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ + +public: + + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_MSG_FIELDS_ACCESS macro + /// related to @b comms::MessageBase class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b highNavRate for @ref CfgHnrFields::highNavRate field + /// @li @b reserved1 for @ref CfgHnrFields::reserved1 field + COMMS_MSG_FIELDS_ACCESS(highNavRate, reserved1); + + /// @brief Default constructor + CfgHnr() = default; + + /// @brief Copy constructor + CfgHnr(const CfgHnr&) = default; + + /// @brief Move constructor + CfgHnr(CfgHnr&& other) = default; + + /// @brief Destructor + ~CfgHnr() = default; + + /// @brief Copy assignment + CfgHnr& operator=(const CfgHnr&) = default; + + /// @brief Move assignment + CfgHnr& operator=(CfgHnr&&) = default; +}; + + +} // namespace message + +} // namespace ublox + diff --git a/include/ublox/message/CfgHnrPoll.h b/include/ublox/message/CfgHnrPoll.h new file mode 100644 index 0000000..8a4eb95 --- /dev/null +++ b/include/ublox/message/CfgHnrPoll.h @@ -0,0 +1,79 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of CFG-HNR (@b poll) message and its fields. + +#pragma once + +#include "ublox/Message.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the CFG-HNR (@b poll) message fields. +/// @see CfgHnrPoll +struct CfgHnrPollFields +{ + /// @brief All the fields bundled in std::tuple. + using All = std::tuple<>; +}; + +/// @brief Definition of CFG-HNR (@b poll) message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref CfgHnrPollFields and for definition of the fields this message contains. +/// @tparam TMsgBase Common interface class for all the messages. +template +class CfgHnrPoll : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Default constructor + CfgHnrPoll() = default; + + /// @brief Copy constructor + CfgHnrPoll(const CfgHnrPoll&) = default; + + /// @brief Move constructor + CfgHnrPoll(CfgHnrPoll&& other) = default; + + /// @brief Destructor + ~CfgHnrPoll() = default; + + /// @brief Copy assignment + CfgHnrPoll& operator=(const CfgHnrPoll&) = default; + + /// @brief Move assignment + CfgHnrPoll& operator=(CfgHnrPoll&&) = default; +}; + + +} // namespace message + +} // namespace ublox + From 4025203e220b420fadaafca95f8e8a85cdd1aed8 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Wed, 9 Aug 2017 16:25:26 +1000 Subject: [PATCH 05/29] Fixes to multiple messages. --- cc_plugin/field/common.cpp | 11 ++++ cc_plugin/field/common.h | 2 +- cc_plugin/message/CfgNavx5.cpp | 2 + cc_plugin/message/CfgNmeaExtV1.cpp | 3 +- cc_plugin/message/CfgPm2.cpp | 13 +++- cc_plugin/message/CfgPms.cpp | 1 + include/ublox/message/CfgNavx5.h | 78 ++++++++++++++++++++++-- include/ublox/message/CfgNmea.h | 8 ++- include/ublox/message/CfgNmeaExtV1.h | 4 +- include/ublox/message/CfgPm2.h | 91 ++++++++++++++++++++++------ include/ublox/message/CfgPms.h | 3 +- 11 files changed, 188 insertions(+), 28 deletions(-) diff --git a/cc_plugin/field/common.cpp b/cc_plugin/field/common.cpp index 1cffb65..31ea6d7 100644 --- a/cc_plugin/field/common.cpp +++ b/cc_plugin/field/common.cpp @@ -186,6 +186,17 @@ QVariantMap createProps_utcStandard(bool serialisedHidden) return props.asMap(); } +QVariantMap createProps_optReserved(unsigned idx, bool uncheckable) +{ + return + cc::property::field::Optional() + .name(QString("reserved%1").arg(idx, 1, 10, QChar('0'))) + .field(createProps_reserved(idx)) + .uncheckable(uncheckable) + .asMap(); +} + + } // namespace common } // namespace field diff --git a/cc_plugin/field/common.h b/cc_plugin/field/common.h index d0a7930..d3ac6b1 100644 --- a/cc_plugin/field/common.h +++ b/cc_plugin/field/common.h @@ -48,7 +48,7 @@ const QVariantMap& props_gnssId(); QVariantMap createProps_reservedBundle(unsigned resIdx, unsigned elemCount); QVariantMap createProps_reservedBundleTwoParts(unsigned idx); QVariantMap createProps_utcStandard(bool serialisedHidden = false); - +QVariantMap createProps_optReserved(unsigned idx, bool uncheckable = false); } // namespace common diff --git a/cc_plugin/message/CfgNavx5.cpp b/cc_plugin/message/CfgNavx5.cpp index 1fce6fe..d058980 100644 --- a/cc_plugin/message/CfgNavx5.cpp +++ b/cc_plugin/message/CfgNavx5.cpp @@ -121,6 +121,8 @@ QVariantList createFieldsProperties() props.append(cc_plugin::field::common::props_reserved(8)); props.append(cc_plugin::field::common::props_reserved(9)); props.append(createProps_boolVal("useAdr")); + props.append(cc_plugin::field::common::createProps_optReserved(10, true)); + props.append(cc_plugin::field::common::createProps_optReserved(11, true)); assert(props.size() == CfgNavx5::FieldIdx_numOfValues); return props; } diff --git a/cc_plugin/message/CfgNmeaExtV1.cpp b/cc_plugin/message/CfgNmeaExtV1.cpp index 5fbd86f..cd0509b 100644 --- a/cc_plugin/message/CfgNmeaExtV1.cpp +++ b/cc_plugin/message/CfgNmeaExtV1.cpp @@ -60,7 +60,8 @@ QVariantMap createProps_flags() props.name("flags") .add("compat") .add("consider") - .add("limit82"); + .add("limit82") + .add("highPrec"); assert(props.bits().size() == ublox::message::CfgNmeaExtV1Fields::flags::BitIdx_numOfValues); return props.asMap(); } diff --git a/cc_plugin/message/CfgPm2.cpp b/cc_plugin/message/CfgPm2.cpp index 5c19a6a..135a91e 100644 --- a/cc_plugin/message/CfgPm2.cpp +++ b/cc_plugin/message/CfgPm2.cpp @@ -88,7 +88,7 @@ QVariantMap createProps_flags() .add(extintSelectProps.asMap()) .add(createEnableDisableProps("extintWake")) .add(createEnableDisableProps("extintBackup")) - .add(createReservedProps()) + .add(createEnableDisableProps("extintInactive")) .add(createEnableDisableProps("limitPeakCurr")) .add(createSingleBitMask("waitTimeFix")) .add(createSingleBitMask("updateRTC")) @@ -101,6 +101,16 @@ QVariantMap createProps_flags() return props.asMap(); } +QVariantMap createProps_extintInactivity() +{ + return + cc::property::field::Optional() + .name("extintInactivity") + .field(cc::property::field::IntValue().name("extintInactivity").asMap()) + .uncheckable() + .asMap(); +} + QVariantList createFieldsProperties() { QVariantList props; @@ -128,6 +138,7 @@ QVariantList createFieldsProperties() props.append(cc_plugin::field::common::props_reserved(9)); props.append(cc_plugin::field::common::props_reserved(10)); props.append(cc_plugin::field::common::props_reserved(11)); + props.append(createProps_extintInactivity()); assert(props.size() == CfgPm2::FieldIdx_numOfValues); return props; } diff --git a/cc_plugin/message/CfgPms.cpp b/cc_plugin/message/CfgPms.cpp index 6e0e587..8d5914a 100644 --- a/cc_plugin/message/CfgPms.cpp +++ b/cc_plugin/message/CfgPms.cpp @@ -52,6 +52,7 @@ QVariantMap createProps_powerSetupValue() .add("Interval") .add("Aggressive 1Hz") .add("Aggressive 2Hz") + .add("Aggressive 4Hz") .add("Invalid", (int)CfgPmsFields::PowerSetupValue::Invalid) .asMap(); } diff --git a/include/ublox/message/CfgNavx5.h b/include/ublox/message/CfgNavx5.h index aafaa0b..9b7f934 100644 --- a/include/ublox/message/CfgNavx5.h +++ b/include/ublox/message/CfgNavx5.h @@ -72,7 +72,10 @@ struct CfgNavx5Fields template bool operator()(const TField& field) const { - return (field.value() == 0) || (field.value() == 2); + return + (field.value() == 0) || + (field.value() == 2) || + (field.value() == 3); } }; @@ -219,6 +222,24 @@ struct CfgNavx5Fields comms::option::ValidNumValueRange<0, (int)UseAdr::NumOfValues - 1> >; + /// @brief Definition of "reserved10" field + /// @details Introduced in v3 of this message, as the result defined as + /// optional field. + using reserved10 = + field::common::OptionalT< + field::common::res2, + comms::option::DefaultOptionalMode + >; + + /// @brief Definition of "reserved11" field + /// @details Introduced in v3 of this message, as the result defined as + /// optional field. + using reserved11 = + field::common::OptionalT< + field::common::res2, + comms::option::DefaultOptionalMode + >; + /// @brief All the fields bundled in std::tuple. using All = std::tuple< version, @@ -243,7 +264,9 @@ struct CfgNavx5Fields aopOrbMaxErr, reserved8, reserved9, - useAdr + useAdr, + reserved10, + reserved11 >; }; @@ -260,7 +283,8 @@ class CfgNavx5 : public TMsgBase, comms::option::StaticNumIdImpl, comms::option::FieldsImpl, - comms::option::MsgType > + comms::option::MsgType >, + comms::option::HasDoRefresh > { public: @@ -294,6 +318,8 @@ class CfgNavx5 : public /// @li @b reserved8 for @ref CfgNavx5Fields::reserved8 field /// @li @b reserved9 for @ref CfgNavx5Fields::reserved9 field /// @li @b useAdr for @ref CfgNavx5Fields::useAdr field + /// @li @b reserved10 for @ref CfgNavx5Fields::reserved10 field + /// @li @b reserved11 for @ref CfgNavx5Fields::reserved11 field COMMS_MSG_FIELDS_ACCESS( version, mask1, @@ -317,7 +343,9 @@ class CfgNavx5 : public aopOrbMaxErr, reserved8, reserved9, - useAdr + useAdr, + reserved10, + reserved11 ); /// @brief Default constructor @@ -337,6 +365,48 @@ class CfgNavx5 : public /// @brief Move assignment CfgNavx5& operator=(CfgNavx5&&) = default; + + /// @brief Provides custom read functionality. + /// @details The existence of "reserved10" (see @ref CfgNavx5::reserved10) and + /// "reserved11" (see @ref CfgNavx5::reserved11) is + /// determined by the value of "version" (see @ref CfgNavx5::version). + template + comms::ErrorStatus doRead(TIter& iter, std::size_t len) + { + using Base = typename std::decay::type; + auto es = Base::template readFieldsUntil(iter, len); + if (es != comms::ErrorStatus::Success) { + return es; + } + + if (3 <= field_version().value()) { + field_reserved10().setExists(); + field_reserved11().setExists(); + } + + return Base::template readFieldsFrom(iter, len); + } + + /// @brief Provides custom refresh functionality + /// @details The existence of "reserved10" (see @ref CfgNavx5::reserved10) and + /// "reserved11" (see @ref CfgNavx5::reserved11) is + /// determined by the value of "version" (see @ref CfgNavx5::version). + bool doRefresh() + { + auto optResMode = comms::field::OptionalMode::Missing; + if (3 <= field_version().value()) { + optResMode = comms::field::OptionalMode::Exists; + } + + if ((field_reserved10().getMode() == optResMode) && + (field_reserved11().getMode() == optResMode)) { + return false; + } + + field_reserved10().setMode(optResMode); + field_reserved11().setMode(optResMode); + return true; + } }; diff --git a/include/ublox/message/CfgNmea.h b/include/ublox/message/CfgNmea.h index b7558a3..cb4a0ce 100644 --- a/include/ublox/message/CfgNmea.h +++ b/include/ublox/message/CfgNmea.h @@ -62,7 +62,13 @@ struct CfgNmeaFields /// @details See definition of @b COMMS_BITMASK_BITS_SEQ macro /// related to @b comms::field::BitmaskValue class from COMMS library /// for details. - COMMS_BITMASK_BITS_SEQ(posFilt, mskPosFilt, timeFilt, dateFilt, gpsOnlyFilter, trackFilt); + COMMS_BITMASK_BITS_SEQ( + posFilt, + mskPosFilt, + timeFilt, + dateFilt, + gpsOnlyFilter, + trackFilt); }; /// @brief Definition of "nmeaVersion" field. diff --git a/include/ublox/message/CfgNmeaExtV1.h b/include/ublox/message/CfgNmeaExtV1.h index e6d0bca..d6f28fc 100644 --- a/include/ublox/message/CfgNmeaExtV1.h +++ b/include/ublox/message/CfgNmeaExtV1.h @@ -68,14 +68,14 @@ struct CfgNmeaExtV1Fields : public CfgNmeaExtFields /// @brief Definition of "flags" field. struct flags : public field::common::X1T< - comms::option::BitmaskReservedBits<0xf8, 0> + comms::option::BitmaskReservedBits<0xf0, 0> > { /// @brief Provide names for internal bits. /// @details See definition of @b COMMS_BITMASK_BITS_SEQ macro /// related to @b comms::field::BitmaskValue class from COMMS library /// for details. - COMMS_BITMASK_BITS_SEQ(compat, consider, limit82); + COMMS_BITMASK_BITS_SEQ(compat, consider, limit82, highPrec); }; diff --git a/include/ublox/message/CfgPm2.h b/include/ublox/message/CfgPm2.h index 4752ac3..fb03f2b 100644 --- a/include/ublox/message/CfgPm2.h +++ b/include/ublox/message/CfgPm2.h @@ -56,6 +56,9 @@ struct CfgPm2Fields /// @brief Value enumeration for @ref extintBackup field. using ExtintBackup = DisabledEnabled; + /// @brief Value enumeration for @ref extintInactive field. + using ExtintInactive = DisabledEnabled; + /// @brief Value enumeration for @ref limitPeakCurr field. using LimitPeakCurr = DisabledEnabled; @@ -71,7 +74,7 @@ struct CfgPm2Fields using version = field::common::U1T< comms::option::DefaultNumValue<1>, - comms::option::ValidNumValueRange<1, 1> + comms::option::ValidNumValueRange<1, 2> >; /// @brief Definition of "reserved1" field. @@ -83,12 +86,6 @@ struct CfgPm2Fields /// @brief Definition of "reserved3" field. using reserved3 = field::common::res1; - /// @brief Definition of "reserved" member of @ref flags bitfield field. - using reserved = - field::common::res1T< - comms::option::FixedBitLength<4> - >; - /// @brief Definition of "extintSelect" member of @ref flags bitfield field. using extintSelect = field::common::EnumT< @@ -113,6 +110,14 @@ struct CfgPm2Fields comms::option::FixedBitLength<1> >; + /// @brief Definition of "extintInactive" member of @ref flags bitfield field. + using extintInactive = + field::common::EnumT< + ExtintInactive, + comms::option::ValidNumValueRange<0, (int)ExtintInactive::NumOfValues - 1>, + comms::option::FixedBitLength<1> + >; + /// @brief Definition of "limitPeakCurr" member of @ref flags bitfield field. using limitPeakCurr = field::common::EnumT< @@ -177,13 +182,13 @@ struct CfgPm2Fields struct flags : public field::common::BitfieldT< std::tuple< - reserved, + field::common::res1T< + comms::option::FixedBitLength<4> + >, extintSelect, extintWake, extintBackup, - field::common::res1T< - comms::option::FixedBitLength<1> - >, + extintInactive, limitPeakCurr, waitTimeFix, updateRTC, @@ -208,15 +213,15 @@ struct CfgPm2Fields extintSelect, extintWake, extintBackup, - invalid2, + extintInactive, limitPeakCurr, waitTimeFix, updateRTC, updateEPH, - invalid3, + invalid2, doNotEnterOff, mode, - invalid4); + invalid3); }; /// @brief Definition of "updatePeriod" field. @@ -258,6 +263,14 @@ struct CfgPm2Fields /// @brief Definition of "reserved11" field. using reserved11 = field::common::res4; + /// @brief Definition of "extintInactivityMs" field. + /// @details Defined as optional to allow single definition for + /// versions 1 and 2 of the message + using extintInactivityMs = + field::common::OptionalT< + field::common::U4T + >; + /// @brief All the fields bundled in std::tuple. using All = std::tuple< version, @@ -277,7 +290,8 @@ struct CfgPm2Fields reserved8, reserved9, reserved10, - reserved11 + reserved11, + extintInactivityMs >; }; @@ -294,7 +308,8 @@ class CfgPm2 : public TMsgBase, comms::option::StaticNumIdImpl, comms::option::FieldsImpl, - comms::option::MsgType > + comms::option::MsgType >, + comms::option::HasDoRefresh > { public: @@ -322,6 +337,7 @@ class CfgPm2 : public /// @li @b reserved9 for @ref CfgPm2Fields::reserved9 field /// @li @b reserved10 for @ref CfgPm2Fields::reserved10 field /// @li @b reserved11 for @ref CfgPm2Fields::reserved11 field + /// @li @b extintInactivityMs for @ref CfgPm2Fields::extintInactivityMs field COMMS_MSG_FIELDS_ACCESS( version, reserved1, @@ -340,7 +356,8 @@ class CfgPm2 : public reserved8, reserved9, reserved10, - reserved11 + reserved11, + extintInactivityMs ); /// @brief Default constructor @@ -360,6 +377,46 @@ class CfgPm2 : public /// @brief Move assignment CfgPm2& operator=(CfgPm2&&) = default; + + /// @brief Provides custom read functionality. + /// @details The existence of "extintInactivityMs" (see @ref CfgPm2::extintInactivityMs) is + /// determined by the value of "version" (see @ref CfgPm2::version). + template + comms::ErrorStatus doRead(TIter& iter, std::size_t len) + { + using Base = typename std::decay::type; + auto es = Base::template readFieldsUntil(iter, len); + if (es != comms::ErrorStatus::Success) { + return es; + } + + if (2 <= field_version().value()) { + field_extintInactivityMs().setExists(); + } + else { + field_extintInactivityMs().setMissing(); + } + return Base::template readFieldsFrom(iter, len); + } + + /// @brief Provides custom refresh functionality + /// @details The existence of "extintInactivityMs" (see @ref CfgPm2::extintInactivityMs) is + /// determined by the value of "version" (see @ref CfgPm2::version). + /// @return @b true in case the mode of "extintInactivityMs" field was modified, @b false otherwise + bool doRefresh() + { + auto extintInactivityMsMode = comms::field::OptionalMode::Missing; + if (2 <= field_version().value()) { + extintInactivityMsMode = comms::field::OptionalMode::Exists; + } + + if (field_extintInactivityMs().getMode() == extintInactivityMsMode) { + return false; + } + + field_extintInactivityMs().setMode(extintInactivityMsMode); + return true; + } }; diff --git a/include/ublox/message/CfgPms.h b/include/ublox/message/CfgPms.h index e097402..0adfc51 100644 --- a/include/ublox/message/CfgPms.h +++ b/include/ublox/message/CfgPms.h @@ -47,6 +47,7 @@ struct CfgPmsFields Interval, ///< Intervale Aggressive_1Hz, ///< Aggressive with 1Hz Aggressive_2Hz, ///< Aggressive with 2Hz + Aggressive_4Hz, ///< Aggressive with 4Hz Invalid = 0xff /// Invalid }; @@ -59,7 +60,7 @@ struct CfgPmsFields if (val == PowerSetupValue::Invalid) { return true; } - return (PowerSetupValue::FullPower <= val) && (val <= PowerSetupValue::Aggressive_2Hz); + return (PowerSetupValue::FullPower <= val) && (val <= PowerSetupValue::Aggressive_4Hz); } }; From 821f11b20a44a3c455125fdb1f41cff2b29603bc Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Wed, 9 Aug 2017 16:40:31 +1000 Subject: [PATCH 06/29] Added missing bits to "inProtoMask" and "outProtoMask" fields of CFG-PRT messages. --- cc_plugin/field/cfg.cpp | 28 +++++++++++++++++----------- include/ublox/message/CfgPrt.h | 24 +++++++++++++++++++----- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/cc_plugin/field/cfg.cpp b/cc_plugin/field/cfg.cpp index a6d329c..456a773 100644 --- a/cc_plugin/field/cfg.cpp +++ b/cc_plugin/field/cfg.cpp @@ -108,22 +108,28 @@ QVariantMap createProps_txReady() QVariantMap createProps_inProtoMask() { - cc::property::field::ForField props; - props.name("inProtoMask") - .add("inUbx") - .add("inNmea") - .add("inRtcm"); - assert(props.bits().size() == ublox::message::CfgPrtFields::inProtoMask::BitIdx_numOfValues); + using Field = ublox::message::CfgPrtFields::inProtoMask; + auto props = + cc::property::field::ForField() + .name("inProtoMask") + .add("inUbx") + .add("inNmea") + .add("inRtcm") + .add(Field::BitIdx_inRtcm3, "inRtcm3"); + assert(props.bits().size() == Field::BitIdx_numOfValues); return props.asMap(); } QVariantMap createProps_outProtoMask() { - cc::property::field::ForField props; - props.name("outProtoMask") - .add("outUbx") - .add("outNmea"); - assert(props.bits().size() == ublox::message::CfgPrtFields::outProtoMask::BitIdx_numOfValues); + using Field = ublox::message::CfgPrtFields::outProtoMask; + auto props = + cc::property::field::ForField() + .name("outProtoMask") + .add("outUbx") + .add("outNmea") + .add(Field::BitIdx_outRtcm3, "outRtcm3"); + assert(props.bits().size() == Field::BitIdx_numOfValues); return props.asMap(); } diff --git a/include/ublox/message/CfgPrt.h b/include/ublox/message/CfgPrt.h index bc15cbf..220fa9b 100644 --- a/include/ublox/message/CfgPrt.h +++ b/include/ublox/message/CfgPrt.h @@ -115,24 +115,38 @@ struct CfgPrtFields /// @brief Definition of "inProtoMask" field. struct inProtoMask : public - field::common::X2T > + field::common::X2T > { /// @brief Provide names for internal bits. /// @details See definition of @b COMMS_BITMASK_BITS macro /// related to @b comms::field::BitmaskValue class from COMMS library /// for details. - COMMS_BITMASK_BITS_SEQ(inUbx, inNmea, inRtcm); + COMMS_BITMASK_BITS(inUbx, inNmea, inRtcm, inRtcm3=5); + + /// @brief Provide convenience access functions for internal bits. + /// @details See definition of @b COMMS_BITMASK_BITS_ACCESS macro + /// related to @b comms::field::BitmaskValue class from COMMS library + /// for details. + COMMS_BITMASK_BITS_ACCESS(inUbx, inNmea, inRtcm, inRtcm3); + }; /// @brief Definition of "outProtoMask" field. struct outProtoMask : public - field::common::X2T > + field::common::X2T > { /// @brief Provide names for internal bits. - /// @details See definition of @b COMMS_BITMASK_BITS_SEQ macro + /// @details See definition of @b COMMS_BITMASK_BITS macro /// related to @b comms::field::BitmaskValue class from COMMS library /// for details. - COMMS_BITMASK_BITS_SEQ(outUbx, outNmea); + COMMS_BITMASK_BITS(outUbx, outNmea, outRtcm3=5); + + /// @brief Provide convenience access functions for internal bits. + /// @details See definition of @b COMMS_BITMASK_BITS_ACCESS macro + /// related to @b comms::field::BitmaskValue class from COMMS library + /// for details. + COMMS_BITMASK_BITS_ACCESS(outUbx, outNmea, outRtcm3); + }; /// @brief Definition of "flags" field. From 18fbd401b3b598527b5fca4d4f265f490ac848de Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Thu, 10 Aug 2017 15:59:28 +1000 Subject: [PATCH 07/29] Implemented CFG-TMODE3 message. --- cc_plugin/AllMessages.h | 4 + cc_plugin/CMakeLists.txt | 2 + cc_plugin/Ublox8Messages.h | 4 + cc_plugin/field/MsgId.cpp | 1 + cc_plugin/field/cfg.cpp | 20 ++ cc_plugin/field/cfg.h | 1 + cc_plugin/message/CfgTmode2.cpp | 14 +- cc_plugin/message/CfgTmode3.cpp | 145 ++++++++++ cc_plugin/message/CfgTmode3.h | 64 +++++ cc_plugin/message/CfgTmode3Poll.cpp | 57 ++++ cc_plugin/message/CfgTmode3Poll.h | 63 ++++ include/ublox/InputMessages.h | 2 + include/ublox/MsgId.h | 1 + include/ublox/field/MsgId.h | 1 + include/ublox/message/CfgSmgr.h | 1 - include/ublox/message/CfgTmode3.h | 394 ++++++++++++++++++++++++++ include/ublox/message/CfgTmode3Poll.h | 79 ++++++ 17 files changed, 840 insertions(+), 13 deletions(-) create mode 100644 cc_plugin/message/CfgTmode3.cpp create mode 100644 cc_plugin/message/CfgTmode3.h create mode 100644 cc_plugin/message/CfgTmode3Poll.cpp create mode 100644 cc_plugin/message/CfgTmode3Poll.h create mode 100644 include/ublox/message/CfgTmode3.h create mode 100644 include/ublox/message/CfgTmode3Poll.h diff --git a/cc_plugin/AllMessages.h b/cc_plugin/AllMessages.h index b0ea518..b45e12d 100644 --- a/cc_plugin/AllMessages.h +++ b/cc_plugin/AllMessages.h @@ -183,6 +183,8 @@ #include "cc_plugin/message/CfgGeofencePoll.h" #include "cc_plugin/message/CfgDgnss.h" #include "cc_plugin/message/CfgDgnssPoll.h" +#include "cc_plugin/message/CfgTmode3.h" +#include "cc_plugin/message/CfgTmode3Poll.h" #include "cc_plugin/message/CfgFixseed.h" #include "cc_plugin/message/CfgDynseed.h" #include "cc_plugin/message/CfgPms.h" @@ -475,6 +477,8 @@ using AllMessages = std::tuple< cc_plugin::message::CfgGeofencePoll, cc_plugin::message::CfgDgnss, cc_plugin::message::CfgDgnssPoll, + cc_plugin::message::CfgTmode3, + cc_plugin::message::CfgTmode3Poll, cc_plugin::message::CfgFixseed, cc_plugin::message::CfgDynseed, cc_plugin::message::CfgPms, diff --git a/cc_plugin/CMakeLists.txt b/cc_plugin/CMakeLists.txt index 939bafa..f1321cd 100644 --- a/cc_plugin/CMakeLists.txt +++ b/cc_plugin/CMakeLists.txt @@ -165,6 +165,8 @@ function (cc_plugin_ublox_all_messages) message/CfgGeofencePoll.cpp message/CfgDgnss.cpp message/CfgDgnssPoll.cpp + message/CfgTmode3.cpp + message/CfgTmode3Poll.cpp message/CfgFixseed.cpp message/CfgDynseed.cpp message/CfgPms.cpp diff --git a/cc_plugin/Ublox8Messages.h b/cc_plugin/Ublox8Messages.h index d63a32e..82a02ba 100644 --- a/cc_plugin/Ublox8Messages.h +++ b/cc_plugin/Ublox8Messages.h @@ -159,6 +159,8 @@ #include "cc_plugin/message/CfgGeofencePoll.h" #include "cc_plugin/message/CfgDgnss.h" #include "cc_plugin/message/CfgDgnssPoll.h" +#include "cc_plugin/message/CfgTmode3.h" +#include "cc_plugin/message/CfgTmode3Poll.h" #include "cc_plugin/message/CfgFixseed.h" #include "cc_plugin/message/CfgDynseed.h" #include "cc_plugin/message/CfgPms.h" @@ -419,6 +421,8 @@ using Ublox8Messages = std::tuple< cc_plugin::message::CfgGeofencePoll, cc_plugin::message::CfgDgnss, cc_plugin::message::CfgDgnssPoll, + cc_plugin::message::CfgTmode3, + cc_plugin::message::CfgTmode3Poll, cc_plugin::message::CfgFixseed, cc_plugin::message::CfgDynseed, cc_plugin::message::CfgPms, diff --git a/cc_plugin/field/MsgId.cpp b/cc_plugin/field/MsgId.cpp index 899074f..7b3b6b8 100644 --- a/cc_plugin/field/MsgId.cpp +++ b/cc_plugin/field/MsgId.cpp @@ -125,6 +125,7 @@ QVariantMap createMsgIdProperties() .add("CFG-SMGR", MsgId_CFG_SMGR) .add("CFG-GEOFENCE", MsgId_CFG_GEOFENCE) .add("CFG-DGNSS", MsgId_CFG_GNSS) + .add("CFG-TMODE3", MsgId_CFG_TMODE3) .add("CFG-FIXSEED", MsgId_CFG_FIXSEED) .add("CFG-DYNSEED", MsgId_CFG_DYNSEED) .add("CFG-PMS", MsgId_CFG_PMS) diff --git a/cc_plugin/field/cfg.cpp b/cc_plugin/field/cfg.cpp index 456a773..d61a9f9 100644 --- a/cc_plugin/field/cfg.cpp +++ b/cc_plugin/field/cfg.cpp @@ -28,6 +28,7 @@ CC_ENABLE_WARNINGS() #include "ublox/message/CfgInf.h" #include "ublox/message/CfgNmea.h" #include "ublox/message/CfgNmeaExt.h" +#include "ublox/message/CfgTmode2.h" namespace cc = comms_champion; @@ -243,6 +244,18 @@ QVariantMap createProps_tpIdx() return props.asMap(); } +QVariantMap createProps_timeMode() +{ + using Field = ublox::message::CfgTmode2Fields::timeMode; + auto props = + cc::property::field::ForField() + .name("timeMode") + .add("Disabled") + .add("Survey In") + .add("Fixed Mode"); + assert(props.values().size() == (int)Field::ValueType::NumOfValues); + return props.asMap(); +} } // namespace @@ -444,6 +457,13 @@ const QVariantMap& props_tpIdx() return Props; } +const QVariantMap& props_timeMode() +{ + static const QVariantMap Props = createProps_timeMode(); + return Props; +} + + } // namespace cfg } // namespace field diff --git a/cc_plugin/field/cfg.h b/cc_plugin/field/cfg.h index 7bfed49..c7dfc3a 100644 --- a/cc_plugin/field/cfg.h +++ b/cc_plugin/field/cfg.h @@ -63,6 +63,7 @@ const QVariantMap& props_nmeaFlags(); const QVariantMap& props_mainTalkerId(); const QVariantMap& props_gsvTalkerId(); const QVariantMap& props_tpIdx(); +const QVariantMap& props_timeMode(); } // namespace cfg diff --git a/cc_plugin/message/CfgTmode2.cpp b/cc_plugin/message/CfgTmode2.cpp index 995163d..d523c8c 100644 --- a/cc_plugin/message/CfgTmode2.cpp +++ b/cc_plugin/message/CfgTmode2.cpp @@ -20,6 +20,7 @@ #include "CfgTmode2.h" #include "cc_plugin/field/common.h" +#include "cc_plugin/field/cfg.h" template class ublox::message::CfgTmode2; template class ublox::cc_plugin::ProtocolMessageBase< @@ -42,17 +43,6 @@ namespace using ublox::message::CfgTmode2Fields; -QVariantMap createProps_timeMode() -{ - cc::property::field::ForField props; - props.name("timeMode") - .add("Disabled") - .add("Survey In") - .add("Fixed Mode"); - assert(props.values().size() == (int)CfgTmode2Fields::TimeMode::NumOfValues); - return props.asMap(); -} - QVariantMap createProps_flags() { cc::property::field::ForField props; @@ -96,7 +86,7 @@ QVariantMap createProps_geodetic(const char* name, int scaledDigits = 0) QVariantList createFieldsProperties() { QVariantList props; - props.append(createProps_timeMode()); + props.append(cc_plugin::field::cfg::props_timeMode()); props.append(cc_plugin::field::common::props_reserved(1)); props.append(createProps_flags()); props.append(createProps_cartesian('X')); diff --git a/cc_plugin/message/CfgTmode3.cpp b/cc_plugin/message/CfgTmode3.cpp new file mode 100644 index 0000000..1eed649 --- /dev/null +++ b/cc_plugin/message/CfgTmode3.cpp @@ -0,0 +1,145 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include "CfgTmode3.h" + +#include "cc_plugin/field/common.h" +#include "cc_plugin/field/cfg.h" + +template class ublox::message::CfgTmode3; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::CfgTmode3, + ublox::cc_plugin::message::CfgTmode3>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +namespace +{ + +using ublox::message::CfgTmode3Fields; + +QVariantMap createProps_flags() +{ + using Field = CfgTmode3Fields::flags; + cc::property::field::ForField props; + props.name("flags") + .add("lla"); + assert(props.bits().size() == Field::BitIdx_numOfValues); + return props.asMap(); +} + +QVariantMap createProps_cartesian(const char* coord) +{ + auto name = QString("ecef%1").arg(coord); + cc::property::field::IntValue coordProps; + coordProps.name(name); + + return + cc::property::field::Optional() + .name(name) + .field(coordProps.asMap()) + .uncheckable() + .asMap(); +} + +QVariantMap createProps_geodetic(const char* name, int scaledDigits = 0) +{ + cc::property::field::IntValue coordProps; + coordProps.name(name); + if (0 < scaledDigits) { + coordProps.scaledDecimals(scaledDigits); + } + + return + cc::property::field::Optional() + .name(name) + .field(coordProps.asMap()) + .uncheckable() + .asMap(); +} + +QVariantList createFieldsProperties() +{ + QVariantList props; + props.append( + cc::property::field::ForField().name("version").asMap()); + props.append(cc_plugin::field::common::props_reserved(1)); + props.append(cc_plugin::field::cfg::props_timeMode()); + props.append(createProps_flags()); + props.append(createProps_cartesian("X")); + props.append(createProps_geodetic("lat", 7)); + props.append(createProps_cartesian("Y")); + props.append(createProps_geodetic("lon", 7)); + props.append(createProps_cartesian("Z")); + props.append(createProps_geodetic("alt")); + props.append(createProps_cartesian("XHP")); + props.append(createProps_geodetic("latHP", 9)); + props.append(createProps_cartesian("YHP")); + props.append(createProps_geodetic("lonHP", 9)); + props.append(createProps_cartesian("ZHP")); + props.append(createProps_geodetic("altHP")); + props.append(cc_plugin::field::common::props_reserved(2)); + props.append( + cc::property::field::ForField().name("fixedPosAcc").asMap()); + props.append( + cc::property::field::ForField().name("svinMinDur").asMap()); + props.append( + cc::property::field::ForField().name("svinAccLimit").asMap()); + props.append(cc_plugin::field::common::props_reserved(3)); + props.append(cc_plugin::field::common::props_reserved(4)); + assert(props.size() == CfgTmode3::FieldIdx_numOfValues); + return props; +} + +} // namespace + +CfgTmode3::CfgTmode3() = default; +CfgTmode3::~CfgTmode3() = default; + +CfgTmode3& CfgTmode3::operator=(const CfgTmode3&) = default; +CfgTmode3& CfgTmode3::operator=(CfgTmode3&&) = default; + + +const char* CfgTmode3::nameImpl() const +{ + static const char* Str = "CFG-TMODE3"; + return Str; +} + +const QVariantList& CfgTmode3::fieldsPropertiesImpl() const +{ + static const auto Props = createFieldsProperties(); + return Props; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/CfgTmode3.h b/cc_plugin/message/CfgTmode3.h new file mode 100644 index 0000000..0e2af4a --- /dev/null +++ b/cc_plugin/message/CfgTmode3.h @@ -0,0 +1,64 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/CfgTmode3.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class CfgTmode3 : public + ProtocolMessageBase< + ublox::message::CfgTmode3, + CfgTmode3> +{ +public: + CfgTmode3(); + CfgTmode3(const CfgTmode3&) = delete; + CfgTmode3(CfgTmode3&&) = delete; + virtual ~CfgTmode3(); + + CfgTmode3& operator=(const CfgTmode3&); + CfgTmode3& operator=(CfgTmode3&&); + +protected: + virtual const char* nameImpl() const override; + virtual const QVariantList& fieldsPropertiesImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::CfgTmode3; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::CfgTmode3, + ublox::cc_plugin::message::CfgTmode3>; + diff --git a/cc_plugin/message/CfgTmode3Poll.cpp b/cc_plugin/message/CfgTmode3Poll.cpp new file mode 100644 index 0000000..88c76ce --- /dev/null +++ b/cc_plugin/message/CfgTmode3Poll.cpp @@ -0,0 +1,57 @@ +// +// Copyright 2015 - 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include "CfgTmode3Poll.h" + +template class ublox::message::CfgTmode3Poll; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::CfgTmode3Poll, + ublox::cc_plugin::message::CfgTmode3Poll>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +CfgTmode3Poll::CfgTmode3Poll() = default; +CfgTmode3Poll::~CfgTmode3Poll() = default; + +CfgTmode3Poll& CfgTmode3Poll::operator=(const CfgTmode3Poll&) = default; +CfgTmode3Poll& CfgTmode3Poll::operator=(CfgTmode3Poll&&) = default; + + +const char* CfgTmode3Poll::nameImpl() const +{ + static const char* Str = "CFG-TMODE3 (Poll)"; + return Str; +} + + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/CfgTmode3Poll.h b/cc_plugin/message/CfgTmode3Poll.h new file mode 100644 index 0000000..2ed5590 --- /dev/null +++ b/cc_plugin/message/CfgTmode3Poll.h @@ -0,0 +1,63 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/CfgTmode3Poll.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class CfgTmode3Poll : public + ProtocolMessageBase< + ublox::message::CfgTmode3Poll, + CfgTmode3Poll> +{ +public: + CfgTmode3Poll(); + CfgTmode3Poll(const CfgTmode3Poll&) = delete; + CfgTmode3Poll(CfgTmode3Poll&&) = delete; + virtual ~CfgTmode3Poll(); + + CfgTmode3Poll& operator=(const CfgTmode3Poll&); + CfgTmode3Poll& operator=(CfgTmode3Poll&&); + +protected: + virtual const char* nameImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::CfgTmode3Poll; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::CfgTmode3Poll, + ublox::cc_plugin::message::CfgTmode3Poll>; + diff --git a/include/ublox/InputMessages.h b/include/ublox/InputMessages.h index 5bc238e..f085980 100644 --- a/include/ublox/InputMessages.h +++ b/include/ublox/InputMessages.h @@ -109,6 +109,7 @@ #include "message/CfgSmgr.h" #include "message/CfgGeofence.h" #include "message/CfgDgnss.h" +#include "message/CfgTMode3.h" #include "message/CfgPms.h" #include "message/UpdSosRestored.h" @@ -251,6 +252,7 @@ using InputMessages = message::CfgSmgr, message::CfgGeofence, message::CfgDgnss, + message::CfgTmode3, message::CfgPms, message::UpdSosRestored, message::UpdSosAck, diff --git a/include/ublox/MsgId.h b/include/ublox/MsgId.h index 8ab1a63..9ba5605 100644 --- a/include/ublox/MsgId.h +++ b/include/ublox/MsgId.h @@ -113,6 +113,7 @@ enum MsgId : std::uint16_t MsgId_CFG_SMGR = 0x0662, ///< ID of CFG-SMGR message MsgId_CFG_GEOFENCE = 0x0669, ///< ID of CFG-GEOFENCE message MsgId_CFG_DGNSS = 0x0670, ///< ID of CFG-DGNSS message + MsgId_CFG_TMODE3 = 0x0671, ///< ID of CFG-TMODE3 message MsgId_CFG_FIXSEED = 0x0684, ///< ID of CFG-FIXSEED message MsgId_CFG_DYNSEED = 0x0685, ///< ID of CFG-DYNSEED message MsgId_CFG_PMS = 0x0686, ///< ID of CFG-PMS message diff --git a/include/ublox/field/MsgId.h b/include/ublox/field/MsgId.h index 24f887b..89fd459 100644 --- a/include/ublox/field/MsgId.h +++ b/include/ublox/field/MsgId.h @@ -197,6 +197,7 @@ struct MsgIdValueValidator MsgId_CFG_SMGR, MsgId_CFG_GEOFENCE, MsgId_CFG_DGNSS, + MsgId_CFG_TMODE3, MsgId_CFG_FIXSEED, MsgId_CFG_DYNSEED, MsgId_CFG_PMS diff --git a/include/ublox/message/CfgSmgr.h b/include/ublox/message/CfgSmgr.h index 16e29ad..d04a6b0 100644 --- a/include/ublox/message/CfgSmgr.h +++ b/include/ublox/message/CfgSmgr.h @@ -164,7 +164,6 @@ struct CfgSmgrFields COMMS_FIELD_MEMBERS_ACCESS(flagsLow, TPCoherent, flagsHigh); }; - // TODO: flags high and low. /// @brief All the fields bundled in std::tuple. using All = std::tuple< version, diff --git a/include/ublox/message/CfgTmode3.h b/include/ublox/message/CfgTmode3.h new file mode 100644 index 0000000..bec99cb --- /dev/null +++ b/include/ublox/message/CfgTmode3.h @@ -0,0 +1,394 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of CFG-TMODE3 message and its fields. + +#pragma once + +#include "ublox/Message.h" +#include "ublox/field/common.h" +#include "CfgTmode2.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the CFG-TMODE3 message fields. +/// @see CfgTmode3 +struct CfgTmode3Fields +{ + /// @brief Definition of "version" field. + using version = + field::common::U1T< + comms::option::ValidNumValueRange<0, 0> + >; + + /// @brief Definition of "reserved1" field + using reserved1 = field::common::res1; + + /// @brief Value enumeration for @ref timeMode field. + /// @details Same as for CFG-TMODE2 message. + using TimeMode = CfgTmode2Fields::TimeMode; + + /// @brief Definition of "timeMode" field. + /// @details Same as for CFG-TMODE2 message. + using timeMode = CfgTmode2Fields::timeMode; + + /// @brief Definition of "flags" field. + struct flags : public + field::common::X2T< + comms::option::BitmaskReservedBits<0xfffe, 0> + > + { + /// @brief Provide names for internal bits. + /// @details See definition of @b COMMS_BITMASK_BITS_SEQ macro + /// related to @b comms::field::BitmaskValue class from COMMS library + /// for details. + COMMS_BITMASK_BITS_SEQ(lla); + }; + + /// @brief Definition of "ecefX" field. + using ecefX = + field::common::OptionalT< + field::common::I4T + >; + + /// @brief Definition of "lat" field. + using lat = + field::common::OptionalT< + field::common::I4T< + comms::option::ScalingRatio<1, 10000000L>, + comms::option::UnitsDegrees + > + >; + + /// @brief Definition of "ecefY" field. + using ecefY = ecefX; + + /// @brief Definition of "lon" field. + using lon = lat; + + /// @brief Definition of "ecefZ" field. + using ecefZ = ecefX; + + /// @brief Definition of "alt" field. + using alt = + field::common::OptionalT< + field::common::I4T + >; + + /// @brief Definition of "ecefXHP" field. + using ecefXHP = + field::common::OptionalT< + field::common::I1T< + comms::option::UnitsMillimeters, + comms::option::ScalingRatio<1, 10> + > + >; + + /// @brief Definition of "latHP" field. + using latHP = + field::common::OptionalT< + field::common::I1T< + comms::option::ScalingRatio<1, 1000000000L>, + comms::option::UnitsDegrees + > + >; + + /// @brief Definition of "ecefYHP" field. + using ecefYHP = ecefXHP; + + /// @brief Definition of "lonHP" field. + using lonHP = latHP; + + /// @brief Definition of "ecefZHP" field. + using ecefZHP = ecefXHP; + + /// @brief Definition of "altHP" field. + using altHP = + field::common::OptionalT< + field::common::I1T< + comms::option::UnitsMillimeters, + comms::option::ScalingRatio<1, 10> + > + >; + + /// @brief Definition of "reserved1" field. + using reserved2 = field::common::res1; + + /// @brief Definition of "fixedPosAcc" field. + using fixedPosAcc = + field::common::U4T< + comms::option::UnitsMillimeters, + comms::option::ScalingRatio<1, 10> + >; + + /// @brief Definition of "svinMinDur" field. + using svinMinDur = field::common::U4T; + + /// @brief Definition of "svinAccLimit" field. + using svinAccLimit = + field::common::U4T< + comms::option::UnitsMillimeters, + comms::option::ScalingRatio<1, 10> + >; + + /// @brief Definition of "reserved3" field. + using reserved3 = field::common::res3; + + /// @brief Definition of "reserved3" field. + using reserved4 = field::common::res4; + + /// @brief All the fields bundled in std::tuple. + using All = std::tuple< + version, + reserved1, + timeMode, + flags, + ecefX, + lat, + ecefY, + lon, + ecefZ, + alt, + ecefXHP, + latHP, + ecefYHP, + lonHP, + ecefZHP, + altHP, + reserved2, + fixedPosAcc, + svinMinDur, + svinAccLimit, + reserved3, + reserved4 + >; +}; + +/// @brief Definition of AID-TMODE3 message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref CfgTmode3Fields and for definition of the fields this message contains +/// and COMMS_MSG_FIELDS_ACCESS() for fields access details. +/// +/// @b NOTE, that Ublox binary protocol specification reinterprets value of +/// some fields based on the value of @b lla bit in @b flags (see @ref CfgTmode3Fields::flags) +/// field. It also combines the dual meaning of the field in a single name, such as +/// @b ecefXOrLat, @b ecefYOrLon, @b ecefZOrAlt, @b ecefXofLatHP, etc... @n +/// The implementation of this message splits these names into two separate +/// fields: @b ecefX + @b lat, @b ecefY + @b lon, @b ecefZ + @b alt, @b ecefXHP + @b latHP, etc... +/// These fields are @b optional (see @ref field::common::OptionalT), and +/// marked as @b missing or @b existing based on the value of @b lla bit +/// in @b flags (see @ref CfgTmode3Fields::flags) field. +/// @tparam TMsgBase Common interface class for all the messages. +template +class CfgTmode3 : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType >, + comms::option::HasDoRefresh + > +{ +public: + + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_MSG_FIELDS_ACCESS macro + /// related to @b comms::MessageBase class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b version for @ref CfgTmode3Fields::version field + /// @li @b reserved1 for @ref CfgTmode3Fields::reserved1 field + /// @li @b timeMode for @ref CfgTmode3Fields::timeMode field + /// @li @b flags for @ref CfgTmode3Fields::flags field + /// @li @b ecefX for @ref CfgTmode3Fields::ecefX field + /// @li @b lat for @ref CfgTmode3Fields::lat field + /// @li @b ecefY for @ref CfgTmode3Fields::ecefY field + /// @li @b lon for @ref CfgTmode3Fields::lon field + /// @li @b ecefZ for @ref CfgTmode3Fields::ecefZ field + /// @li @b alt for @ref CfgTmode3Fields::alt field + /// @li @b ecefXHP for @ref CfgTmode3Fields::ecefXHP field + /// @li @b latHP for @ref CfgTmode3Fields::latHP field + /// @li @b ecefYHP for @ref CfgTmode3Fields::ecefYHP field + /// @li @b lonHP for @ref CfgTmode3Fields::lonHP field + /// @li @b ecefZHP for @ref CfgTmode3Fields::ecefZHP field + /// @li @b altHP for @ref CfgTmode3Fields::altHP field + /// @li @b reserved2 for @ref CfgTmode3Fields::reserved2 field + /// @li @b fixedPosAcc for @ref CfgTmode3Fields::fixedPosAcc field + /// @li @b svinMinDur for @ref CfgTmode3Fields::svinMinDur field + /// @li @b svinAccLimit for @ref CfgTmode3Fields::svinAccLimit field + /// @li @b reserved3 for @ref CfgTmode3Fields::reserved3 field + /// @li @b reserved4 for @ref CfgTmode3Fields::reserved4 field + COMMS_MSG_FIELDS_ACCESS( + version, + reserved1, + timeMode, + flags, + ecefX, + lat, + ecefY, + lon, + ecefZ, + alt, + ecefXHP, + latHP, + ecefYHP, + lonHP, + ecefZHP, + altHP, + reserved2, + fixedPosAcc, + svinMinDur, + svinAccLimit, + reserved3, + reserved4 + ); + + + /// @brief Default constructor + /// @details The existing/missing mode of the optional fields is determined + /// by the default value of the @b flags (see @ref CfgTmode3Fields::flags) + /// field, i.e. the @ref CfgTmode3Fields::ecefX, @ref CfgTmode3Fields::ecefY, + /// and @ref CfgTmode3Fields::ecefZ fields are marked as @b existing, while + /// @ref CfgTmode3Fields::lat, @ref CfgTmode3Fields::lon, and + /// @ref CfgTmode3Fields::alt are marked as @b missing. + CfgTmode3() + { + field_ecefX().setExists(); + field_ecefY().setExists(); + field_ecefZ().setExists(); + field_ecefXHP().setExists(); + field_ecefYHP().setExists(); + field_ecefZHP().setExists(); + + field_lat().setMissing(); + field_lon().setMissing(); + field_alt().setMissing(); + field_latHP().setMissing(); + field_lonHP().setMissing(); + field_altHP().setMissing(); + } + + /// @brief Copy constructor + CfgTmode3(const CfgTmode3&) = default; + + /// @brief Move constructor + CfgTmode3(CfgTmode3&& other) = default; + + /// @brief Destructor + ~CfgTmode3() = default; + + /// @brief Copy assignment + CfgTmode3& operator=(const CfgTmode3&) = default; + + /// @brief Move assignment + CfgTmode3& operator=(CfgTmode3&&) = default; + + /// @brief Provides custom read functionality. + /// @details This function performs read of the first fields up to the + /// @b flags (see @ref CfgTmode3Fields::flags). Based on the value of + /// @b lla bit, the relevant optional fields are marked as either + /// @b existing or @b missing and the read continues until the end. + template + comms::ErrorStatus doRead(TIter& iter, std::size_t len) + { + using Base = typename std::decay::type; + auto es = Base::template readFieldsUntil(iter, len); + if (es != comms::ErrorStatus::Success) { + return es; + } + + auto cartesianMode = comms::field::OptionalMode::Exists; + auto geodeticMode = comms::field::OptionalMode::Missing; + if (field_flags().getBitValue_lla()) { + std::swap(cartesianMode, geodeticMode); + } + + field_ecefX().setMode(cartesianMode); + field_ecefY().setMode(cartesianMode); + field_ecefZ().setMode(cartesianMode); + field_ecefXHP().setMode(cartesianMode); + field_ecefYHP().setMode(cartesianMode); + field_ecefZHP().setMode(cartesianMode); + + + field_lat().setMode(geodeticMode); + field_lon().setMode(geodeticMode); + field_alt().setMode(geodeticMode); + field_latHP().setMode(geodeticMode); + field_lonHP().setMode(geodeticMode); + field_altHP().setMode(geodeticMode); + + return Base::template readFieldsFrom(iter, len); + } + + /// @brief Provides custom refresh functionality + /// @details The function checks the value of @b lla bit in the @b flags + /// (see @ref CfgTmode3Fields::flags) field and modifies mode of relevant + /// @b optional fields accordingly. + /// @return @b true in case the mode of any optional field was modified, @b false otherwise + bool doRefresh() + { + auto cartesianMode = comms::field::OptionalMode::Exists; + auto geodeticMode = comms::field::OptionalMode::Missing; + if (field_flags().getBitValue_lla()) { + std::swap(cartesianMode, geodeticMode); + } + + if ((field_ecefX().getMode() == cartesianMode) && + (field_ecefY().getMode() == cartesianMode) && + (field_ecefZ().getMode() == cartesianMode) && + (field_ecefXHP().getMode() == cartesianMode) && + (field_ecefYHP().getMode() == cartesianMode) && + (field_ecefZHP().getMode() == cartesianMode) && + (field_lat().getMode() == geodeticMode) && + (field_lon().getMode() == geodeticMode) && + (field_alt().getMode() == geodeticMode) && + (field_latHP().getMode() == geodeticMode) && + (field_lonHP().getMode() == geodeticMode) && + (field_altHP().getMode() == geodeticMode)) { + return false; + } + + field_ecefX().setMode(cartesianMode); + field_ecefY().setMode(cartesianMode); + field_ecefZ().setMode(cartesianMode); + field_ecefXHP().setMode(cartesianMode); + field_ecefYHP().setMode(cartesianMode); + field_ecefZHP().setMode(cartesianMode); + + field_lat().setMode(geodeticMode); + field_lon().setMode(geodeticMode); + field_alt().setMode(geodeticMode); + field_latHP().setMode(geodeticMode); + field_lonHP().setMode(geodeticMode); + field_altHP().setMode(geodeticMode); + return true; + } +}; + +} // namespace message + +} // namespace ublox + diff --git a/include/ublox/message/CfgTmode3Poll.h b/include/ublox/message/CfgTmode3Poll.h new file mode 100644 index 0000000..121cca4 --- /dev/null +++ b/include/ublox/message/CfgTmode3Poll.h @@ -0,0 +1,79 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of CFG-TMODE3 (@b poll) message and its fields. + +#pragma once + +#include "ublox/Message.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the CFG-TMODE3 (@b poll) message fields. +/// @see CfgTmode3Poll +struct CfgTmode3PollFields +{ + /// @brief All the fields bundled in std::tuple. + using All = std::tuple<>; +}; + +/// @brief Definition of CFG-TMODE3 (@b poll) message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref CfgTmode3PollFields and for definition of the fields this message contains. +/// @tparam TMsgBase Common interface class for all the messages. +template +class CfgTmode3Poll : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Default constructor + CfgTmode3Poll() = default; + + /// @brief Copy constructor + CfgTmode3Poll(const CfgTmode3Poll&) = default; + + /// @brief Move constructor + CfgTmode3Poll(CfgTmode3Poll&& other) = default; + + /// @brief Destructor + ~CfgTmode3Poll() = default; + + /// @brief Copy assignment + CfgTmode3Poll& operator=(const CfgTmode3Poll&) = default; + + /// @brief Move assignment + CfgTmode3Poll& operator=(CfgTmode3Poll&&) = default; +}; + + +} // namespace message + +} // namespace ublox + From 3e5172a27f7d4eb2979c92ed20ddeef41e4483c0 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Thu, 10 Aug 2017 16:03:48 +1000 Subject: [PATCH 08/29] Preparation for new ESF-* messages. --- cc_plugin/field/MsgId.cpp | 3 +++ include/ublox/InputMessages.h | 2 +- include/ublox/MsgId.h | 3 +++ include/ublox/field/MsgId.h | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cc_plugin/field/MsgId.cpp b/cc_plugin/field/MsgId.cpp index 7b3b6b8..9eb2c87 100644 --- a/cc_plugin/field/MsgId.cpp +++ b/cc_plugin/field/MsgId.cpp @@ -165,7 +165,10 @@ QVariantMap createMsgIdProperties() .add("TIM-FCHG", MsgId_TIM_FCHG) .add("TIM-HOC", MsgId_TIM_HOC) + .add("ESF-MEAS", MsgId_ESF_MEAS) + .add("ESF-RAW", MsgId_ESF_RAW) .add("ESF-STATUS", MsgId_ESF_STATUS) + .add("ESF-INS", MsgId_ESF_INS) .add("MGA-GPS", MsgId_MGA_GPS) .add("MGA-GAL", MsgId_MGA_GAL) diff --git a/include/ublox/InputMessages.h b/include/ublox/InputMessages.h index f085980..e48a85b 100644 --- a/include/ublox/InputMessages.h +++ b/include/ublox/InputMessages.h @@ -109,7 +109,7 @@ #include "message/CfgSmgr.h" #include "message/CfgGeofence.h" #include "message/CfgDgnss.h" -#include "message/CfgTMode3.h" +#include "message/CfgTmode3.h" #include "message/CfgPms.h" #include "message/UpdSosRestored.h" diff --git a/include/ublox/MsgId.h b/include/ublox/MsgId.h index 9ba5605..9a29fe9 100644 --- a/include/ublox/MsgId.h +++ b/include/ublox/MsgId.h @@ -148,7 +148,10 @@ enum MsgId : std::uint16_t MsgId_TIM_VCOCAL = 0x0d15, ///< ID of TIM-VCOCAL message MsgId_TIM_FCHG = 0x0d16, ///< ID of TIM-FCHG message MsgId_TIM_HOC = 0x0d17, ///< ID of TIM-HOC message + MsgId_ESF_MEAS = 0x1002, ///< ID of ESF-MEAS message + MsgId_ESF_RAW = 0x1003, ///< ID of ESF-RAW message MsgId_ESF_STATUS = 0x1010, ///< ID of ESF-STATUS message + MsgId_ESF_INS = 0x1015, ///< ID of ESF-INS message MsgId_MGA_GPS = 0x1300, ///< ID of MGA-GPS message MsgId_MGA_GAL = 0x1302, ///< ID of MGA-GAL message MsgId_MGA_BDS = 0x1303, ///< ID of MGA-BDS message diff --git a/include/ublox/field/MsgId.h b/include/ublox/field/MsgId.h index 89fd459..948aee8 100644 --- a/include/ublox/field/MsgId.h +++ b/include/ublox/field/MsgId.h @@ -277,7 +277,10 @@ struct MsgIdValueValidator static bool validateEsf(ublox::MsgId id) { static const ublox::MsgId IDs[] = { + MsgId_ESF_MEAS, + MsgId_ESF_RAW, MsgId_ESF_STATUS, + MsgId_ESF_INS, }; auto iter = std::lower_bound(std::begin(IDs), std::end(IDs), id); From dcd48a6f0383d9a27856123fe631d99fbb912711 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Fri, 11 Aug 2017 07:45:34 +1000 Subject: [PATCH 09/29] Implemented ESF-INS message. --- cc_plugin/AllMessages.h | 4 + cc_plugin/CMakeLists.txt | 2 + cc_plugin/Ublox8Messages.h | 5 + cc_plugin/message/EsfIns.cpp | 112 ++++++++++++++++++ cc_plugin/message/EsfIns.h | 64 +++++++++++ cc_plugin/message/EsfInsPoll.cpp | 55 +++++++++ cc_plugin/message/EsfInsPoll.h | 63 ++++++++++ include/ublox/InputMessages.h | 2 + include/ublox/field/common.h | 19 ++- include/ublox/message/EsfIns.h | 179 +++++++++++++++++++++++++++++ include/ublox/message/EsfInsPoll.h | 83 +++++++++++++ 11 files changed, 587 insertions(+), 1 deletion(-) create mode 100644 cc_plugin/message/EsfIns.cpp create mode 100644 cc_plugin/message/EsfIns.h create mode 100644 cc_plugin/message/EsfInsPoll.cpp create mode 100644 cc_plugin/message/EsfInsPoll.h create mode 100644 include/ublox/message/EsfIns.h create mode 100644 include/ublox/message/EsfInsPoll.h diff --git a/cc_plugin/AllMessages.h b/cc_plugin/AllMessages.h index b45e12d..43f3037 100644 --- a/cc_plugin/AllMessages.h +++ b/cc_plugin/AllMessages.h @@ -261,6 +261,8 @@ #include "cc_plugin/message/EsfStatus.h" #include "cc_plugin/message/EsfStatusPoll.h" +#include "cc_plugin/message/EsfIns.h" +#include "cc_plugin/message/EsfInsPoll.h" #include "cc_plugin/message/MgaGpsEph.h" #include "cc_plugin/message/MgaGpsAlm.h" @@ -549,6 +551,8 @@ using AllMessages = std::tuple< cc_plugin::message::TimFchgPoll, cc_plugin::message::EsfStatus, cc_plugin::message::EsfStatusPoll, + cc_plugin::message::EsfIns, + cc_plugin::message::EsfInsPoll, cc_plugin::message::MgaGpsEph, cc_plugin::message::MgaGpsAlm, cc_plugin::message::MgaGpsHealth, diff --git a/cc_plugin/CMakeLists.txt b/cc_plugin/CMakeLists.txt index f1321cd..dbcf7ae 100644 --- a/cc_plugin/CMakeLists.txt +++ b/cc_plugin/CMakeLists.txt @@ -238,6 +238,8 @@ function (cc_plugin_ublox_all_messages) message/TimHoc.cpp message/EsfStatus.cpp message/EsfStatusPoll.cpp + message/EsfIns.cpp + message/EsfInsPoll.cpp message/MgaGpsEph.cpp message/MgaGpsAlm.cpp message/MgaGpsHealth.cpp diff --git a/cc_plugin/Ublox8Messages.h b/cc_plugin/Ublox8Messages.h index 82a02ba..64269df 100644 --- a/cc_plugin/Ublox8Messages.h +++ b/cc_plugin/Ublox8Messages.h @@ -230,6 +230,9 @@ #include "cc_plugin/message/EsfStatus.h" #include "cc_plugin/message/EsfStatusPoll.h" +#include "cc_plugin/message/EsfIns.h" +#include "cc_plugin/message/EsfInsPoll.h" + #include "cc_plugin/message/MgaGpsEph.h" #include "cc_plugin/message/MgaGpsAlm.h" @@ -486,6 +489,8 @@ using Ublox8Messages = std::tuple< cc_plugin::message::TimFchgPoll, cc_plugin::message::EsfStatus, cc_plugin::message::EsfStatusPoll, + cc_plugin::message::EsfIns, + cc_plugin::message::EsfInsPoll, cc_plugin::message::MgaGpsEph, cc_plugin::message::MgaGpsAlm, cc_plugin::message::MgaGpsHealth, diff --git a/cc_plugin/message/EsfIns.cpp b/cc_plugin/message/EsfIns.cpp new file mode 100644 index 0000000..f1a41a8 --- /dev/null +++ b/cc_plugin/message/EsfIns.cpp @@ -0,0 +1,112 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "EsfIns.h" + +#include + +#include "cc_plugin/field/common.h" + +template class ublox::message::EsfIns; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::EsfIns, + ublox::cc_plugin::message::EsfIns>; + + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +namespace +{ + +using ublox::message::EsfInsFields; + +QVariantMap createProps_bitfield0() +{ + using Field = EsfInsFields::bitfield0; + auto props = + cc::property::field::ForField() + .name("bitfield0") + .add("xAngRateValid") + .add("yAngRateValid") + .add("zAngRateValid") + .add("xAccelValid") + .add("yAccelValid") + .add("zAccelValid"); + assert(props.bits().size() == Field::BitIdx_numOfValues); + return props.asMap(); +} + +QVariantList createFieldsProperties() +{ + QVariantList props; + props.append( + cc::property::field::ForField().name("version").asMap()); + props.append(createProps_bitfield0()); + props.append(cc_plugin::field::common::props_reserved(1)); + props.append(cc_plugin::field::common::props_iTOW()); + props.append( + cc::property::field::ForField().name("xAngRate").asMap()); + props.append( + cc::property::field::ForField().name("yAngRate").asMap()); + props.append( + cc::property::field::ForField().name("zAngRate").asMap()); + props.append( + cc::property::field::ForField().name("xAccel").asMap()); + props.append( + cc::property::field::ForField().name("yAccel").asMap()); + props.append( + cc::property::field::ForField().name("zAccel").asMap()); + + assert(props.size() == EsfIns::FieldIdx_numOfValues); + return props; +} + +} // namespace + +EsfIns::EsfIns() = default; +EsfIns::~EsfIns() = default; + +EsfIns& EsfIns::operator=(const EsfIns&) = default; +EsfIns& EsfIns::operator=(EsfIns&&) = default; + +const char* EsfIns::nameImpl() const +{ + static const char* Str = "ESF-INS"; + return Str; +} + +const QVariantList& EsfIns::fieldsPropertiesImpl() const +{ + static const auto Props = createFieldsProperties(); + return Props; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/EsfIns.h b/cc_plugin/message/EsfIns.h new file mode 100644 index 0000000..80e879f --- /dev/null +++ b/cc_plugin/message/EsfIns.h @@ -0,0 +1,64 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/EsfIns.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class EsfIns : public + ProtocolMessageBase< + ublox::message::EsfIns, + EsfIns> +{ +public: + EsfIns(); + EsfIns(const EsfIns&) = delete; + EsfIns(EsfIns&&) = delete; + virtual ~EsfIns(); + + EsfIns& operator=(const EsfIns&); + EsfIns& operator=(EsfIns&&); + +protected: + virtual const char* nameImpl() const override; + virtual const QVariantList& fieldsPropertiesImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::EsfIns; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::EsfIns, + ublox::cc_plugin::message::EsfIns>; + diff --git a/cc_plugin/message/EsfInsPoll.cpp b/cc_plugin/message/EsfInsPoll.cpp new file mode 100644 index 0000000..49012cb --- /dev/null +++ b/cc_plugin/message/EsfInsPoll.cpp @@ -0,0 +1,55 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#include "EsfInsPoll.h" + +template class ublox::message::EsfInsPoll; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::EsfInsPoll, + ublox::cc_plugin::message::EsfInsPoll>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +EsfInsPoll::EsfInsPoll() = default; +EsfInsPoll::~EsfInsPoll() = default; + +EsfInsPoll& EsfInsPoll::operator=(const EsfInsPoll&) = default; +EsfInsPoll& EsfInsPoll::operator=(EsfInsPoll&&) = default; + + +const char* EsfInsPoll::nameImpl() const +{ + static const char* Str = "ESF-INS (Poll)"; + return Str; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/EsfInsPoll.h b/cc_plugin/message/EsfInsPoll.h new file mode 100644 index 0000000..c065160 --- /dev/null +++ b/cc_plugin/message/EsfInsPoll.h @@ -0,0 +1,63 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/EsfInsPoll.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class EsfInsPoll : public + ProtocolMessageBase< + ublox::message::EsfInsPoll, + EsfInsPoll> +{ +public: + EsfInsPoll(); + EsfInsPoll(const EsfInsPoll&) = delete; + EsfInsPoll(EsfInsPoll&&) = delete; + virtual ~EsfInsPoll(); + + EsfInsPoll& operator=(const EsfInsPoll&); + EsfInsPoll& operator=(EsfInsPoll&&); + +protected: + virtual const char* nameImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::EsfInsPoll; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::EsfInsPoll, + ublox::cc_plugin::message::EsfInsPoll>; + diff --git a/include/ublox/InputMessages.h b/include/ublox/InputMessages.h index e48a85b..4a8559f 100644 --- a/include/ublox/InputMessages.h +++ b/include/ublox/InputMessages.h @@ -149,6 +149,7 @@ #include "message/TimFchg.h" #include "message/EsfStatus.h" +#include "message/EsfIns.h" #include "message/MgaFlashAck.h" #include "message/MgaAck.h" @@ -287,6 +288,7 @@ using InputMessages = message::TimVcocal, message::TimFchg, message::EsfStatus, + message::EsfIns, message::MgaFlashAck, message::MgaAck, message::MgaDbd, diff --git a/include/ublox/field/common.h b/include/ublox/field/common.h index be8a4a3..747e105 100644 --- a/include/ublox/field/common.h +++ b/include/ublox/field/common.h @@ -137,6 +137,23 @@ using X2T = /// @brief Same as @ref X2T without any extra options using X2 = X2T<>; +/// @brief Common definition for 3 bytes bitmask value field +/// @details Defined to be @b comms::field::BitmaskValue +/// with @ref FieldBase as a base class, 3 bytes fixed length +/// and @b TOptions... as extra options. +/// @tparam TOptions Extra options. +template +using X3T = + comms::field::BitmaskValue< + FieldBase, + comms::option::FixedLength<3>, + TOptions... + >; + +/// @brief Same as @ref X3T without any extra options +using X3 = X3T<>; + + /// @brief Common definition for 4 bytes unsigned integer value field /// @details Defined to be @b comms::field::IntValue /// with @ref FieldBase as a base class, @b std::uint32_t as a storage type @@ -171,7 +188,7 @@ using I4 = I4T<>; /// @brief Common definition for 4 bytes bitmask value field /// @details Defined to be @b comms::field::BitmaskValue -/// with @ref FieldBase as a base class, 2 bytes fixed length +/// with @ref FieldBase as a base class, 4 bytes fixed length /// and @b TOptions... as extra options. /// @tparam TOptions Extra options. template diff --git a/include/ublox/message/EsfIns.h b/include/ublox/message/EsfIns.h new file mode 100644 index 0000000..6938f48 --- /dev/null +++ b/include/ublox/message/EsfIns.h @@ -0,0 +1,179 @@ +// +// Copyright 2015 - 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of ESF-INS message and its fields. + +#pragma once + +#include "ublox/Message.h" +#include "ublox/field/common.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the ESF-INS message fields. +/// @see EsfIns +struct EsfInsFields +{ + /// @brief Definition of "version" field. + using version = + field::common::U1T< + comms::option::ValidNumValueRange<1, 1>, + comms::option::DefaultNumValue<1> + >; + + /// @brief Definition of "bitfield0" field excluding "version" information. + struct bitfield0 : public + field::common::X3T< + comms::option::BitmaskReservedBits<0xffffc0, 0> + > + { + /// @brief Provide names for internal bits. + /// @details See definition of @b COMMS_BITMASK_BITS_SEQ macro + /// related to @b comms::field::BitmaskValue class from COMMS library + /// for details. + COMMS_BITMASK_BITS_SEQ( + xAngRateValid, + yAngRateValid, + zAngRateValid, + xAccelValid, + yAccelValid, + zAccelValid); + }; + + /// @brief Definition of "reserved1" field. + using reserved1 = field::common::res4; + + /// @brief Definition of "iTOW" field. + using iTOW = field::common::iTOW; + + /// @brief Definition of "xAngRate" field. + using xAngRate = + field::common::I4T< + comms::option::ScalingRatio<1, 1000>, + comms::option::UnitsDegrees + >; + + /// @brief Definition of "yAngRate" field. + using yAngRate = xAngRate; + + /// @brief Definition of "zAngRate" field. + using zAngRate = xAngRate; + + /// @brief Definition of "xAccel" field. + using xAccel = field::common::I4; + + /// @brief Definition of "yAccel" field. + using yAccel = xAccel; + + /// @brief Definition of "zAccel" field. + using zAccel = xAccel; + + /// @brief All the fields bundled in std::tuple. + using All = std::tuple< + version, + bitfield0, + reserved1, + iTOW, + xAngRate, + yAngRate, + zAngRate, + xAccel, + yAccel, + zAccel + >; +}; + +/// @brief Definition of ESF-INS message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref EsfInsFields and for definition of the fields this message contains +/// and COMMS_MSG_FIELDS_ACCESS() for fields access details. +/// @tparam TMsgBase Common interface class for all the messages. +template +class EsfIns : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_MSG_FIELDS_ACCESS macro + /// related to @b comms::MessageBase class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b version for @ref EsfInsFields::version field + /// @li @b bitfield0 for @ref EsfInsFields::bitfield0 field + /// @li @b reserved1 for @ref EsfInsFields::reserved1 field + /// @li @b iTOW for @ref EsfInsFields::iTOW field + /// @li @b xAngRate for @ref EsfInsFields::xAngRate field + /// @li @b yAngRate for @ref EsfInsFields::yAngRate field + /// @li @b zAngRate for @ref EsfInsFields::zAngRate field + /// @li @b xAccel for @ref EsfInsFields::xAccel field + /// @li @b yAccel for @ref EsfInsFields::yAccel field + /// @li @b zAccel for @ref EsfInsFields::zAccel field + COMMS_MSG_FIELDS_ACCESS( + version, + bitfield0, + reserved1, + iTOW, + xAngRate, + yAngRate, + zAngRate, + xAccel, + yAccel, + zAccel + ); + + /// @brief Default constructor + EsfIns() = default; + + /// @brief Copy constructor + EsfIns(const EsfIns&) = default; + + /// @brief Move constructor + EsfIns(EsfIns&& other) = default; + + /// @brief Destructor + ~EsfIns() = default; + + /// @brief Copy assignment + EsfIns& operator=(const EsfIns&) = default; + + /// @brief Move assignment + EsfIns& operator=(EsfIns&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + diff --git a/include/ublox/message/EsfInsPoll.h b/include/ublox/message/EsfInsPoll.h new file mode 100644 index 0000000..86875e8 --- /dev/null +++ b/include/ublox/message/EsfInsPoll.h @@ -0,0 +1,83 @@ +// +// Copyright 2015 - 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of ESF-INS (@b poll) message and its fields. + +#pragma once + +#include "ublox/Message.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the ESF-INS (@b poll) message fields. +/// @see EsfInsPoll +struct EsfInsPollFields +{ + /// @brief All the fields bundled in std::tuple. + using All = std::tuple<>; +}; + +/// @brief Definition of ESF-INS (@b poll) message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref EsfInsPollFields and for definition of the fields this message contains. +/// @tparam TMsgBase Common interface class for all the messages. +template +class EsfInsPoll : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Default constructor + EsfInsPoll() = default; + + /// @brief Copy constructor + EsfInsPoll(const EsfInsPoll&) = default; + + /// @brief Move constructor + EsfInsPoll(EsfInsPoll&& other) = default; + + /// @brief Destructor + ~EsfInsPoll() = default; + + /// @brief Copy assignment + EsfInsPoll& operator=(const EsfInsPoll&) = default; + + /// @brief Move assignment + EsfInsPoll& operator=(EsfInsPoll&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + From 7acddde0c753d39b9689e1bbcc8210687a586e58 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Fri, 11 Aug 2017 17:19:10 +1000 Subject: [PATCH 10/29] Implemented ESF-MEAS message. --- cc_plugin/AllMessages.h | 4 + cc_plugin/CMakeLists.txt | 2 + cc_plugin/Ublox8Messages.h | 5 +- cc_plugin/message/EsfMeas.cpp | 166 ++++++++++++++++ cc_plugin/message/EsfMeas.h | 64 +++++++ cc_plugin/message/EsfMeasPoll.cpp | 55 ++++++ cc_plugin/message/EsfMeasPoll.h | 63 +++++++ include/ublox/InputMessages.h | 2 + include/ublox/field/common.h | 17 ++ include/ublox/message/EsfMeas.h | 282 ++++++++++++++++++++++++++++ include/ublox/message/EsfMeasPoll.h | 83 ++++++++ 11 files changed, 742 insertions(+), 1 deletion(-) create mode 100644 cc_plugin/message/EsfMeas.cpp create mode 100644 cc_plugin/message/EsfMeas.h create mode 100644 cc_plugin/message/EsfMeasPoll.cpp create mode 100644 cc_plugin/message/EsfMeasPoll.h create mode 100644 include/ublox/message/EsfMeas.h create mode 100644 include/ublox/message/EsfMeasPoll.h diff --git a/cc_plugin/AllMessages.h b/cc_plugin/AllMessages.h index 43f3037..578bc5b 100644 --- a/cc_plugin/AllMessages.h +++ b/cc_plugin/AllMessages.h @@ -259,6 +259,8 @@ #include "cc_plugin/message/TimFchgPoll.h" #include "cc_plugin/message/TimHoc.h" +#include "cc_plugin/message/EsfMeas.h" +#include "cc_plugin/message/EsfMeasPoll.h" #include "cc_plugin/message/EsfStatus.h" #include "cc_plugin/message/EsfStatusPoll.h" #include "cc_plugin/message/EsfIns.h" @@ -549,6 +551,8 @@ using AllMessages = std::tuple< cc_plugin::message::TimVcocalPoll, cc_plugin::message::TimFchg, cc_plugin::message::TimFchgPoll, + cc_plugin::message::EsfMeas, + cc_plugin::message::EsfMeasPoll, cc_plugin::message::EsfStatus, cc_plugin::message::EsfStatusPoll, cc_plugin::message::EsfIns, diff --git a/cc_plugin/CMakeLists.txt b/cc_plugin/CMakeLists.txt index dbcf7ae..8a0c052 100644 --- a/cc_plugin/CMakeLists.txt +++ b/cc_plugin/CMakeLists.txt @@ -236,6 +236,8 @@ function (cc_plugin_ublox_all_messages) message/TimFchg.cpp message/TimFchgPoll.cpp message/TimHoc.cpp + message/EsfMeas.cpp + message/EsfMeasPoll.cpp message/EsfStatus.cpp message/EsfStatusPoll.cpp message/EsfIns.cpp diff --git a/cc_plugin/Ublox8Messages.h b/cc_plugin/Ublox8Messages.h index 64269df..613ca6e 100644 --- a/cc_plugin/Ublox8Messages.h +++ b/cc_plugin/Ublox8Messages.h @@ -228,12 +228,13 @@ #include "cc_plugin/message/TimFchgPoll.h" #include "cc_plugin/message/TimHoc.h" +#include "cc_plugin/message/EsfMeas.h" +#include "cc_plugin/message/EsfMeasPoll.h" #include "cc_plugin/message/EsfStatus.h" #include "cc_plugin/message/EsfStatusPoll.h" #include "cc_plugin/message/EsfIns.h" #include "cc_plugin/message/EsfInsPoll.h" - #include "cc_plugin/message/MgaGpsEph.h" #include "cc_plugin/message/MgaGpsAlm.h" #include "cc_plugin/message/MgaGpsHealth.h" @@ -487,6 +488,8 @@ using Ublox8Messages = std::tuple< cc_plugin::message::TimVcocalPoll, cc_plugin::message::TimFchg, cc_plugin::message::TimFchgPoll, + cc_plugin::message::EsfMeas, + cc_plugin::message::EsfMeasPoll, cc_plugin::message::EsfStatus, cc_plugin::message::EsfStatusPoll, cc_plugin::message::EsfIns, diff --git a/cc_plugin/message/EsfMeas.cpp b/cc_plugin/message/EsfMeas.cpp new file mode 100644 index 0000000..928eeb3 --- /dev/null +++ b/cc_plugin/message/EsfMeas.cpp @@ -0,0 +1,166 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "EsfMeas.h" + +#include + +#include "cc_plugin/field/common.h" + +template class ublox::message::EsfMeas; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::EsfMeas, + ublox::cc_plugin::message::EsfMeas>; + + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +namespace +{ + +using ublox::message::EsfMeasFields; + +QVariantMap createProps_timeMarkSent() +{ + using Field = EsfMeasFields::timeMarkSent; + auto props = + cc::property::field::ForField() + .name("timeMarkSent") + .serialisedHidden() + .add("None") + .add("Ext0") + .add("Ext1"); + assert(props.values().size() == (int)Field::ValueType::NumOfValues); + return props.asMap(); +} + +QVariantMap createProps_timeMarkEdge() +{ + using Field = EsfMeasFields::timeMarkEdge; + auto props = + cc::property::field::ForField() + .name("timeMarkEdge") + .serialisedHidden() + .add("Rising") + .add("Falling"); + assert(props.values().size() == (int)Field::ValueType::NumOfValues); + return props.asMap(); +} + +QVariantMap createProps_flagsBits() +{ + using Field = EsfMeasFields::flagsBits; + auto props = + cc::property::field::ForField() + .serialisedHidden() + .add("calibTtagValid"); + assert(props.bits().size() == Field::BitIdx_numOfValues); + return props.asMap(); +} + +QVariantMap createProps_flags() +{ + using Field = EsfMeasFields::flags; + auto props = + cc::property::field::ForField() + .name("flags") + .add(createProps_timeMarkSent()) + .add(createProps_timeMarkEdge()) + .add(createProps_flagsBits()); + assert(props.members().size() == Field::FieldIdx_numOfValues); + return props.asMap(); +} + +QVariantMap createProps_data() +{ + using DataElemField = EsfMeasFields::dataElem; + auto dataElemProps = + cc::property::field::ForField() + .add(cc::property::field::ForField().name("dataField").asMap()) + .add(cc::property::field::ForField().name("dataType").asMap()) + .serialisedHidden(); + assert(dataElemProps.members().size() == DataElemField::FieldIdx_numOfValues); + + return + cc::property::field::ForField >() + .name("data") + .add(dataElemProps.asMap()) + .serialisedHidden() + .asMap(); +} + +QVariantMap createProps_calibTtag() +{ + using Field = EsfMeasFields::calibTtag; + auto props = + cc::property::field::ForField() + .name("calibTtag") + .field(cc::property::field::ForField().name("calibTtag").asMap()) + .uncheckable(); + return props.asMap(); +} + +QVariantList createFieldsProperties() +{ + QVariantList props; + props.append( + cc::property::field::ForField().name("timeTag").asMap()); + props.append(createProps_flags()); + props.append( + cc::property::field::ForField().name("id").asMap()); + props.append(createProps_data()); + props.append(createProps_calibTtag()); + + assert(props.size() == EsfMeas::FieldIdx_numOfValues); + return props; +} + +} // namespace + +EsfMeas::EsfMeas() = default; +EsfMeas::~EsfMeas() = default; + +EsfMeas& EsfMeas::operator=(const EsfMeas&) = default; +EsfMeas& EsfMeas::operator=(EsfMeas&&) = default; + +const char* EsfMeas::nameImpl() const +{ + static const char* Str = "ESF-MEAS"; + return Str; +} + +const QVariantList& EsfMeas::fieldsPropertiesImpl() const +{ + static const auto Props = createFieldsProperties(); + return Props; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/EsfMeas.h b/cc_plugin/message/EsfMeas.h new file mode 100644 index 0000000..43f4bd9 --- /dev/null +++ b/cc_plugin/message/EsfMeas.h @@ -0,0 +1,64 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/EsfMeas.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class EsfMeas : public + ProtocolMessageBase< + ublox::message::EsfMeas, + EsfMeas> +{ +public: + EsfMeas(); + EsfMeas(const EsfMeas&) = delete; + EsfMeas(EsfMeas&&) = delete; + virtual ~EsfMeas(); + + EsfMeas& operator=(const EsfMeas&); + EsfMeas& operator=(EsfMeas&&); + +protected: + virtual const char* nameImpl() const override; + virtual const QVariantList& fieldsPropertiesImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::EsfMeas; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::EsfMeas, + ublox::cc_plugin::message::EsfMeas>; + diff --git a/cc_plugin/message/EsfMeasPoll.cpp b/cc_plugin/message/EsfMeasPoll.cpp new file mode 100644 index 0000000..609a5fe --- /dev/null +++ b/cc_plugin/message/EsfMeasPoll.cpp @@ -0,0 +1,55 @@ +// +// Copyright 2015 - 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#include "EsfMeasPoll.h" + +template class ublox::message::EsfMeasPoll; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::EsfMeasPoll, + ublox::cc_plugin::message::EsfMeasPoll>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +EsfMeasPoll::EsfMeasPoll() = default; +EsfMeasPoll::~EsfMeasPoll() = default; + +EsfMeasPoll& EsfMeasPoll::operator=(const EsfMeasPoll&) = default; +EsfMeasPoll& EsfMeasPoll::operator=(EsfMeasPoll&&) = default; + + +const char* EsfMeasPoll::nameImpl() const +{ + static const char* Str = "ESF-MEAS (Poll)"; + return Str; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/EsfMeasPoll.h b/cc_plugin/message/EsfMeasPoll.h new file mode 100644 index 0000000..df1e6d5 --- /dev/null +++ b/cc_plugin/message/EsfMeasPoll.h @@ -0,0 +1,63 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/EsfMeasPoll.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class EsfMeasPoll : public + ProtocolMessageBase< + ublox::message::EsfMeasPoll, + EsfMeasPoll> +{ +public: + EsfMeasPoll(); + EsfMeasPoll(const EsfMeasPoll&) = delete; + EsfMeasPoll(EsfMeasPoll&&) = delete; + virtual ~EsfMeasPoll(); + + EsfMeasPoll& operator=(const EsfMeasPoll&); + EsfMeasPoll& operator=(EsfMeasPoll&&); + +protected: + virtual const char* nameImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::EsfMeasPoll; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::EsfMeasPoll, + ublox::cc_plugin::message::EsfMeasPoll>; + diff --git a/include/ublox/InputMessages.h b/include/ublox/InputMessages.h index 4a8559f..0226c26 100644 --- a/include/ublox/InputMessages.h +++ b/include/ublox/InputMessages.h @@ -148,6 +148,7 @@ #include "message/TimVcocal.h" #include "message/TimFchg.h" +#include "message/EsfMeas.h" #include "message/EsfStatus.h" #include "message/EsfIns.h" @@ -287,6 +288,7 @@ using InputMessages = message::TimSmeas, message::TimVcocal, message::TimFchg, + message::EsfMeas, message::EsfStatus, message::EsfIns, message::MgaFlashAck, diff --git a/include/ublox/field/common.h b/include/ublox/field/common.h index 747e105..597f006 100644 --- a/include/ublox/field/common.h +++ b/include/ublox/field/common.h @@ -137,6 +137,23 @@ using X2T = /// @brief Same as @ref X2T without any extra options using X2 = X2T<>; +/// @brief Common definition for 3 bytes unsigned integer value field +/// @details Defined to be @b comms::field::IntValue +/// with @ref FieldBase as a base class, @b std::uint32_t as a storage type, +/// 3 bytes serialisation length, and @b TOptions... as extra options. +/// @tparam TOptions Extra options. +template +using U3T = + comms::field::IntValue< + FieldBase, + std::uint32_t, + comms::option::FixedLength<3>, + TOptions... + >; + +/// @brief Same as @ref U3T without any extra options. +using U3 = U3T<>; + /// @brief Common definition for 3 bytes bitmask value field /// @details Defined to be @b comms::field::BitmaskValue /// with @ref FieldBase as a base class, 3 bytes fixed length diff --git a/include/ublox/message/EsfMeas.h b/include/ublox/message/EsfMeas.h new file mode 100644 index 0000000..3365dba --- /dev/null +++ b/include/ublox/message/EsfMeas.h @@ -0,0 +1,282 @@ +// +// Copyright 2015 - 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of ESF-MEAS message and its fields. + +#pragma once + +#include "ublox/Message.h" +#include "ublox/field/common.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the ESF-MEAS message fields. +/// @see EsfMeas +struct EsfMeasFields +{ + /// @brief Definition of "timeTag" field. + using timeTag = field::common::U4; + + /// @brief Value enumeration for @ref timeMarkSent field. + enum class TimeMarkSent : std::uint8_t + { + None, ///< none + Ext0, ///< on Ext0 + Ext1, ///< on Ext1 + NumOfValues /// number of available values + }; + + /// @brief Definition of "timeMarkSent" member of @ref flags bitfield. + using timeMarkSent = + field::common::EnumT< + TimeMarkSent, + comms::option::ValidNumValueRange<0, (int)TimeMarkSent::NumOfValues - 1>, + comms::option::FixedBitLength<2> + >; + + /// @brief Value enumeration for @ref timeMarkEdge field. + enum class TimeMarkEdge : std::uint8_t + { + Rising, ///< rising edge + Falling, ///< falling edge + NumOfValues /// number of available values + }; + + /// @brief Definition of "timeMarkEdge" member of @ref flags bitfield. + using timeMarkEdge = + field::common::EnumT< + TimeMarkEdge, + comms::option::ValidNumValueRange<0, (int)TimeMarkEdge::NumOfValues - 1>, + comms::option::FixedBitLength<1> + >; + + + /// @brief Definition of bits in @ref flags field as a separate member field. + struct flagsBits : public + field::common::X2T< + comms::option::BitmaskReservedBits<0xfffe, 0>, + comms::option::FixedBitLength<13> + > + { + /// @brief Provide names for internal bits. + /// @details See definition of @b COMMS_BITMASK_BITS_SEQ macro + /// related to @b comms::field::BitmaskValue class from COMMS library + /// for details. + COMMS_BITMASK_BITS_SEQ(calibTtagValid); + }; + + /// @brief Definition of "flags" field. + struct flags : public + field::common::BitfieldT< + std::tuple< + timeMarkSent, + timeMarkEdge, + flagsBits + > + > + { + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_FIELD_MEMBERS_ACCESS macro + /// related to @b comms::field::Bitfield class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b timeMarkSent for @ref EsfMeasFields::timeMarkSent field + /// @li @b timeMarkEdge for @ref EsfMeasFields::timeMarkEdge field + /// @li @b flagsBits for @ref EsfMeasFields::flagsBits field + COMMS_FIELD_MEMBERS_ACCESS(timeMarkSent, timeMarkEdge, flagsBits); + }; + + /// @brief Definition of "id" field. + using id = field::common::U2; + + /// @brief Definition of "dataField" field. + using dataField = field::common::U3; + + /// @brief Definition of "dataType" field. + using dataType = + field::common::U1T< + comms::option::ValidNumValueRange<0, 63> + >; + + /// @breif Definition of single data element for @ref data field. + struct dataElem : public + field::common::BundleT< + std::tuple< + dataField, + dataType + > + > + { + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_FIELD_MEMBERS_ACCESS macro + /// related to @b comms::field::Bitfield class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b dataField for @ref EsfMeasFields::dataField field + /// @li @b dataType for @ref EsfMeasFields::dataType field + COMMS_FIELD_MEMBERS_ACCESS(dataField, dataType); + }; + + /// @brief Definition of "data" field as list of elements (@ref dataElem). + /// @tparam TOpt Extra option(s) + template + using data = + field::common::ListT< + dataElem, + TOpt + >; + + /// @brief Definition of "calibTtag" field. + using calibTtag = + field::common::OptionalT< + field::common::U4T, + comms::option::DefaultOptionalMode + >; + + + /// @brief All the fields bundled in std::tuple. + /// @tparam TOpt Extra option(s) for @ref data field + template + using All = std::tuple< + timeTag, + flags, + id, + data, + calibTtag + >; +}; + +/// @brief Definition of ESF-MEAS message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref EsfMeasFields and for definition of the fields this message contains +/// and COMMS_MSG_FIELDS_ACCESS() for fields access details. +/// @tparam TMsgBase Common interface class for all the messages. +/// @tparam TDataOpt Extra option(s) for @b data field +template +class EsfMeas : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl >, + comms::option::MsgType >, + comms::option::HasDoRefresh + > +{ + +public: + + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_MSG_FIELDS_ACCESS macro + /// related to @b comms::MessageBase class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b timeTag for @ref EsfMeasFields::timeTag field + /// @li @b flags for @ref EsfMeasFields::flags field + /// @li @b id for @ref EsfMeasFields::id field + /// @li @b data for @ref EsfMeasFields::data field + /// @li @b calibTtag for @ref EsfMeasFields::calibTtag field + COMMS_MSG_FIELDS_ACCESS( + timeTag, + flags, + id, + data, + calibTtag + ); + + /// @brief Default constructor + EsfMeas() = default; + + /// @brief Copy constructor + EsfMeas(const EsfMeas&) = default; + + /// @brief Move constructor + EsfMeas(EsfMeas&& other) = default; + + /// @brief Destructor + ~EsfMeas() = default; + + /// @brief Copy assignment + EsfMeas& operator=(const EsfMeas&) = default; + + /// @brief Move assignment + EsfMeas& operator=(EsfMeas&&) = default; + + /// @brief Provides custom read functionality. + template + comms::ErrorStatus doRead(TIter& iter, std::size_t len) + { + using Base = typename std::decay::type; + auto es = Base::template readFieldsUntil(iter, len); + if (es != comms::ErrorStatus::Success) { + return es; + } + + if (!field_flags().field_flagsBits().getBitValue_calibTtagValid()) { + field_calibTtag().setMissing(); + return Base::template readFieldsFrom(iter, len); + } + + std::size_t calibTtagLen = EsfMeasFields::calibTtag::maxLength(); + if (len < calibTtagLen) { + return comms::ErrorStatus::NotEnoughData; + } + + es = field_data().read(iter, len - calibTtagLen); + if (es != comms::ErrorStatus::Success) { + return es; + } + + field_calibTtag().setExists(); + return Base::template readFieldsFrom(iter, calibTtagLen); + } + + /// @brief Provides custom refresh functionality + bool doRefresh() + { + auto calibTtagMode = comms::field::OptionalMode::Missing; + if (field_flags().field_flagsBits().getBitValue_calibTtagValid()) { + calibTtagMode = comms::field::OptionalMode::Exists; + } + + if (field_calibTtag().getMode() == calibTtagMode) { + return false; + } + + field_calibTtag().setMode(calibTtagMode); + return true; + } +}; + + +} // namespace message + +} // namespace ublox + + + + + diff --git a/include/ublox/message/EsfMeasPoll.h b/include/ublox/message/EsfMeasPoll.h new file mode 100644 index 0000000..b427ea0 --- /dev/null +++ b/include/ublox/message/EsfMeasPoll.h @@ -0,0 +1,83 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of ESF-MEAS (@b poll) message and its fields. + +#pragma once + +#include "ublox/Message.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the ESF-MEAS (@b poll) message fields. +/// @see EsfMeasPoll +struct EsfMeasPollFields +{ + /// @brief All the fields bundled in std::tuple. + using All = std::tuple<>; +}; + +/// @brief Definition of ESF-MEAS (@b poll) message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref EsfMeasPollFields and for definition of the fields this message contains. +/// @tparam TMsgBase Common interface class for all the messages. +template +class EsfMeasPoll : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Default constructor + EsfMeasPoll() = default; + + /// @brief Copy constructor + EsfMeasPoll(const EsfMeasPoll&) = default; + + /// @brief Move constructor + EsfMeasPoll(EsfMeasPoll&& other) = default; + + /// @brief Destructor + ~EsfMeasPoll() = default; + + /// @brief Copy assignment + EsfMeasPoll& operator=(const EsfMeasPoll&) = default; + + /// @brief Move assignment + EsfMeasPoll& operator=(EsfMeasPoll&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + From 7381610cc5c4858b6afe52ab061373aaab5a4516 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Mon, 14 Aug 2017 08:57:50 +1000 Subject: [PATCH 11/29] Implemented ESF-RAW message. --- cc_plugin/AllMessages.h | 2 + cc_plugin/CMakeLists.txt | 1 + cc_plugin/Ublox8Messages.h | 2 + cc_plugin/message/EsfRaw.cpp | 100 +++++++++++++++++++++++ cc_plugin/message/EsfRaw.h | 64 +++++++++++++++ include/ublox/InputMessages.h | 2 + include/ublox/message/EsfRaw.h | 144 +++++++++++++++++++++++++++++++++ 7 files changed, 315 insertions(+) create mode 100644 cc_plugin/message/EsfRaw.cpp create mode 100644 cc_plugin/message/EsfRaw.h create mode 100644 include/ublox/message/EsfRaw.h diff --git a/cc_plugin/AllMessages.h b/cc_plugin/AllMessages.h index 578bc5b..2812b84 100644 --- a/cc_plugin/AllMessages.h +++ b/cc_plugin/AllMessages.h @@ -261,6 +261,7 @@ #include "cc_plugin/message/EsfMeas.h" #include "cc_plugin/message/EsfMeasPoll.h" +#include "cc_plugin/message/EsfRaw.h" #include "cc_plugin/message/EsfStatus.h" #include "cc_plugin/message/EsfStatusPoll.h" #include "cc_plugin/message/EsfIns.h" @@ -553,6 +554,7 @@ using AllMessages = std::tuple< cc_plugin::message::TimFchgPoll, cc_plugin::message::EsfMeas, cc_plugin::message::EsfMeasPoll, + cc_plugin::message::EsfRaw, cc_plugin::message::EsfStatus, cc_plugin::message::EsfStatusPoll, cc_plugin::message::EsfIns, diff --git a/cc_plugin/CMakeLists.txt b/cc_plugin/CMakeLists.txt index 8a0c052..01dc033 100644 --- a/cc_plugin/CMakeLists.txt +++ b/cc_plugin/CMakeLists.txt @@ -238,6 +238,7 @@ function (cc_plugin_ublox_all_messages) message/TimHoc.cpp message/EsfMeas.cpp message/EsfMeasPoll.cpp + message/EsfRaw.cpp message/EsfStatus.cpp message/EsfStatusPoll.cpp message/EsfIns.cpp diff --git a/cc_plugin/Ublox8Messages.h b/cc_plugin/Ublox8Messages.h index 613ca6e..3930afc 100644 --- a/cc_plugin/Ublox8Messages.h +++ b/cc_plugin/Ublox8Messages.h @@ -230,6 +230,7 @@ #include "cc_plugin/message/EsfMeas.h" #include "cc_plugin/message/EsfMeasPoll.h" +#include "cc_plugin/message/EsfRaw.h" #include "cc_plugin/message/EsfStatus.h" #include "cc_plugin/message/EsfStatusPoll.h" #include "cc_plugin/message/EsfIns.h" @@ -490,6 +491,7 @@ using Ublox8Messages = std::tuple< cc_plugin::message::TimFchgPoll, cc_plugin::message::EsfMeas, cc_plugin::message::EsfMeasPoll, + cc_plugin::message::EsfRaw, cc_plugin::message::EsfStatus, cc_plugin::message::EsfStatusPoll, cc_plugin::message::EsfIns, diff --git a/cc_plugin/message/EsfRaw.cpp b/cc_plugin/message/EsfRaw.cpp new file mode 100644 index 0000000..feed5ff --- /dev/null +++ b/cc_plugin/message/EsfRaw.cpp @@ -0,0 +1,100 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "EsfRaw.h" + +#include + +#include "cc_plugin/field/common.h" + +template class ublox::message::EsfRaw; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::EsfRaw, + ublox::cc_plugin::message::EsfRaw>; + + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +namespace +{ + +using ublox::message::EsfRawFields; + +QVariantMap createProps_list() +{ + using BlockField = EsfRawFields::block; + auto blockProps = + cc::property::field::ForField() + .add(cc::property::field::ForField().name("dataField").asMap()) + .add(cc::property::field::ForField().name("dataType").asMap()) + .add(cc::property::field::ForField().name("sTtag").asMap()) + .serialisedHidden(); + assert(blockProps.members().size() == BlockField::FieldIdx_numOfValues); + + return + cc::property::field::ForField >() + .name("data") + .add(blockProps.asMap()) + .serialisedHidden() + .asMap(); +} + +QVariantList createFieldsProperties() +{ + QVariantList props; + props.append(cc_plugin::field::common::props_reserved(1)); + props.append(createProps_list()); + + assert(props.size() == EsfRaw::FieldIdx_numOfValues); + return props; +} + +} // namespace + +EsfRaw::EsfRaw() = default; +EsfRaw::~EsfRaw() = default; + +EsfRaw& EsfRaw::operator=(const EsfRaw&) = default; +EsfRaw& EsfRaw::operator=(EsfRaw&&) = default; + +const char* EsfRaw::nameImpl() const +{ + static const char* Str = "ESF-RAW"; + return Str; +} + +const QVariantList& EsfRaw::fieldsPropertiesImpl() const +{ + static const auto Props = createFieldsProperties(); + return Props; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/EsfRaw.h b/cc_plugin/message/EsfRaw.h new file mode 100644 index 0000000..351634b --- /dev/null +++ b/cc_plugin/message/EsfRaw.h @@ -0,0 +1,64 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/EsfRaw.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class EsfRaw : public + ProtocolMessageBase< + ublox::message::EsfRaw, + EsfRaw> +{ +public: + EsfRaw(); + EsfRaw(const EsfRaw&) = delete; + EsfRaw(EsfRaw&&) = delete; + virtual ~EsfRaw(); + + EsfRaw& operator=(const EsfRaw&); + EsfRaw& operator=(EsfRaw&&); + +protected: + virtual const char* nameImpl() const override; + virtual const QVariantList& fieldsPropertiesImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::EsfRaw; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::EsfRaw, + ublox::cc_plugin::message::EsfRaw>; + diff --git a/include/ublox/InputMessages.h b/include/ublox/InputMessages.h index 0226c26..08e0cb4 100644 --- a/include/ublox/InputMessages.h +++ b/include/ublox/InputMessages.h @@ -149,6 +149,7 @@ #include "message/TimFchg.h" #include "message/EsfMeas.h" +#include "message/EsfRaw.h" #include "message/EsfStatus.h" #include "message/EsfIns.h" @@ -289,6 +290,7 @@ using InputMessages = message::TimVcocal, message::TimFchg, message::EsfMeas, + message::EsfRaw, message::EsfStatus, message::EsfIns, message::MgaFlashAck, diff --git a/include/ublox/message/EsfRaw.h b/include/ublox/message/EsfRaw.h new file mode 100644 index 0000000..f60fff7 --- /dev/null +++ b/include/ublox/message/EsfRaw.h @@ -0,0 +1,144 @@ +// +// Copyright 2015 - 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of ESF-RAW message and its fields. + +#pragma once + +#include "ublox/Message.h" +#include "ublox/field/common.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the ESF-RAW message fields. +/// @see EsfRaw +struct EsfRawFields +{ + /// @brief Definition of "reserved1" field. + using reserved1 = field::common::res4; + + /// @brief Definition of "dataField" field. + using dataField = field::common::U3; + + /// @brief Definition of "dataType" field. + using dataType = field::common::U1; + + /// @brief Definition of "sTtag" field. + using sTtag = field::common::U4; + + /// @breif Definition of single block element for @ref list field. + struct block : public + field::common::BundleT< + std::tuple< + dataField, + dataType, + sTtag + > + > + { + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_FIELD_MEMBERS_ACCESS macro + /// related to @b comms::field::Bitfield class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b dataField for @ref EsfRawFields::dataField field + /// @li @b dataType for @ref EsfRawFields::dataType field + /// @li @b sTtag for @ref EsfRawFields::sTtag field + COMMS_FIELD_MEMBERS_ACCESS(dataField, dataType, sTtag); + }; + + /// @brief Definition of "list" field as list of elements (@ref block). + /// @tparam TOpt Extra option(s) + template + using list = + field::common::ListT< + block, + TOpt + >; + + /// @brief All the fields bundled in std::tuple. + /// @tparam TOpt Extra option(s) for @ref data field + template + using All = std::tuple< + reserved1, + list + >; +}; + +/// @brief Definition of ESF-RAW message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref EsfRawFields and for definition of the fields this message contains +/// and COMMS_MSG_FIELDS_ACCESS() for fields access details. +/// @tparam TMsgBase Common interface class for all the messages. +/// @tparam TListOpt Extra option(s) for @b list field +template +class EsfRaw : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl >, + comms::option::MsgType > + > +{ + +public: + + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_MSG_FIELDS_ACCESS macro + /// related to @b comms::MessageBase class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b reserved1 for @ref EsfRawFields::reserved1 field + /// @li @b list for @ref EsfRawFields::list field + COMMS_MSG_FIELDS_ACCESS(reserved1, list); + + /// @brief Default constructor + EsfRaw() = default; + + /// @brief Copy constructor + EsfRaw(const EsfRaw&) = default; + + /// @brief Move constructor + EsfRaw(EsfRaw&& other) = default; + + /// @brief Destructor + ~EsfRaw() = default; + + /// @brief Copy assignment + EsfRaw& operator=(const EsfRaw&) = default; + + /// @brief Move assignment + EsfRaw& operator=(EsfRaw&&) = default; +}; + +} // namespace message + +} // namespace ublox + + + + + From 4eb37ff30e8f412d0de27dfacb189065e15f0072 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Mon, 14 Aug 2017 17:45:39 +1000 Subject: [PATCH 12/29] Implemented HNR-PVT message. --- cc_plugin/AllMessages.h | 7 +- cc_plugin/CMakeLists.txt | 2 + cc_plugin/Ublox8Messages.h | 8 +- cc_plugin/field/MsgId.cpp | 2 + cc_plugin/message/HnrPvt.cpp | 141 +++++++++++++++ cc_plugin/message/HnrPvt.h | 64 +++++++ cc_plugin/message/HnrPvtPoll.cpp | 53 ++++++ cc_plugin/message/HnrPvtPoll.h | 63 +++++++ include/ublox/InputMessages.h | 5 +- include/ublox/MsgId.h | 3 +- include/ublox/field/MsgId.h | 11 ++ include/ublox/message/HnrPvt.h | 271 +++++++++++++++++++++++++++++ include/ublox/message/HnrPvtPoll.h | 83 +++++++++ 13 files changed, 709 insertions(+), 4 deletions(-) create mode 100644 cc_plugin/message/HnrPvt.cpp create mode 100644 cc_plugin/message/HnrPvt.h create mode 100644 cc_plugin/message/HnrPvtPoll.cpp create mode 100644 cc_plugin/message/HnrPvtPoll.h create mode 100644 include/ublox/message/HnrPvt.h create mode 100644 include/ublox/message/HnrPvtPoll.h diff --git a/cc_plugin/AllMessages.h b/cc_plugin/AllMessages.h index 2812b84..53c8979 100644 --- a/cc_plugin/AllMessages.h +++ b/cc_plugin/AllMessages.h @@ -317,6 +317,9 @@ #include "cc_plugin/message/SecSign.h" #include "cc_plugin/message/SecUniqid.h" +#include "cc_plugin/message/HnrPvt.h" +#include "cc_plugin/message/HnrPvtPoll.h" + namespace ublox { @@ -605,7 +608,9 @@ using AllMessages = std::tuple< cc_plugin::message::LogFindtime, cc_plugin::message::LogRetrieveposextra, cc_plugin::message::SecSign, - cc_plugin::message::SecUniqid + cc_plugin::message::SecUniqid, + cc_plugin::message::HnrPvt, + cc_plugin::message::HnrPvtPoll >; } // namespace cc_plugin diff --git a/cc_plugin/CMakeLists.txt b/cc_plugin/CMakeLists.txt index 01dc033..dfc0dbc 100644 --- a/cc_plugin/CMakeLists.txt +++ b/cc_plugin/CMakeLists.txt @@ -290,6 +290,8 @@ function (cc_plugin_ublox_all_messages) message/LogRetrieveposextra.cpp message/SecSign.cpp message/SecUniqid.cpp + message/HnrPvt.cpp + message/HnrPvtPoll.cpp field/MsgId.cpp field/common.cpp field/nav.cpp diff --git a/cc_plugin/Ublox8Messages.h b/cc_plugin/Ublox8Messages.h index 3930afc..6d1a327 100644 --- a/cc_plugin/Ublox8Messages.h +++ b/cc_plugin/Ublox8Messages.h @@ -286,6 +286,9 @@ #include "cc_plugin/message/SecSign.h" #include "cc_plugin/message/SecUniqid.h" +#include "cc_plugin/message/HnrPvt.h" +#include "cc_plugin/message/HnrPvtPoll.h" + namespace ublox { @@ -542,7 +545,10 @@ using Ublox8Messages = std::tuple< cc_plugin::message::LogFindtime, cc_plugin::message::LogRetrieveposextra, cc_plugin::message::SecSign, - cc_plugin::message::SecUniqid + cc_plugin::message::SecUniqid, + cc_plugin::message::HnrPvt, + cc_plugin::message::HnrPvtPoll + >; } // namespace cc_plugin diff --git a/cc_plugin/field/MsgId.cpp b/cc_plugin/field/MsgId.cpp index 9eb2c87..9b620c1 100644 --- a/cc_plugin/field/MsgId.cpp +++ b/cc_plugin/field/MsgId.cpp @@ -193,6 +193,8 @@ QVariantMap createMsgIdProperties() .add("SEC-SIGN", MsgId_SEC_SIGN) .add("SEC-UNIQID", MsgId_SEC_UNIQID) + .add("HNR-PVT", MsgId_HNR_PVT) + .asMap(); } diff --git a/cc_plugin/message/HnrPvt.cpp b/cc_plugin/message/HnrPvt.cpp new file mode 100644 index 0000000..f50f5b2 --- /dev/null +++ b/cc_plugin/message/HnrPvt.cpp @@ -0,0 +1,141 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include "HnrPvt.h" +#include "cc_plugin/field/common.h" +#include "cc_plugin/field/nav.h" + +template class ublox::message::HnrPvt; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::HnrPvt, + ublox::cc_plugin::message::HnrPvt>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +namespace +{ + +using ublox::message::HnrPvtFields; + +QVariantMap createProps_valid() +{ + cc::property::field::ForField props; + props.name("valid") + .add("validDate") + .add("validTime") + .add("fullyResolved"); + + assert(props.bits().size() == HnrPvtFields::validBits::BitIdx_numOfValues); + return props.asMap(); +} + +QVariantMap createProps_flags() +{ + using Field = HnrPvtFields::flags; + auto props = + cc::property::field::ForField() + .name("flags") + .add("gnssFixOK") + .add("diffSoln") + .add("WKNSET") + .add("TOWSET") + .add("headVehValid"); + + assert(props.bits().size() == Field::BitIdx_numOfValues); + return props.asMap(); +} + +QVariantMap createProps_heading(const QString& name) +{ + return + cc::property::field::IntValue() + .name(name) + .scaledDecimals(5) + .asMap(); +} + +QVariantList createFieldsProperties() +{ + QVariantList props; + props.append(cc_plugin::field::nav::props_iTOW()); + props.append(cc_plugin::field::nav::props_year()); + props.append(cc_plugin::field::nav::props_month()); + props.append(cc_plugin::field::nav::props_day()); + props.append(cc_plugin::field::nav::props_hour()); + props.append(cc_plugin::field::nav::props_min()); + props.append(cc_plugin::field::nav::props_sec()); + props.append(createProps_valid()); + props.append(cc_plugin::field::nav::props_nano()); + props.append(cc_plugin::field::nav::props_gpsFix()); + props.append(createProps_flags()); + props.append(cc_plugin::field::common::props_reserved(1)); + props.append(cc_plugin::field::nav::props_lon()); + props.append(cc_plugin::field::nav::props_lat()); + props.append(cc_plugin::field::nav::props_height()); + props.append(cc_plugin::field::nav::props_hMSL()); + props.append(cc_plugin::field::nav::props_gSpeed()); + props.append( + cc::property::field::ForField().name("speed").asMap()); + props.append(createProps_heading("headMot")); + props.append(createProps_heading("headVeh")); + props.append(cc_plugin::field::nav::props_hAcc()); + props.append(cc_plugin::field::nav::props_vAcc()); + props.append(cc_plugin::field::nav::props_sAcc()); + props.append(createProps_heading("headAcc")); + props.append(cc_plugin::field::common::props_reserved(2)); + + assert(props.size() == HnrPvt::FieldIdx_numOfValues); + return props; +} + +} // namespace + +HnrPvt::HnrPvt() = default; +HnrPvt::~HnrPvt() = default; + +HnrPvt& HnrPvt::operator=(const HnrPvt&) = default; +HnrPvt& HnrPvt::operator=(HnrPvt&&) = default; + +const char* HnrPvt::nameImpl() const +{ + static const char* Str = "HNR-PVT"; + return Str; +} + +const QVariantList& HnrPvt::fieldsPropertiesImpl() const +{ + static const auto Props = createFieldsProperties(); + return Props; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/HnrPvt.h b/cc_plugin/message/HnrPvt.h new file mode 100644 index 0000000..1cc6002 --- /dev/null +++ b/cc_plugin/message/HnrPvt.h @@ -0,0 +1,64 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/HnrPvt.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class HnrPvt : public + ProtocolMessageBase< + ublox::message::HnrPvt, + HnrPvt> +{ +public: + HnrPvt(); + HnrPvt(const HnrPvt&) = delete; + HnrPvt(HnrPvt&&) = delete; + virtual ~HnrPvt(); + + HnrPvt& operator=(const HnrPvt&); + HnrPvt& operator=(HnrPvt&&); + +protected: + virtual const char* nameImpl() const override; + virtual const QVariantList& fieldsPropertiesImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::HnrPvt; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::HnrPvt, + ublox::cc_plugin::message::HnrPvt>; + diff --git a/cc_plugin/message/HnrPvtPoll.cpp b/cc_plugin/message/HnrPvtPoll.cpp new file mode 100644 index 0000000..3cb974d --- /dev/null +++ b/cc_plugin/message/HnrPvtPoll.cpp @@ -0,0 +1,53 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "HnrPvtPoll.h" + +template class ublox::message::HnrPvtPoll; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::HnrPvtPoll, + ublox::cc_plugin::message::HnrPvtPoll>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +HnrPvtPoll::HnrPvtPoll() = default; +HnrPvtPoll::~HnrPvtPoll() = default; + +HnrPvtPoll& HnrPvtPoll::operator=(const HnrPvtPoll&) = default; +HnrPvtPoll& HnrPvtPoll::operator=(HnrPvtPoll&&) = default; + +const char* HnrPvtPoll::nameImpl() const +{ + static const char* Str = "HNR-PVT (Poll)"; + return Str; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/HnrPvtPoll.h b/cc_plugin/message/HnrPvtPoll.h new file mode 100644 index 0000000..57648d1 --- /dev/null +++ b/cc_plugin/message/HnrPvtPoll.h @@ -0,0 +1,63 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/HnrPvtPoll.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class HnrPvtPoll : public + ProtocolMessageBase< + ublox::message::HnrPvtPoll, + HnrPvtPoll> +{ +public: + HnrPvtPoll(); + HnrPvtPoll(const HnrPvtPoll&) = delete; + HnrPvtPoll(HnrPvtPoll&&) = delete; + virtual ~HnrPvtPoll(); + + HnrPvtPoll& operator=(const HnrPvtPoll&); + HnrPvtPoll& operator=(HnrPvtPoll&&); + +protected: + virtual const char* nameImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::HnrPvtPoll; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::HnrPvtPoll, + ublox::cc_plugin::message::HnrPvtPoll>; + diff --git a/include/ublox/InputMessages.h b/include/ublox/InputMessages.h index 08e0cb4..01358c8 100644 --- a/include/ublox/InputMessages.h +++ b/include/ublox/InputMessages.h @@ -166,6 +166,8 @@ #include "message/SecSign.h" #include "message/SecUniqid.h" +#include "message/HnrPvt.h" + namespace ublox { @@ -302,7 +304,8 @@ using InputMessages = message::LogFindtime, message::LogRetrieveposextra, message::SecSign, - message::SecUniqid + message::SecUniqid, + message::HnrPvt >; } // namespace ublox diff --git a/include/ublox/MsgId.h b/include/ublox/MsgId.h index 9a29fe9..ac02c4f 100644 --- a/include/ublox/MsgId.h +++ b/include/ublox/MsgId.h @@ -172,7 +172,8 @@ enum MsgId : std::uint16_t MsgId_LOG_FINDTIME = 0x210e, ///< ID of LOG-FINDTIME message MsgId_LOG_RETRIEVEPOSEXTRA = 0x210f, ///< ID of LOG-RETRIEVEPOSEXTRA message MsgId_SEC_SIGN = 0x2701, ///< ID of SEC-SIGN message - MsgId_SEC_UNIQID = 0x2703 ///< ID of SEC-UNIQID message + MsgId_SEC_UNIQID = 0x2703, ///< ID of SEC-UNIQID message + MsgId_HNR_PVT = 0x2800, ///< ID of HNR-PVT message }; } // namespace ublox diff --git a/include/ublox/field/MsgId.h b/include/ublox/field/MsgId.h index 948aee8..4fdcdca 100644 --- a/include/ublox/field/MsgId.h +++ b/include/ublox/field/MsgId.h @@ -58,6 +58,7 @@ struct MsgIdValueValidator std::make_pair(classId(MsgId_MGA_GPS), &MsgIdValueValidator::validateMga), std::make_pair(classId(MsgId_LOG_ERASE), &MsgIdValueValidator::validateLog), std::make_pair(classId(MsgId_SEC_SIGN), &MsgIdValueValidator::validateSec), + std::make_pair(classId(MsgId_HNR_PVT), &MsgIdValueValidator::validateHnr), }; ublox::MsgId id = field.value(); @@ -335,6 +336,16 @@ struct MsgIdValueValidator auto iter = std::lower_bound(std::begin(IDs), std::end(IDs), id); return (iter != std::end(IDs)) && (*iter == id); } + + static bool validateHnr(ublox::MsgId id) + { + static const ublox::MsgId IDs[] = { + MsgId_HNR_PVT, + }; + + auto iter = std::lower_bound(std::begin(IDs), std::end(IDs), id); + return (iter != std::end(IDs)) && (*iter == id); + } }; } // namespace details diff --git a/include/ublox/message/HnrPvt.h b/include/ublox/message/HnrPvt.h new file mode 100644 index 0000000..5ef86d1 --- /dev/null +++ b/include/ublox/message/HnrPvt.h @@ -0,0 +1,271 @@ +// +// Copyright 2015 - 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of HNR-PVT message and its fields. + +#pragma once + +#include "ublox/Message.h" +#include "ublox/field/nav.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the HNR-PVT message fields. +/// @see HnrPvt +struct HnrPvtFields +{ + /// @brief Definition of "iTOW" field. + using iTOW = field::common::iTOW; + + /// @brief Definition of "year" field. + using year = field::nav::year; + + /// @brief Definition of "month" field. + using month = field::nav::month; + + /// @brief Definition of "day" field. + using day = field::nav::day; + + /// @brief Definition of "hour" field. + using hour = field::nav::hour; + + /// @brief Definition of "min" field. + using min = field::nav::min; + + /// @brief Definition of "sec" field. + using sec = field::nav::sec; + + /// @brief Definition of "valid" field. + struct validBits : public + field::common::X1T< + comms::option::BitmaskReservedBits<0xf8, 0> > + { + /// @brief Provide names for internal bits. + /// @details See definition of @b COMMS_BITMASK_BITS_SEQ macro + /// related to @b comms::field::BitmaskValue class from COMMS library + /// for details. + COMMS_BITMASK_BITS_SEQ(validDate, validTime, fullyResolved); + }; + + /// @brief Definition of "nano" field. + using nano = field::nav::nano; + + /// @brief Value enumeration for @ref gpsFix field. + using GpsFix = field::nav::GpsFix; + + /// @brief Definition of "gpsFix" field. + using gpsFix = field::nav::gpsFix; + + /// @brief Definition of two first bits (@b gnssFixOn and @b diffSoln) in + /// @ref flags bitfield as separate bitmask member field. + struct flags : public + field::common::X1T< + comms::option::BitmaskReservedBits<0xe0, 0> + > + { + /// @brief Provide names for internal bits. + /// @details See definition of @b COMMS_BITMASK_BITS_SEQ macro + /// related to @b comms::field::BitmaskValue class from COMMS library + /// for details. + COMMS_BITMASK_BITS_SEQ(gnssFixOK, diffSoln, WKNSET, TOWSET, headVehValid); + }; + + /// @brief Definition of "reserved1" field. + using reserved1 = field::common::res2; + + /// @brief Definition of "lon" field. + using lon = field::nav::lon; + + /// @brief Definition of "lat" field. + using lat = field::nav::lat; + + /// @brief Definition of "height" field. + using height = field::nav::height; + + /// @brief Definition of "hMSL" field. + using hMSL = field::nav::hMSL; + + /// @brief Definition of "gSpeed" field. + using gSpeed = field::common::I4T; + + /// @brief Definition of "gSpeed" field. + using speed = gSpeed; + + /// @brief Definition of "headMot" field. + using headMot = field::nav::heading; + + /// @brief Definition of "headVeh" field. + using headVeh = field::nav::heading; + + /// @brief Definition of "hAcc" field. + using hAcc = field::nav::hAcc; + + /// @brief Definition of "vAcc" field. + using vAcc = field::nav::vAcc; + + /// @brief Definition of "sAcc" field. + using sAcc = field::common::U4T; + + /// @brief Definition of "headAcc" field. + using headAcc = + field::common::U4T< + comms::option::ScalingRatio<1, 100000>, + comms::option::UnitsDegrees + >; + + /// @brief Definition of "reserved2" field. + using reserved2 = field::common::res4; + + /// @brief All the fields bundled in std::tuple. + using All = std::tuple< + iTOW, + year, + month, + day, + hour, + min, + sec, + validBits, + nano, + gpsFix, + flags, + reserved1, + lon, + lat, + height, + hMSL, + gSpeed, + speed, + headMot, + headVeh, + hAcc, + vAcc, + sAcc, + headAcc, + reserved2 + >; +}; + +/// @brief Definition of HNR-PVT message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref HnrPvtFields and for definition of the fields this message contains +/// and COMMS_MSG_FIELDS_ACCESS() for fields access details. +/// @tparam TMsgBase Common interface class for all the messages. +template +class HnrPvt : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_MSG_FIELDS_ACCESS macro + /// related to @b comms::MessageBase class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b iTOW for @ref HnrPvtFields::iTOW field + /// @li @b year for @ref HnrPvtFields::year field + /// @li @b month for @ref HnrPvtFields::month field + /// @li @b day for @ref HnrPvtFields::day field + /// @li @b hour for @ref HnrPvtFields::hour field + /// @li @b min for @ref HnrPvtFields::min field + /// @li @b sec for @ref HnrPvtFields::sec field + /// @li @b valid for @ref HnrPvtFields::validBits field + /// @li @b nano for @ref HnrPvtFields::nano field + /// @li @b gpsFix for @ref HnrPvtFields::gpsFix field + /// @li @b flags for @ref HnrPvtFields::flags field + /// @li @b reserved1 for @ref HnrPvtFields::reserved1 field + /// @li @b lon for @ref HnrPvtFields::lon field + /// @li @b lat for @ref HnrPvtFields::lat field + /// @li @b height for @ref HnrPvtFields::height field + /// @li @b hMSL for @ref HnrPvtFields::hMSL field + /// @li @b gSpeed for @ref HnrPvtFields::gSpeed field + /// @li @b speed for @ref HnrPvtFields::speed field + /// @li @b headMot for @ref HnrPvtFields::headMot field + /// @li @b headVeh for @ref HnrPvtFields::headVeh field + /// @li @b hAcc for @ref HnrPvtFields::hAcc field + /// @li @b vAcc for @ref HnrPvtFields::vAcc field + /// @li @b sAcc for @ref HnrPvtFields::sAcc field + /// @li @b headAcc for @ref HnrPvtFields::headAcc field + /// @li @b reserved2 for @ref HnrPvtFields::reserved2 field + COMMS_MSG_FIELDS_ACCESS( + iTOW, + year, + month, + day, + hour, + min, + sec, + validBits, + nano, + gpsFix, + flags, + reserved1, + lon, + lat, + height, + hMSL, + gSpeed, + speed, + headMot, + headVeh, + hAcc, + vAcc, + sAcc, + headAcc, + reserved2); + + /// @brief Default constructor + HnrPvt() = default; + + /// @brief Copy constructor + HnrPvt(const HnrPvt&) = default; + + /// @brief Move constructor + HnrPvt(HnrPvt&& other) = default; + + /// @brief Destructor + ~HnrPvt() = default; + + /// @brief Copy assignment + HnrPvt& operator=(const HnrPvt&) = default; + + /// @brief Move assignment + HnrPvt& operator=(HnrPvt&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + diff --git a/include/ublox/message/HnrPvtPoll.h b/include/ublox/message/HnrPvtPoll.h new file mode 100644 index 0000000..dfe8663 --- /dev/null +++ b/include/ublox/message/HnrPvtPoll.h @@ -0,0 +1,83 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of HNR-PVT (@b poll) message and its fields. + +#pragma once + +#include "ublox/Message.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the HNR-PVT (@b poll) message fields. +/// @see HnrPvtPoll +struct HnrPvtPollFields +{ + /// @brief All the fields bundled in std::tuple. + using All = std::tuple<>; +}; + +/// @brief Definition of HNR-PVT (@b poll) message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref HnrPvtPollFields and for definition of the fields this message contains. +/// @tparam TMsgBase Common interface class for all the messages. +template +class HnrPvtPoll : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Default constructor + HnrPvtPoll() = default; + + /// @brief Copy constructor + HnrPvtPoll(const HnrPvtPoll&) = default; + + /// @brief Move constructor + HnrPvtPoll(HnrPvtPoll&& other) = default; + + /// @brief Destructor + ~HnrPvtPoll() = default; + + /// @brief Copy assignment + HnrPvtPoll& operator=(const HnrPvtPoll&) = default; + + /// @brief Move assignment + HnrPvtPoll& operator=(HnrPvtPoll&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + From 88dd86fe7e02365480b90f5cbce20df0543603a9 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Mon, 14 Aug 2017 17:50:53 +1000 Subject: [PATCH 13/29] Fixes to documentation links. --- include/ublox/message/CfgNavx5.h | 12 ++++++------ include/ublox/message/CfgPm2.h | 8 ++++---- include/ublox/message/EsfMeas.h | 2 +- include/ublox/message/EsfRaw.h | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/ublox/message/CfgNavx5.h b/include/ublox/message/CfgNavx5.h index 9b7f934..c3be93b 100644 --- a/include/ublox/message/CfgNavx5.h +++ b/include/ublox/message/CfgNavx5.h @@ -367,9 +367,9 @@ class CfgNavx5 : public CfgNavx5& operator=(CfgNavx5&&) = default; /// @brief Provides custom read functionality. - /// @details The existence of "reserved10" (see @ref CfgNavx5::reserved10) and - /// "reserved11" (see @ref CfgNavx5::reserved11) is - /// determined by the value of "version" (see @ref CfgNavx5::version). + /// @details The existence of "reserved10" (see @ref CfgNavx5Fields::reserved10) and + /// "reserved11" (see @ref CfgNavx5Fields::reserved11) is + /// determined by the value of "version" (see @ref CfgNavx5Fields::version). template comms::ErrorStatus doRead(TIter& iter, std::size_t len) { @@ -388,9 +388,9 @@ class CfgNavx5 : public } /// @brief Provides custom refresh functionality - /// @details The existence of "reserved10" (see @ref CfgNavx5::reserved10) and - /// "reserved11" (see @ref CfgNavx5::reserved11) is - /// determined by the value of "version" (see @ref CfgNavx5::version). + /// @details The existence of "reserved10" (see @ref CfgNavx5Fields::reserved10) and + /// "reserved11" (see @ref CfgNavx5Fields::reserved11) is + /// determined by the value of "version" (see @ref CfgNavx5Fields::version). bool doRefresh() { auto optResMode = comms::field::OptionalMode::Missing; diff --git a/include/ublox/message/CfgPm2.h b/include/ublox/message/CfgPm2.h index fb03f2b..1022652 100644 --- a/include/ublox/message/CfgPm2.h +++ b/include/ublox/message/CfgPm2.h @@ -379,8 +379,8 @@ class CfgPm2 : public CfgPm2& operator=(CfgPm2&&) = default; /// @brief Provides custom read functionality. - /// @details The existence of "extintInactivityMs" (see @ref CfgPm2::extintInactivityMs) is - /// determined by the value of "version" (see @ref CfgPm2::version). + /// @details The existence of "extintInactivityMs" (see @ref CfgPm2Fields::extintInactivityMs) is + /// determined by the value of "version" (see @ref CfgPm2Fields::version). template comms::ErrorStatus doRead(TIter& iter, std::size_t len) { @@ -400,8 +400,8 @@ class CfgPm2 : public } /// @brief Provides custom refresh functionality - /// @details The existence of "extintInactivityMs" (see @ref CfgPm2::extintInactivityMs) is - /// determined by the value of "version" (see @ref CfgPm2::version). + /// @details The existence of "extintInactivityMs" (see @ref CfgPm2Fields::extintInactivityMs) is + /// determined by the value of "version" (see @ref CfgPm2Fields::version). /// @return @b true in case the mode of "extintInactivityMs" field was modified, @b false otherwise bool doRefresh() { diff --git a/include/ublox/message/EsfMeas.h b/include/ublox/message/EsfMeas.h index 3365dba..17749ad 100644 --- a/include/ublox/message/EsfMeas.h +++ b/include/ublox/message/EsfMeas.h @@ -118,7 +118,7 @@ struct EsfMeasFields comms::option::ValidNumValueRange<0, 63> >; - /// @breif Definition of single data element for @ref data field. + /// @brief Definition of single data element for @ref data field. struct dataElem : public field::common::BundleT< std::tuple< diff --git a/include/ublox/message/EsfRaw.h b/include/ublox/message/EsfRaw.h index f60fff7..85041eb 100644 --- a/include/ublox/message/EsfRaw.h +++ b/include/ublox/message/EsfRaw.h @@ -45,7 +45,7 @@ struct EsfRawFields /// @brief Definition of "sTtag" field. using sTtag = field::common::U4; - /// @breif Definition of single block element for @ref list field. + /// @brief Definition of single block element for @ref list field. struct block : public field::common::BundleT< std::tuple< @@ -77,7 +77,7 @@ struct EsfRawFields >; /// @brief All the fields bundled in std::tuple. - /// @tparam TOpt Extra option(s) for @ref data field + /// @tparam TOpt Extra option(s) for @ref list field template using All = std::tuple< reserved1, From f815fc0af0dbe8503764fa8edc8597e665d1ffee Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Mon, 14 Aug 2017 18:21:24 +1000 Subject: [PATCH 14/29] Minor fixes. --- cc_plugin/message/LogRetrievepos.cpp | 2 ++ cc_plugin/message/MonGnss.cpp | 8 ++++---- include/ublox/message/LogRetrievepos.h | 8 +++++--- include/ublox/message/MgaBdsIono.h | 2 -- include/ublox/message/MgaBdsUtc.h | 1 - include/ublox/message/MonGnss.h | 10 +++++----- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/cc_plugin/message/LogRetrievepos.cpp b/cc_plugin/message/LogRetrievepos.cpp index ebfc3e5..c20291d 100644 --- a/cc_plugin/message/LogRetrievepos.cpp +++ b/cc_plugin/message/LogRetrievepos.cpp @@ -55,8 +55,10 @@ QVariantMap createProps_fixType() return cc::property::field::ForField() .name("fixType") + .add("Dead reckoning", (int)LogRetrieveposFields::FixType::DeadReckoning) .add("2D-Fix", (int)LogRetrieveposFields::FixType::Fix_2D) .add("3D-Fix", (int)LogRetrieveposFields::FixType::Fix_3D) + .add("GNSS + Dead reckoning", (int)LogRetrieveposFields::FixType::GnssAndDeadReckoning) .asMap(); } diff --git a/cc_plugin/message/MonGnss.cpp b/cc_plugin/message/MonGnss.cpp index 3c326b2..f5ef090 100644 --- a/cc_plugin/message/MonGnss.cpp +++ b/cc_plugin/message/MonGnss.cpp @@ -1,4 +1,4 @@ -// +// // Copyright 2017 (C). Alex Robenko. All rights reserved. // @@ -57,13 +57,13 @@ QVariantMap createProps_supported() QVariantMap createProps_default() { auto props = - cc::property::field::ForField() - .name("default") + cc::property::field::ForField() + .name("defaultGnss") .add("GPSDef") .add("GlonassDef") .add("BeidouDef") .add("GalileoDef"); - assert(props.bits().size() == MonGnssFields::deflt::BitIdx_numOfValues); + assert(props.bits().size() == MonGnssFields::defaultGnss::BitIdx_numOfValues); return props.asMap(); } diff --git a/include/ublox/message/LogRetrievepos.h b/include/ublox/message/LogRetrievepos.h index 4b31e5a..bbb5349 100644 --- a/include/ublox/message/LogRetrievepos.h +++ b/include/ublox/message/LogRetrievepos.h @@ -36,8 +36,10 @@ struct LogRetrieveposFields /// @brief Value enumeration for @ref fixType field. enum class FixType : std::uint8_t { - Fix_2D = 2, ///< 2D fix - Fix_3D ///< 3D fix + DeadReckoning = 1, ///< Dead reckoning + Fix_2D, ///< 2D fix + Fix_3D, ///< 3D fix + GnssAndDeadReckoning ///< GNSS + Dead Reckoning combined }; /// @brief Definition of "entryIndex" field. @@ -75,7 +77,7 @@ struct LogRetrieveposFields using fixType = field::common::EnumT< FixType, - comms::option::ValidNumValueRange<(int)FixType::Fix_2D, (int)FixType::Fix_3D> + comms::option::ValidNumValueRange<(int)FixType::DeadReckoning, (int)FixType::GnssAndDeadReckoning> >; /// @brief Definition of "year" field. diff --git a/include/ublox/message/MgaBdsIono.h b/include/ublox/message/MgaBdsIono.h index 28b1bff..e0a8a6e 100644 --- a/include/ublox/message/MgaBdsIono.h +++ b/include/ublox/message/MgaBdsIono.h @@ -85,8 +85,6 @@ struct MgaBdsIonoFields /// @brief Definition of "reserved2" field. using reserved2 = field::common::res4; - - // TODO /// @brief All the fields bundled in std::tuple. using All = std::tuple< type, diff --git a/include/ublox/message/MgaBdsUtc.h b/include/ublox/message/MgaBdsUtc.h index bfccb13..5adb220 100644 --- a/include/ublox/message/MgaBdsUtc.h +++ b/include/ublox/message/MgaBdsUtc.h @@ -84,7 +84,6 @@ struct MgaBdsUtcFields /// @brief Definition of "reserved3" field. using reserved3 = field::common::res2; - // TODO /// @brief All the fields bundled in std::tuple. using All = std::tuple< type, diff --git a/include/ublox/message/MonGnss.h b/include/ublox/message/MonGnss.h index dc61210..7bbd839 100644 --- a/include/ublox/message/MonGnss.h +++ b/include/ublox/message/MonGnss.h @@ -53,8 +53,8 @@ struct MonGnssFields COMMS_BITMASK_BITS_SEQ(GPSSup, GlonassSup, BeidouSup, GalileoSup); }; - /// @brief Definition of "default" field. - struct deflt : public + /// @brief Definition of "defaultGnss" field. + struct defaultGnss : public field::common::X1T< comms::option::BitmaskReservedBits<0xf0, 0> > @@ -90,7 +90,7 @@ struct MonGnssFields using All = std::tuple< version, supported, - deflt, + defaultGnss, enabled, simultaneous, reserved1 @@ -123,14 +123,14 @@ class MonGnss : public /// The field names are: /// @li @b version for @ref MonGnssFields::version field /// @li @b supported for @ref MonGnssFields::supported field - /// @li @b default for @ref MonGnssFields::deflt field + /// @li @b defaultGnss for @ref MonGnssFields::defaultGnss field /// @li @b enabled for @ref MonGnssFields::enabled field /// @li @b simultaneous for @ref MonGnssFields::simultaneous field /// @li @b reserved1 for @ref MonGnssFields::reserved1 field COMMS_MSG_FIELDS_ACCESS( version, supported, - default, + defaultGnss, enabled, simultaneous, reserved1 From 1f35eb4ac026dceb059817b4f26651f3ee89c1a4 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Thu, 17 Aug 2017 17:07:09 +1000 Subject: [PATCH 15/29] Implemented NAV-ATT message. --- cc_plugin/AllMessages.h | 4 + cc_plugin/CMakeLists.txt | 2 + cc_plugin/Ublox8Messages.h | 4 + cc_plugin/field/MsgId.cpp | 1 + cc_plugin/message/NavAtt.cpp | 97 ++++++++++++++++ cc_plugin/message/NavAtt.h | 64 +++++++++++ cc_plugin/message/NavAttPoll.cpp | 54 +++++++++ cc_plugin/message/NavAttPoll.h | 63 +++++++++++ include/ublox/InputMessages.h | 2 + include/ublox/MsgId.h | 1 + include/ublox/field/MsgId.h | 1 + include/ublox/message/NavAtt.h | 174 +++++++++++++++++++++++++++++ include/ublox/message/NavAttPoll.h | 83 ++++++++++++++ 13 files changed, 550 insertions(+) create mode 100644 cc_plugin/message/NavAtt.cpp create mode 100644 cc_plugin/message/NavAtt.h create mode 100644 cc_plugin/message/NavAttPoll.cpp create mode 100644 cc_plugin/message/NavAttPoll.h create mode 100644 include/ublox/message/NavAtt.h create mode 100644 include/ublox/message/NavAttPoll.h diff --git a/cc_plugin/AllMessages.h b/cc_plugin/AllMessages.h index 53c8979..62a1a7c 100644 --- a/cc_plugin/AllMessages.h +++ b/cc_plugin/AllMessages.h @@ -29,6 +29,8 @@ #include "cc_plugin/message/NavStatusPoll.h" #include "cc_plugin/message/NavDop.h" #include "cc_plugin/message/NavDopPoll.h" +#include "cc_plugin/message/NavAtt.h" +#include "cc_plugin/message/NavAttPoll.h" #include "cc_plugin/message/NavSol.h" #include "cc_plugin/message/NavSolPoll.h" #include "cc_plugin/message/NavPvt.h" @@ -335,6 +337,8 @@ using AllMessages = std::tuple< cc_plugin::message::NavStatusPoll, cc_plugin::message::NavDop, cc_plugin::message::NavDopPoll, + cc_plugin::message::NavAtt, + cc_plugin::message::NavAttPoll, cc_plugin::message::NavSol, cc_plugin::message::NavSolPoll, cc_plugin::message::NavPvt, diff --git a/cc_plugin/CMakeLists.txt b/cc_plugin/CMakeLists.txt index dfc0dbc..fab1a4a 100644 --- a/cc_plugin/CMakeLists.txt +++ b/cc_plugin/CMakeLists.txt @@ -15,6 +15,8 @@ function (cc_plugin_ublox_all_messages) message/NavStatusPoll.cpp message/NavDop.cpp message/NavDopPoll.cpp + message/NavAtt.cpp + message/NavAttPoll.cpp message/NavSol.cpp message/NavSolPoll.cpp message/NavPvt.cpp diff --git a/cc_plugin/Ublox8Messages.h b/cc_plugin/Ublox8Messages.h index 6d1a327..d8a85b0 100644 --- a/cc_plugin/Ublox8Messages.h +++ b/cc_plugin/Ublox8Messages.h @@ -29,6 +29,8 @@ #include "cc_plugin/message/NavStatusPoll.h" #include "cc_plugin/message/NavDop.h" #include "cc_plugin/message/NavDopPoll.h" +#include "cc_plugin/message/NavAtt.h" +#include "cc_plugin/message/NavAttPoll.h" #include "cc_plugin/message/NavSol.h" #include "cc_plugin/message/NavSolPoll.h" #include "cc_plugin/message/NavPvt.h" @@ -304,6 +306,8 @@ using Ublox8Messages = std::tuple< cc_plugin::message::NavStatusPoll, cc_plugin::message::NavDop, cc_plugin::message::NavDopPoll, + cc_plugin::message::NavAtt, + cc_plugin::message::NavAttPoll, cc_plugin::message::NavSol, cc_plugin::message::NavSolPoll, cc_plugin::message::NavPvt, diff --git a/cc_plugin/field/MsgId.cpp b/cc_plugin/field/MsgId.cpp index 9b620c1..92c5985 100644 --- a/cc_plugin/field/MsgId.cpp +++ b/cc_plugin/field/MsgId.cpp @@ -44,6 +44,7 @@ QVariantMap createMsgIdProperties() .add("NAV-POSLLH", MsgId_NAV_POSLLH) .add("NAV-STATUS", MsgId_NAV_STATUS) .add("NAV-DOP", MsgId_NAV_DOP) + .add("NAV-ATT", MsgId_NAV_ATT) .add("NAV-SOL", MsgId_NAV_SOL) .add("NAV-PVT", MsgId_NAV_PVT) .add("NAV_ODO", MsgId_NAV_ODO) diff --git a/cc_plugin/message/NavAtt.cpp b/cc_plugin/message/NavAtt.cpp new file mode 100644 index 0000000..34b0b49 --- /dev/null +++ b/cc_plugin/message/NavAtt.cpp @@ -0,0 +1,97 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include "NavAtt.h" +#include "cc_plugin/field/nav.h" +#include "cc_plugin/field/common.h" + +template class ublox::message::NavAtt; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavAtt, + ublox::cc_plugin::message::NavAtt>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +namespace +{ + +using ublox::message::NavAttFields; + +QVariantMap createProps_attField(const char* name) +{ + return + cc::property::field::IntValue() + .name(name) + .scaledDecimals(5) + .asMap(); +} + +QVariantList createFieldsProperties() +{ + QVariantList props; + props.append(cc_plugin::field::nav::props_iTOW()); + props.append( + cc::property::field::ForField().name("version").asMap()); + props.append(cc_plugin::field::common::props_reserved(1)); + props.append(createProps_attField("roll")); + props.append(createProps_attField("pitch")); + props.append(createProps_attField("heading")); + props.append(createProps_attField("accRoll")); + props.append(createProps_attField("accPitch")); + props.append(createProps_attField("accHeading")); + + assert(props.size() == NavAtt::FieldIdx_numOfValues); + return props; +} + +} // namespace + +NavAtt::NavAtt() = default; +NavAtt::~NavAtt() = default; + +NavAtt& NavAtt::operator=(const NavAtt&) = default; +NavAtt& NavAtt::operator=(NavAtt&&) = default; + +const char* NavAtt::nameImpl() const +{ + static const char* Str = "NAV-ATT"; + return Str; +} + +const QVariantList& NavAtt::fieldsPropertiesImpl() const +{ + static const auto Props = createFieldsProperties(); + return Props; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/NavAtt.h b/cc_plugin/message/NavAtt.h new file mode 100644 index 0000000..34ce933 --- /dev/null +++ b/cc_plugin/message/NavAtt.h @@ -0,0 +1,64 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/NavAtt.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class NavAtt : public + ProtocolMessageBase< + ublox::message::NavAtt, + NavAtt> +{ +public: + NavAtt(); + NavAtt(const NavAtt&) = delete; + NavAtt(NavAtt&&) = delete; + virtual ~NavAtt(); + + NavAtt& operator=(const NavAtt&); + NavAtt& operator=(NavAtt&&); + +protected: + virtual const char* nameImpl() const override; + virtual const QVariantList& fieldsPropertiesImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::NavAtt; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavAtt, + ublox::cc_plugin::message::NavAtt>; + diff --git a/cc_plugin/message/NavAttPoll.cpp b/cc_plugin/message/NavAttPoll.cpp new file mode 100644 index 0000000..7190840 --- /dev/null +++ b/cc_plugin/message/NavAttPoll.cpp @@ -0,0 +1,54 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#include "NavAttPoll.h" + +template class ublox::message::NavAttPoll; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavAttPoll, + ublox::cc_plugin::message::NavAttPoll>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +NavAttPoll::NavAttPoll() = default; +NavAttPoll::~NavAttPoll() = default; + +NavAttPoll& NavAttPoll::operator=(const NavAttPoll&) = default; +NavAttPoll& NavAttPoll::operator=(NavAttPoll&&) = default; + +const char* NavAttPoll::nameImpl() const +{ + static const char* Str = "NAV-ATT (Poll)"; + return Str; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/NavAttPoll.h b/cc_plugin/message/NavAttPoll.h new file mode 100644 index 0000000..55471ce --- /dev/null +++ b/cc_plugin/message/NavAttPoll.h @@ -0,0 +1,63 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/NavAttPoll.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class NavAttPoll : public + ProtocolMessageBase< + ublox::message::NavAttPoll, + NavAttPoll> +{ +public: + NavAttPoll(); + NavAttPoll(const NavAttPoll&) = delete; + NavAttPoll(NavAttPoll&&) = delete; + virtual ~NavAttPoll(); + + NavAttPoll& operator=(const NavAttPoll&); + NavAttPoll& operator=(NavAttPoll&&); + +protected: + virtual const char* nameImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::NavAttPoll; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavAttPoll, + ublox::cc_plugin::message::NavAttPoll>; + diff --git a/include/ublox/InputMessages.h b/include/ublox/InputMessages.h index 01358c8..f85068c 100644 --- a/include/ublox/InputMessages.h +++ b/include/ublox/InputMessages.h @@ -28,6 +28,7 @@ #include "message/NavPosllh.h" #include "message/NavStatus.h" #include "message/NavDop.h" +#include "message/NavAtt.h" #include "message/NavSol.h" #include "message/NavPvt.h" #include "message/NavOdo.h" @@ -181,6 +182,7 @@ using InputMessages = message::NavPosllh, message::NavStatus, message::NavDop, + message::NavAtt, message::NavSol, message::NavPvt, message::NavOdo, diff --git a/include/ublox/MsgId.h b/include/ublox/MsgId.h index ac02c4f..724d54b 100644 --- a/include/ublox/MsgId.h +++ b/include/ublox/MsgId.h @@ -36,6 +36,7 @@ enum MsgId : std::uint16_t MsgId_NAV_POSLLH = 0x0102, ///< ID of NAV-POSLLH message MsgId_NAV_STATUS = 0x0103, ///< ID of NAV-STATUS message MsgId_NAV_DOP = 0x0104, ///< ID of NAV-DOP message + MsgId_NAV_ATT = 0x0105, ///< ID of NAV-ATT message MsgId_NAV_SOL = 0x0106, ///< ID of NAV-SOL message MsgId_NAV_PVT = 0x0107, ///< ID of NAV-PVT message MsgId_NAV_ODO = 0x0109, ///< ID of NAV-ODO message diff --git a/include/ublox/field/MsgId.h b/include/ublox/field/MsgId.h index 4fdcdca..661a692 100644 --- a/include/ublox/field/MsgId.h +++ b/include/ublox/field/MsgId.h @@ -91,6 +91,7 @@ struct MsgIdValueValidator MsgId_NAV_POSLLH, MsgId_NAV_STATUS, MsgId_NAV_DOP, + MsgId_NAV_ATT, MsgId_NAV_SOL, MsgId_NAV_PVT, MsgId_NAV_ODO, diff --git a/include/ublox/message/NavAtt.h b/include/ublox/message/NavAtt.h new file mode 100644 index 0000000..ac3073f --- /dev/null +++ b/include/ublox/message/NavAtt.h @@ -0,0 +1,174 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of NAV-ATT message and its fields. + +#pragma once + +#include "ublox/Message.h" +#include "ublox/field/nav.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the NAV-ATT message fields. +/// @see NavAtt +struct NavAttFields +{ + /// @brief Definition of "iTOW" field. + using iTOW = field::nav::iTOW; + + /// @brief Definition of "version" field. + using version = + field::common::U1T >; + + /// @brief Definition of "reserved1" field. + using reserved1 = field::common::res3; + + /// @bried Definition of "roll" field. + using roll = + field::common::I4T< + comms::option::UnitsDegrees, + comms::option::ScalingRatio<1, 100000> + >; + + /// @bried Definition of "pitch" field. + using pitch = + field::common::I4T< + comms::option::UnitsDegrees, + comms::option::ScalingRatio<1, 100000> + >; + + /// @bried Definition of "heading" field. + using heading = + field::common::I4T< + comms::option::UnitsDegrees, + comms::option::ScalingRatio<1, 100000> + >; + + /// @bried Definition of "accRoll" field. + using accRoll = + field::common::U4T< + comms::option::UnitsDegrees, + comms::option::ScalingRatio<1, 100000> + >; + + /// @bried Definition of "accPitch" field. + using accPitch = + field::common::U4T< + comms::option::UnitsDegrees, + comms::option::ScalingRatio<1, 100000> + >; + + /// @bried Definition of "accHeading" field. + using accHeading = + field::common::U4T< + comms::option::UnitsDegrees, + comms::option::ScalingRatio<1, 100000> + >; + + /// @brief All the fields bundled in std::tuple. + using All = std::tuple< + iTOW, + version, + reserved1, + roll, + pitch, + heading, + accRoll, + accPitch, + accHeading + >; +}; + +/// @brief Definition of NAV-ATT message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref NavAttFields and for definition of the fields this message contains +/// and COMMS_MSG_FIELDS_ACCESS() for fields access details. +/// @tparam TMsgBase Common interface class for all the messages. +template +class NavAtt : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_MSG_FIELDS_ACCESS macro + /// related to @b comms::MessageBase class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b iTOW for @ref NavAttFields::iTOW field + /// @li @b version for @ref NavAttFields::version field + /// @li @b reserved1 for @ref NavAttFields::reserved1 field + /// @li @b roll for @ref NavAttFields::roll field + /// @li @b pitch for @ref NavAttFields::pitch field + /// @li @b heading for @ref NavAttFields::heading field + /// @li @b accRoll for @ref NavAttFields::accRoll field + /// @li @b accPitch for @ref NavAttFields::accPitch field + /// @li @b accHeading for @ref NavAttFields::accHeading field + COMMS_MSG_FIELDS_ACCESS( + iTOW, + version, + reserved1, + roll, + pitch, + heading, + accRoll, + accPitch, + accHeading + ); + + /// @brief Default constructor + NavAtt() = default; + + /// @brief Copy constructor + NavAtt(const NavAtt&) = default; + + /// @brief Move constructor + NavAtt(NavAtt&& other) = default; + + /// @brief Destructor + ~NavAtt() = default; + + /// @brief Copy assignment + NavAtt& operator=(const NavAtt&) = default; + + /// @brief Move assignment + NavAtt& operator=(NavAtt&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + diff --git a/include/ublox/message/NavAttPoll.h b/include/ublox/message/NavAttPoll.h new file mode 100644 index 0000000..c1c1207 --- /dev/null +++ b/include/ublox/message/NavAttPoll.h @@ -0,0 +1,83 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of NAV-ATT (@b poll) message and its fields. + +#pragma once + +#include "ublox/Message.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the NAV-ATT (@b poll) message fields. +/// @see NavAttPoll +struct NavAttPollFields +{ + /// @brief All the fields bundled in std::tuple. + using All = std::tuple<>; +}; + +/// @brief Definition of NAV-ATT (@b poll) message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref NavAttPollFields and for definition of the fields this message contains. +/// @tparam TMsgBase Common interface class for all the messages. +template +class NavAttPoll : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Default constructor + NavAttPoll() = default; + + /// @brief Copy constructor + NavAttPoll(const NavAttPoll&) = default; + + /// @brief Move constructor + NavAttPoll(NavAttPoll&& other) = default; + + /// @brief Destructor + ~NavAttPoll() = default; + + /// @brief Copy assignment + NavAttPoll& operator=(const NavAttPoll&) = default; + + /// @brief Move assignment + NavAttPoll& operator=(NavAttPoll&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + From 6e81c8a0feed5e2d921ed18aa97eea8564533353 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Fri, 18 Aug 2017 08:47:30 +1000 Subject: [PATCH 16/29] Implemented NAV-HPPOSECEF message. --- cc_plugin/AllMessages.h | 4 + cc_plugin/CMakeLists.txt | 2 + cc_plugin/Ublox8Messages.h | 4 + cc_plugin/field/MsgId.cpp | 2 + cc_plugin/message/NavHpposecef.cpp | 107 ++++++++++++++ cc_plugin/message/NavHpposecef.h | 64 +++++++++ cc_plugin/message/NavHpposecefPoll.cpp | 54 +++++++ cc_plugin/message/NavHpposecefPoll.h | 63 +++++++++ include/ublox/InputMessages.h | 4 + include/ublox/MsgId.h | 2 + include/ublox/field/MsgId.h | 2 + include/ublox/message/NavAtt.h | 12 +- include/ublox/message/NavHpposecef.h | 171 +++++++++++++++++++++++ include/ublox/message/NavHpposecefPoll.h | 83 +++++++++++ include/ublox/message/NavPosecef.h | 8 +- 15 files changed, 572 insertions(+), 10 deletions(-) create mode 100644 cc_plugin/message/NavHpposecef.cpp create mode 100644 cc_plugin/message/NavHpposecef.h create mode 100644 cc_plugin/message/NavHpposecefPoll.cpp create mode 100644 cc_plugin/message/NavHpposecefPoll.h create mode 100644 include/ublox/message/NavHpposecef.h create mode 100644 include/ublox/message/NavHpposecefPoll.h diff --git a/cc_plugin/AllMessages.h b/cc_plugin/AllMessages.h index 62a1a7c..88839b4 100644 --- a/cc_plugin/AllMessages.h +++ b/cc_plugin/AllMessages.h @@ -42,6 +42,8 @@ #include "cc_plugin/message/NavVelecefPoll.h" #include "cc_plugin/message/NavVelned.h" #include "cc_plugin/message/NavVelnedPoll.h" +#include "cc_plugin/message/NavHpposecef.h" +#include "cc_plugin/message/NavHpposecefPoll.h" #include "cc_plugin/message/NavTimegps.h" #include "cc_plugin/message/NavTimegpsPoll.h" #include "cc_plugin/message/NavTimeutc.h" @@ -350,6 +352,8 @@ using AllMessages = std::tuple< cc_plugin::message::NavVelecefPoll, cc_plugin::message::NavVelned, cc_plugin::message::NavVelnedPoll, + cc_plugin::message::NavHpposecef, + cc_plugin::message::NavHpposecefPoll, cc_plugin::message::NavTimegps, cc_plugin::message::NavTimegpsPoll, cc_plugin::message::NavTimeutc, diff --git a/cc_plugin/CMakeLists.txt b/cc_plugin/CMakeLists.txt index fab1a4a..ae4728e 100644 --- a/cc_plugin/CMakeLists.txt +++ b/cc_plugin/CMakeLists.txt @@ -28,6 +28,8 @@ function (cc_plugin_ublox_all_messages) message/NavVelecefPoll.cpp message/NavVelned.cpp message/NavVelnedPoll.cpp + message/NavHpposecef.cpp + message/NavHpposecefPoll.cpp message/NavTimegps.cpp message/NavTimegpsPoll.cpp message/NavTimeutc.cpp diff --git a/cc_plugin/Ublox8Messages.h b/cc_plugin/Ublox8Messages.h index d8a85b0..a49073f 100644 --- a/cc_plugin/Ublox8Messages.h +++ b/cc_plugin/Ublox8Messages.h @@ -42,6 +42,8 @@ #include "cc_plugin/message/NavVelecefPoll.h" #include "cc_plugin/message/NavVelned.h" #include "cc_plugin/message/NavVelnedPoll.h" +#include "cc_plugin/message/NavHpposecef.h" +#include "cc_plugin/message/NavHpposecefPoll.h" #include "cc_plugin/message/NavTimegps.h" #include "cc_plugin/message/NavTimegpsPoll.h" #include "cc_plugin/message/NavTimeutc.h" @@ -319,6 +321,8 @@ using Ublox8Messages = std::tuple< cc_plugin::message::NavVelecefPoll, cc_plugin::message::NavVelned, cc_plugin::message::NavVelnedPoll, + cc_plugin::message::NavHpposecef, + cc_plugin::message::NavHpposecefPoll, cc_plugin::message::NavTimegps, cc_plugin::message::NavTimegpsPoll, cc_plugin::message::NavTimeutc, diff --git a/cc_plugin/field/MsgId.cpp b/cc_plugin/field/MsgId.cpp index 92c5985..b1dcf4c 100644 --- a/cc_plugin/field/MsgId.cpp +++ b/cc_plugin/field/MsgId.cpp @@ -51,6 +51,8 @@ QVariantMap createMsgIdProperties() .add("NAV-RESETODO", MsgId_NAV_RESETODO) .add("NAV-VELECEF", MsgId_NAV_VELECEF) .add("NAV-VELNED", MsgId_NAV_VELNED) + .add("NAV-HPPOSECEF", MsgId_NAV_HPPOSECEF) + .add("NAV-HPPOSLLH", MsgId_NAV_HPPOSLLH) .add("NAV-TIMEGPS", MsgId_NAV_TIMEGPS) .add("NAV-TIMEUTC", MsgId_NAV_TIMEUTC) .add("NAV-CLOCK", MsgId_NAV_CLOCK) diff --git a/cc_plugin/message/NavHpposecef.cpp b/cc_plugin/message/NavHpposecef.cpp new file mode 100644 index 0000000..8fde259 --- /dev/null +++ b/cc_plugin/message/NavHpposecef.cpp @@ -0,0 +1,107 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include "NavHpposecef.h" +#include "cc_plugin/field/nav.h" +#include "cc_plugin/field/common.h" + +template class ublox::message::NavHpposecef; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavHpposecef, + ublox::cc_plugin::message::NavHpposecef>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +using NavHpposecefFields = ublox::message::NavHpposecefFields; +namespace +{ + +QVariantMap createProps_ecefHp(char dir) +{ + return + cc::property::field::IntValue() + .name(QString("edef%1Hp").arg(dir)) + .scaledDecimals(1) + .asMap(); +} + +QVariantMap createProps_pAcc() +{ + return + cc::property::field::IntValue() + .name("pAcc") + .scaledDecimals(1) + .asMap(); +} + +QVariantList createFieldsProperties() +{ + QVariantList props; + props.append( + cc::property::field::ForField().name("version").asMap()); + props.append(cc_plugin::field::common::props_reserved(1)); + props.append(cc_plugin::field::nav::props_iTOW()); + props.append(cc_plugin::field::nav::props_ecefX()); + props.append(cc_plugin::field::nav::props_ecefY()); + props.append(cc_plugin::field::nav::props_ecefZ()); + props.append(createProps_ecefHp('X')); + props.append(createProps_ecefHp('Y')); + props.append(createProps_ecefHp('Z')); + props.append(cc_plugin::field::common::props_reserved(2)); + props.append(createProps_pAcc()); + + assert(props.size() == NavHpposecef::FieldIdx_numOfValues); + return props; +} + +} // namespace + +NavHpposecef::NavHpposecef() = default; +NavHpposecef::~NavHpposecef() = default; + +NavHpposecef& NavHpposecef::operator=(const NavHpposecef&) = default; +NavHpposecef& NavHpposecef::operator=(NavHpposecef&&) = default; + +const char* NavHpposecef::nameImpl() const +{ + static const char* Str = "NAV-HPPOSECEF"; + return Str; +} + +const QVariantList& NavHpposecef::fieldsPropertiesImpl() const +{ + static const auto Props = createFieldsProperties(); + return Props; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/NavHpposecef.h b/cc_plugin/message/NavHpposecef.h new file mode 100644 index 0000000..4c3a653 --- /dev/null +++ b/cc_plugin/message/NavHpposecef.h @@ -0,0 +1,64 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/NavHpposecef.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class NavHpposecef : public + ProtocolMessageBase< + ublox::message::NavHpposecef, + NavHpposecef> +{ +public: + NavHpposecef(); + NavHpposecef(const NavHpposecef&) = delete; + NavHpposecef(NavHpposecef&&) = delete; + virtual ~NavHpposecef(); + + NavHpposecef& operator=(const NavHpposecef&); + NavHpposecef& operator=(NavHpposecef&&); + +protected: + virtual const char* nameImpl() const override; + virtual const QVariantList& fieldsPropertiesImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::NavHpposecef; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavHpposecef, + ublox::cc_plugin::message::NavHpposecef>; + diff --git a/cc_plugin/message/NavHpposecefPoll.cpp b/cc_plugin/message/NavHpposecefPoll.cpp new file mode 100644 index 0000000..ef605dd --- /dev/null +++ b/cc_plugin/message/NavHpposecefPoll.cpp @@ -0,0 +1,54 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "NavHpposecefPoll.h" + +template class ublox::message::NavHpposecefPoll; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavHpposecefPoll, + ublox::cc_plugin::message::NavHpposecefPoll>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +NavHpposecefPoll::NavHpposecefPoll() = default; +NavHpposecefPoll::~NavHpposecefPoll() = default; + +NavHpposecefPoll& NavHpposecefPoll::operator=(const NavHpposecefPoll&) = default; +NavHpposecefPoll& NavHpposecefPoll::operator=(NavHpposecefPoll&&) = default; + + +const char* NavHpposecefPoll::nameImpl() const +{ + static const char* Str = "NAV-HPPOSECEF (Poll)"; + return Str; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/NavHpposecefPoll.h b/cc_plugin/message/NavHpposecefPoll.h new file mode 100644 index 0000000..63874b1 --- /dev/null +++ b/cc_plugin/message/NavHpposecefPoll.h @@ -0,0 +1,63 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/NavHpposecefPoll.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class NavHpposecefPoll : public + ProtocolMessageBase< + ublox::message::NavHpposecefPoll, + NavHpposecefPoll> +{ +public: + NavHpposecefPoll(); + NavHpposecefPoll(const NavHpposecefPoll&) = delete; + NavHpposecefPoll(NavHpposecefPoll&&) = delete; + virtual ~NavHpposecefPoll(); + + NavHpposecefPoll& operator=(const NavHpposecefPoll&); + NavHpposecefPoll& operator=(NavHpposecefPoll&&); + +protected: + virtual const char* nameImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::NavHpposecefPoll; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavHpposecefPoll, + ublox::cc_plugin::message::NavHpposecefPoll>; + diff --git a/include/ublox/InputMessages.h b/include/ublox/InputMessages.h index f85068c..1032680 100644 --- a/include/ublox/InputMessages.h +++ b/include/ublox/InputMessages.h @@ -34,6 +34,8 @@ #include "message/NavOdo.h" #include "message/NavVelecef.h" #include "message/NavVelned.h" +#include "message/NavHpposecef.h" +#include "message/NavHpposllh.h" #include "message/NavTimegps.h" #include "message/NavTimeutc.h" #include "message/NavClock.h" @@ -188,6 +190,8 @@ using InputMessages = message::NavOdo, message::NavVelecef, message::NavVelned, + message::NavHpposecef, + message::NavHpposllh, message::NavTimegps, message::NavTimeutc, message::NavClock, diff --git a/include/ublox/MsgId.h b/include/ublox/MsgId.h index 724d54b..0941f56 100644 --- a/include/ublox/MsgId.h +++ b/include/ublox/MsgId.h @@ -43,6 +43,8 @@ enum MsgId : std::uint16_t MsgId_NAV_RESETODO = 0x0110, ///< ID of NAV-RESETODO message MsgId_NAV_VELECEF = 0x0111, ///< ID of NAV-VELECEF message MsgId_NAV_VELNED = 0x0112, ///< ID of NAV-VELNED message + MsgId_NAV_HPPOSECEF = 0x0113, ///< ID of NAV-HPPOSECEF message + MsgId_NAV_HPPOSLLH = 0x0114, ///< ID of NAV-HPPOSLLH message MsgId_NAV_TIMEGPS = 0x0120, ///< ID of NAV-TIMEGPS message MsgId_NAV_TIMEUTC = 0x0121, ///< ID of NAV-TIMEUTC message MsgId_NAV_CLOCK = 0x0122, ///< ID of NAV-CLOCK message diff --git a/include/ublox/field/MsgId.h b/include/ublox/field/MsgId.h index 661a692..5748ebb 100644 --- a/include/ublox/field/MsgId.h +++ b/include/ublox/field/MsgId.h @@ -98,6 +98,8 @@ struct MsgIdValueValidator MsgId_NAV_RESETODO, MsgId_NAV_VELECEF, MsgId_NAV_VELNED, + MsgId_NAV_HPPOSECEF, + MsgId_NAV_HPPOSLLH, MsgId_NAV_TIMEGPS, MsgId_NAV_TIMEUTC, MsgId_NAV_CLOCK, diff --git a/include/ublox/message/NavAtt.h b/include/ublox/message/NavAtt.h index ac3073f..37f217f 100644 --- a/include/ublox/message/NavAtt.h +++ b/include/ublox/message/NavAtt.h @@ -43,42 +43,42 @@ struct NavAttFields /// @brief Definition of "reserved1" field. using reserved1 = field::common::res3; - /// @bried Definition of "roll" field. + /// @brief Definition of "roll" field. using roll = field::common::I4T< comms::option::UnitsDegrees, comms::option::ScalingRatio<1, 100000> >; - /// @bried Definition of "pitch" field. + /// @brief Definition of "pitch" field. using pitch = field::common::I4T< comms::option::UnitsDegrees, comms::option::ScalingRatio<1, 100000> >; - /// @bried Definition of "heading" field. + /// @brief Definition of "heading" field. using heading = field::common::I4T< comms::option::UnitsDegrees, comms::option::ScalingRatio<1, 100000> >; - /// @bried Definition of "accRoll" field. + /// @brief Definition of "accRoll" field. using accRoll = field::common::U4T< comms::option::UnitsDegrees, comms::option::ScalingRatio<1, 100000> >; - /// @bried Definition of "accPitch" field. + /// @brief Definition of "accPitch" field. using accPitch = field::common::U4T< comms::option::UnitsDegrees, comms::option::ScalingRatio<1, 100000> >; - /// @bried Definition of "accHeading" field. + /// @brief Definition of "accHeading" field. using accHeading = field::common::U4T< comms::option::UnitsDegrees, diff --git a/include/ublox/message/NavHpposecef.h b/include/ublox/message/NavHpposecef.h new file mode 100644 index 0000000..1965d79 --- /dev/null +++ b/include/ublox/message/NavHpposecef.h @@ -0,0 +1,171 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of NAV-HPPOSECEF message and its fields. + +#pragma once + +#include "ublox/Message.h" +#include "ublox/field/nav.h" + +namespace ublox +{ + +namespace message +{ +/// @brief Accumulates details of all the NAV-HPPOSECEF message fields. +/// @see NavHpposecef +struct NavHpposecefFields +{ + /// @brief Definition of "version" field. + using version = + field::common::U1T< + comms::option::ValidNumValueRange<0, 0> + >; + + /// @brief Definition of "reserved1" field. + using reserved1 = field::common::res3; + + /// @brief Definition of "iTOW" field. + using iTOW = field::nav::iTOW; + + /// @brief Definition of "ecefX" field. + using ecefX = field::nav::ecefX; + + /// @brief Definition of "ecefY" field. + using ecefY = field::nav::ecefY; + + /// @brief Definition of "ecefZ" field. + using ecefZ = field::nav::ecefZ; + + /// @brief Definition of "ecefXHp" field. + using ecefXHp = + field::common::I1T< + comms::option::ScalingRatio<1, 10>, + comms::option::UnitsMillimeters + >; + + /// @brief Definition of "ecefYHp" field. + using ecefYHp = ecefXHp; + + /// @brief Definition of "ecefZHp" field. + using ecefZHp = ecefXHp; + + /// @brief Definition of "reserved2" field. + using reserved2 = field::common::res1; + + /// @brief Definition of "pAcc" field. + using pAcc = + field::common::U4T< + comms::option::UnitsMillimeters, + comms::option::ScalingRatio<1, 10> + >; + + /// @brief All the fields bundled in std::tuple. + using All = std::tuple< + version, + reserved1, + iTOW, + ecefX, + ecefY, + ecefZ, + ecefXHp, + ecefYHp, + ecefZHp, + reserved2, + pAcc + >; +}; + +/// @brief Definition of NAV-HPPOSECEF message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref NavHpposecefFields and for definition of the fields this message contains +/// and COMMS_MSG_FIELDS_ACCESS() for fields access details. +/// @tparam TMsgBase Common interface class for all the messages. +template +class NavHpposecef : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_MSG_FIELDS_ACCESS macro + /// related to @b comms::MessageBase class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b version for @ref NavHpposecefFields::version field + /// @li @b reserved1 for @ref NavHpposecefFields::reserved1 field + /// @li @b iTOW for @ref NavHpposecefFields::iTOW field + /// @li @b ecefX for @ref NavHpposecefFields::ecefX field + /// @li @b ecefY for @ref NavHpposecefFields::ecefY field + /// @li @b ecefZ for @ref NavHpposecefFields::ecefZ field + /// @li @b ecefXHp for @ref NavHpposecefFields::ecefXHp field + /// @li @b ecefYHp for @ref NavHpposecefFields::ecefYHp field + /// @li @b ecefZHp for @ref NavHpposecefFields::ecefZHp field + /// @li @b reserved2 for @ref NavHpposecefFields::reserved2 field + /// @li @b pAcc for @ref NavHpposecefFields::pAcc field + COMMS_MSG_FIELDS_ACCESS( + version, + reserved1, + iTOW, + ecefX, + ecefY, + ecefZ, + ecefXHp, + ecefYHp, + ecefZHp, + reserved2, + pAcc + ); + + /// @brief Default constructor + NavHpposecef() = default; + + /// @brief Copy constructor + NavHpposecef(const NavHpposecef&) = default; + + /// @brief Move constructor + NavHpposecef(NavHpposecef&& other) = default; + + /// @brief Destructor + ~NavHpposecef() = default; + + /// @brief Copy assignment + NavHpposecef& operator=(const NavHpposecef&) = default; + + /// @brief Move assignment + NavHpposecef& operator=(NavHpposecef&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + diff --git a/include/ublox/message/NavHpposecefPoll.h b/include/ublox/message/NavHpposecefPoll.h new file mode 100644 index 0000000..8f1034a --- /dev/null +++ b/include/ublox/message/NavHpposecefPoll.h @@ -0,0 +1,83 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of NAV-HPPOSECEF (@b poll) message and its fields. + +#pragma once + +#include "ublox/Message.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the NAV-HPPOSECEF (@b poll) message fields. +/// @see NavHpposecefPoll +struct NavHpposecefPollFields +{ + /// @brief All the fields bundled in std::tuple. + using All = std::tuple<>; +}; + +/// @brief Definition of NAV-HPPOSECEF (@b poll) message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref NavHpposecefPollFields and for definition of the fields this message contains. +/// @tparam TMsgBase Common interface class for all the messages. +template +class NavHpposecefPoll : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Default constructor + NavHpposecefPoll() = default; + + /// @brief Copy constructor + NavHpposecefPoll(const NavHpposecefPoll&) = default; + + /// @brief Move constructor + NavHpposecefPoll(NavHpposecefPoll&& other) = default; + + /// @brief Destructor + ~NavHpposecefPoll() = default; + + /// @brief Copy assignment + NavHpposecefPoll& operator=(const NavHpposecefPoll&) = default; + + /// @brief Move assignment + NavHpposecefPoll& operator=(NavHpposecefPoll&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + diff --git a/include/ublox/message/NavPosecef.h b/include/ublox/message/NavPosecef.h index 499d81b..27f9a89 100644 --- a/include/ublox/message/NavPosecef.h +++ b/include/ublox/message/NavPosecef.h @@ -35,16 +35,16 @@ struct NavPosecefFields /// @brief Definition of "iTOW" field. using iTOW = field::nav::iTOW; - /// @brief Definition of "iTOW" field. + /// @brief Definition of "ecefX" field. using ecefX = field::nav::ecefX; - /// @brief Definition of "iTOW" field. + /// @brief Definition of "ecefY" field. using ecefY = field::nav::ecefY; - /// @brief Definition of "iTOW" field. + /// @brief Definition of "ecefZ" field. using ecefZ = field::nav::ecefZ; - /// @brief Definition of "iTOW" field. + /// @brief Definition of "pAcc" field. using pAcc = field::nav::pAcc; /// @brief All the fields bundled in std::tuple. From 92fe06b657e4acbaeefdbddd73cbaa117daf8398 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Fri, 18 Aug 2017 16:28:36 +1000 Subject: [PATCH 17/29] Implemented NAV-HPPOSLLH status. --- cc_plugin/AllMessages.h | 4 + cc_plugin/CMakeLists.txt | 2 + cc_plugin/Ublox8Messages.h | 4 + cc_plugin/message/NavHpposllh.cpp | 112 ++++++++++++++ cc_plugin/message/NavHpposllh.h | 64 ++++++++ cc_plugin/message/NavHpposllhPoll.cpp | 54 +++++++ cc_plugin/message/NavHpposllhPoll.h | 63 ++++++++ include/ublox/message/NavHpposecef.h | 3 +- include/ublox/message/NavHpposllh.h | 186 ++++++++++++++++++++++++ include/ublox/message/NavHpposllhPoll.h | 83 +++++++++++ 10 files changed, 574 insertions(+), 1 deletion(-) create mode 100644 cc_plugin/message/NavHpposllh.cpp create mode 100644 cc_plugin/message/NavHpposllh.h create mode 100644 cc_plugin/message/NavHpposllhPoll.cpp create mode 100644 cc_plugin/message/NavHpposllhPoll.h create mode 100644 include/ublox/message/NavHpposllh.h create mode 100644 include/ublox/message/NavHpposllhPoll.h diff --git a/cc_plugin/AllMessages.h b/cc_plugin/AllMessages.h index 88839b4..e94a12a 100644 --- a/cc_plugin/AllMessages.h +++ b/cc_plugin/AllMessages.h @@ -44,6 +44,8 @@ #include "cc_plugin/message/NavVelnedPoll.h" #include "cc_plugin/message/NavHpposecef.h" #include "cc_plugin/message/NavHpposecefPoll.h" +#include "cc_plugin/message/NavHpposllh.h" +#include "cc_plugin/message/NavHpposllhPoll.h" #include "cc_plugin/message/NavTimegps.h" #include "cc_plugin/message/NavTimegpsPoll.h" #include "cc_plugin/message/NavTimeutc.h" @@ -354,6 +356,8 @@ using AllMessages = std::tuple< cc_plugin::message::NavVelnedPoll, cc_plugin::message::NavHpposecef, cc_plugin::message::NavHpposecefPoll, + cc_plugin::message::NavHpposllh, + cc_plugin::message::NavHpposllhPoll, cc_plugin::message::NavTimegps, cc_plugin::message::NavTimegpsPoll, cc_plugin::message::NavTimeutc, diff --git a/cc_plugin/CMakeLists.txt b/cc_plugin/CMakeLists.txt index ae4728e..c178f93 100644 --- a/cc_plugin/CMakeLists.txt +++ b/cc_plugin/CMakeLists.txt @@ -30,6 +30,8 @@ function (cc_plugin_ublox_all_messages) message/NavVelnedPoll.cpp message/NavHpposecef.cpp message/NavHpposecefPoll.cpp + message/NavHpposllh.cpp + message/NavHpposllhPoll.cpp message/NavTimegps.cpp message/NavTimegpsPoll.cpp message/NavTimeutc.cpp diff --git a/cc_plugin/Ublox8Messages.h b/cc_plugin/Ublox8Messages.h index a49073f..a315b48 100644 --- a/cc_plugin/Ublox8Messages.h +++ b/cc_plugin/Ublox8Messages.h @@ -44,6 +44,8 @@ #include "cc_plugin/message/NavVelnedPoll.h" #include "cc_plugin/message/NavHpposecef.h" #include "cc_plugin/message/NavHpposecefPoll.h" +#include "cc_plugin/message/NavHpposllh.h" +#include "cc_plugin/message/NavHpposllhPoll.h" #include "cc_plugin/message/NavTimegps.h" #include "cc_plugin/message/NavTimegpsPoll.h" #include "cc_plugin/message/NavTimeutc.h" @@ -323,6 +325,8 @@ using Ublox8Messages = std::tuple< cc_plugin::message::NavVelnedPoll, cc_plugin::message::NavHpposecef, cc_plugin::message::NavHpposecefPoll, + cc_plugin::message::NavHpposllh, + cc_plugin::message::NavHpposllhPoll, cc_plugin::message::NavTimegps, cc_plugin::message::NavTimegpsPoll, cc_plugin::message::NavTimeutc, diff --git a/cc_plugin/message/NavHpposllh.cpp b/cc_plugin/message/NavHpposllh.cpp new file mode 100644 index 0000000..7d39c4b --- /dev/null +++ b/cc_plugin/message/NavHpposllh.cpp @@ -0,0 +1,112 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include "NavHpposllh.h" +#include "cc_plugin/field/nav.h" +#include "cc_plugin/field/common.h" + +template class ublox::message::NavHpposllh; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavHpposllh, + ublox::cc_plugin::message::NavHpposllh>; + + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +namespace +{ + +using NavHpposllhFields = ublox::message::NavHpposllhFields; + +QVariantMap createProps_degHp(const char* name) +{ + return + cc::property::field::IntValue() + .name(name) + .scaledDecimals(9) + .asMap(); +} + +QVariantMap createProps_mmHp(const char* name) +{ + return + cc::property::field::IntValue() + .name(name) + .scaledDecimals(1) + .asMap(); +} + +QVariantList createFieldsProperties() +{ + QVariantList props; + props.append( + cc::property::field::ForField().name("version").asMap()); + props.append(cc_plugin::field::common::props_reserved(1)); + props.append(cc_plugin::field::nav::props_iTOW()); + props.append(cc_plugin::field::nav::props_lon()); + props.append(cc_plugin::field::nav::props_lat()); + props.append(cc_plugin::field::nav::props_height()); + props.append(cc_plugin::field::nav::props_hMSL()); + props.append(createProps_degHp("lonHp")); + props.append(createProps_degHp("latHp")); + props.append(createProps_mmHp("heightHp")); + props.append(createProps_mmHp("hMSLHp")); + props.append(createProps_mmHp("hAcc")); + props.append(createProps_mmHp("vAcc")); + + assert(props.size() == NavHpposllh::FieldIdx_numOfValues); + return props; +} + +} // namespace + +NavHpposllh::NavHpposllh() = default; +NavHpposllh::~NavHpposllh() = default; + +NavHpposllh& NavHpposllh::operator=(const NavHpposllh&) = default; +NavHpposllh& NavHpposllh::operator=(NavHpposllh&&) = default; + + +const char* NavHpposllh::nameImpl() const +{ + static const char* Str = "NAV-HPPOSLLH"; + return Str; +} + +const QVariantList& NavHpposllh::fieldsPropertiesImpl() const +{ + static const auto Props = createFieldsProperties(); + return Props; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/NavHpposllh.h b/cc_plugin/message/NavHpposllh.h new file mode 100644 index 0000000..b02d5ca --- /dev/null +++ b/cc_plugin/message/NavHpposllh.h @@ -0,0 +1,64 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/NavHpposllh.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class NavHpposllh : public + ProtocolMessageBase< + ublox::message::NavHpposllh, + NavHpposllh> +{ +public: + NavHpposllh(); + NavHpposllh(const NavHpposllh&) = delete; + NavHpposllh(NavHpposllh&&) = delete; + virtual ~NavHpposllh(); + + NavHpposllh& operator=(const NavHpposllh&); + NavHpposllh& operator=(NavHpposllh&&); + +protected: + virtual const char* nameImpl() const override; + virtual const QVariantList& fieldsPropertiesImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::NavHpposllh; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavHpposllh, + ublox::cc_plugin::message::NavHpposllh>; + diff --git a/cc_plugin/message/NavHpposllhPoll.cpp b/cc_plugin/message/NavHpposllhPoll.cpp new file mode 100644 index 0000000..a9bdb87 --- /dev/null +++ b/cc_plugin/message/NavHpposllhPoll.cpp @@ -0,0 +1,54 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "NavHpposllhPoll.h" + +template class ublox::message::NavHpposllhPoll; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavHpposllhPoll, + ublox::cc_plugin::message::NavHpposllhPoll>; + + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +NavHpposllhPoll::NavHpposllhPoll() = default; +NavHpposllhPoll::~NavHpposllhPoll() = default; + +NavHpposllhPoll& NavHpposllhPoll::operator=(const NavHpposllhPoll&) = default; +NavHpposllhPoll& NavHpposllhPoll::operator=(NavHpposllhPoll&&) = default; + +const char* NavHpposllhPoll::nameImpl() const +{ + static const char* Str = "NAV-HPPOSLLH (Poll)"; + return Str; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/NavHpposllhPoll.h b/cc_plugin/message/NavHpposllhPoll.h new file mode 100644 index 0000000..3550091 --- /dev/null +++ b/cc_plugin/message/NavHpposllhPoll.h @@ -0,0 +1,63 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/NavHpposllhPoll.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class NavHpposllhPoll : public + ProtocolMessageBase< + ublox::message::NavHpposllhPoll, + NavHpposllhPoll> +{ +public: + NavHpposllhPoll(); + NavHpposllhPoll(const NavHpposllhPoll&) = delete; + NavHpposllhPoll(NavHpposllhPoll&&) = delete; + virtual ~NavHpposllhPoll(); + + NavHpposllhPoll& operator=(const NavHpposllhPoll&); + NavHpposllhPoll& operator=(NavHpposllhPoll&&); + +protected: + virtual const char* nameImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::NavHpposllhPoll; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavHpposllhPoll, + ublox::cc_plugin::message::NavHpposllhPoll>; + diff --git a/include/ublox/message/NavHpposecef.h b/include/ublox/message/NavHpposecef.h index 1965d79..caa5879 100644 --- a/include/ublox/message/NavHpposecef.h +++ b/include/ublox/message/NavHpposecef.h @@ -57,7 +57,8 @@ struct NavHpposecefFields using ecefXHp = field::common::I1T< comms::option::ScalingRatio<1, 10>, - comms::option::UnitsMillimeters + comms::option::UnitsMillimeters, + comms::option::ValidNumValueRange<-99, 99> >; /// @brief Definition of "ecefYHp" field. diff --git a/include/ublox/message/NavHpposllh.h b/include/ublox/message/NavHpposllh.h new file mode 100644 index 0000000..8d04fb4 --- /dev/null +++ b/include/ublox/message/NavHpposllh.h @@ -0,0 +1,186 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of NAV-HPPOSLLH message and its fields. + +#pragma once + +#include "ublox/Message.h" +#include "ublox/field/nav.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the NAV-HPPOSLLH message fields. +/// @see NavHpposllh +struct NavHpposllhFields +{ + /// @brief Definition of "version" field. + using version = + field::common::U1T >; + + /// @brief Definition of "reserved1" field. + using reserved1 = field::common::res3; + + /// @brief Definition of "iTOW" field. + using iTOW = field::nav::iTOW; + + /// @brief Definition of "lon" field. + using lon = field::nav::lon; + + /// @brief Definition of "lat" field. + using lat = field::nav::lat; + + /// @brief Definition of "height" field. + using height = field::nav::height; + + /// @brief Definition of "hMSL" field. + using hMSL = field::nav::hMSL; + + /// @brief Definition of "lonHp" field. + using lonHp = + field::common::I1T< + comms::option::ScalingRatio<1, 1000000000L>, + comms::option::UnitsDegrees, + comms::option::ValidNumValueRange<-99, 99> + >; + + /// @brief Definition of "lonHp" field. + using latHp = lonHp; + + /// @brief Definition of "heightHp" field. + using heightHp = + field::common::I1T< + comms::option::UnitsMillimeters, + comms::option::ScalingRatio<1, 10>, + comms::option::ValidNumValueRange<-9, 9> + >; + + /// @brief Definition of "hMSLHp" field. + using hMSLHp = heightHp; + + /// @brief Definition of "hAcc" field. + using hAcc = + field::common::U4T< + comms::option::UnitsMillimeters, + comms::option::ScalingRatio<1, 10> + >; + + /// @brief Definition of "vAcc" field. + using vAcc = hAcc; + + /// @brief All the fields bundled in std::tuple. + using All = std::tuple< + version, + reserved1, + iTOW, + lon, + lat, + height, + hMSL, + lonHp, + latHp, + heightHp, + hMSLHp, + hAcc, + vAcc + >; +}; + +/// @brief Definition of NAV-HPPOSLLH message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref NavHpposllhFields and for definition of the fields this message contains +/// and COMMS_MSG_FIELDS_ACCESS() for fields access details. +/// @tparam TMsgBase Common interface class for all the messages. +template +class NavHpposllh : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_MSG_FIELDS_ACCESS macro + /// related to @b comms::MessageBase class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b version for @ref NavHpposllhFields::version field + /// @li @b reserved1 for @ref NavHpposllhFields::reserved1 field + /// @li @b iTOW for @ref NavHpposllhFields::iTOW field + /// @li @b lon for @ref NavHpposllhFields::lon field + /// @li @b lat for @ref NavHpposllhFields::lat field + /// @li @b height for @ref NavHpposllhFields::height field + /// @li @b hMSL for @ref NavHpposllhFields::hMSL field + /// @li @b lonHp for @ref NavHpposllhFields::lonHp field + /// @li @b latHp for @ref NavHpposllhFields::latHp field + /// @li @b heightHp for @ref NavHpposllhFields::heightHp field + /// @li @b hMSLHp for @ref NavHpposllhFields::hMSLHp field + /// @li @b hAcc for @ref NavHpposllhFields::hAcc field + /// @li @b vAcc for @ref NavHpposllhFields::vAcc field + COMMS_MSG_FIELDS_ACCESS( + version, + reserved1, + iTOW, + lon, + lat, + height, + hMSL, + lonHp, + latHp, + heightHp, + hMSLHp, + hAcc, + vAcc); + + /// @brief Default constructor + NavHpposllh() = default; + + /// @brief Copy constructor + NavHpposllh(const NavHpposllh&) = default; + + /// @brief Move constructor + NavHpposllh(NavHpposllh&& other) = default; + + /// @brief Destructor + ~NavHpposllh() = default; + + /// @brief Copy assignment + NavHpposllh& operator=(const NavHpposllh&) = default; + + /// @brief Move assignment + NavHpposllh& operator=(NavHpposllh&&) = default; +}; + +} // namespace message + +} // namespace ublox + + + + + diff --git a/include/ublox/message/NavHpposllhPoll.h b/include/ublox/message/NavHpposllhPoll.h new file mode 100644 index 0000000..24116ae --- /dev/null +++ b/include/ublox/message/NavHpposllhPoll.h @@ -0,0 +1,83 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of NAV-HPPOSLLH (@b poll) message and its fields. + +#pragma once + +#include "ublox/Message.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the NAV-HPPOSLLH (@b poll) message fields. +/// @see NavHpposllhPoll +struct NavHpposllhPollFields +{ + /// @brief All the fields bundled in std::tuple. + using All = std::tuple<>; +}; + +/// @brief Definition of NAV-HPPOSLLH (@b poll) message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref NavHpposllhPollFields and for definition of the fields this message contains. +/// @tparam TMsgBase Common interface class for all the messages. +template +class NavHpposllhPoll : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Default constructor + NavHpposllhPoll() = default; + + /// @brief Copy constructor + NavHpposllhPoll(const NavHpposllhPoll&) = default; + + /// @brief Move constructor + NavHpposllhPoll(NavHpposllhPoll&& other) = default; + + /// @brief Destructor + ~NavHpposllhPoll() = default; + + /// @brief Copy assignment + NavHpposllhPoll& operator=(const NavHpposllhPoll&) = default; + + /// @brief Move assignment + NavHpposllhPoll& operator=(NavHpposllhPoll&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + From 8c8fbc5b04db0bc6dbfb4262bf30bfb612b9afd3 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Fri, 18 Aug 2017 17:26:27 +1000 Subject: [PATCH 18/29] Updated NAV-PVT message. --- cc_plugin/message/NavPvt.cpp | 50 ++++++++++++++++---- include/ublox/message/NavOrb.h | 2 +- include/ublox/message/NavPvt.h | 86 +++++++++++++++++++++++++++------- 3 files changed, 111 insertions(+), 27 deletions(-) diff --git a/cc_plugin/message/NavPvt.cpp b/cc_plugin/message/NavPvt.cpp index 23b2ea3..30b040a 100644 --- a/cc_plugin/message/NavPvt.cpp +++ b/cc_plugin/message/NavPvt.cpp @@ -48,7 +48,8 @@ QVariantMap createProps_valid() props.name("valid") .add("validDate") .add("validTime") - .add("fullyResolved"); + .add("fullyResolved") + .add("validMag"); assert(props.bits().size() == NavPvtFields::validBits::BitIdx_numOfValues); return props.asMap(); @@ -77,20 +78,29 @@ QVariantMap createProps_flags() .serialisedHidden(); assert(psmStateProps.values().size() == (int)NavPvtFields::PsmState::NumOfValues); - auto flagsHighProps = - cc::property::field::ForField() + auto headVehValidProps = + cc::property::field::ForField() .add("headVehValid") .serialisedHidden(); - assert(flagsHighProps.bits().size() == NavPvtFields::flagsHigh::BitIdx_numOfValues); + assert(headVehValidProps.bits().size() == NavPvtFields::headVehValid::BitIdx_numOfValues); + auto carrSolnProps = + cc::property::field::ForField() + .name("carrSoln") + .add("No carrier") + .add("Float") + .add("Fixed") + .serialisedHidden(); + assert(carrSolnProps.values().size() == (int)NavPvtFields::CarrSoln::NumOfValues); auto props = cc::property::field::ForField() .name("flags") .add(flagsLowProps.asMap()) .add(psmStateProps.asMap()) - .add(flagsHighProps.asMap()); + .add(headVehValidProps.asMap()) + .add(carrSolnProps.asMap()); assert(props.members().size() == (int)NavPvtFields::flags::FieldIdx_numOfValues); return props.asMap(); } @@ -127,12 +137,31 @@ QVariantMap createProps_headVeh() .asMap(); } -QVariantMap createProps_reserved3() +QVariantMap createProps_magDec() +{ + using Field = NavPvtFields::magDec; + return + cc::property::field::ForField() + .name("magDec") + .field( + cc::property::field::ForField() + .name("magDec") + .scaledDecimals(2) + .asMap()) + .asMap(); +} + +QVariantMap createProps_magAcc() { + using Field = NavPvtFields::magAcc; return - cc::property::field::ForField() - .name("reserved3") - .field(cc_plugin::field::common::props_reserved(3)) + cc::property::field::ForField() + .name("magAcc") + .field( + cc::property::field::ForField() + .name("magAcc") + .scaledDecimals(2) + .asMap()) .asMap(); } @@ -170,7 +199,8 @@ QVariantList createFieldsProperties() props.append(cc_plugin::field::common::props_reserved(1)); props.append(cc_plugin::field::common::props_reserved(2)); props.append(createProps_headVeh()); - props.append(createProps_reserved3()); + props.append(createProps_magDec()); + props.append(createProps_magAcc()); assert(props.size() == NavPvt::FieldIdx_numOfValues); return props; diff --git a/include/ublox/message/NavOrb.h b/include/ublox/message/NavOrb.h index 94a332f..b174211 100644 --- a/include/ublox/message/NavOrb.h +++ b/include/ublox/message/NavOrb.h @@ -36,7 +36,7 @@ struct NavOrbFields /// @brief Definition of "iTOW" field. using iTOW = field::nav::iTOW; - /// @brief Definition of "globalFlags" field. + /// @brief Definition of "version" field. using version = field::common::U1T< comms::option::ValidNumValueRange<1, 1>, diff --git a/include/ublox/message/NavPvt.h b/include/ublox/message/NavPvt.h index a2dc641..06eea2d 100644 --- a/include/ublox/message/NavPvt.h +++ b/include/ublox/message/NavPvt.h @@ -69,13 +69,13 @@ struct NavPvtFields /// @brief Definition of "valid" field. struct validBits : public field::common::X1T< - comms::option::BitmaskReservedBits<0xf8, 0> > + comms::option::BitmaskReservedBits<0xf0, 0> > { /// @brief Provide names for internal bits. /// @details See definition of @b COMMS_BITMASK_BITS_SEQ macro /// related to @b comms::field::BitmaskValue class from COMMS library /// for details. - COMMS_BITMASK_BITS_SEQ(validDate, validTime, fullyResolved); + COMMS_BITMASK_BITS_SEQ(validDate, validTime, fullyResolved, validMag); }; /// @brief Definition of "tAcc" field. @@ -109,9 +109,9 @@ struct NavPvtFields /// @brief Definition of the bits in the "high" area of /// @ref flags bitfield. - struct flagsHigh : public + struct headVehValid : public field::common::X1T< - comms::option::FixedBitLength<3>, + comms::option::FixedBitLength<1>, comms::option::BitmaskReservedBits<0xfe, 0> > { @@ -119,9 +119,25 @@ struct NavPvtFields /// @details See definition of @b COMMS_BITMASK_BITS_SEQ macro /// related to @b comms::field::BitmaskValue class from COMMS library /// for details. - COMMS_BITMASK_BITS_SEQ(headVehValid); + COMMS_BITMASK_BITS_SEQ(bit); }; + enum class CarrSoln : std::uint8_t + { + NoCarrier, ///< no carrier phase range solution + Float, /// float solution, + Fixed, /// fixed solution + NumOfValues + }; + + /// @brief Definition of "carrSoln" member field in @ref flags bitmask field. + using carrSoln = + field::common::EnumT< + CarrSoln, + comms::option::FixedBitLength<2>, + comms::option::ValidNumValueRange<0, (int)CarrSoln::NumOfValues - 1> + >; + /// @brief Definition of "flags" field. struct flags : public @@ -129,7 +145,8 @@ struct NavPvtFields std::tuple< flagsLow, psmState, - flagsHigh + headVehValid, + carrSoln > > { @@ -137,7 +154,7 @@ struct NavPvtFields /// @details See definition of @b COMMS_FIELD_MEMBERS_ACCESS macro /// related to @b comms::field::Bitfield class from COMMS library /// for details. - COMMS_FIELD_MEMBERS_ACCESS(flagsLow, psmState, flagsHigh); + COMMS_FIELD_MEMBERS_ACCESS(flagsLow, psmState, headVehValid, carrSoln); }; /// @brief Definition of "flags2" field. @@ -214,19 +231,36 @@ struct NavPvtFields using reserved2 = field::common::res4; /// @brief Definition of "headVeh" field. + /// @details Defined as "optional" to allow usage with ublox-7 and earlier devices using headVeh = field::common::OptionalT< field::nav::heading, comms::option::DefaultOptionalMode >; - /// @brief Definition of "reserved3" field. - using reserved3 = + /// @brief Definition of "magDec" field. + /// @details Defined as "optional" to allow usage with ublox-7 and earlier devices + using magDec = + field::common::OptionalT< + field::common::I2T< + comms::option::ScalingRatio<1, 100>, + comms::option::UnitsDegrees + >, + comms::option::DefaultOptionalMode + >; + + /// @brief Definition of "magAcc" field. + /// @details Defined as "optional" to allow usage with ublox-7 and earlier devices + using magAcc = field::common::OptionalT< - field::common::res4, + field::common::U2T< + comms::option::ScalingRatio<1, 100>, + comms::option::UnitsDegrees + >, comms::option::DefaultOptionalMode >; + /// @brief All the fields bundled in std::tuple. using All = std::tuple< iTOW, @@ -260,7 +294,8 @@ struct NavPvtFields reserved1, reserved2, headVeh, - reserved3 + magDec, + magAcc >; }; @@ -319,7 +354,8 @@ class NavPvt : public /// @li @b reserved1 for @ref NavPvtFields::reserved1 field /// @li @b reserved2 for @ref NavPvtFields::reserved2 field /// @li @b headVeh for @ref NavPvtFields::headVeh field - /// @li @b reserved3 for @ref NavPvtFields::reserved3 field + /// @li @b magDec for @ref NavPvtFields::magDec field + /// @li @b magAcc for @ref NavPvtFields::magAcc field COMMS_MSG_FIELDS_ACCESS( iTOW, year, @@ -352,7 +388,8 @@ class NavPvt : public reserved1, reserved2, headVeh, - reserved3 + magDec, + magAcc ); /// @brief Default constructor @@ -385,20 +422,37 @@ class NavPvt : public static const auto ReqLen = NavPvtFields::headVeh::Field::maxLength() + - NavPvtFields::reserved3::Field::maxLength(); + NavPvtFields::magDec::Field::maxLength() + + NavPvtFields::magAcc::Field::maxLength(); if (len < ReqLen) { field_headVeh().setMissing(); - field_reserved3().setMissing(); + field_magDec().setMissing(); + field_magAcc().setMissing(); return es; } field_headVeh().setExists(); - field_reserved3().setExists(); + field_magDec().setExists(); + field_magAcc().setExists(); return Base::template readFieldsFrom(iter, len); } + bool doValid() const + { + using Base = typename std::decay::type; + if (!Base::doValid()) { + return false; + } + + // 3 last fields must have the same mode + auto mode = field_headVeh().getMode(); + return + (field_magDec().getMode() == mode) && + (field_magAcc().getMode() == mode); + } + }; From ccc30af6a76016217ebaf91b1be9c1b65150ac68 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Mon, 21 Aug 2017 17:37:48 +1000 Subject: [PATCH 19/29] Implemented NAV-RELPOSNED message. --- cc_plugin/AllMessages.h | 4 + cc_plugin/CMakeLists.txt | 2 + cc_plugin/Ublox8Messages.h | 4 + cc_plugin/field/MsgId.cpp | 1 + cc_plugin/field/nav.cpp | 13 ++ cc_plugin/field/nav.h | 1 + cc_plugin/message/NavPvt.cpp | 11 +- cc_plugin/message/NavRelposned.cpp | 156 ++++++++++++++ cc_plugin/message/NavRelposned.h | 64 ++++++ cc_plugin/message/NavRelposnedPoll.cpp | 53 +++++ cc_plugin/message/NavRelposnedPoll.h | 63 ++++++ include/ublox/InputMessages.h | 2 + include/ublox/MsgId.h | 1 + include/ublox/field/MsgId.h | 1 + include/ublox/field/nav.h | 19 ++ include/ublox/message/NavPvt.h | 17 +- include/ublox/message/NavRelposned.h | 251 +++++++++++++++++++++++ include/ublox/message/NavRelposnedPoll.h | 82 ++++++++ 18 files changed, 721 insertions(+), 24 deletions(-) create mode 100644 cc_plugin/message/NavRelposned.cpp create mode 100644 cc_plugin/message/NavRelposned.h create mode 100644 cc_plugin/message/NavRelposnedPoll.cpp create mode 100644 cc_plugin/message/NavRelposnedPoll.h create mode 100644 include/ublox/message/NavRelposned.h create mode 100644 include/ublox/message/NavRelposnedPoll.h diff --git a/cc_plugin/AllMessages.h b/cc_plugin/AllMessages.h index e94a12a..2b016b9 100644 --- a/cc_plugin/AllMessages.h +++ b/cc_plugin/AllMessages.h @@ -72,6 +72,8 @@ #include "cc_plugin/message/NavSatPoll.h" #include "cc_plugin/message/NavGeofence.h" #include "cc_plugin/message/NavGeofencePoll.h" +#include "cc_plugin/message/NavRelposned.h" +#include "cc_plugin/message/NavRelposnedPoll.h" #include "cc_plugin/message/NavEkfstatus.h" #include "cc_plugin/message/NavEkfstatusPoll.h" #include "cc_plugin/message/NavAopstatus.h" @@ -384,6 +386,8 @@ using AllMessages = std::tuple< cc_plugin::message::NavSatPoll, cc_plugin::message::NavGeofence, cc_plugin::message::NavGeofencePoll, + cc_plugin::message::NavRelposned, + cc_plugin::message::NavRelposnedPoll, cc_plugin::message::NavEkfstatus, cc_plugin::message::NavEkfstatusPoll, cc_plugin::message::NavAopstatus, diff --git a/cc_plugin/CMakeLists.txt b/cc_plugin/CMakeLists.txt index c178f93..ef80d3e 100644 --- a/cc_plugin/CMakeLists.txt +++ b/cc_plugin/CMakeLists.txt @@ -58,6 +58,8 @@ function (cc_plugin_ublox_all_messages) message/NavSatPoll.cpp message/NavGeofence.cpp message/NavGeofencePoll.cpp + message/NavRelposned.cpp + message/NavRelposnedPoll.cpp message/NavEkfstatus.cpp message/NavEkfstatusPoll.cpp message/NavAopstatus.cpp diff --git a/cc_plugin/Ublox8Messages.h b/cc_plugin/Ublox8Messages.h index a315b48..8eb057d 100644 --- a/cc_plugin/Ublox8Messages.h +++ b/cc_plugin/Ublox8Messages.h @@ -72,6 +72,8 @@ #include "cc_plugin/message/NavSatPoll.h" #include "cc_plugin/message/NavGeofence.h" #include "cc_plugin/message/NavGeofencePoll.h" +#include "cc_plugin/message/NavRelposned.h" +#include "cc_plugin/message/NavRelposnedPoll.h" #include "cc_plugin/message/NavEkfstatusPoll.h" #include "cc_plugin/message/NavAopstatusU8.h" #include "cc_plugin/message/NavAopstatusPoll.h" @@ -353,6 +355,8 @@ using Ublox8Messages = std::tuple< cc_plugin::message::NavSatPoll, cc_plugin::message::NavGeofence, cc_plugin::message::NavGeofencePoll, + cc_plugin::message::NavRelposned, + cc_plugin::message::NavRelposnedPoll, cc_plugin::message::NavAopstatusU8, cc_plugin::message::NavAopstatusPoll, cc_plugin::message::NavEoe, diff --git a/cc_plugin/field/MsgId.cpp b/cc_plugin/field/MsgId.cpp index b1dcf4c..0854308 100644 --- a/cc_plugin/field/MsgId.cpp +++ b/cc_plugin/field/MsgId.cpp @@ -66,6 +66,7 @@ QVariantMap createMsgIdProperties() .add("NAV-ORB", MsgId_NAV_ORB) .add("NAV-SAT", MsgId_NAV_SAT) .add("NAV-GEOFENCE", MsgId_NAV_GEOFENCE) + .add("NAV-RELPOSNED", MsgId_NAV_RELPOSNED) .add("NAV-EKFSTATUS", MsgId_NAV_EKFSTATUS) .add("NAV-AOPSTATUS", MsgId_NAV_AOPSTATUS) .add("NAV-EOE", MsgId_NAV_EOE) diff --git a/cc_plugin/field/nav.cpp b/cc_plugin/field/nav.cpp index 0d3e47c..b5c49cc 100644 --- a/cc_plugin/field/nav.cpp +++ b/cc_plugin/field/nav.cpp @@ -381,6 +381,19 @@ const QVariantMap& props_svid() return common::props_svid(); } +QVariantMap createProps_carrSoln(bool serialisedHidden) +{ + auto props = + cc::property::field::EnumValue() + .name("carrSoln") + .add("No carrier") + .add("Float") + .add("Fixed") + .serialisedHidden(serialisedHidden); + assert(props.values().size() == (int)ublox::field::nav::CarrSoln::NumOfValues); + return props.asMap(); +} + } // namespace nav } // namespace field diff --git a/cc_plugin/field/nav.h b/cc_plugin/field/nav.h index f84373f..a8c9d05 100644 --- a/cc_plugin/field/nav.h +++ b/cc_plugin/field/nav.h @@ -74,6 +74,7 @@ const QVariantMap& props_velD(); const QVariantMap& props_numCh(); const QVariantMap& props_cnt(); const QVariantMap& props_svid(); +QVariantMap createProps_carrSoln(bool serialisedHidden = true); } // namespace nav diff --git a/cc_plugin/message/NavPvt.cpp b/cc_plugin/message/NavPvt.cpp index 30b040a..585d018 100644 --- a/cc_plugin/message/NavPvt.cpp +++ b/cc_plugin/message/NavPvt.cpp @@ -85,22 +85,13 @@ QVariantMap createProps_flags() assert(headVehValidProps.bits().size() == NavPvtFields::headVehValid::BitIdx_numOfValues); - auto carrSolnProps = - cc::property::field::ForField() - .name("carrSoln") - .add("No carrier") - .add("Float") - .add("Fixed") - .serialisedHidden(); - assert(carrSolnProps.values().size() == (int)NavPvtFields::CarrSoln::NumOfValues); - auto props = cc::property::field::ForField() .name("flags") .add(flagsLowProps.asMap()) .add(psmStateProps.asMap()) .add(headVehValidProps.asMap()) - .add(carrSolnProps.asMap()); + .add(cc_plugin::field::nav::createProps_carrSoln()); assert(props.members().size() == (int)NavPvtFields::flags::FieldIdx_numOfValues); return props.asMap(); } diff --git a/cc_plugin/message/NavRelposned.cpp b/cc_plugin/message/NavRelposned.cpp new file mode 100644 index 0000000..3db9867 --- /dev/null +++ b/cc_plugin/message/NavRelposned.cpp @@ -0,0 +1,156 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include "NavRelposned.h" +#include "cc_plugin/field/common.h" +#include "cc_plugin/field/nav.h" + +template class ublox::message::NavRelposned; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavRelposned, + ublox::cc_plugin::message::NavRelposned>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +namespace +{ + +using ublox::message::NavRelposnedFields; + +QVariantMap createProps_hp(char ch) +{ + auto props = + cc::property::field::ForField() + .name(QString("relPosHP%1").arg(ch)) + .scaledDecimals(1); + return props.asMap(); +} + +QVariantMap createProps_acc(char ch) +{ + auto props = + cc::property::field::ForField() + .name(QString("acc%1").arg(ch)) + .scaledDecimals(1); + return props.asMap(); +} + +QVariantMap createProps_flagsLow() +{ + using Field = NavRelposnedFields::flagsLow; + auto props = + cc::property::field::ForField() + .name("flags") + .serialisedHidden() + .add("gnssFixOK") + .add("diffSoln") + .add("relPosValid"); + assert(props.bits().size() == Field::BitIdx_numOfValues); + return props.asMap(); +} + +QVariantMap createProps_flagsHigh() +{ + using Field = NavRelposnedFields::flagsHigh; + auto props = + cc::property::field::ForField() + .serialisedHidden() + .add("isMoving") + .add("refPosMiss") + .add("refObsMiss"); + assert(props.bits().size() == Field::BitIdx_numOfValues); + return props.asMap(); +} + + +QVariantMap createProps_flags() +{ + using Field = NavRelposnedFields::flags; + auto props = + cc::property::field::ForField() + .add(createProps_flagsLow()) + .add(cc_plugin::field::nav::createProps_carrSoln()) + .add(createProps_flagsHigh()); + assert(props.members().size() == Field::FieldIdx_numOfValues); + return props.asMap(); +} + +QVariantList createFieldsProperties() +{ + QVariantList props; + props.append( + cc::property::field::ForField().name("version").asMap()); + props.append(cc_plugin::field::common::props_reserved(1)); + props.append( + cc::property::field::ForField().name("refStationId").asMap()); + props.append(cc_plugin::field::nav::props_iTOW()); + props.append( + cc::property::field::ForField().name("relPosN").asMap()); + props.append( + cc::property::field::ForField().name("relPosE").asMap()); + props.append( + cc::property::field::ForField().name("relPosD").asMap()); + props.append(createProps_hp('N')); + props.append(createProps_hp('E')); + props.append(createProps_hp('D')); + props.append(cc_plugin::field::common::props_reserved(2)); + props.append(createProps_acc('N')); + props.append(createProps_acc('E')); + props.append(createProps_acc('D')); + props.append(createProps_flags()); + + assert(props.size() == NavRelposned::FieldIdx_numOfValues); + return props; +} + +} // namespace + +NavRelposned::NavRelposned() = default; +NavRelposned::~NavRelposned() = default; + +NavRelposned& NavRelposned::operator=(const NavRelposned&) = default; +NavRelposned& NavRelposned::operator=(NavRelposned&&) = default; + +const char* NavRelposned::nameImpl() const +{ + static const char* Str = "NAV-RELPOSNED"; + return Str; +} + +const QVariantList& NavRelposned::fieldsPropertiesImpl() const +{ + static const auto Props = createFieldsProperties(); + return Props; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/NavRelposned.h b/cc_plugin/message/NavRelposned.h new file mode 100644 index 0000000..91e6d51 --- /dev/null +++ b/cc_plugin/message/NavRelposned.h @@ -0,0 +1,64 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/NavRelposned.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class NavRelposned : public + ProtocolMessageBase< + ublox::message::NavRelposned, + NavRelposned> +{ +public: + NavRelposned(); + NavRelposned(const NavRelposned&) = delete; + NavRelposned(NavRelposned&&) = delete; + virtual ~NavRelposned(); + + NavRelposned& operator=(const NavRelposned&); + NavRelposned& operator=(NavRelposned&&); + +protected: + virtual const char* nameImpl() const override; + virtual const QVariantList& fieldsPropertiesImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::NavRelposned; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavRelposned, + ublox::cc_plugin::message::NavRelposned>; + diff --git a/cc_plugin/message/NavRelposnedPoll.cpp b/cc_plugin/message/NavRelposnedPoll.cpp new file mode 100644 index 0000000..c751fcc --- /dev/null +++ b/cc_plugin/message/NavRelposnedPoll.cpp @@ -0,0 +1,53 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "NavRelposnedPoll.h" + +template class ublox::message::NavRelposnedPoll; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavRelposnedPoll, + ublox::cc_plugin::message::NavRelposnedPoll>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +NavRelposnedPoll::NavRelposnedPoll() = default; +NavRelposnedPoll::~NavRelposnedPoll() = default; + +NavRelposnedPoll& NavRelposnedPoll::operator=(const NavRelposnedPoll&) = default; +NavRelposnedPoll& NavRelposnedPoll::operator=(NavRelposnedPoll&&) = default; + +const char* NavRelposnedPoll::nameImpl() const +{ + static const char* Str = "NAV-RELPOSNED (Poll)"; + return Str; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/NavRelposnedPoll.h b/cc_plugin/message/NavRelposnedPoll.h new file mode 100644 index 0000000..b65de2f --- /dev/null +++ b/cc_plugin/message/NavRelposnedPoll.h @@ -0,0 +1,63 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/NavRelposnedPoll.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class NavRelposnedPoll : public + ProtocolMessageBase< + ublox::message::NavRelposnedPoll, + NavRelposnedPoll> +{ +public: + NavRelposnedPoll(); + NavRelposnedPoll(const NavRelposnedPoll&) = delete; + NavRelposnedPoll(NavRelposnedPoll&&) = delete; + virtual ~NavRelposnedPoll(); + + NavRelposnedPoll& operator=(const NavRelposnedPoll&); + NavRelposnedPoll& operator=(NavRelposnedPoll&&); + +protected: + virtual const char* nameImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::NavRelposnedPoll; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavRelposnedPoll, + ublox::cc_plugin::message::NavRelposnedPoll>; + diff --git a/include/ublox/InputMessages.h b/include/ublox/InputMessages.h index 1032680..5120cf4 100644 --- a/include/ublox/InputMessages.h +++ b/include/ublox/InputMessages.h @@ -49,6 +49,7 @@ #include "message/NavOrb.h" #include "message/NavSat.h" #include "message/NavGeofence.h" +#include "message/NavRelposned.h" #include "message/NavEkfstatus.h" #include "message/NavAopstatus.h" #include "message/NavAopstatusU8.h" @@ -205,6 +206,7 @@ using InputMessages = message::NavOrb, message::NavSat, message::NavGeofence, + message::NavRelposned, message::NavEkfstatus, message::NavAopstatus, message::NavAopstatusU8, diff --git a/include/ublox/MsgId.h b/include/ublox/MsgId.h index 0941f56..0dcd4f3 100644 --- a/include/ublox/MsgId.h +++ b/include/ublox/MsgId.h @@ -58,6 +58,7 @@ enum MsgId : std::uint16_t MsgId_NAV_ORB = 0x0134, ///< ID of NAV-ORB message MsgId_NAV_SAT = 0x0135, ///< ID of NAV-SAT message MsgId_NAV_GEOFENCE = 0x0139, ///< ID of NAV-GEOFENCE message + MsgId_NAV_RELPOSNED = 0x013C, ///< ID of NAV-RELPOSNED message MsgId_NAV_EKFSTATUS = 0x0140, ///< ID of NAV-EKFSTATUS message MsgId_NAV_AOPSTATUS = 0x0160, ///< ID of NAV-AOPSTATUS message MsgId_NAV_EOE = 0x0161, ///< ID of NAV-EOE message diff --git a/include/ublox/field/MsgId.h b/include/ublox/field/MsgId.h index 5748ebb..ce364f2 100644 --- a/include/ublox/field/MsgId.h +++ b/include/ublox/field/MsgId.h @@ -113,6 +113,7 @@ struct MsgIdValueValidator MsgId_NAV_ORB, MsgId_NAV_SAT, MsgId_NAV_GEOFENCE, + MsgId_NAV_RELPOSNED, MsgId_NAV_EKFSTATUS, MsgId_NAV_AOPSTATUS, MsgId_NAV_EOE diff --git a/include/ublox/field/nav.h b/include/ublox/field/nav.h index 67e0670..de7c7b7 100644 --- a/include/ublox/field/nav.h +++ b/include/ublox/field/nav.h @@ -190,6 +190,25 @@ using numCh = common::U1; /// @brief Definition of common "svid" field. using svid = common::svid; +/// @brief Value enumeration for @ref carrSoln field. +enum class CarrSoln : std::uint8_t +{ + NoCarrier, ///< no carrier phase range solution + Float, /// float solution, + Fixed, /// fixed solution + NumOfValues +}; + +/// @brief Definition of "carrSoln" member field in @ref flags bitmask field. +template +using carrSoln = + common::EnumT< + CarrSoln, + comms::option::ValidNumValueRange<0, (int)CarrSoln::NumOfValues - 1>, + TOpts... + >; + + } // namespace nav } // namespace field diff --git a/include/ublox/message/NavPvt.h b/include/ublox/message/NavPvt.h index 06eea2d..74b1fd0 100644 --- a/include/ublox/message/NavPvt.h +++ b/include/ublox/message/NavPvt.h @@ -122,22 +122,11 @@ struct NavPvtFields COMMS_BITMASK_BITS_SEQ(bit); }; - enum class CarrSoln : std::uint8_t - { - NoCarrier, ///< no carrier phase range solution - Float, /// float solution, - Fixed, /// fixed solution - NumOfValues - }; + /// @brief Value enumeration for @ref carrSoln field. + using CarrSoln = field::nav::CarrSoln; /// @brief Definition of "carrSoln" member field in @ref flags bitmask field. - using carrSoln = - field::common::EnumT< - CarrSoln, - comms::option::FixedBitLength<2>, - comms::option::ValidNumValueRange<0, (int)CarrSoln::NumOfValues - 1> - >; - + using carrSoln = field::nav::carrSoln >; /// @brief Definition of "flags" field. struct flags : public diff --git a/include/ublox/message/NavRelposned.h b/include/ublox/message/NavRelposned.h new file mode 100644 index 0000000..c65e195 --- /dev/null +++ b/include/ublox/message/NavRelposned.h @@ -0,0 +1,251 @@ +// +// Copyright 2015 - 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of NAV-RELPOSNED message and its fields. + +#pragma once + +#include "ublox/Message.h" +#include "ublox/field/nav.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the NAV-RELPOSNED message fields. +/// @see NavRelposned +struct NavRelposnedFields +{ + /// @brief Definition of "version" field. + using version = + field::common::U1T< + comms::option::ValidNumValueRange<0, 0> + >; + + /// @brief Definition of "reserved1" field. + using reserved1 = field::common::res1; + + /// @brief Definition of "refStationId" field. + using refStationId = + field::common::U2T< + comms::option::ValidNumValueRange<0, 4095> + >; + + /// @brief Definition of "iTOW" field. + using iTOW = field::nav::iTOW; + + /// @brief Definition of "relPosN" field. + using relPosN = + field::common::I4T< + comms::option::UnitsCentimeters + >; + + /// @brief Definition of "relPosE" field. + using relPosE = relPosN; + + /// @brief Definition of "relPosD" field. + using relPosD = relPosN; + + /// @brief Definition of "relPosHPN" field. + using relPosHPN = + field::common::I1T< + comms::option::UnitsMillimeters, + comms::option::ScalingRatio<1, 10>, + comms::option::ValidNumValueRange<-99, 99> + >; + + /// @brief Definition of "relPosHPE" field. + using relPosHPE = relPosHPN; + + /// @brief Definition of "relPosHPD" field. + using relPosHPD = relPosHPN; + + /// @brief Definition of "reserved2" field. + using reserved2 = field::common::res1; + + /// @brief Definition of "accN" field. + using accN = + field::common::U4T< + comms::option::UnitsMillimeters, + comms::option::ScalingRatio<1, 10> + >; + + /// @brief Definition of "accE" field. + using accE = accN; + + /// @brief Definition of "accD" field. + using accD = accN; + + /// @brief Definition of bits in low part of @b flags bifield. + struct flagsLow : public + field::common::X1T< + comms::option::FixedBitLength<3>, + comms::option::BitmaskReservedBits<0xf8, 0> + > + { + /// @brief Provide names for internal bits. + /// @details See definition of @b COMMS_BITMASK_BITS_SEQ macro + /// related to @b comms::field::BitmaskValue class from COMMS library + /// for details. + COMMS_BITMASK_BITS_SEQ(gnssFixOK, diffSoln, relPosValid); + }; + + /// @brief Value enumeration for @ref carrSoln field. + using CarrSoln = field::nav::CarrSoln; + + /// @brief Definition of "carrSoln" member field in @ref flags bitmask field. + using carrSoln = field::nav::carrSoln >; + + /// @brief Definition of bits in high part of @b flags bifield. + struct flagsHigh : public + field::common::X4T< + comms::option::FixedBitLength<27>, + comms::option::BitmaskReservedBits<0xfffffff8, 0> + > + { + /// @brief Provide names for internal bits. + /// @details See definition of @b COMMS_BITMASK_BITS_SEQ macro + /// related to @b comms::field::BitmaskValue class from COMMS library + /// for details. + COMMS_BITMASK_BITS_SEQ(isMoving, refPosMiss, refObsMiss); + }; + + /// @brief Definition of "flags" field. + struct flags : public + field::common::BitfieldT< + std::tuple< + flagsLow, + carrSoln, + flagsHigh + > + > + { + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_FIELD_MEMBERS_ACCESS macro + /// related to @b comms::field::Bitfield class from COMMS library + /// for details. + COMMS_FIELD_MEMBERS_ACCESS(flagsLow, carrSoln, flagsHigh); + }; + + /// @brief All the fields bundled in std::tuple. + using All = std::tuple< + version, + reserved1, + refStationId, + iTOW, + relPosN, + relPosE, + relPosD, + relPosHPN, + relPosHPE, + relPosHPD, + reserved2, + accN, + accE, + accD, + flags + >; +}; + +/// @brief Definition of NAV-RELPOSNED message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref NavRelposnedFields and for definition of the fields this message contains +/// and COMMS_MSG_FIELDS_ACCESS() for fields access details. +/// @tparam TMsgBase Common interface class for all the messages. +template +class NavRelposned : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_MSG_FIELDS_ACCESS macro + /// related to @b comms::MessageBase class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b version for @ref NavRelposnedFields::version field + /// @li @b reserved1 for @ref NavRelposnedFields::reserved1 field + /// @li @b refStationId for @ref NavRelposnedFields::refStationId field + /// @li @b iTOW for @ref NavRelposnedFields::iTOW field + /// @li @b relPosN for @ref NavRelposnedFields::relPosN field + /// @li @b relPosE for @ref NavRelposnedFields::relPosE field + /// @li @b relPosD for @ref NavRelposnedFields::relPosD field + /// @li @b relPosHPN for @ref NavRelposnedFields::relPosHPN field + /// @li @b relPosHPE for @ref NavRelposnedFields::relPosHPE field + /// @li @b relPosHPD for @ref NavRelposnedFields::relPosHPD field + /// @li @b reserved2 for @ref NavRelposnedFields::reserved2 field + /// @li @b accN for @ref NavRelposnedFields::accN field + /// @li @b accE for @ref NavRelposnedFields::accE field + /// @li @b accD for @ref NavRelposnedFields::accD field + /// @li @b flags for @ref NavRelposnedFields::flags field + COMMS_MSG_FIELDS_ACCESS( + version, + reserved1, + refStationId, + iTOW, + relPosN, + relPosE, + relPosD, + relPosHPN, + relPosHPE, + relPosHPD, + reserved2, + accN, + accE, + accD, + flags + ); + + /// @brief Default constructor + NavRelposned() = default; + + /// @brief Copy constructor + NavRelposned(const NavRelposned&) = default; + + /// @brief Move constructor + NavRelposned(NavRelposned&& other) = default; + + /// @brief Destructor + ~NavRelposned() = default; + + /// @brief Copy assignment + NavRelposned& operator=(const NavRelposned&) = default; + + /// @brief Move assignment + NavRelposned& operator=(NavRelposned&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + diff --git a/include/ublox/message/NavRelposnedPoll.h b/include/ublox/message/NavRelposnedPoll.h new file mode 100644 index 0000000..07fe723 --- /dev/null +++ b/include/ublox/message/NavRelposnedPoll.h @@ -0,0 +1,82 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of NAV-RELPOSNED (@b poll) message and its fields. + +#pragma once + +#include "ublox/Message.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the NAV-RELPOSNED (@b poll) message fields. +/// @see NavRelposnedPoll +struct NavRelposnedPollFields +{ + /// @brief All the fields bundled in std::tuple. + using All = std::tuple<>; +}; + +/// @brief Definition of NAV-RELPOSNED (@b poll) message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref NavRelposnedPollFields and for definition of the fields this message contains. +/// @tparam TMsgBase Common interface class for all the messages. +template +class NavRelposnedPoll : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Default constructor + NavRelposnedPoll() = default; + + /// @brief Copy constructor + NavRelposnedPoll(const NavRelposnedPoll&) = default; + + /// @brief Move constructor + NavRelposnedPoll(NavRelposnedPoll&& other) = default; + + /// @brief Destructor + ~NavRelposnedPoll() = default; + + /// @brief Copy assignment + NavRelposnedPoll& operator=(const NavRelposnedPoll&) = default; + + /// @brief Move assignment + NavRelposnedPoll& operator=(NavRelposnedPoll&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + From 06217ca4971824d3e5f056d9bdeb3028af133c2b Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Mon, 21 Aug 2017 17:46:46 +1000 Subject: [PATCH 20/29] Updates to NAV-SAT. --- cc_plugin/message/NavSat.cpp | 7 ++++++- include/ublox/message/NavSat.h | 30 +++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/cc_plugin/message/NavSat.cpp b/cc_plugin/message/NavSat.cpp index 4680523..d44953f 100644 --- a/cc_plugin/message/NavSat.cpp +++ b/cc_plugin/message/NavSat.cpp @@ -134,7 +134,12 @@ QVariantMap createProps_flagsHigh() .add("ephAvail") .add("almAvail") .add("anoAvail") - .add("aopAvail"); + .add("aopAvail") + .add(Field::BitIdx_sbasCorrUsed, "sbasCorrUsed") + .add("rtcmCorrUsed") + .add(Field::BitIdx_prCorrUsed, "prCorrUsed") + .add("crCorrUsed") + .add("doCorrUsed"); assert(props.bits().size() == Field::BitIdx_numOfValues); return props.asMap(); } diff --git a/include/ublox/message/NavSat.h b/include/ublox/message/NavSat.h index 50aeb38..9232adb 100644 --- a/include/ublox/message/NavSat.h +++ b/include/ublox/message/NavSat.h @@ -159,14 +159,38 @@ struct NavSatFields struct flagsHigh : public field::common::X4T< comms::option::FixedBitLength<21>, - comms::option::BitmaskReservedBits<0xfffffff0, 0> + comms::option::BitmaskReservedBits<0xfffff190, 0> > { /// @brief Provide names for internal bits. - /// @details See definition of @b COMMS_BITMASK_BITS_SEQ macro + /// @details See definition of @b COMMS_BITMASK_BITS macro + /// related to @b comms::field::BitmaskValue class from COMMS library + /// for details. + COMMS_BITMASK_BITS( + ephAvail, + almAvail, + anoAvail, + aopAvail, + sbasCorrUsed=5, + rtcmCorrUsed, + prCorrUsed=9, + crCorrUsed, + doCorrUsed); + + /// @brief Provide convenience access functions for internal bits. + /// @details See definition of @b COMMS_BITMASK_BITS_ACCESS macro /// related to @b comms::field::BitmaskValue class from COMMS library /// for details. - COMMS_BITMASK_BITS_SEQ(ephAvail, almAvail, anoAvail, aopAvail); + COMMS_BITMASK_BITS_ACCESS( + ephAvail, + almAvail, + anoAvail, + aopAvail, + sbasCorrUsed, + rtcmCorrUsed, + prCorrUsed, + crCorrUsed, + doCorrUsed); }; /// @brief Definition of "flags" field. From a34b84643cea6b58a175840c3a94e7a8feaab670 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Mon, 21 Aug 2017 18:33:21 +1000 Subject: [PATCH 21/29] Implemented NAV-SVIN message. --- cc_plugin/AllMessages.h | 4 + cc_plugin/CMakeLists.txt | 2 + cc_plugin/Ublox8Messages.h | 2 + cc_plugin/field/MsgId.cpp | 1 + cc_plugin/message/NavSvin.cpp | 120 ++++++++++++++++ cc_plugin/message/NavSvin.h | 64 +++++++++ cc_plugin/message/NavSvinPoll.cpp | 53 +++++++ cc_plugin/message/NavSvinPoll.h | 63 ++++++++ include/ublox/InputMessages.h | 2 + include/ublox/MsgId.h | 1 + include/ublox/field/MsgId.h | 1 + include/ublox/message/NavRelposned.h | 2 +- include/ublox/message/NavSvin.h | 206 +++++++++++++++++++++++++++ include/ublox/message/NavSvinPoll.h | 82 +++++++++++ 14 files changed, 602 insertions(+), 1 deletion(-) create mode 100644 cc_plugin/message/NavSvin.cpp create mode 100644 cc_plugin/message/NavSvin.h create mode 100644 cc_plugin/message/NavSvinPoll.cpp create mode 100644 cc_plugin/message/NavSvinPoll.h create mode 100644 include/ublox/message/NavSvin.h create mode 100644 include/ublox/message/NavSvinPoll.h diff --git a/cc_plugin/AllMessages.h b/cc_plugin/AllMessages.h index 2b016b9..8cd021a 100644 --- a/cc_plugin/AllMessages.h +++ b/cc_plugin/AllMessages.h @@ -72,6 +72,8 @@ #include "cc_plugin/message/NavSatPoll.h" #include "cc_plugin/message/NavGeofence.h" #include "cc_plugin/message/NavGeofencePoll.h" +#include "cc_plugin/message/NavSvin.h" +#include "cc_plugin/message/NavSvinPoll.h" #include "cc_plugin/message/NavRelposned.h" #include "cc_plugin/message/NavRelposnedPoll.h" #include "cc_plugin/message/NavEkfstatus.h" @@ -386,6 +388,8 @@ using AllMessages = std::tuple< cc_plugin::message::NavSatPoll, cc_plugin::message::NavGeofence, cc_plugin::message::NavGeofencePoll, + cc_plugin::message::NavSvin, + cc_plugin::message::NavSvinPoll, cc_plugin::message::NavRelposned, cc_plugin::message::NavRelposnedPoll, cc_plugin::message::NavEkfstatus, diff --git a/cc_plugin/CMakeLists.txt b/cc_plugin/CMakeLists.txt index ef80d3e..1b4c560 100644 --- a/cc_plugin/CMakeLists.txt +++ b/cc_plugin/CMakeLists.txt @@ -58,6 +58,8 @@ function (cc_plugin_ublox_all_messages) message/NavSatPoll.cpp message/NavGeofence.cpp message/NavGeofencePoll.cpp + message/NavSvin.cpp + message/NavSvinPoll.cpp message/NavRelposned.cpp message/NavRelposnedPoll.cpp message/NavEkfstatus.cpp diff --git a/cc_plugin/Ublox8Messages.h b/cc_plugin/Ublox8Messages.h index 8eb057d..371a14b 100644 --- a/cc_plugin/Ublox8Messages.h +++ b/cc_plugin/Ublox8Messages.h @@ -355,6 +355,8 @@ using Ublox8Messages = std::tuple< cc_plugin::message::NavSatPoll, cc_plugin::message::NavGeofence, cc_plugin::message::NavGeofencePoll, + cc_plugin::message::NavSvin, + cc_plugin::message::NavSvinPoll, cc_plugin::message::NavRelposned, cc_plugin::message::NavRelposnedPoll, cc_plugin::message::NavAopstatusU8, diff --git a/cc_plugin/field/MsgId.cpp b/cc_plugin/field/MsgId.cpp index 0854308..e322fbf 100644 --- a/cc_plugin/field/MsgId.cpp +++ b/cc_plugin/field/MsgId.cpp @@ -66,6 +66,7 @@ QVariantMap createMsgIdProperties() .add("NAV-ORB", MsgId_NAV_ORB) .add("NAV-SAT", MsgId_NAV_SAT) .add("NAV-GEOFENCE", MsgId_NAV_GEOFENCE) + .add("NAV-SVIN", MsgId_NAV_SVIN) .add("NAV-RELPOSNED", MsgId_NAV_RELPOSNED) .add("NAV-EKFSTATUS", MsgId_NAV_EKFSTATUS) .add("NAV-AOPSTATUS", MsgId_NAV_AOPSTATUS) diff --git a/cc_plugin/message/NavSvin.cpp b/cc_plugin/message/NavSvin.cpp new file mode 100644 index 0000000..0e049b5 --- /dev/null +++ b/cc_plugin/message/NavSvin.cpp @@ -0,0 +1,120 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include "NavSvin.h" +#include "cc_plugin/field/common.h" +#include "cc_plugin/field/nav.h" + +template class ublox::message::NavSvin; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavSvin, + ublox::cc_plugin::message::NavSvin>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +namespace +{ + +using ublox::message::NavSvinFields; + +QVariantMap createProps_hp(char ch) +{ + auto props = + cc::property::field::ForField() + .name(QString("mean%1HP").arg(ch)) + .scaledDecimals(1); + return props.asMap(); +} + +QVariantMap createProps_meanAcc() +{ + auto props = + cc::property::field::ForField() + .name("meanAcc") + .scaledDecimals(1); + return props.asMap(); +} + +QVariantList createFieldsProperties() +{ + QVariantList props; + props.append( + cc::property::field::ForField().name("version").asMap()); + props.append(cc_plugin::field::common::props_reserved(1)); + props.append(cc_plugin::field::nav::props_iTOW()); + props.append( + cc::property::field::ForField().name("dur").asMap()); + props.append( + cc::property::field::ForField().name("meanX").asMap()); + props.append( + cc::property::field::ForField().name("meanY").asMap()); + props.append( + cc::property::field::ForField().name("meanZ").asMap()); + props.append(createProps_hp('X')); + props.append(createProps_hp('Y')); + props.append(createProps_hp('Z')); + props.append(cc_plugin::field::common::props_reserved(2)); + props.append(createProps_meanAcc()); + props.append( + cc::property::field::ForField().name("obs").asMap()); + props.append( + cc::property::field::ForField().name("valid").asMap()); + props.append( + cc::property::field::ForField().name("active").asMap()); + props.append(cc_plugin::field::common::props_reserved(3)); + + assert(props.size() == NavSvin::FieldIdx_numOfValues); + return props; +} + +} // namespace + +NavSvin::NavSvin() = default; +NavSvin::~NavSvin() = default; + +NavSvin& NavSvin::operator=(const NavSvin&) = default; +NavSvin& NavSvin::operator=(NavSvin&&) = default; + +const char* NavSvin::nameImpl() const +{ + static const char* Str = "NAV-SVIN"; + return Str; +} + +const QVariantList& NavSvin::fieldsPropertiesImpl() const +{ + static const auto Props = createFieldsProperties(); + return Props; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/NavSvin.h b/cc_plugin/message/NavSvin.h new file mode 100644 index 0000000..b11cf5e --- /dev/null +++ b/cc_plugin/message/NavSvin.h @@ -0,0 +1,64 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/NavSvin.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class NavSvin : public + ProtocolMessageBase< + ublox::message::NavSvin, + NavSvin> +{ +public: + NavSvin(); + NavSvin(const NavSvin&) = delete; + NavSvin(NavSvin&&) = delete; + virtual ~NavSvin(); + + NavSvin& operator=(const NavSvin&); + NavSvin& operator=(NavSvin&&); + +protected: + virtual const char* nameImpl() const override; + virtual const QVariantList& fieldsPropertiesImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::NavSvin; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavSvin, + ublox::cc_plugin::message::NavSvin>; + diff --git a/cc_plugin/message/NavSvinPoll.cpp b/cc_plugin/message/NavSvinPoll.cpp new file mode 100644 index 0000000..2c5e00f --- /dev/null +++ b/cc_plugin/message/NavSvinPoll.cpp @@ -0,0 +1,53 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "NavSvinPoll.h" + +template class ublox::message::NavSvinPoll; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavSvinPoll, + ublox::cc_plugin::message::NavSvinPoll>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +NavSvinPoll::NavSvinPoll() = default; +NavSvinPoll::~NavSvinPoll() = default; + +NavSvinPoll& NavSvinPoll::operator=(const NavSvinPoll&) = default; +NavSvinPoll& NavSvinPoll::operator=(NavSvinPoll&&) = default; + +const char* NavSvinPoll::nameImpl() const +{ + static const char* Str = "NAV-SVIN (Poll)"; + return Str; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/NavSvinPoll.h b/cc_plugin/message/NavSvinPoll.h new file mode 100644 index 0000000..83b8742 --- /dev/null +++ b/cc_plugin/message/NavSvinPoll.h @@ -0,0 +1,63 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/NavSvinPoll.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class NavSvinPoll : public + ProtocolMessageBase< + ublox::message::NavSvinPoll, + NavSvinPoll> +{ +public: + NavSvinPoll(); + NavSvinPoll(const NavSvinPoll&) = delete; + NavSvinPoll(NavSvinPoll&&) = delete; + virtual ~NavSvinPoll(); + + NavSvinPoll& operator=(const NavSvinPoll&); + NavSvinPoll& operator=(NavSvinPoll&&); + +protected: + virtual const char* nameImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::NavSvinPoll; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::NavSvinPoll, + ublox::cc_plugin::message::NavSvinPoll>; + diff --git a/include/ublox/InputMessages.h b/include/ublox/InputMessages.h index 5120cf4..a7e0f1c 100644 --- a/include/ublox/InputMessages.h +++ b/include/ublox/InputMessages.h @@ -49,6 +49,7 @@ #include "message/NavOrb.h" #include "message/NavSat.h" #include "message/NavGeofence.h" +#include "message/NavSvin.h" #include "message/NavRelposned.h" #include "message/NavEkfstatus.h" #include "message/NavAopstatus.h" @@ -206,6 +207,7 @@ using InputMessages = message::NavOrb, message::NavSat, message::NavGeofence, + message::NavSvin, message::NavRelposned, message::NavEkfstatus, message::NavAopstatus, diff --git a/include/ublox/MsgId.h b/include/ublox/MsgId.h index 0dcd4f3..ad6bf49 100644 --- a/include/ublox/MsgId.h +++ b/include/ublox/MsgId.h @@ -58,6 +58,7 @@ enum MsgId : std::uint16_t MsgId_NAV_ORB = 0x0134, ///< ID of NAV-ORB message MsgId_NAV_SAT = 0x0135, ///< ID of NAV-SAT message MsgId_NAV_GEOFENCE = 0x0139, ///< ID of NAV-GEOFENCE message + MsgId_NAV_SVIN = 0x013B, ///< ID of NAV-SVIN message MsgId_NAV_RELPOSNED = 0x013C, ///< ID of NAV-RELPOSNED message MsgId_NAV_EKFSTATUS = 0x0140, ///< ID of NAV-EKFSTATUS message MsgId_NAV_AOPSTATUS = 0x0160, ///< ID of NAV-AOPSTATUS message diff --git a/include/ublox/field/MsgId.h b/include/ublox/field/MsgId.h index ce364f2..45cdfe0 100644 --- a/include/ublox/field/MsgId.h +++ b/include/ublox/field/MsgId.h @@ -113,6 +113,7 @@ struct MsgIdValueValidator MsgId_NAV_ORB, MsgId_NAV_SAT, MsgId_NAV_GEOFENCE, + MsgId_NAV_SVIN, MsgId_NAV_RELPOSNED, MsgId_NAV_EKFSTATUS, MsgId_NAV_AOPSTATUS, diff --git a/include/ublox/message/NavRelposned.h b/include/ublox/message/NavRelposned.h index c65e195..a734ecb 100644 --- a/include/ublox/message/NavRelposned.h +++ b/include/ublox/message/NavRelposned.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2017 (C). Alex Robenko. All rights reserved. +// Copyright 2017 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/include/ublox/message/NavSvin.h b/include/ublox/message/NavSvin.h new file mode 100644 index 0000000..f75d7f6 --- /dev/null +++ b/include/ublox/message/NavSvin.h @@ -0,0 +1,206 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of NAV-SVIN message and its fields. + +#pragma once + +#include "ublox/Message.h" +#include "ublox/field/nav.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the NAV-SVIN message fields. +/// @see NavSvin +struct NavSvinFields +{ + /// @brief Definition of "version" field. + using version = + field::common::U1T< + comms::option::ValidNumValueRange<0, 0> + >; + + /// @brief Definition of "reserved1" field. + using reserved1 = field::common::res3; + + /// @brief Definition of "iTOW" field. + using iTOW = field::nav::iTOW; + + /// @brief Definition of "dur" field. + using dur = field::common::U4T; + + /// @brief Definition of "meanX" field. + using meanX = + field::common::I4T< + comms::option::UnitsCentimeters + >; + + /// @brief Definition of "meanY" field. + using meanY = meanX; + + /// @brief Definition of "meanZ" field. + using meanZ = meanX; + + /// @brief Definition of "meanXHP" field. + using meanXHP = + field::common::I1T< + comms::option::UnitsMillimeters, + comms::option::ScalingRatio<1, 10>, + comms::option::ValidNumValueRange<-99, 99> + >; + + /// @brief Definition of "meanYHP" field. + using meanYHP = meanXHP; + + /// @brief Definition of "meanZHP" field. + using meanZHP = meanXHP; + + /// @brief Definition of "reserved2" field. + using reserved2 = field::common::res1; + + /// @brief Definition of "meanAcc" field. + using meanAcc = + field::common::U4T< + comms::option::UnitsMillimeters, + comms::option::ScalingRatio<1, 10> + >; + + /// @brief Definition of "obs" field. + using obs = field::common::U4; + + /// @brief Definition of "valid" field. + using isValid = field::common::U1T >; + + /// @brief Definition of "active" field. + using active = field::common::U1T >; + + /// @brief Definition of "reserved3" field. + using reserved3 = field::common::res2; + + /// @brief All the fields bundled in std::tuple. + using All = std::tuple< + version, + reserved1, + iTOW, + dur, + meanX, + meanY, + meanZ, + meanXHP, + meanYHP, + meanZHP, + reserved2, + meanAcc, + obs, + isValid, + active, + reserved3 + >; +}; + +/// @brief Definition of NAV-SVIN message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref NavSvinFields and for definition of the fields this message contains +/// and COMMS_MSG_FIELDS_ACCESS() for fields access details. +/// @tparam TMsgBase Common interface class for all the messages. +template +class NavSvin : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_MSG_FIELDS_ACCESS macro + /// related to @b comms::MessageBase class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b version for @ref NavSvinFields::version field + /// @li @b reserved1 for @ref NavSvinFields::reserved1 field + /// @li @b iTOW for @ref NavSvinFields::iTOW field + /// @li @b dur for @ref NavSvinFields::dur field + /// @li @b meanX for @ref NavSvinFields::meanX field + /// @li @b meanY for @ref NavSvinFields::meanY field + /// @li @b meanZ for @ref NavSvinFields::meanZ field + /// @li @b meanXHP for @ref NavSvinFields::meanXHP field + /// @li @b meanYHP for @ref NavSvinFields::meanYHP field + /// @li @b meanYHP for @ref NavSvinFields::meanYHP field + /// @li @b reserved2 for @ref NavSvinFields::reserved2 field + /// @li @b meanAcc for @ref NavSvinFields::meanAcc field + /// @li @b obs for @ref NavSvinFields::obs field + /// @li @b valid for @ref NavSvinFields::isValid field + /// @li @b active for @ref NavSvinFields::active field + /// @li @b reserved3 for @ref NavSvinFields::reserved3 field + COMMS_MSG_FIELDS_ACCESS( + version, + reserved1, + iTOW, + dur, + meanX, + meanY, + meanZ, + meanXHP, + meanYHP, + meanZHP, + reserved2, + meanAcc, + obs, + valid, + active, + reserved3 + ); + + /// @brief Default constructor + NavSvin() = default; + + /// @brief Copy constructor + NavSvin(const NavSvin&) = default; + + /// @brief Move constructor + NavSvin(NavSvin&& other) = default; + + /// @brief Destructor + ~NavSvin() = default; + + /// @brief Copy assignment + NavSvin& operator=(const NavSvin&) = default; + + /// @brief Move assignment + NavSvin& operator=(NavSvin&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + diff --git a/include/ublox/message/NavSvinPoll.h b/include/ublox/message/NavSvinPoll.h new file mode 100644 index 0000000..56b70b3 --- /dev/null +++ b/include/ublox/message/NavSvinPoll.h @@ -0,0 +1,82 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of NAV-SVIN (@b poll) message and its fields. + +#pragma once + +#include "ublox/Message.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the NAV-SVIN (@b poll) message fields. +/// @see NavSvinPoll +struct NavSvinPollFields +{ + /// @brief All the fields bundled in std::tuple. + using All = std::tuple<>; +}; + +/// @brief Definition of NAV-SVIN (@b poll) message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref NavSvinPollFields and for definition of the fields this message contains. +/// @tparam TMsgBase Common interface class for all the messages. +template +class NavSvinPoll : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Default constructor + NavSvinPoll() = default; + + /// @brief Copy constructor + NavSvinPoll(const NavSvinPoll&) = default; + + /// @brief Move constructor + NavSvinPoll(NavSvinPoll&& other) = default; + + /// @brief Destructor + ~NavSvinPoll() = default; + + /// @brief Copy assignment + NavSvinPoll& operator=(const NavSvinPoll&) = default; + + /// @brief Move assignment + NavSvinPoll& operator=(NavSvinPoll&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + From a3b5d3e2f40edeaba4325e14e62fcd7d4c420841 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Mon, 21 Aug 2017 18:34:11 +1000 Subject: [PATCH 22/29] Fix to documentation build. --- include/ublox/field/nav.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ublox/field/nav.h b/include/ublox/field/nav.h index de7c7b7..6b0401c 100644 --- a/include/ublox/field/nav.h +++ b/include/ublox/field/nav.h @@ -199,7 +199,7 @@ enum class CarrSoln : std::uint8_t NumOfValues }; -/// @brief Definition of "carrSoln" member field in @ref flags bitmask field. +/// @brief Definition of "carrSoln" field. template using carrSoln = common::EnumT< From 6152382e121bf2adb41ffc607344128786db5394 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Tue, 22 Aug 2017 08:46:29 +1000 Subject: [PATCH 23/29] Fixing bug in NAV-TIMELS message definition. --- cc_plugin/message/NavTimels.cpp | 2 +- include/ublox/message/NavTimels.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cc_plugin/message/NavTimels.cpp b/cc_plugin/message/NavTimels.cpp index 55f5d41..c3004d9 100644 --- a/cc_plugin/message/NavTimels.cpp +++ b/cc_plugin/message/NavTimels.cpp @@ -67,7 +67,7 @@ QVariantMap createProps_srcOfLsChange() cc::property::field::ForField() .name("srcOfLsChange") .add("No source") - .add("GPS") + .add("GPS", (int)Field::ValueType::Gps) .add("SBAS") .add("BeiDou") .add("Galileo") diff --git a/include/ublox/message/NavTimels.h b/include/ublox/message/NavTimels.h index a02aa45..8557ec6 100644 --- a/include/ublox/message/NavTimels.h +++ b/include/ublox/message/NavTimels.h @@ -87,7 +87,7 @@ struct NavTimelsFields enum class SrcOfLsChange : std::uint8_t { NoSource, ///< No source - Gps, ///< GPS + Gps = 2, ///< GPS Sbas, ///< SBAS BeiDou, ///< BeiDou Galileo, ///< Galileo From ba0d82dee81c2eb07d8a1b93fbc04a4bf02bb717 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Tue, 22 Aug 2017 09:16:23 +1000 Subject: [PATCH 24/29] Implemented RXM-RTCM message. --- cc_plugin/AllMessages.h | 10 ++- cc_plugin/CMakeLists.txt | 1 + cc_plugin/Ublox8Messages.h | 4 + cc_plugin/field/MsgId.cpp | 1 + cc_plugin/message/RxmRtcm.cpp | 98 +++++++++++++++++++++++ cc_plugin/message/RxmRtcm.h | 64 +++++++++++++++ include/ublox/InputMessages.h | 2 + include/ublox/MsgId.h | 1 + include/ublox/field/MsgId.h | 1 + include/ublox/message/RxmRtcm.h | 138 ++++++++++++++++++++++++++++++++ 10 files changed, 316 insertions(+), 4 deletions(-) create mode 100644 cc_plugin/message/RxmRtcm.cpp create mode 100644 cc_plugin/message/RxmRtcm.h create mode 100644 include/ublox/message/RxmRtcm.h diff --git a/cc_plugin/AllMessages.h b/cc_plugin/AllMessages.h index 8cd021a..fd63de7 100644 --- a/cc_plugin/AllMessages.h +++ b/cc_plugin/AllMessages.h @@ -98,13 +98,14 @@ #include "cc_plugin/message/RxmEph.h" #include "cc_plugin/message/RxmEphPollSv.h" #include "cc_plugin/message/RxmEphPoll.h" +#include "cc_plugin/message/RxmRtcm.h" #include "cc_plugin/message/RxmPmreqV0.h" #include "cc_plugin/message/RxmPmreq.h" #include "cc_plugin/message/RxmRlmShort.h" #include "cc_plugin/message/RxmRlmLong.h" #include "cc_plugin/message/RxmImes.h" #include "cc_plugin/message/RxmImesPoll.h" - +/* #include "cc_plugin/message/InfError.h" #include "cc_plugin/message/InfWarning.h" #include "cc_plugin/message/InfNotice.h" @@ -329,7 +330,7 @@ #include "cc_plugin/message/HnrPvt.h" #include "cc_plugin/message/HnrPvtPoll.h" - +*/ namespace ublox { @@ -413,12 +414,13 @@ using AllMessages = std::tuple< cc_plugin::message::RxmEph, cc_plugin::message::RxmEphPollSv, cc_plugin::message::RxmEphPoll, + cc_plugin::message::RxmRtcm, cc_plugin::message::RxmPmreqV0, cc_plugin::message::RxmPmreq, cc_plugin::message::RxmRlmShort, cc_plugin::message::RxmRlmLong, cc_plugin::message::RxmImes, - cc_plugin::message::RxmImesPoll, + cc_plugin::message::RxmImesPoll/*, cc_plugin::message::InfError, cc_plugin::message::InfWarning, cc_plugin::message::InfNotice, @@ -630,7 +632,7 @@ using AllMessages = std::tuple< cc_plugin::message::SecSign, cc_plugin::message::SecUniqid, cc_plugin::message::HnrPvt, - cc_plugin::message::HnrPvtPoll + cc_plugin::message::HnrPvtPoll*/ >; } // namespace cc_plugin diff --git a/cc_plugin/CMakeLists.txt b/cc_plugin/CMakeLists.txt index 1b4c560..4a8cfec 100644 --- a/cc_plugin/CMakeLists.txt +++ b/cc_plugin/CMakeLists.txt @@ -83,6 +83,7 @@ function (cc_plugin_ublox_all_messages) message/RxmEph.cpp message/RxmEphPollSv.cpp message/RxmEphPoll.cpp + message/RxmRtcm.cpp message/RxmPmreqV0.cpp message/RxmPmreq.cpp message/RxmRlmShort.cpp diff --git a/cc_plugin/Ublox8Messages.h b/cc_plugin/Ublox8Messages.h index 371a14b..d1c0c67 100644 --- a/cc_plugin/Ublox8Messages.h +++ b/cc_plugin/Ublox8Messages.h @@ -72,6 +72,8 @@ #include "cc_plugin/message/NavSatPoll.h" #include "cc_plugin/message/NavGeofence.h" #include "cc_plugin/message/NavGeofencePoll.h" +#include "cc_plugin/message/NavSvin.h" +#include "cc_plugin/message/NavSvinPoll.h" #include "cc_plugin/message/NavRelposned.h" #include "cc_plugin/message/NavRelposnedPoll.h" #include "cc_plugin/message/NavEkfstatusPoll.h" @@ -84,6 +86,7 @@ #include "cc_plugin/message/RxmRawx.h" #include "cc_plugin/message/RxmRawxPoll.h" #include "cc_plugin/message/RxmSvsi.h" +#include "cc_plugin/message/RxmRtcm.h" #include "cc_plugin/message/RxmSvsiPoll.h" #include "cc_plugin/message/RxmPmreqV0.h" #include "cc_plugin/message/RxmPmreq.h" @@ -368,6 +371,7 @@ using Ublox8Messages = std::tuple< cc_plugin::message::RxmRawxPoll, cc_plugin::message::RxmSvsi, cc_plugin::message::RxmSvsiPoll, + cc_plugin::message::RxmRtcm, cc_plugin::message::RxmPmreqV0, cc_plugin::message::RxmPmreq, cc_plugin::message::RxmRlmShort, diff --git a/cc_plugin/field/MsgId.cpp b/cc_plugin/field/MsgId.cpp index e322fbf..b900d4c 100644 --- a/cc_plugin/field/MsgId.cpp +++ b/cc_plugin/field/MsgId.cpp @@ -80,6 +80,7 @@ QVariantMap createMsgIdProperties() .add("RXM-SVSI", MsgId_RXM_SVSI) .add("RXM-ALM", MsgId_RXM_ALM) .add("RXM-EPH", MsgId_RXM_EPH) + .add("RXM-RTCM", MsgId_RXM_RTCM) .add("RXM-PMREQ", MsgId_RXM_PMREQ) .add("RXM-RLM", MsgId_RXM_RLM) .add("RXM-IMES", MsgId_RXM_IMES) diff --git a/cc_plugin/message/RxmRtcm.cpp b/cc_plugin/message/RxmRtcm.cpp new file mode 100644 index 0000000..688cc54 --- /dev/null +++ b/cc_plugin/message/RxmRtcm.cpp @@ -0,0 +1,98 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#include "RxmRtcm.h" + +#include + +#include "cc_plugin/field/common.h" + +template class ublox::message::RxmRtcm; +template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::RxmRtcm, + ublox::cc_plugin::message::RxmRtcm>; + +namespace cc = comms_champion; + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +namespace +{ + +using ublox::message::RxmRtcmFields; + +QVariantMap createProps_flags() +{ + using Field = RxmRtcmFields::flags; + auto props = + cc::property::field::ForField() + .name("flags") + .add("crcFailed"); + assert(props.bits().size() == Field::BitIdx_numOfValues); + return props.asMap(); +} + +QVariantList createFieldsProperties() +{ + QVariantList props; + props.append( + cc::property::field::ForField().name("version").asMap()); + props.append(createProps_flags()); + props.append(cc_plugin::field::common::props_reserved(1)); + props.append( + cc::property::field::ForField().name("refStation").asMap()); + props.append( + cc::property::field::ForField().name("msgType").asMap()); + + assert(props.size() == RxmRtcm::FieldIdx_numOfValues); + return props; +} + +} // namespace + +RxmRtcm::RxmRtcm() = default; +RxmRtcm::~RxmRtcm() = default; + +RxmRtcm& RxmRtcm::operator=(const RxmRtcm&) = default; +RxmRtcm& RxmRtcm::operator=(RxmRtcm&&) = default; + +const char* RxmRtcm::nameImpl() const +{ + static const char* Str = "RXM-RTCM"; + return Str; +} + +const QVariantList& RxmRtcm::fieldsPropertiesImpl() const +{ + static const auto Props = createFieldsProperties(); + return Props; +} + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + diff --git a/cc_plugin/message/RxmRtcm.h b/cc_plugin/message/RxmRtcm.h new file mode 100644 index 0000000..5372324 --- /dev/null +++ b/cc_plugin/message/RxmRtcm.h @@ -0,0 +1,64 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once + +#include "comms_champion/comms_champion.h" +#include "ublox/message/RxmRtcm.h" +#include "cc_plugin/Message.h" +#include "cc_plugin/ProtocolMessageBase.h" + +namespace ublox +{ + +namespace cc_plugin +{ + +namespace message +{ + +class RxmRtcm : public + ProtocolMessageBase< + ublox::message::RxmRtcm, + RxmRtcm> +{ +public: + RxmRtcm(); + RxmRtcm(const RxmRtcm&) = delete; + RxmRtcm(RxmRtcm&&) = delete; + virtual ~RxmRtcm(); + + RxmRtcm& operator=(const RxmRtcm&); + RxmRtcm& operator=(RxmRtcm&&); + +protected: + virtual const char* nameImpl() const override; + virtual const QVariantList& fieldsPropertiesImpl() const override; +}; + +} // namespace message + +} // namespace cc_plugin + +} // namespace ublox + +extern template class ublox::message::RxmRtcm; +extern template class ublox::cc_plugin::ProtocolMessageBase< + ublox::message::RxmRtcm, + ublox::cc_plugin::message::RxmRtcm>; + diff --git a/include/ublox/InputMessages.h b/include/ublox/InputMessages.h index a7e0f1c..8cc680c 100644 --- a/include/ublox/InputMessages.h +++ b/include/ublox/InputMessages.h @@ -64,6 +64,7 @@ #include "message/RxmSvsi.h" #include "message/RxmAlm.h" #include "message/RxmEph.h" +#include "message/RxmRtcm.h" #include "message/RxmRlmShort.h" #include "message/RxmRlmLong.h" #include "message/RxmImes.h" @@ -220,6 +221,7 @@ using InputMessages = message::RxmSvsi, message::RxmAlm, message::RxmEph, + message::RxmRtcm, message::RxmRlmShort, message::RxmRlmLong, message::RxmImes, diff --git a/include/ublox/MsgId.h b/include/ublox/MsgId.h index ad6bf49..e6eb20e 100644 --- a/include/ublox/MsgId.h +++ b/include/ublox/MsgId.h @@ -71,6 +71,7 @@ enum MsgId : std::uint16_t MsgId_RXM_SVSI = 0x0220, ///< ID of RXM-SVSI message MsgId_RXM_ALM = 0x0230, ///< ID of RXM-ALM message MsgId_RXM_EPH = 0x0231, ///< ID of RXM-EPH message + MsgId_RXM_RTCM = 0x0232, ///< ID of RXM-RTCM message MsgId_RXM_PMREQ = 0x0241, ///< ID of RXM-PMREQ message MsgId_RXM_RLM = 0x0259, ///< ID of RXM-RLM message MsgId_RXM_IMES = 0x0261, ///< ID of RXM-IMES message diff --git a/include/ublox/field/MsgId.h b/include/ublox/field/MsgId.h index 45cdfe0..dc816b1 100644 --- a/include/ublox/field/MsgId.h +++ b/include/ublox/field/MsgId.h @@ -135,6 +135,7 @@ struct MsgIdValueValidator MsgId_RXM_SVSI, MsgId_RXM_ALM, MsgId_RXM_EPH, + MsgId_RXM_RTCM, MsgId_RXM_PMREQ, MsgId_RXM_RLM, MsgId_RXM_IMES, diff --git a/include/ublox/message/RxmRtcm.h b/include/ublox/message/RxmRtcm.h new file mode 100644 index 0000000..057f58f --- /dev/null +++ b/include/ublox/message/RxmRtcm.h @@ -0,0 +1,138 @@ +// +// Copyright 2017 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +/// @file +/// @brief Contains definition of RXM-RTCM message and its fields. + +#pragma once + +#include "ublox/Message.h" +#include "ublox/field/common.h" + +namespace ublox +{ + +namespace message +{ + +/// @brief Accumulates details of all the RXM-RTCM message fields. +/// @see RxmRtcm +struct RxmRtcmFields +{ + /// @brief Definition of "version" field. + using version = + field::common::U1T< + comms::option::DefaultNumValue<2>, + comms::option::ValidNumValueRange<2, 2> + >; + + /// @brief Definition of "flags" field. + struct flags : public + field::common::X1T< + comms::option::BitmaskReservedBits<0xfe, 0> + > + { + /// @brief Provide names and access functions for internal bits. + /// @details See definition of @b COMMS_BITMASK_BITS_SEQ macro + /// related to @b comms::field::BitmaskValue class from COMMS library + /// for details. + COMMS_BITMASK_BITS_SEQ(crcFailed); + }; + + /// @brief Definition of "reserved1" field. + using reserved1 = field::common::res2; + + /// @brief Definition of "refStation" field. + using refStation = field::common::U2; + + /// @brief Definition of "msgType" field. + using msgType = field::common::U2; + + /// @brief All the fields bundled in std::tuple. + using All = std::tuple< + version, + flags, + reserved1, + refStation, + msgType + >; +}; + +/// @brief Definition of RXM-RTCM message +/// @details Inherits from @b comms::MessageBase +/// while providing @b TMsgBase as common interface class as well as +/// various implementation options. @n +/// See @ref RxmRtcmFields and for definition of the fields this message contains +/// and COMMS_MSG_FIELDS_ACCESS() for fields access details. +/// @tparam TMsgBase Common interface class for all the messages. +template +class RxmRtcm : public + comms::MessageBase< + TMsgBase, + comms::option::StaticNumIdImpl, + comms::option::FieldsImpl, + comms::option::MsgType > + > +{ +public: + + /// @brief Allow access to internal fields. + /// @details See definition of @b COMMS_MSG_FIELDS_ACCESS macro + /// related to @b comms::MessageBase class from COMMS library + /// for details. + /// + /// The field names are: + /// @li @b version for @ref RxmRtcmFields::version field + /// @li @b flags for @ref RxmRtcmFields::flags field + /// @li @b reserved1 for @ref RxmRtcmFields::reserved1 field + /// @li @b refStation for @ref RxmRtcmFields::refStation field + /// @li @b msgType for @ref RxmRtcmFields::msgType field + COMMS_MSG_FIELDS_ACCESS( + version, + flags, + reserved1, + refStation, + msgType); + + /// @brief Default constructor + RxmRtcm() = default; + + /// @brief Copy constructor + RxmRtcm(const RxmRtcm&) = default; + + /// @brief Move constructor + RxmRtcm(RxmRtcm&& other) = default; + + /// @brief Destructor + ~RxmRtcm() = default; + + /// @brief Copy assignment + RxmRtcm& operator=(const RxmRtcm&) = default; + + /// @brief Move assignment + RxmRtcm& operator=(RxmRtcm&&) = default; +}; + + +} // namespace message + +} // namespace ublox + + + + + From c996c78633f7ef64056f4d09d1a9bd82fc5f6dab Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Tue, 22 Aug 2017 09:17:06 +1000 Subject: [PATCH 25/29] Restoring all messages list. --- cc_plugin/AllMessages.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cc_plugin/AllMessages.h b/cc_plugin/AllMessages.h index fd63de7..35810b8 100644 --- a/cc_plugin/AllMessages.h +++ b/cc_plugin/AllMessages.h @@ -105,7 +105,7 @@ #include "cc_plugin/message/RxmRlmLong.h" #include "cc_plugin/message/RxmImes.h" #include "cc_plugin/message/RxmImesPoll.h" -/* + #include "cc_plugin/message/InfError.h" #include "cc_plugin/message/InfWarning.h" #include "cc_plugin/message/InfNotice.h" @@ -330,7 +330,7 @@ #include "cc_plugin/message/HnrPvt.h" #include "cc_plugin/message/HnrPvtPoll.h" -*/ + namespace ublox { @@ -420,7 +420,7 @@ using AllMessages = std::tuple< cc_plugin::message::RxmRlmShort, cc_plugin::message::RxmRlmLong, cc_plugin::message::RxmImes, - cc_plugin::message::RxmImesPoll/*, + cc_plugin::message::RxmImesPoll, cc_plugin::message::InfError, cc_plugin::message::InfWarning, cc_plugin::message::InfNotice, @@ -632,7 +632,7 @@ using AllMessages = std::tuple< cc_plugin::message::SecSign, cc_plugin::message::SecUniqid, cc_plugin::message::HnrPvt, - cc_plugin::message::HnrPvtPoll*/ + cc_plugin::message::HnrPvtPoll >; } // namespace cc_plugin From d4f303c24f5ccf89e23f7f7313e8fb0d946ca663 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Wed, 23 Aug 2017 16:42:52 +1000 Subject: [PATCH 26/29] Updating tutorial. --- doc/main.dox | 171 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 166 insertions(+), 5 deletions(-) diff --git a/doc/main.dox b/doc/main.dox index c26e3aa..285662c 100644 --- a/doc/main.dox +++ b/doc/main.dox @@ -326,7 +326,7 @@ /// @code /// ProtStack protStack; // Protocol stack defined earlier /// -/// returns number of bytes written to the buffer +/// //returns number of bytes written to the buffer /// std::size_t writeMsg(const MyOutputMessage& msg, std::uint8_t* buf, std::size_t bufLen) /// { /// // Check the output buffer has enough space to serialise the message @@ -445,7 +445,7 @@ /// @subsection ublox_fields_accessing Accessing Message Fields /// Every message class in ublox::message namespace uses /// @b COMMS_MSG_FIELDS_ACCESS() macro to provide names to its fields. For -/// example comms::message::NavPosecef class defines the following names: +/// example @ref ublox::message::NavPosecef class defines the following names: /// @code /// namespace ublox /// { @@ -644,8 +644,12 @@ /// auto& outProtoMaskField = msg.field_outProtoMask(); /// /// outProtoMaskField.setBitValue_outUbx(true); -/// outProtoMaskField.setBitValue_outNmea(false); +/// outProtoMaskField.setBitValue_outNmea(false); // redundant /// @endcode +/// @b NOTE, that all the bits in the "bitmask" field are cleared when the field +/// is default constructed, as the result explicitly clearing the "outNmea" bit +/// in the example above is redundant. +/// /// The @b BitIdx enum values can also be used: /// @code /// using OutCfgPrtUsb = ublox::message::CfgPrtUsb; @@ -655,9 +659,19 @@ /// /// using OutProtoMaskField = ublox::message::CfgPrtFields::outProtoMask; /// outProtoMaskField.setBitValue(OutProtoMaskField::BitIdx_outUbx, true); -/// outProtoMaskField.setBitValue(OutProtoMaskField::BitIdx_outNmea, false); +/// outProtoMaskField.setBitValue(OutProtoMaskField::BitIdx_outNmea, false); // redundant /// @endcode /// +/// The bitmask fields also support setting of the raw mask value as well. +/// It can be useful when the protocol has been updated to add new bits to the +/// existing field, but the old version of UBLOX library is being used. For example, +/// let's assume that @ref ublox::message::CfgPrtFields::outProtoMask field doesn't +/// contain @b outRtcm3 bit definition. The code which sets @b outUbx and @b outRtcm3 +/// bits may look like this: +/// @code +/// outProtoMaskField.value() = 0x21; +/// @endcode +/// /// @subsection ublox_fields_complex Complex Fields /// There are multiple complex fields, such as bitfields (for example /// ublox::message::CfgPrtFields::txReady) or bundles (for example @@ -682,4 +696,151 @@ /// pinField.value() = ...; /// thresField.value() = ...; /// @endcode - +/// +/// @subsection ublox_fields_var_data Variable Length Data Fields +/// Some fields may contain raw bytes and have variable length. For example @ref +/// ublox::message::AidAlpsrvFields::data field used in @ref +/// ublox::message::AidAlpsrv message. It is defined to be a +/// @b comms::field::ArrayList containing raw data (@b std::uint8_t). +/// The access to the data can be implemented as following: +/// @code +/// void handle(InAidAlpsrv& msg) +/// { +/// auto& dataField = msg.field_data(); // access to "data" field +/// auto& dataVector = dataField.value(); // access the std::vector storage +/// std::uint8_t firstByte = dataVector[0]; // use usual way to access vector elements +/// ... +/// } +/// @endcode +/// Other variable length data fields may contain other fields. For example +/// @ref ublox::message::NavSatFields::data field used in @ref ublox::message::NavSat +/// message. It is defined to be @b comms::field::ArrayList containing other +/// field (@b comms::field::Bundle). The to the stored data can be implemented +/// as following: +/// @code +/// void handle(InNavSat& msg) +/// { +/// auto& dataField = msg.field_data(); // access to "data" field +/// auto& dataVector = dataField.value(); // access the std::vector > storage +/// auto& firstBlock = dataVector[0]; // use usual way to access vector elements, which are bundle fields +/// auto& gnssIdField = firstBlock.field_gnssId(); // access the bundle member field +/// std::uint8_t gnssIdValue = gnssIdField.value(); // access the value storage +/// ... +/// } +/// @endcode +/// +/// @subsection ublox_fields_string String Fields +/// Access to the string fields is somewhat similar to @ref ublox_fields_var_data. +/// See @ref ublox::message::MonVer message definition and the code below: +/// @code +/// void handle(InMonVer& msg) +/// { +/// auto& swVerField = msg.field_swVersion(); // access to "swVersion" field +/// std::string& swVer = swVerField.value(); // access the std::string storage +/// auto& hwVerField = msg.field_hwVersion(); // access to "hwVersion" field +/// std::string& hwVer = hwVerField.value(); // access the std::string storage +/// ... +/// } +/// @endcode +/// +/// @subsection ublox_fields_optional Optional Fields +/// There are fields that are defined to be optional (@b comms::field::Optional). +/// Usually their existence is determined by a value of some other field, such +/// as a bit in some "flags" field. For example @ref ublox::message::CfgTmode2 +/// message. The bit "lla" in its "flags" field (see @ref ublox::message::CfgTmode2Fields::flags) +/// determines the existence of either ("ecefX", "ecefY", "ecefZ") or +/// ("lat", "lon", "alt") set of fields. All of these fields are defined to +/// be "optional". The handling code may look like this: +/// @code +/// void handle(InCfgTmode2& msg) +/// { +/// if (msg.field_flags().getBitValue_lla()) { +/// // Make sure the right fields exist +/// assert(msg.field_lat().doesExist()); +/// assert(msg.field_lon().doesExist()); +/// assert(msg.field_lon().doesExist()); +/// assert(msg.field_ecefX().isMissing()); +/// assert(msg.field_ecefY().isMissing()); +/// assert(msg.field_ecefZ().isMissing()); +/// auto lat = comms::units::getDegrees(msg.field_lat().field()); +/// auto lon = comms::units::getDegrees(msg.field_lon().field()); +/// auto alt = comms::units::getMeters(msg.field_alt().field()); +/// ... +/// } else { +/// // Make sure the right fields exist +/// assert(msg.field_lat().isMissing()); +/// assert(msg.field_lon().isMissing()); +/// assert(msg.field_lon().isMissing()); +/// assert(msg.field_ecefX().doesExist()); +/// assert(msg.field_ecefY().doesExist()); +/// assert(msg.field_ecefZ().doesExist()); +/// auto ecefX = comms::units::getMeters(msg.field_ecefX().field()); +/// auto ecefY = comms::units::getMeters(msg.field_ecefY().field()); +/// auto ecefZ = comms::units::getMeters(msg.field_ecefZ().field()); +/// ... +/// } +/// } +/// @endcode +/// @b NOTE additional call to @b field() member function of the "optional" field +/// to get an access to the @b real field the former wraps. +/// +/// @section ublox_refresh Consistent State of the Message +/// When preparing message to send and assigning new values to the fields, the +/// message may be in inconsistent state. As an example let's take +/// @ref ublox::message::CfgTmode2 message. +/// @code +/// using OutCfgTmode2 = ublox::message::CfgTmode2; +/// OutCfgTmode2 msg; +/// msg.field_flags().setBitValue_lla(true); // use "lat", "lon", "alt" set +/// comms::units::setDegrees(msg.field_lat().field(), 123.456); // note call to *.field() member func +/// comms::units::setDegrees(msg.field_lon().field(), 152.111); // note call to *.field() member func +/// comms::units::setMeters(msg.field_alt().field(), 80.134); // note call to *.field() member func +/// @endcode +/// @b NOTE, that default constructed ublox::message::CfgTmode2 message sets +/// "ecefX", "ecefY", and "ecefZ" fields to be @b existing, while "lat", "lon", +/// and "alt" fields to be @b missing. This is due to the "lla" bit being default +/// constructed as @b 0. The result of the code above is that message object +/// is in inconsistent state, i.e. the "lla" bit is set, but "lat", "lon", and +/// "alt" fields are still marked to be missing (and "ecefX", "ecefY", and "ecefZ" +/// are still marked as existing). If the message object is serialised now, the +/// values of "ecef" fields (all default constructed as 0) will be written. @n +/// In order to bring the message object into the proper consistent state the +/// state of the optional fields need to be reversed. It can be done manually: +/// @code +/// msg.field_lat().setExists(); +/// msg.field_lon().setExists(); +/// msg.field_alt().setExists(); +/// msg.field_ecefX().setMissing(); +/// msg.field_ecefY().setMissing(); +/// msg.field_ecefZ().setMissing(); +/// @endcode +/// However, it is a tedious and error prone process. Every message object has +/// a @b doRefresh() member function, which is either inherited from @b comms::MessageBase +/// class or explicitly overridden inside the message definition class. It is +/// recommended to use it instead: +/// @code +/// msg.doRefresh(); +/// @endcode +/// If the message cannot have an inconsistent state, then call to @b doRefresh() +/// member function will do nothgin, and will probably be optimised away by the +/// compiler. +/// +/// @section ublox_back_compat Backward Compatibility +/// The new versions of the UBX protocol may result in adding new enum values or +/// bits to existing bitmasks. Such changes are easily introduced into the +/// library and do not break backward compatibility. The older versions of the +/// firmware or earlier device models just don't use these values/bits. +/// +/// Sometimes the new versions of the same message are introduced. Usually the +/// new version ends up being a separate class. For example @ref +/// ublox::message::RxmPmreq and ublox::message::RxmPmreqV0. The latter is +/// definition of the message that has "version" field with @b 0 value. +/// +/// Sometimes new fields are appended at the end of the same message. Good +/// example is @b NAV-PVT message (@ref ublox::message::NavPvt). +/// The ublox-8 devices have added "headVeh", +/// "magDec", and "magAcc" fields at the end. The ublox-7 devices didn't have +/// these fields. The @b UBLOX library defines these fields as +/// "optional" (see @ref ublox_fields_optional), they are read and populated +/// if "read" operation has extra 8 bytes. +/// From c7d024d7c4b48361ceeea5800ae968a7bafd300a Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sun, 27 Aug 2017 19:54:46 +1000 Subject: [PATCH 27/29] Using v0.21 of the CommsChampion. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e92a57..82943d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,7 +68,7 @@ set (CC_EXTERNAL_TGT "comms_champion_external") macro (externals install_dir build_cc) include(ExternalProject) - set (cc_tag "develop") + set (cc_tag "v0.21") set (cc_main_dir "${CMAKE_BINARY_DIR}/comms_champion") set (cc_src_dir "${cc_main_dir}/src") set (cc_bin_dir "${cc_main_dir}/build") From ea4c3c8b16a161431fa5a0bf807eab0ab6be8726 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sun, 27 Aug 2017 19:56:10 +1000 Subject: [PATCH 28/29] Updating travis configuration. --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6bff0b6..8651472 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,18 +31,18 @@ matrix: env: _CC=clang-3.9 _CXX=clang++-3.9 _BUILD="-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_CXX_STANDARD=14" before_install: - - sudo add-apt-repository ppa:beineri/opt-qt551 -y + - sudo add-apt-repository ppa:beineri/opt-qt562-trusty -y - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - - sudo add-apt-repository ppa:george-edison55/precise-backports -y + - sudo add-apt-repository ppa:george-edison55/cmake-3.x -y - wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo apt-add-repository "deb http://apt.llvm.org/precise/ llvm-toolchain-precise-3.9 main" -y - sudo apt-get update -q - - sudo apt-get install g++-5 g++-6 clang-3.9 cmake cmake-data qt55declarative qt55serialport -y + - sudo apt-get install g++-5 g++-6 clang-3.9 cmake cmake-data qt56base qt55serialport -y before_script: - mkdir build - cd build - - source /opt/qt55/bin/qt55-env.sh + - source /opt/qt56/bin/qt56-env.sh - CC=${_CC} CXX=${_CXX} cmake .. -DCC_UBLOX_FULL_SOLUTION=ON ${_BUILD} script: From 0e23d317c74ae3e11d80b9db66340820a3c28e85 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sun, 27 Aug 2017 20:07:32 +1000 Subject: [PATCH 29/29] Revert "Updating travis configuration." This reverts commit ea4c3c8b16a161431fa5a0bf807eab0ab6be8726. --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8651472..6bff0b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,18 +31,18 @@ matrix: env: _CC=clang-3.9 _CXX=clang++-3.9 _BUILD="-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_CXX_STANDARD=14" before_install: - - sudo add-apt-repository ppa:beineri/opt-qt562-trusty -y + - sudo add-apt-repository ppa:beineri/opt-qt551 -y - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - - sudo add-apt-repository ppa:george-edison55/cmake-3.x -y + - sudo add-apt-repository ppa:george-edison55/precise-backports -y - wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo apt-add-repository "deb http://apt.llvm.org/precise/ llvm-toolchain-precise-3.9 main" -y - sudo apt-get update -q - - sudo apt-get install g++-5 g++-6 clang-3.9 cmake cmake-data qt56base qt55serialport -y + - sudo apt-get install g++-5 g++-6 clang-3.9 cmake cmake-data qt55declarative qt55serialport -y before_script: - mkdir build - cd build - - source /opt/qt56/bin/qt56-env.sh + - source /opt/qt55/bin/qt55-env.sh - CC=${_CC} CXX=${_CXX} cmake .. -DCC_UBLOX_FULL_SOLUTION=ON ${_BUILD} script: