Accessories
Arduino for motors and lights library.
AccessoryGroup Class Reference

#include "AccessoryGroup.hpp"

Public Member Functions

void begin ()
 
void AddState (GroupState *inpState)
 
void AddState (unsigned long inId, bool inSynchronous = true)
 
void AddStateItem (unsigned long inId, Accessory &inAccessory, ACC_STATE inState, unsigned int inDelay = 0)
 
void AddRange (const AccessoryGroup &inGroup)
 
GroupStateGetByID (unsigned long inId) const
 
ACCSCHAINEDLISTITEM< GroupState > * GetItemByID (unsigned long inId) const
 
void Event (unsigned long inId, ACCESSORIES_EVENT_TYPE inEvent = ACCESSORIES_EVENT_MOVEPOSITIONID, int inData = 0)
 
void StartAction (GroupState *inpState)
 
void ResetAction ()
 
bool IsActionItemPending ()
 
bool loop ()
 
bool Toggle (unsigned long inId)
 
int EEPROMSave (int inPos, bool inSimulate = false)
 
int EEPROMLoad (int inPos)
 

Static Public Member Functions

static void EventAll (unsigned long inId, ACCESSORIES_EVENT_TYPE inEvent = ACCESSORIES_EVENT_MOVEPOSITIONID, int inData = 0)
 
static bool loops ()
 
static uint8_t GetCount ()
 
static int EEPROMSaveAll (int inPos, bool inSimulate = false)
 
static int EEPROMLoadAll (int inPos)
 

Detailed Description

This class describes a group of accessories. Each group defines some GroupState to set multiple accessories states with only one Id.

Definition at line 120 of file AccessoryGroup.hpp.

Member Function Documentation

void AccessoryGroup::AddRange ( const AccessoryGroup &  inGroup)

Insert a full group into this one.

Parameters
inGroupgroup to insert. All states of inGroup will be added to this group.

Definition at line 204 of file AccessoryGroup.cpp.

void AccessoryGroup::AddState ( GroupState inpState)
inline

Add a new state.

Parameters
inpStateAddress of the GroupState to add.

Definition at line 140 of file AccessoryGroup.hpp.

void AccessoryGroup::AddState ( unsigned long  inId,
bool  inSynchronous = true 
)
inline

Add a new state.

Parameters
inIdid of this state.
inSynchronous

Definition at line 146 of file AccessoryGroup.hpp.

void AccessoryGroup::AddStateItem ( unsigned long  inId,
Accessory inAccessory,
ACC_STATE  inState,
unsigned int  inDelay = 0 
)

Add a new state item, into the state of the given id.

Parameters
inIdid of the state to complete.
inAccessoryAccessory.
inStatestate to reach.
inDelayThe delay gives a duration of the movement, to ensure that this movement is finished before starting the next one.Only used in asynchronous group state. Default is 0.

Definition at line 171 of file AccessoryGroup.cpp.

void AccessoryGroup::begin ( )

Initialize the instance.

Definition at line 164 of file AccessoryGroup.cpp.

int AccessoryGroup::EEPROMLoad ( int  inPos)

Reload the data of the group from the EEPROM.

Remarks
Only for internal usage.
static int AccessoryGroup::EEPROMLoadAll ( int  inPos)
static

Reload the data of all the groups from the EEPROM.

Remarks
Only for internal usage.
int AccessoryGroup::EEPROMSave ( int  inPos,
bool  inSimulate = false 
)

Save the data of this group in the EEPROM.

Remarks
Only for internal usage.
static int AccessoryGroup::EEPROMSaveAll ( int  inPos,
bool  inSimulate = false 
)
static

Save the data of all the groups in the EEPROM.

Remarks
Only for internal usage.
void AccessoryGroup::Event ( unsigned long  inId,
ACCESSORIES_EVENT_TYPE  inEvent = ACCESSORIES_EVENT_MOVEPOSITIONID,
int  inData = 0 
)

Execute a new event. Nothing appends if the Id is not in this group.

Parameters
inIdId of an accessory or an accessory item.
inEventType of the new event. Default is ACCESSORIES_EVENT_MOVEPOSITIONID.
inDataAssociated data to the event type. Default is 0.

Definition at line 339 of file AccessoryGroup.cpp.

void AccessoryGroup::EventAll ( unsigned long  inId,
ACCESSORIES_EVENT_TYPE  inEvent = ACCESSORIES_EVENT_MOVEPOSITIONID,
int  inData = 0 
)
static

Loop through all AccessoryGroup and execute a new event.

Parameters
inIdId of an accessory or an accessory item.
inEventType of the new event. Default is ACCESSORIES_EVENT_MOVEPOSITIONID.
inDataAssociated data to the event type. Default is 0.

Definition at line 314 of file AccessoryGroup.cpp.

GroupState * AccessoryGroup::GetByID ( unsigned long  inId) const

Gets a state by seraching an id.

Parameters
inIdId to found.
Returns
found GroupState address or NULL.

Definition at line 228 of file AccessoryGroup.cpp.

uint8_t AccessoryGroup::GetCount ( )
static

Get the total number of groups.

Remarks
Only for internal usage.

Definition at line 215 of file AccessoryGroup.cpp.

ACCSCHAINEDLISTITEM< GroupState > * AccessoryGroup::GetItemByID ( unsigned long  inId) const

Gets the item list from a given GroupState idenitifed by its id.

Parameters
inIdId to found.
Returns
found GroupState item list or NULL.

Definition at line 238 of file AccessoryGroup.cpp.

bool AccessoryGroup::IsActionItemPending ( )

Checks if a state item has not been executed.

Returns
true if at least one accessory should still move.

Definition at line 252 of file AccessoryGroup.cpp.

bool AccessoryGroup::loop ( )

Main loop function.

Returns
true if something has been done.

Definition at line 281 of file AccessoryGroup.cpp.

bool AccessoryGroup::loops ( )
static

Do movements of all the groups.

Remarks
Only for internal usage.

Definition at line 294 of file AccessoryGroup.cpp.

void AccessoryGroup::ResetAction ( )
inline

Prepare for a future action

Remarks
Only for internal usage.

Definition at line 195 of file AccessoryGroup.hpp.

void AccessoryGroup::StartAction ( GroupState inpState)

Starts a new action.

Parameters
inpStateaddress of the starting state.
Remarks
Only for internal usage.

Definition at line 257 of file AccessoryGroup.cpp.

bool AccessoryGroup::Toggle ( unsigned long  inId)

Move to the next GroupState.

Returns
returns the new state.

Definition at line 344 of file AccessoryGroup.cpp.


The documentation for this class was generated from the following files: