MCPcopy Create free account
hub / github.com/Arduino-IRremote/Arduino-IRremote / IRCommandDispatcher

Class IRCommandDispatcher

src/IRCommandDispatcher.h:93–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91};
92
93class IRCommandDispatcher {
94public:
95 void init();
96 void printIRInfo(Print *aSerial);
97
98 bool checkAndRunNonBlockingCommands();
99 bool checkAndRunSuspendedBlockingCommands();
100 void setNextBlockingCommand(IRCommandType aBlockingCommandToRunNext);
101 bool delayAndCheckForStop(uint16_t aDelayMillis);
102
103 // The main dispatcher function
104 void checkAndCallCommand(bool aCallBlockingCommandImmediately);
105
106 void printIRCommandString(Print *aSerial, IRCommandType aCommand);
107 void printIRCommandStringForArrayIndex(Print *aSerial, uint_fast8_t aMappingArrayIndex);
108 void setRequestToStopReceived(bool aRequestToStopReceived = true);
109
110 IRCommandType currentBlockingCommandCalled = COMMAND_EMPTY; // The code for the current called command
111 IRCommandType lastBlockingCommandCalled = COMMAND_EMPTY; // The code for the last called command. Can be evaluated by main loop
112 IRCommandType BlockingCommandToRunNext = COMMAND_EMPTY; // Storage for command currently suspended to allow the current command to end, before it is called by main loop
113 bool justCalledBlockingCommand = false; // Flag that a blocking command was received and called - is set before call of command
114 /*
115 * Flag for running blocking commands to terminate. To check, you can use "if (IRDispatcher.requestToStopReceived) return;" (available as macro RETURN_IF_STOP).
116 * It is set if a blocking IR command received, which cannot be executed directly. Can be reset by main loop, if command has stopped.
117 * It is reset before executing a blocking command.
118 */
119 volatile bool requestToStopReceived;
120 /*
121 * This flag must be true, if we have a function, which want to interpret the IR codes by itself e.g. the calibrate function of QuadrupedControl
122 */
123 bool doNotUseDispatcher = false;
124
125 struct IRDataForCommandDispatcherStruct IRReceivedData;
126
127};
128
129extern IRCommandDispatcher IRDispatcher;
130

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected