CheeseBoard
A library for use with the CheeseBoard Cheddar platform
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
GfxSSIDListBox Class Reference
Inheritance diagram for GfxSSIDListBox:
Inheritance graph

Public Member Functions

 GfxSSIDListBox (uint16_t x=0, uint16_t y=0)
 
int16_t add (const GfxNetInfo s)
 
bool remove (const uint8_t idx, bool compactAfter=true)
 
void draw (uint16_t xOffset=0, uint16_t yOffset=0)
 
uint16_t width ()
 
uint16_t height ()
 
uint16_t lineHeight ()
 
GfxNetInfooperator[] (int16_t idx)
 
GfxNetInfooperator[] (const String &ssid)
 
int16_t find (const String &ssid, uint8_t n=1)
 
bool select (int16_t idx)
 
int16_t selected ()
 
uint8_t scrollDown (uint8_t rows)
 
uint8_t scrollUp (uint8_t rows)
 
bool scrollTo (uint8_t idx)
 
int16_t update (String ssid, int8_t channel, uint8_t signal)
 
int16_t findNext (uint8_t from=0)
 
int16_t findPreceding (uint8_t from=MaxItems)
 
uint8_t count ()
 

Static Public Attributes

static const uint8_t MaxItems = 32
 

Protected Member Functions

int16_t findGap (uint8_t startAt=0)
 
bool isCompacted ()
 Sort the items contained in the list box using quicksort. More...
 
void compact ()
 Make used items contiguous (remove gaps) More...
 
bool isOnScreen (uint8_t idx)
 
uint8_t rowsFrom (uint8_t idx)
 

Protected Attributes

GfxNetInfo_items [MaxItems]
 
int16_t _selected
 
uint8_t _screenLines
 
uint8_t _screenStart
 
uint8_t _lineHeight
 

Detailed Description

Definition at line 8 of file GfxSSIDListBox.h.

Member Function Documentation

◆ add()

int16_t GfxSSIDListBox::add ( const GfxNetInfo  s)

Adds a string item to the list box at the first free entry.

Parameters
sthe string to add to the list box.
Returns
index the item was added at if successful, else -1.

Definition at line 33 of file GfxSSIDListBox.cpp.

◆ compact()

void GfxSSIDListBox::compact ( )
protected

Make used items contiguous (remove gaps)

Make used items contiguous (remove gaps).

Definition at line 188 of file GfxSSIDListBox.cpp.

Here is the caller graph for this function:

◆ count()

uint8_t GfxSSIDListBox::count ( )

Get number of items in list.

Returns
how many non-NULL items are in the list.

Definition at line 146 of file GfxSSIDListBox.cpp.

Here is the caller graph for this function:

◆ draw()

void GfxSSIDListBox::draw ( uint16_t  xOffset = 0,
uint16_t  yOffset = 0 
)
virtual

Draw the GfxSSIDListBox (do not send buffer to CbOledDisplay) Items contains NULL strings will not be displayed

Implements GfxItem.

Definition at line 65 of file GfxSSIDListBox.cpp.

Here is the call graph for this function:

◆ find()

int16_t GfxSSIDListBox::find ( const String &  ssid,
uint8_t  n = 1 
)
Returns
index of nth item which has the SSID ssid, or -1 if not found
Parameters
ssidthe SSID of the object to find
nthe nth instance to search for

Definition at line 157 of file GfxSSIDListBox.cpp.

◆ findGap()

int16_t GfxSSIDListBox::findGap ( uint8_t  startAt = 0)
protected

Find the next free slot.

Returns
index of first "gap" (i.e. where item is NULL), or -1 if there are no gaps.
Parameters
startAtindex to start looking for gaps at.

Definition at line 111 of file GfxSSIDListBox.cpp.

Here is the caller graph for this function:

◆ findNext()

int16_t GfxSSIDListBox::findNext ( uint8_t  from = 0)

Find next.

Returns
the first index which is not NULL after "from", or -1 if not found.
Parameters
fromthe index to search from.

Definition at line 122 of file GfxSSIDListBox.cpp.

Here is the caller graph for this function:

◆ findPreceding()

int16_t GfxSSIDListBox::findPreceding ( uint8_t  from = MaxItems)

Find preceeding.

Returns
the first index which is not NULL before "from", or -1 if not found.
Parameters
fromthe index to search from.

Definition at line 132 of file GfxSSIDListBox.cpp.

Here is the caller graph for this function:

◆ height()

