VLCB
Loading...
Searching...
No Matches
LEDUserInterface.h
Go to the documentation of this file.
1// Copyright (C) Sven Rosvall (sven@rosvall.ie)
2// This file is part of VLCB-Arduino project on https://github.com/SvenRosvall/VLCB-Arduino
3// Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
4// The full licence can be found at: http://creativecommons.org/licenses/by-nc-sa/4.0/
5
6#pragma once
7
8#include "LED.h"
9#include "Switch.h"
10#include "Service.h"
11#include "vlcbdefs.hpp"
12
13namespace VLCB
14{
23{
24public:
26 LEDUserInterface(byte greenLedPin, byte yellowLedPin, byte pushButtonPin);
27
28 void setGreenLedPin(byte pin);
29 void setYellowLedPin(byte pin);
30 void setSwitchPin(byte pin);
31
33 virtual VlcbServiceTypes getServiceID() const override { return SERVICE_ID_NONE; }
34 virtual byte getServiceVersionID() const override { return 1; }
35
36 bool isButtonPressed();
37 virtual void process() override;
38 virtual void processAction(const Action &action) override;
40
41private:
42 LED greenLed;
43 LED yellowLed;
44 Switch pushButton;
45
46 bool resetRequested();
47 void checkRequestedAction();
48
49 void indicateMode(VlcbModeParams mode);
50};
51
52}
virtual void processAction(const Action &action) override
Called when there is an action available.
Definition LEDUserInterface.cpp:61
virtual VlcbServiceTypes getServiceID() const override
Return a unique ID for this service.
Definition LEDUserInterface.h:33
void setYellowLedPin(byte pin)
Definition LEDUserInterface.cpp:31
void setGreenLedPin(byte pin)
Definition LEDUserInterface.cpp:26
void setSwitchPin(byte pin)
Definition LEDUserInterface.cpp:36
bool isButtonPressed()
Definition LEDUserInterface.cpp:41
virtual byte getServiceVersionID() const override
Return the version of the service specification implemented by this service.
Definition LEDUserInterface.h:34
LEDUserInterface()
Definition LEDUserInterface.h:25
class to encapsulate a non-blocking LED
Definition LED.h:29
Interface base class for all VLCB services.
Definition Service.h:25
Definition Switch.h:20
Definition AbstractEventTeachingService.cpp:13
void process()
Definition VLCB.cpp:192
An action to be performed.
Definition Controller.h:90
VlcbModeParams
Definition vlcbdefs.hpp:562
VlcbServiceTypes
Definition vlcbdefs.hpp:487
@ SERVICE_ID_NONE
Definition vlcbdefs.hpp:491