GlobalCovfefe
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
GlobalCovfefe Class Reference

This class emulates the IR sending of a GlobalCache device. More...

#include <GlobalCovfefe.h>

Inheritance diagram for GlobalCovfefe:
Inheritance graph
[legend]

Public Member Functions

 GlobalCovfefe (IrSender *irSender, int commandLed=invalidPin, int transmitLed=invalidPin)
 Main constructor. More...
 
 GlobalCovfefe (const GlobalCovfefe &orig)
 Copy constructor. More...
 
virtual ~GlobalCovfefe ()
 
void readProcessCommand (Stream &stream) const
 Reads and processes one command from the supplied Stream argument. More...
 
void getdevices (Stream &stream) const
 Implements the getdevices command. More...
 
void getversion (Stream &stream) const
 Implements the getversion command. More...
 
void sendir (Stream &stream, char *buf) const
 Implements the sendir command. More...
 
virtual void blink (unsigned int count=blinkCount, milliseconds_t delay=blinkDelay) const
 Implements the blink command (found in GC-100) More...
 

Static Public Attributes

static const char * version = VERSION
 Version of the present program. More...
 
static const uint16_t tcpPort = 4998U
 The GlobalCache standard TCP command port. More...
 
static const char eolChar = '\r'
 GlobalCache uses CR as line terminator. More...
 
static const int invalidPin = -1
 
static const size_t bufSize = 300U
 Max length on input line. More...
 
static const unsigned int blinkCount = 3
 
static const milliseconds_t blinkDelay = 200
 

Protected Member Functions

virtual void processCommand (Stream &stream, char *buf) const
 Processes one command from the supplied Stream argument. More...
 
void initLed (int pin) const
 
void turnOnLed (int pin) const
 
void turnOffLed (int pin) const
 
void turnOnOffLed (int pin, milliseconds_t delay) const
 Turns on the pin as the first argument, waits delay milli seconds, then turns off the pin. More...
 

Detailed Description

This class emulates the IR sending of a GlobalCache device.

It does not know about Ethernet, only reads from (and writes to) a Stream, given as argument to a few of the member functions.

Definition at line 27 of file GlobalCovfefe.h.

Constructor & Destructor Documentation

◆ GlobalCovfefe() [1/2]

GlobalCovfefe::GlobalCovfefe ( IrSender *  irSender,
int  commandLed = invalidPin,
int  transmitLed = invalidPin 
)

Main constructor.

Parameters
irSenderPointer to an IrSender from Infrared4Arduino.
commandLedPin number of command LED, if present.
transmitLedPin number of transmit LED, if present.

Definition at line 61 of file GlobalCovfefe.cpp.

◆ GlobalCovfefe() [2/2]

GlobalCovfefe::GlobalCovfefe ( const GlobalCovfefe orig)

Copy constructor.

Parameters
orig

Definition at line 68 of file GlobalCovfefe.cpp.

◆ ~GlobalCovfefe()

GlobalCovfefe::~GlobalCovfefe ( )
virtual

Definition at line 71 of file GlobalCovfefe.cpp.

Member Function Documentation

◆ blink()

void GlobalCovfefe::blink ( unsigned int  count = blinkCount,
milliseconds_t  delay = blinkDelay 
) const
virtual

Implements the blink command (found in GC-100)

Parameters
countNumber of times to flash.
delayDelay in milli seconds

Reimplemented in GlobalCovfefeLearner.

Definition at line 97 of file GlobalCovfefe.cpp.

◆ getdevices()

void GlobalCovfefe::getdevices ( Stream &  stream) const

Implements the getdevices command.

Parameters
streamwhere the output is written.

Definition at line 173 of file GlobalCovfefe.cpp.

◆ getversion()

void GlobalCovfefe::getversion ( Stream &  stream) const

Implements the getversion command.

Parameters
streamwhere the output is written.

Definition at line 180 of file GlobalCovfefe.cpp.

◆ initLed()

void GlobalCovfefe::initLed ( int  pin) const
protected

Definition at line 74 of file GlobalCovfefe.cpp.

◆ processCommand()

void GlobalCovfefe::processCommand ( Stream &  stream,
char *  buf 
) const
protectedvirtual

Processes one command from the supplied Stream argument.

To be overridden in derived classes that are implementing more commands.

Parameters
streamwhere possible output is written.
bufCommand line, to be interpreted.

Reimplemented in GlobalCovfefeLearner.

Definition at line 121 of file GlobalCovfefe.cpp.

◆ readProcessCommand()

void GlobalCovfefe::readProcessCommand ( Stream &  stream) const

Reads and processes one command from the supplied Stream argument.

Parameters
streamwhere the output is written.

Definition at line 104 of file GlobalCovfefe.cpp.

◆ sendir()

void GlobalCovfefe::sendir ( Stream &  stream,
char *  buf 
) const

Implements the sendir command.

The command line, by writing on the supplied argument.

Parameters
streamwhere the output (completeir) is written.
bufSupposed to hold the complete command line. Is destroyed, thereby not const.

Definition at line 150 of file GlobalCovfefe.cpp.

◆ turnOffLed()

void GlobalCovfefe::turnOffLed ( int  pin) const
protected

Definition at line 84 of file GlobalCovfefe.cpp.

◆ turnOnLed()

void GlobalCovfefe::turnOnLed ( int  pin) const
protected

Definition at line 79 of file GlobalCovfefe.cpp.

◆ turnOnOffLed()

void GlobalCovfefe::turnOnOffLed ( int  pin,
milliseconds_t  delay 
) const
protected

Turns on the pin as the first argument, waits delay milli seconds, then turns off the pin.

Parameters
pin
delay

Definition at line 89 of file GlobalCovfefe.cpp.

Member Data Documentation

◆ blinkCount

const unsigned int GlobalCovfefe::blinkCount = 3
static

Definition at line 98 of file GlobalCovfefe.h.

◆ blinkDelay

const milliseconds_t GlobalCovfefe::blinkDelay = 200
static

Definition at line 100 of file GlobalCovfefe.h.

◆ bufSize

const size_t GlobalCovfefe::bufSize = 300U
static

Max length on input line.

Definition at line 96 of file GlobalCovfefe.h.

◆ eolChar

const char GlobalCovfefe::eolChar = '\r'
static

GlobalCache uses CR as line terminator.

Period.

Definition at line 89 of file GlobalCovfefe.h.

◆ invalidPin

const int GlobalCovfefe::invalidPin = -1
static

Definition at line 91 of file GlobalCovfefe.h.

◆ tcpPort

const uint16_t GlobalCovfefe::tcpPort = 4998U
static

The GlobalCache standard TCP command port.

Definition at line 84 of file GlobalCovfefe.h.

◆ version

const char * GlobalCovfefe::version = VERSION
static

Version of the present program.

Definition at line 79 of file GlobalCovfefe.h.


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