My Project
Loading...
Searching...
No Matches
MCLocoTrigger.h
Go to the documentation of this file.
1#pragma once
2
3#include "enums.h"
4#include <Arduino.h>
5
6// Loco event trigger
8{
9 public:
10 MCLocoTrigger(MCTriggerSource source, std::string eventType, std::string eventId, std::string value, int8_t delayInMs = 0);
11
12 // Returns a boolean value indicating whether the given trigger details match this trigger.
13 bool Matches(MCTriggerSource source, std::string eventType, std::string eventId, std::string value);
14
15 private:
16 // Holds the source that initialized the trigger (Loco, RocRail, ...).
17 MCTriggerSource _source;
18
19 // Holds the event that occurred (fnchanged/dirchanged/velochanged).
20 std::string _eventType;
21
22 // Holds the event identifier of the trigger (e.g. 0 or 2 for fn0 or fn2).
23 std::string _eventId;
24
25 // Holds the value of the event trigger (on/off, forward/backward/stop, accelerating/decelerating, ...).
26 std::string _value;
27
28 // Holds the delay in milliseconds between receiving the trigger and executing any related actions.
29 int8_t _delayInMs;
30};
Definition MCLocoTrigger.h:8
bool Matches(MCTriggerSource source, std::string eventType, std::string eventId, std::string value)
Definition MCLocoTrigger.cpp:6
MCLocoTrigger(MCTriggerSource source, std::string eventType, std::string eventId, std::string value, int8_t delayInMs=0)
Definition MCLocoTrigger.cpp:3
MCTriggerSource
Definition enums.h:77