#include "AccessoryLight.hpp"
Public Member Functions | |
AccessoryLight () | |
void | begin (Port *inpPort, unsigned long inId, unsigned long inBlinkDuration = 0, int inIntensity = 255) |
void | SetBlinking (unsigned long inBlinkingDelay) |
void | SetFading (uint8_t inStep, uint8_t inDelay) |
bool | IsOn () const |
bool | IsBlinking () const |
bool | IsFading () const |
void | Event (unsigned long inId, ACCESSORIES_EVENT_TYPE inEvent = ACCESSORIES_EVENT_MOVEPOSITIONID, int inData = 0) |
void | SetState (ACC_STATE inState) |
ACC_STATE | Toggle () |
void | LightOn () |
void | LightOff () |
void | Blink () |
int | EEPROMLoad (int inPos) |
![]() | |
Accessory () | |
void | begin (ACC_STATE inStartingState = STATE_NONE) |
Port * | GetPort () const |
ACC_STATE | GetState () const |
ACC_STATE | GetPreviousState () const |
bool | IsNone () const |
bool | IsFirst () const |
bool | IsSecond () const |
unsigned int | GetDebounceDelay () const |
unsigned long | GetLastMoveTime () const |
unsigned long | GetDuration () const |
bool | loop () |
virtual int | EEPROMSave (int inPos, bool inSimulate = false) |
uint8_t | AddMovingPosition (unsigned long inId, int inPosition) |
uint8_t | AddMovingPositions (const MovingPosition *inMovingPositions_P) |
void | AdjustMovingPositionsSize (uint8_t inNewSize) |
bool | IsEmpty () const |
uint8_t | IndexOfMovingPositionById (unsigned long inId) const |
int | GetMovingPositionValueById (unsigned long inId) const |
int | GetMovingPositionValueByIndex (uint8_t inIndex) const |
unsigned long | GetMovingPositionIdByIndex (uint8_t inIndex) const |
const uint8_t | GetLastMovingPosition () const |
const uint8_t | GetMovingPositionSize () const |
void | SetLastMovingPosition (uint8_t inLastPositionIndex) |
void | SetDebounceDelay (unsigned int inDebounceDelay) |
void | SetLastMoveTime () |
void | SetDuration (unsigned long inDuration) |
void | SetNextAccessory (Accessory *inAccessory) |
Accessory * | GetNextAccessory () const |
unsigned long | GetActionStartingMillis () const |
virtual void | StartAction (ACC_STATE inState) |
bool | IsActionDelayPending () const |
virtual bool | IsGroupActionPending () const |
virtual bool | CanBePositional () const |
virtual void | MovePosition (int inPosition) |
void | SetStateRaw (ACC_STATE inNewState) |
void | SetStartingMillis () |
void | ResetStartingMillis () |
Additional Inherited Members | |
![]() | |
static void | ExecuteEvent (unsigned long inId, ACCESSORIES_EVENT_TYPE inEvent = ACCESSORIES_EVENT_MOVEPOSITIONID, int inData = 0) |
static uint8_t | GetCount () |
static bool | IsActionPending () |
static Accessory * | GetFirstAccessory () |
![]() | |
Port * | pPort |
ACC_STATE | prevState |
This class describes a single light accessory.
Events handled:
id | type | data | effect |
---|---|---|---|
light id | ACCESSORIES_EVENT_MOVEPOSITIONID | toggle on/off | |
light id | ACCESSORIES_EVENT_TOGGLE | toggle on/off | |
light id | ACCESSORIES_EVENT_MOVE | ACCESSORIES_MOVE_STRAIGHT | Light on |
light id | ACCESSORIES_EVENT_MOVE | ACCESSORIES_MOVE_TOP | Light on |
light id | ACCESSORIES_EVENT_MOVE | ACCESSORIES_MOVE_LEFT | Light on |
light id | ACCESSORIES_EVENT_MOVE | ACCESSORIES_MOVE_DIVERGE | Light on |
light id | ACCESSORIES_EVENT_MOVE | ACCESSORIES_MOVE_BOTTOM | Light on |
light id | ACCESSORIES_EVENT_MOVE | ACCESSORIES_MOVE_RIGHT | Light on |
light id | ACCESSORIES_EVENT_MOVE | ACCESSORIES_MOVE_ON | Light on |
light id | ACCESSORIES_EVENT_MOVE | ACCESSORIES_MOVE_STOP | Light off |
light id | ACCESSORIES_EVENT_MOVE | ACCESSORIES_MOVE_OFF | Light off |
light id | ACCESSORIES_EVENT_MOVE | ACCESSORIES_MOVE_MORE | Increase speed of 1 |
light id | ACCESSORIES_EVENT_MOVE | ACCESSORIES_MOVE_LESS | Decrease speed of 1 |
light id | ACCESSORIES_EVENT_MOVEPOSITION | New speed | Set the light On at the given speed, without changing the current speed. |
light id | ACCESSORIES_EVENT_SETSPEED | New speed | Change the current speed |
Definition at line 36 of file AccessoryLight.hpp.
AccessoryLight::AccessoryLight | ( | ) |
Default constructor.
Definition at line 12 of file AccessoryLight.cpp.
void AccessoryLight::begin | ( | Port * | inpPort, |
unsigned long | inId, | ||
unsigned long | inBlinkDuration = 0 , |
||
int | inIntensity = 255 |
||
) |
Initialize the instance.
inpPort | Port driven this light. |
inId | Id of this accessory. |
inBlinkDuration | Blink duration, 0 for fix light. Default is 0. |
inIntensity | Intensity of this light. Default is maximum, 255. |
Definition at line 16 of file AccessoryLight.cpp.
|
inline |
Turn the light on and blink.
Definition at line 96 of file AccessoryLight.hpp.
|
virtual |
|
virtual |
Execute a new event.
inId | Id of an accessory or an accessory item. |
inEvent | Type of the new event. Default is ACCESSORIES_EVENT_MOVEPOSITIONID. |
inData | Associated data to the event type. Default is 0. |
Reimplemented from Accessory.
Definition at line 41 of file AccessoryLight.cpp.
|
inline |
Checks if the light is blinking.
Definition at line 69 of file AccessoryLight.hpp.
|
inline |
Checks if the light is fading.
Definition at line 74 of file AccessoryLight.hpp.
|
inline |
Checks if the light is on.
Definition at line 65 of file AccessoryLight.hpp.
|
inline |
Turn the light off.
Definition at line 94 of file AccessoryLight.hpp.
|
inline |
Turn the light on.
Definition at line 92 of file AccessoryLight.hpp.
|
inline |
Sets the blinking delay.
inBlinkingDelay | Blinking delay in milliseconds. |
Definition at line 55 of file AccessoryLight.hpp.
|
inline |
Set the fading mode, defining its speed.
inStep | Number of steps between light on and light off. |
inDelay | Duration of each step. |
Definition at line 60 of file AccessoryLight.hpp.
|
inlinevirtual |
Sets the internal state.
inState | new state LIGHTON, LIGHTOFF or LIGHTBLINKING. |
Reimplemented from Accessory.
Definition at line 86 of file AccessoryLight.hpp.
|
inlinevirtual |
Change the state from ON to OFF or OFF to ON.
Implements Accessory.
Definition at line 90 of file AccessoryLight.hpp.