EmbAJAX
Simplistic framework for creating and handling displays and controls on a web page served by an embeddable device (Arduino or other microcontroller with Arduino support).
Public Member Functions | List of all members
EmbAJAXJoystick Class Reference

#include <EmbAJAXJoystick.h>

Inheritance diagram for EmbAJAXJoystick:
Inheritance graph
[legend]
Collaboration diagram for EmbAJAXJoystick:
Collaboration graph
[legend]

Public Member Functions

 EmbAJAXJoystick (const char *id, int width, int height, const char *position_adjust=EmbAJAXJoystick_FREE_POSITION, const char *snap_back=EmbAJAXJoystick_SNAP_BACK)
 
void print () const override
 
void updateFromDriverArg (const char *argname)
 
int getX () const
 
int getY () const
 
void setPosition (int x, int y)
 
const char * valueProperty (uint8_t which=EmbAJAXBase::Value) const override
 
const char * value (uint8_t which=EmbAJAXBase::Value) const override
 
- Public Member Functions inherited from EmbAJAXElement
 EmbAJAXElement (const char *id)
 
const char * id () const
 
bool sendUpdates (uint16_t since, bool first) override
 
virtual bool valueNeedsEscaping (uint8_t which=EmbAJAXBase::Value) const
 
EmbAJAXElementtoElement () override final
 
- Public Member Functions inherited from EmbAJAXBase
void setVisible (bool visible)
 
void setEnabled (bool enabled)
 
virtual EmbAJAXElementfindChild (const char *id) const
 

Additional Inherited Members

- Public Types inherited from EmbAJAXBase
enum  Property {
  Visibility , Enabledness , Value , FirstElementSpecificProperty ,
  HTMLAllowed
}
 
- Static Public Member Functions inherited from EmbAJAXBase
static void setDriver (EmbAJAXOutputDriverBase *driver)
 
- Protected Member Functions inherited from EmbAJAXElement
void setBasicProperty (uint8_t num, bool status) override
 
bool basicProperty (uint8_t num) const
 
void setChanged ()
 
bool changed (uint16_t since)
 
void printTextInput (size_t size, const char *value) const
 
- Protected Member Functions inherited from EmbAJAXBase
void printChildren (EmbAJAXBase **children, size_t num) const
 
bool sendUpdates (EmbAJAXBase **children, size_t num, uint16_t since, bool first)
 
EmbAJAXElementfindChild (EmbAJAXBase **children, size_t num, const char *id) const
 
void printPage (EmbAJAXBase **children, size_t num, const char *_title, const char *_header, uint16_t _min_interval) const
 
void handleRequest (EmbAJAXBase **children, size_t num, void(*change_callback)())
 
- Protected Attributes inherited from EmbAJAXElement
byte _flags
 
const char * _id
 
- Static Protected Attributes inherited from EmbAJAXBase
static EmbAJAXOutputDriverBase_driver
 
static char itoa_buf [8]
 
constexpr static const char null_string [1]
 

Detailed Description

This class provides a basic joystick for directional control. WORK IN PROGRESS, API and behavior may be subject to change in future versions of EmbAJAX.

Constructor & Destructor Documentation

◆ EmbAJAXJoystick()

EmbAJAXJoystick::EmbAJAXJoystick ( const char *  id,
int  width,
int  height,
const char *  position_adjust = EmbAJAXJoystick_FREE_POSITION,
const char *  snap_back = EmbAJAXJoystick_SNAP_BACK 
)
inline

C'tor.

Parameters
widthElement width
heightElement height
position_adjustCustom javascript that will be applied to "correct" the user supplied position, e.g. snapping it to certain allowed positions. @See e.g. EmbAJAXJoystick_POSITION_9_DIRECTIONS
snap_backCustom javascript that will be applied to snap back the position on mouse release. @See EmbAJAXJoystick_SNAP_BACK

Member Function Documentation

◆ getX()

int EmbAJAXJoystick::getX ( ) const
inline

Get current x position. Position is returned as a value between -1000 and +1000 (center 0), independent of the size of the control.

◆ getY()

int EmbAJAXJoystick::getY ( ) const
inline

Get current y position. Position is returned as a value between -1000 and +1000 (center 0), independent of the size of the control.

◆ setPosition()

void EmbAJAXJoystick::setPosition ( int  x,
int  y 
)
inline

Set x/y position in the client(s). Range -1000 to +1000.

◆ updateFromDriverArg()

void EmbAJAXJoystick::updateFromDriverArg ( const char *  argname)
inlinevirtual

override this in your derived class to allow updates to be propagated from client to server (if wanted). The implementation need not call setChanged().

Reimplemented from EmbAJAXElement.

◆ value()

const char* EmbAJAXJoystick::value ( uint8_t  which = EmbAJAXBase::Value) const
inlineoverridevirtual

const char representation of the current server side value. Must be implemented in derived class. This base class handles visibility and enabledness, only. Do call the base implementation for any "which" that is not handled in your derived class.

Reimplemented from EmbAJAXElement.

◆ valueProperty()

const char* EmbAJAXJoystick::valueProperty ( uint8_t  which = EmbAJAXBase::Value) const
inlineoverridevirtual

The JS property that will have to be set on the client. Must be implemented in derived class. This base class handles visibility and enabledness, only. Do call the base implementation for any "which" that is not handled in your derived class.

Reimplemented from EmbAJAXElement.


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