A C++ template library for embedded applications
Designed and maintained by
Aster Consulting Ltd
MIT licensed
Join the ETL community

Messages

Message types used for many of the framework classes.

____________________________________________________________________________________________________
message_types.h

etl::message_id_t

The type used for message ids.

By default can hold a value between 0 and 255.
If ETL_MESSAGE_ID_TYPE is defined then this type will be used instead.

____________________________________________________________________________________________________
etl::message_router_id_t

The type used for message router ids.
Can hold a value between 0 and 255.

____________________________________________________________________________________________________
message.h

The message classes are the common communication method across all of the message capable frameworks.
They are identified by a unique id number that specialises the base class.

if ETL_POLYMORPHIC_MESSAGES is defined then messages have a public virtual destructor. The default is protected non-
virtual.

____________________________________________________________________________________________________

imessage


The base class for messages.
It is this class that is passed around, usually by const reference.

const etl::message_id_t message_id;
The id of the message

____________________________________________________________________________________________________

message


Inherits from etl::imessage.

Requires an integral id as the template parameter.

____________________________________________________________________________________________________
message_id

The id of the message.
Can be accessed by etl::imessage or etl::message instances.

____________________________________________________________________________________________________
ID

The id of the message as an enum.
Can be accessed by etl::message instances.


____________________________________________________________________________________________________

Example


enum
{
  START,
  STOP,
  SET_SPEED
};

struct Start : public etl::message<START>
{
};

struct Stop : public etl::message<STOP>
{
  bool isEmergencyStop;
};

struct SetSpeed : public etl::message<SET_SPEED>
{
  uint32_t speed;
};

void Receive(const etl::imessage& msg);