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
27{
28public:
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; }
46
49
50protected:
51 bool HasBeenInitialized = false;
52 uint32_t InputDataBufferSize = 0;
56
57private:
58
59}; // c_InputCommon
InputValue_t
Definition externalInput.h:32
Definition InputCommon.hpp:27
c_InputMgr::e_InputChannelIds InputChannelId
Definition InputCommon.hpp:54
virtual void SetOperationalState(bool ActiveFlag)
Definition InputCommon.hpp:42
c_InputMgr::e_InputType ChannelType
Definition InputCommon.hpp:55
virtual void ProcessButtonActions(c_ExternalInput::InputValue_t value)
Definition InputCommon.hpp:45
bool IsInputChannelActive
Definition InputCommon.hpp:53
virtual void GetConfig(ArduinoJson::JsonObject &jsonConfig)=0
Get the current config used by the driver.
virtual void Process(void)=0
Call from loop(), renders Input data.
virtual void GetDriverName(String &sDriverName)=0
get the name for the instantiated driver
virtual bool SetConfig(ArduinoJson::JsonObject &jsonConfig)=0
Set a new config in the driver.
bool HasBeenInitialized
Definition InputCommon.hpp:51
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
virtual ~c_InputCommon()
Definition InputCommon.cpp:39
virtual void NetworkStateChanged(bool IsConnected)
Definition InputCommon.hpp:43
virtual void Begin()=0
set up the operating environment based on the current config (or defaults)
c_InputMgr::e_InputChannelIds GetInputChannelId()
Definition InputCommon.hpp:47
virtual bool isShutDownRebootNeeded()
Definition InputCommon.hpp:44
virtual void SetBufferInfo(uint32_t BufferSize)=0
uint32_t InputDataBufferSize
Definition InputCommon.hpp:52
c_InputMgr::e_InputType GetInputType()
Definition InputCommon.hpp:48
virtual void GetStatus(JsonObject &jsonStatus)=0
e_InputType
Definition InputMgr.hpp:71
@ InputType_Disabled
Definition InputMgr.hpp:81
e_InputChannelIds
Definition InputMgr.hpp:40
@ InputChannelId_ALL
Definition InputMgr.hpp:45