Commanders
Arduino buttons/bus library
ButtonsCommanderButton Class Reference

#include "ButtonsCommanderButton.hpp"

Inheritance diagram for ButtonsCommanderButton:
ButtonsCommanderAnalogPushes ButtonsCommanderAnalogPushesItem ButtonsCommanderEncoder ButtonsCommanderPotentiometer ButtonsCommanderPush ButtonsCommanderSwitch ButtonsCommanderSwitchOnePin ButtonsCommanderSwitchTwoPins

Public Member Functions

 ButtonsCommanderButton (unsigned long inId)
 
unsigned long GetId () const
 
virtual ButtonsCommanderButton * GetFromId (unsigned long inId)
 
virtual int GetPosition () const
 
virtual void beforeFirstLoop ()
 
virtual unsigned long loop ()
 
virtual void EndLoop ()
 
void SetNextButton (ButtonsCommanderButton *inpButton)
 
ButtonsCommanderButton * GetNextButton () const
 

Protected Attributes

unsigned long Id
 

Detailed Description

A button is a hardware device allowing user to act when this device is used. Its id is sent, and the listener of the commander events can do the job.

This is the base class for all buttons, this class should not be instantiate !

Constructor & Destructor Documentation

ButtonsCommanderButton::ButtonsCommanderButton ( unsigned long  inId)

Default constructor.

Parameters
inIdeach button can be identified by at least one id.

Member Function Documentation

virtual void ButtonsCommanderButton::beforeFirstLoop ( )
inlinevirtual

This function will be called after sketch Setup(), but before the first call to loop(). It will be called only one time.

Reimplemented in ButtonsCommanderSwitch, ButtonsCommanderSwitchTwoPins, and ButtonsCommanderSwitchOnePin.

virtual void ButtonsCommanderButton::EndLoop ( )
inlinevirtual

Reinitialize the button for future use. Called at the end of the loop, if an event has been raised.

Reimplemented in ButtonsCommanderAnalogPushes.

virtual ButtonsCommanderButton* ButtonsCommanderButton::GetFromId ( unsigned long  inId)
inlinevirtual

Gets the button's address from its id.

Parameters
inIdid to find.
Returns
found button address or NULL if not found.

Reimplemented in ButtonsCommanderAnalogPushes.

unsigned long ButtonsCommanderButton::GetId ( ) const
inline

Gets the button's id.

ButtonsCommanderButton* ButtonsCommanderButton::GetNextButton ( ) const
inline

Gets the next button of 'this' in the linked list.

Returns
address of the next button, or NULL if this was the end of the list.
virtual int ButtonsCommanderButton::GetPosition ( ) const
inlinevirtual

Gets the current position of the button. Only possible on analog buttons like potentiometers or encoders.

Returns
Current value, or 0 if the button does not allow this.

Reimplemented in ButtonsCommanderEncoder, and ButtonsCommanderPotentiometer.

virtual unsigned long ButtonsCommanderButton::loop ( )
inlinevirtual
void ButtonsCommanderButton::SetNextButton ( ButtonsCommanderButton *  inpButton)
inline

Adds a new button at the end of the button linked list.

Parameters
inpButtonnew button to add.

Member Data Documentation

unsigned long ButtonsCommanderButton::Id
protected

Id of this button. This id should be unique !


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