Go to the documentation of this file.
29 #ifndef _IR_COMMAND_DISPATCHER_H
30 #define _IR_COMMAND_DISPATCHER_H
36 #if defined(USE_DISPATCHER_COMMAND_STRINGS)
37 #define COMMAND_STRING(anyString) anyString
39 #define COMMAND_STRING(anyString)
44 #define IR_COMMAND_FLAG_BLOCKING 0x00 // default - blocking command, repeat not accepted, only one command at a time. Stops an already running command.
45 #define IR_COMMAND_FLAG_REPEATABLE 0x01 // repeat accepted
46 #define IR_COMMAND_FLAG_NON_BLOCKING 0x02 // Non blocking (short) command that can be processed any time and may interrupt other IR commands - used for stop, set direction etc.
47 #define IR_COMMAND_FLAG_REPEATABLE_NON_BLOCKING (IR_COMMAND_FLAG_REPEATABLE | IR_COMMAND_FLAG_NON_BLOCKING)
48 #define IR_COMMAND_FLAG_BEEP 0x04 // Do a single short beep before executing command. May not be useful for short or repeating commands.
49 #define IR_COMMAND_FLAG_BLOCKING_BEEP (IR_COMMAND_FLAG_BLOCKING | IR_COMMAND_FLAG_BEEP)
51 #if !defined(IS_STOP_REQUESTED)
52 #define IS_STOP_REQUESTED IRDispatcher.requestToStopReceived
54 #if !defined(RETURN_IF_STOP)
55 #define RETURN_IF_STOP if (IRDispatcher.requestToStopReceived) return
57 #if !defined(BREAK_IF_STOP)
58 #define BREAK_IF_STOP if (IRDispatcher.requestToStopReceived) break
60 #if !defined(DELAY_AND_RETURN_IF_STOP)
61 #define DELAY_AND_RETURN_IF_STOP(aDurationMillis) if (IRDispatcher.delayAndCheckForStop(aDurationMillis)) return
67 #if defined(DISPATCHER_IR_COMMAND_HAS_MORE_THAN_8_BIT)
68 #define COMMAND_EMPTY __UINT_FAST16_MAX__ // 0xFFFF code no command
72 #define COMMAND_EMPTY __UINT_FAST8_MAX__ // 0xFF code no command
80 #if defined(USE_DISPATCHER_COMMAND_STRINGS)
81 const char *CommandString;
131 #endif // _IR_COMMAND_DISPATCHER_H
volatile bool requestToStopReceived
IRCommandType currentBlockingCommandCalled
void printIRInfo(Print *aSerial)
volatile bool isAvailable
IRCommandType BlockingCommandToRunNext
void setNextBlockingCommand(IRCommandType aBlockingCommandToRunNext)
volatile uint32_t MillisOfLastCode
void printIRCommandStringForArrayIndex(Print *aSerial, uint_fast8_t aMappingArrayIndex)
IRCommandType lastBlockingCommandCalled
void printIRCommandString(Print *aSerial, IRCommandType aCommand)
bool delayAndCheckForStop(uint16_t aDelayMillis)
uint_fast8_t IRCommandType
void setRequestToStopReceived(bool aRequestToStopReceived=true)
IRCommandDispatcher IRDispatcher
struct IRDataForCommandDispatcherStruct IRReceivedData
void checkAndCallCommand(bool aCallBlockingCommandImmediately)
bool checkAndRunNonBlockingCommands()
bool justCalledBlockingCommand
bool checkAndRunSuspendedBlockingCommands()