ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
InputCommon.hpp
Go to the documentation of this file.
1
#pragma once
2
/*
3
* InputCommon.hpp - Input base class
4
*
5
* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
6
* Copyright (c) 2021, 2025 Shelby Merrick
7
* http://www.forkineye.com
8
*
9
* This program is provided free for you to use in any way that you wish,
10
* subject to the laws and regulations where you are using it. Due diligence
11
* is strongly suggested before using this code. Please give credit where due.
12
*
13
* The Author makes no warranty of any kind, express or implied, with regard
14
* to this program or the documentation contained in this document. The
15
* Author shall not be liable in any event for incidental or consequential
16
* damages in connection with, or arising out of, the furnishing, performance
17
* or use of these programs.
18
*
19
* This is a base class used to manage the Input port. It provides a common API
20
* for use by the factory class to manage the object.
21
*/
22
23
#include "
ESPixelStick.h
"
24
#include "
InputMgr.hpp
"
25
26
class
c_InputCommon
27
{
28
public
:
29
c_InputCommon
(
c_InputMgr::e_InputChannelIds
NewInputChannelId,
30
c_InputMgr::e_InputType
NewChannelType,
31
uint32_t BufferSize);
32
virtual
~c_InputCommon
();
33
34
// functions to be provided by the derived class
35
virtual
void
Begin
() = 0;
36
virtual
bool
SetConfig
(ArduinoJson::JsonObject & jsonConfig) = 0;
37
virtual
void
GetConfig
(ArduinoJson::JsonObject & jsonConfig) = 0;
38
virtual
void
GetStatus
(JsonObject & jsonStatus) = 0;
39
virtual
void
Process
(
void
) = 0;
40
virtual
void
GetDriverName
(String & sDriverName) = 0;
41
virtual
void
SetBufferInfo
(uint32_t BufferSize) = 0;
42
virtual
void
SetOperationalState
(
bool
ActiveFlag) {
IsInputChannelActive
= ActiveFlag; }
43
virtual
void
NetworkStateChanged
(
bool
IsConnected) {};
// used by poorly designed rx functions
44
virtual
bool
isShutDownRebootNeeded
() {
return
false
; }
45
virtual
void
ProcessButtonActions
(
c_ExternalInput::InputValue_t
value) {};
46
47
c_InputMgr::e_InputChannelIds
GetInputChannelId
() {
return
InputChannelId
; }
48
c_InputMgr::e_InputType
GetInputType
() {
return
ChannelType
; }
49
50
protected
:
51
bool
HasBeenInitialized
=
false
;
52
uint32_t
InputDataBufferSize
= 0;
53
bool
IsInputChannelActive
=
true
;
54
c_InputMgr::e_InputChannelIds
InputChannelId
=
c_InputMgr::e_InputChannelIds::InputChannelId_ALL
;
55
c_InputMgr::e_InputType
ChannelType
=
c_InputMgr::e_InputType::InputType_Disabled
;
56
57
private
:
58
59
};
// c_InputCommon
ESPixelStick.h
InputMgr.hpp
c_ExternalInput::InputValue_t
InputValue_t
Definition
externalInput.h:32
c_InputCommon
Definition
InputCommon.hpp:27
c_InputCommon::InputChannelId
c_InputMgr::e_InputChannelIds InputChannelId
Definition
InputCommon.hpp:54
c_InputCommon::SetOperationalState
virtual void SetOperationalState(bool ActiveFlag)
Definition
InputCommon.hpp:42
c_InputCommon::ChannelType
c_InputMgr::e_InputType ChannelType
Definition
InputCommon.hpp:55
c_InputCommon::ProcessButtonActions
virtual void ProcessButtonActions(c_ExternalInput::InputValue_t value)
Definition
InputCommon.hpp:45
c_InputCommon::IsInputChannelActive
bool IsInputChannelActive
Definition
InputCommon.hpp:53
c_InputCommon::GetConfig
virtual void GetConfig(ArduinoJson::JsonObject &jsonConfig)=0
Get the current config used by the driver.
c_InputCommon::Process
virtual void Process(void)=0
Call from loop(), renders Input data.
c_InputCommon::GetDriverName
virtual void GetDriverName(String &sDriverName)=0
get the name for the instantiated driver
c_InputCommon::SetConfig
virtual bool SetConfig(ArduinoJson::JsonObject &jsonConfig)=0
Set a new config in the driver.
c_InputCommon::HasBeenInitialized
bool HasBeenInitialized
Definition
InputCommon.hpp:51
c_InputCommon::c_InputCommon
c_InputCommon(c_InputMgr::e_InputChannelIds NewInputChannelId, c_InputMgr::e_InputType NewChannelType, uint32_t BufferSize)
< Start up the driver and put it into a safe mode
Definition
InputCommon.cpp:28
c_InputCommon::~c_InputCommon
virtual ~c_InputCommon()
Definition
InputCommon.cpp:39
c_InputCommon::NetworkStateChanged
virtual void NetworkStateChanged(bool IsConnected)
Definition
InputCommon.hpp:43
c_InputCommon::Begin
virtual void Begin()=0
set up the operating environment based on the current config (or defaults)
c_InputCommon::GetInputChannelId
c_InputMgr::e_InputChannelIds GetInputChannelId()
Definition
InputCommon.hpp:47
c_InputCommon::isShutDownRebootNeeded
virtual bool isShutDownRebootNeeded()
Definition
InputCommon.hpp:44
c_InputCommon::SetBufferInfo
virtual void SetBufferInfo(uint32_t BufferSize)=0
c_InputCommon::InputDataBufferSize
uint32_t InputDataBufferSize
Definition
InputCommon.hpp:52
c_InputCommon::GetInputType
c_InputMgr::e_InputType GetInputType()
Definition
InputCommon.hpp:48
c_InputCommon::GetStatus
virtual void GetStatus(JsonObject &jsonStatus)=0
c_InputMgr::e_InputType
e_InputType
Definition
InputMgr.hpp:71
c_InputMgr::InputType_Disabled
@ InputType_Disabled
Definition
InputMgr.hpp:81
c_InputMgr::e_InputChannelIds
e_InputChannelIds
Definition
InputMgr.hpp:40
c_InputMgr::InputChannelId_ALL
@ InputChannelId_ALL
Definition
InputMgr.hpp:45
include
input
InputCommon.hpp
Generated by
1.12.0