-
Notifications
You must be signed in to change notification settings - Fork 13
/
CfgInf.h
176 lines (148 loc) · 6.05 KB
/
CfgInf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
//
// 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 <http:https://www.gnu.org/licenses/>.
/// @file
/// @brief Contains definition of CFG-INF message and its fields.
#pragma once
#include "ublox/Message.h"
#include "ublox/field/cfg.h"
namespace ublox
{
namespace message
{
/// @brief Accumulates details of all the CFG-INF message fields.
/// @see CfgInf
struct CfgInfFields
{
/// @brief Protocol ID enumeration.
using ProtocolId = field::cfg::ProtocolId;
/// @brief Use this enumeration to access right bitmask in @ref infMsgMask list field.
enum
{
infMsgMask_ddc, ///< index of @b DDC bitmask field
infMsgMask_uart, ///< index of @b UART bitmask field
infMsgMask_uart2, ///< index of @b UART2 bitmask field
infMsgMask_usb, ///< index of @b USB bitmask field
infMsgMask_spi, ///< index of @b SPI bitmask field
infMsgMask_reserved, ///< index of reserved bitmask field
infMsgMask_numOfValues ///< number of available masks
};
/// @brief Definition of "protocolID" field.
using protocolID = field::cfg::protocolID;
/// @brief Definition of "reserved0" field.
using reserved0 = field::common::res1;
/// @brief Definition of "reserved1" field.
using reserved1 = field::common::res2;
/// @brief definition of single bitmask value field in @ref infMsgMask field
struct mask : 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(ERROR, WARNING, NOTICE, DEBUG, TEST);
};
/// @brief Definition of "infMsgMask" field.
/// @tparam TOpt Extra option(s)
template <typename TOpt = comms::option::EmptyOption>
using infMsgMask =
field::common::ListT<
mask,
comms::option::SequenceFixedSize<infMsgMask_numOfValues>,
TOpt
>;
/// @brief Definition of a single configuration bundle element in @ref list field.
/// @tparam TOpt Extra option(s) for @ref infMsgMask field.
template <typename TOpt = comms::option::EmptyOption>
struct element : public
field::common::BundleT<
std::tuple<
protocolID,
reserved0,
reserved1,
infMsgMask<TOpt>
>
>
{
/// @brief Allow access to internal fields.
/// @details See definition of @b COMMS_FIELD_MEMBERS_ACCESS macro
/// related to @b comms::field::Bundle class from COMMS library
/// for details.
COMMS_FIELD_MEMBERS_ACCESS(protocolID, reserved0, reserved1, infMsgMask);
};
/// @brief @ref CfgInf message may contain multiple configuration elements
/// (see @ref element). This field defines a list of such elements.
/// @tparam TListOpt Extra option(s) for @ref list field itself.
/// @tparam TInfMsgMaskOpt Extra option(s) for @ref infMsgMask field.
template <
typename TListOpt = comms::option::EmptyOption,
typename TInfMsgMaskOpt = comms::option::EmptyOption>
using list = field::common::ListT<element<TInfMsgMaskOpt>, TListOpt>;
/// @brief All the fields bundled in std::tuple.
/// @tparam TListOpt Extra option(s) for @ref list field.
/// @tparam TInfMsgMaskOpt Extra option(s) for @ref infMsgMask field.
template <
typename TListOpt = comms::option::EmptyOption,
typename TInfMsgMaskOpt = comms::option::EmptyOption>
using All = std::tuple<
list<TListOpt, TInfMsgMaskOpt>
>;
};
/// @brief Definition of CFG-INF message
/// @details Inherits from @b comms::MessageBase
/// while providing @b TMsgBase as common interface class as well as
/// various implementation options. @n
/// See @ref CfgInfFields 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.
/// @tparam TInfMsgMaskOpt Extra option(s) for @b infMsgMask field.
template <
typename TMsgBase = Message,
typename TListOpt = comms::option::EmptyOption,
typename TInfMsgMaskOpt = comms::option::EmptyOption>
class CfgInf : public
comms::MessageBase<
TMsgBase,
comms::option::StaticNumIdImpl<MsgId_CFG_INF>,
comms::option::FieldsImpl<CfgInfFields::All<TListOpt, TInfMsgMaskOpt> >,
comms::option::MsgType<CfgInf<TMsgBase, TListOpt, TInfMsgMaskOpt> >
>
{
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 list for @ref CfgInfFields::list field
COMMS_MSG_FIELDS_ACCESS(list);
/// @brief Default constructor
CfgInf() = default;
/// @brief Copy constructor
CfgInf(const CfgInf&) = default;
/// @brief Move constructor
CfgInf(CfgInf&& other) = default;
/// @brief Destructor
~CfgInf() = default;
/// @brief Copy assignment
CfgInf& operator=(const CfgInf&) = default;
/// @brief Move assignment
CfgInf& operator=(CfgInf&&) = default;
};
} // namespace message
} // namespace ublox