Skip to content

Commit 226e569

Browse files
committed
Changes to the tutorials to reflect changes in the code generated by the new version of the commsdsl2comms.
1 parent 614a961 commit 226e569

File tree

7 files changed

+12
-23
lines changed

7 files changed

+12
-23
lines changed

tutorials/tutorial13/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,16 @@ One other extra thing which is worth paying attention to is how the `switch` bas
9696
(see [include/tutorial13/dispatch/DispatchMessage.h](include/tutorial13/dispatch/DispatchMessage.h))
9797
is implemented.
9898
```cpp
99-
template<typename TProtOptions, typename TMsg, typename THandler>
99+
template<typename TProtOptions, typename TId, typename TMsg, typename THandler>
100100
auto dispatchMessage(
101-
tutorial13::MsgId id,
101+
TId id,
102102
std::size_t idx,
103103
TMsg& msg,
104104
THandler& handler) -> decltype(handler.handle(msg))
105105
{
106106
using InterfaceType = typename std::decay<decltype(msg)>::type;
107-
switch(id) {
108-
case tutorial13::MsgId_M1:
107+
switch(static_cast<std::intmax_t>(id)) {
108+
case 1 /* 0x1 */:
109109
{
110110
switch (idx) {
111111
case 0U:
@@ -120,7 +120,7 @@ auto dispatchMessage(
120120
...
121121
break;
122122
}
123-
case tutorial13::MsgId_M2:
123+
case 2 /* 0x2 */:
124124
{
125125
switch (idx) {
126126
case 0U:

tutorials/tutorial14/include/tutorial14/frame/checksum/PlusOneSum.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#pragma once
22

3+
#include <cstdint>
4+
#include <type_traits>
5+
36
namespace tutorial14
47
{
58

tutorials/tutorial19/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ template <typename TMsgBase, typename TOpt = tutorial19::options::DefaultOptions
325325
class Msg3 : public
326326
comms::MessageBase<
327327
TMsgBase,
328-
comms::option::def::StaticNumIdImpl<tutorial19::MsgId_M3>,
328+
comms::option::def::StaticNumIdImpl<3 /* 0x3 */>,
329329
comms::option::def::FieldsImpl<typename Msg3Fields<TOpt>::All>,
330330
comms::option::def::MsgType<Msg3<TMsgBase, TOpt> >,
331331
comms::option::def::HasName,

tutorials/tutorial20/README.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,6 @@ As the result, for all the messages that follow, the `Version` member field
102102
the `read()` operation is forwarded to the `<payload>` layer, which in turn invokes `read()` operation of
103103
the message object.
104104

105-
----
106-
107-
**SIDE NOTE**: If [CommsChampion Tools](https://github.com/commschamp/cc_tools_qt/wiki/How-to-Use-CommsChampion-Tools)
108-
are intended to be used for the protocol visualization and/or debugging, it is better to hide the `Version` field
109-
inside the transport framing from being displayed altogether (because it's not really there). In such case it is
110-
recommended to slightly update the definition of the `<value>` layer above into the following:
111-
```xml
112-
<value name="Version" interfaceFieldName="Version" pseudo="true">
113-
<ref field="Version" displayHidden="true" />
114-
</value>
115-
```
116-
117-
---
118-
119105
Note that in this tutorial the client is also compiled to have the default version **5** (the default state of all the
120106
fields in all the messages is valid for version **5**). In order to emulate version **4** client the
121107
field of the pseudo `Version` `<value>` layer is modified when `Connect` message is sent:

tutorials/tutorial23/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ using ServerProtocolOptions =
109109
Without using options from the `t23_ext::options` the compilation will fail because
110110
`t23_ext::ns1::field::S1` [field](include/t23_ext/ns1/field/S1.h) attempts to
111111
access the options referencing `typename TOpt::t23_ext::ns1::field::S1`, which
112-
does not existing in the options provided by the `tutorial23`.
112+
does not exist in the options provided by the `tutorial23`.
113113

114114
```cpp
115115
template <typename TOpt = t23_ext::options::DefaultOptions, typename... TExtraOpts>

tutorials/tutorial24/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ template <typename TMsgBase, typename TOpt = tutorial24::options::DefaultOptions
6464
class Msg1 : public
6565
comms::MessageBase<
6666
TMsgBase,
67-
comms::option::def::StaticNumIdImpl<tutorial24::MsgId_M1>,
67+
comms::option::def::StaticNumIdImpl<1 /* 0x1 */>,
6868
comms::option::def::FieldsImpl<typename Msg1Fields<TOpt>::All>,
6969
comms::option::def::MsgType<Msg1<TMsgBase, TOpt> >,
7070
comms::option::def::HasName,

tutorials/tutorial6/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ using Frame = tutorial6::frame::Frame<Message>;
173173
```
174174

175175
The much better approach would be to reuse `AllMessages` inner type defined by the
176-
[comms::frame::ProtocolLayerBase](https://commschamp.github.io/comms_doc/classcomms_1_1protocol_1_1ProtocolLayerBase.html)
176+
[comms::frame::FrameLayerBase](https://commschamp.github.io/comms_doc/classcomms_1_1protocol_1_1ProtocolLayerBase.html)
177177
class which serves as a base type of any framing **layer**. The better code would be:
178178
```cpp
179179
using AllMessages = Frame::AllMessages;

0 commit comments

Comments
 (0)