-
Notifications
You must be signed in to change notification settings - Fork 0
/
DccFunction.h
50 lines (40 loc) · 1.71 KB
/
DccFunction.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* Declaration of a DCC function
*/
#ifndef _DCC_FUNCTION_H_
#define _DCC_FUNCTION_H_
#include "CrossFunc.h"
#include <Arduino.h>
#include <WiFi.h>
// State of DCC functions
#define OFF 0 // Off
#define ON 1 // On
class DccFunction {
private:
// Function
byte fn; // No. of the function
/*
* 0 ... 28
*/
byte state; // State of the function
/*
* OFF, ON
*/
String stateTxt[2] = { "OFF", "ON" }; // State as a text --> used for debugging
String label; // Name of the function
// WiThrottle server communication
String cmdPrefix; // Prefix to be used in the communication to WiThrottle server
public:
// Constructor
DccFunction(void);
// Initialize Class
void setFn(byte fn); // Set function number
void setPrefix(String cmdPrefix); // Set Prefix for WiThrottle server communication
// Change state of the function
void toggle(); // Change state
void on(); // Change state to On
void off(); // Change state to Off
// WiThrottle server communication
void listenToLoco(String serverInfo); // Use information sent by WiThrottle server to WiThrottle to update the DCC function's information about state and label
};
#endif