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 !

Definition at line 15 of file ButtonsCommanderButton.hpp.

Constructor & Destructor Documentation

ButtonsCommanderButton::ButtonsCommanderButton ( unsigned long  inId)

Default constructor.

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

Definition at line 10 of file ButtonsCommanderButton.cpp.

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.

Definition at line 44 of file ButtonsCommanderButton.hpp.

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.

Definition at line 53 of file ButtonsCommanderButton.hpp.

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.

Definition at line 35 of file ButtonsCommanderButton.hpp.

unsigned long ButtonsCommanderButton::GetId ( ) const
inline

Gets the button's id.

Definition at line 30 of file ButtonsCommanderButton.hpp.

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.

Definition at line 62 of file ButtonsCommanderButton.hpp.

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.

Definition at line 40 of file ButtonsCommanderButton.hpp.

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.

Definition at line 58 of file ButtonsCommanderButton.hpp.

Member Data Documentation

unsigned long ButtonsCommanderButton::Id
protected

Id of this button. This id should be unique !

Definition at line 19 of file ButtonsCommanderButton.hpp.


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