QPIDfirmware  v0.1
Object oriented firmware for autonomous motor drivers with encoder based PID controller and flexible interface
QPID_Object Class Reference

Base class for all QPID classes. Establishes interface for message processing and provides error reporting and logging functions. More...

Inheritance diagram for QPID_Object:

Public Member Functions

virtual void update ()
 (abstract) Can be overridden by QPID subsystems which need to do their own polling. Will be called by QPID_Unit::update() for subsystems, and by firmware/client for QPID_Unit itself.
 
void throwError (const char *invokedBy, const char *errorMessage)
 Writes error message and error invoking class to Serial. More...
 
void log (const char *logEntry)
 Puts timestamped string into the system log (atm: writes it out to Serial). More...
 

Protected Member Functions

 QPID_Object ()
 Constructor. Begins Serial with 115200 baud for logging and error reporting, if not done previously.
 
virtual bool processMessage (uint8_t *message)
 (abstract) Interprets message handed down from QPID_Unit locally. Must be overridden in derived classes
 

Detailed Description

Base class for all QPID classes. Establishes interface for message processing and provides error reporting and logging functions.

Note
(obsolete) throwError() uses typeinfo's typeid(this).name() to print the class causing the error. Arduino invokes the compiler with -fno-rtti flag, which disables typeid (weird c++ stuff, once again, if it's a language feature, why can you disable it by compiler flag...). So, you'll have to eliminate -fno-rtti flag from the platform.txt definition file for your target platform to make this compile.
Todo:
(done by eliminating typeid()) Having to editing platform.txt sucks. Find a better way or eliminate typeid().

Member Function Documentation

◆ throwError()

void QPID_Object::throwError ( const char *  invokedBy,
const char *  errorMessage 
)

Writes error message and error invoking class to Serial.

Parameters
invokedByA string of the class and/or function which invoked the error.
errorMessageA string describing the error.
Todo:
implement smarter error messaging

◆ log()

void QPID_Object::log ( const char *  logEntry)

Puts timestamped string into the system log (atm: writes it out to Serial).

Todo:
implement smarter logging

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