tcMenu
MessageProcessors.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 https://www.thecoderscorner.com (Nutricherry LTD).
3  * This product is licensed under an Apache license, see the LICENSE file in the top-level directory.
4  *
5  * MessageProcessors.h - standard message processors that decode tcMenu messages.
6  */
7 
8 #ifndef _TCMENU_MESSAGEPROCESSORS_H_
9 #define _TCMENU_MESSAGEPROCESSORS_H_
10 
11 #include <PlatformDetermination.h>
12 #include "tcMenu.h"
13 
21 class TagValueRemoteConnector; // forward reference
22 class FieldAndValue; // forward reference
23 
36  struct {
37  MenuItem* item;
38  int changeValue;
39  uint32_t correlation;
40  ChangeType changeType;
41  } value;
42  struct {
43  uint8_t major, minor;
44  ApiPlatform platform;
45  bool authProvided;
46  } join;
47  struct {
48  char name[16];
49  } pairing;
50  struct {
51  char mode;
52  uint8_t button;
53  uint32_t correlation;
54  } dialog;
55  struct {
56  HeartbeatMode hbMode;
57  } hb;
58 };
59 
67 struct MsgHandler {
71  uint16_t msgType;
72 };
73 
79 extern MsgHandler msgHandlers[];
80 #define MSG_HANDLERS_SIZE 5
81 
86 
91 
96 
101 
106 
116 private:
118  MsgHandler* handlers;
119  int noOfHandlers;
120 
121  MsgHandler* currHandler;
122  uint16_t currentMsgType;
123 public:
127  CombinedMessageProcessor(MsgHandler handlers[], int noOfHandlers);
131  void newMsg(uint16_t msgType);
135  void fieldUpdate(TagValueRemoteConnector* connector, FieldAndValue* field);
136 };
137 
138 #endif /* _TCMENU_MESSAGEPROCESSORS_H_ */
void fieldUpdateValueMsg(TagValueRemoteConnector *connector, FieldAndValue *field, MessageProcessorInfo *info)
Definition: MessageProcessors.cpp:210
Definition: MenuItems.h:324
void fieldUpdateDialogMsg(TagValueRemoteConnector *connector, FieldAndValue *field, MessageProcessorInfo *info)
Definition: MessageProcessors.cpp:47
Definition: RemoteConnector.h:77
void fieldUpdateJoinMsg(TagValueRemoteConnector *connector, FieldAndValue *field, MessageProcessorInfo *info)
Definition: MessageProcessors.cpp:88
Definition: MessageProcessors.h:115
ApiPlatform
Definition: RemoteTypes.h:138
HeartbeatMode
Definition: RemoteTypes.h:148
MsgHandler msgHandlers[]
Definition: MessageProcessors.cpp:20
Definition: MessageProcessors.h:35
void fieldUpdatePairingMsg(TagValueRemoteConnector *connector, FieldAndValue *field, MessageProcessorInfo *info)
Definition: MessageProcessors.cpp:74
uint16_t msgType
Definition: MessageProcessors.h:71
Definition: MessageProcessors.h:67
Definition: RemoteConnector.h:158
ChangeType
Definition: RemoteTypes.h:131
void fieldUpdateHeartbeatMsg(TagValueRemoteConnector *connector, FieldAndValue *field, MessageProcessorInfo *info)
Definition: MessageProcessors.cpp:28