m2etis  0.4
MessageType.h
Go to the documentation of this file.
1 /*
2  Copyright (2016) Michael Baer, Daniel Bonrath, All rights reserved.
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15  */
16 
22 #ifndef __M2ETIS_MESSAGE_MESSAGETYPE_H__
23 #define __M2ETIS_MESSAGE_MESSAGETYPE_H__
24 
25 #include <cstdint>
26 
27 namespace m2etis {
28 namespace message {
29 
30  // Mask to calculate the message Number
31  static const uint32_t MSG_TYPE_MASK = 65535; // bit 0-15
32  static const uint32_t ACTION_TYPE_MASK = 4294901760; // bit 16-31
33 
34  // Defining type for messages on a certain channel. May change on embedded architectures. Therefore defined here as typedef
35  typedef uint32_t MessageType;
36 
37  enum ActionType : uint32_t {
38  NONE = 1<<16, // 65536
39  SUBSCRIBE = 1<<17, // 131072
40  UNSUBSCRIBE = 1<<18, // 262144
41  PUBLISH = 1<<19, // 524288
42  CONTROL = 1<<20, // 1048576
43  NOTIFY = 1<<21, // 2097152
44  JOIN = 1<<22, // 4194304
45  STATE = 1<<23, // 8388608
46  LEAVE = 1<<24, // 16777216
47  };
48 
49 } /* namespace message */
50 } /* namespace m2etis */
51 
52 #endif /* __M2ETIS_MESSAGE_MESSAGETYPE_H__ */
53 
static const uint32_t MSG_TYPE_MASK
Definition: MessageType.h:31
uint32_t MessageType
Definition: MessageType.h:35
static const uint32_t ACTION_TYPE_MASK
Definition: MessageType.h:32