uint16_t GfxSSIDListBox::height ( )
virtual

Get object height.

Returns
Object height in pixels.

Implements GfxItem.

Definition at line 87 of file GfxSSIDListBox.cpp.

◆ isCompacted()

bool GfxSSIDListBox::isCompacted ( )
protected

Sort the items contained in the list box using quicksort.

Sort the items contained in the list box using quicksort.

Todo:
: Add sorting to the list, by signal strength or ssid name.

Discover compactedness state.

Returns
true if there are no gaps between string items, else false.

Definition at line 174 of file GfxSSIDListBox.cpp.

Here is the caller graph for this function:

◆ isOnScreen()

bool GfxSSIDListBox::isOnScreen ( uint8_t  idx)
protected

Find out if idx is currently visible on screen.

Definition at line 221 of file GfxSSIDListBox.cpp.

Here is the caller graph for this function:

◆ operator[]() [1/2]

GfxNetInfo * GfxSSIDListBox::operator[] ( int16_t  idx)

Get an GfxNetInfo pointer by index

Parameters
idxthe index of the item to fetch
Returns
NULL if there is not object at the specified index, or the index is out of range, else returns a point to the GfxNetInfo object at the specified index

Definition at line 92 of file GfxSSIDListBox.cpp.

◆ operator[]() [2/2]

GfxNetInfo * GfxSSIDListBox::operator[] ( const String &  ssid)

Get in GfxNetInfo pointer by SSID

Parameters
siidthe SSID of the item to fetch
Returns
NULL if there is not object at the specified index, or the index is out of range, else returns a point to the GfxNetInfo object at the specified index

Definition at line 101 of file GfxSSIDListBox.cpp.

◆ remove()

bool GfxSSIDListBox::remove ( const uint8_t  idx,
bool  compactAfter = true 
)

Remove item at index idx.

Parameters
idxthe index of the item to remove
compactAfterif true, compact() will be called after the item is removed
Returns
true if successful, else false

Definition at line 44 of file GfxSSIDListBox.cpp.

◆ rowsFrom()

uint8_t GfxSSIDListBox::rowsFrom ( uint8_t  idx)
protected

Find out how many rows after there from idx on (which are non-NULL).

Definition at line 235 of file GfxSSIDListBox.cpp.

Here is the caller graph for this function:

◆ scrollDown()

uint8_t GfxSSIDListBox::scrollDown ( uint8_t  rows)

Scroll down the display a number of rows

Returns
the number of rows scrolled (e.g. 0 if already as far as can do)

Definition at line 246 of file GfxSSIDListBox.cpp.

Here is the caller graph for this function:

◆ scrollTo()

bool GfxSSIDListBox::scrollTo ( uint8_t  idx)

Scrolls the displayed items until idx is displayed. Note: if idx is currently displayed, no scrolling is performed

Returns
true if scrolled OK, else false.

Definition at line 280 of file GfxSSIDListBox.cpp.

◆ scrollUp()

uint8_t GfxSSIDListBox::scrollUp ( uint8_t  rows)

Scroll up the display a number of rows

Returns
the number of rows scrolled (e.g. 0 if already as far as can do)

Definition at line 265 of file GfxSSIDListBox.cpp.

Here is the caller graph for this function:

◆ select()

bool GfxSSIDListBox::select ( int16_t  idx)

Select item at index idx

Returns
true if successful (item exists or idx was -1)
Parameters
idxthe index of the item to select, or -1 to de-select

Definition at line 204 of file GfxSSIDListBox.cpp.

◆ selected()

int16_t GfxSSIDListBox::selected ( )
Returns
the index of the currently selected item (or -1 if none are selected)

Definition at line 216 of file GfxSSIDListBox.cpp.

Here is the caller graph for this function:

◆ update()

int16_t GfxSSIDListBox::update ( String  ssid,
int8_t  channel,
uint8_t  signal 
)

Update the signal strength and channel for a specified ssid.

If the SSID doesn't exist, it will be added to the first available slot in the list.

Parameters
ssidThe SSID of the network to update/add.
channelthe channel of the network.
signalthe signal strength expressed as a percentage.
Returns
the index of the updated / added item, or -1 if the operation failed (e.g. no space in list to add a new item).

Definition at line 299 of file GfxSSIDListBox.cpp.

◆ width()

uint16_t GfxSSIDListBox::width ( )
virtual

Get object width.

Returns
Object width in pixels.

Implements GfxItem.

Definition at line 82 of file GfxSSIDListBox.cpp.


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