HerkuleXLib  1.1
Arduino library to drive HerkuleX DRS-0101 and DRS-0201
Public Member Functions | List of all members
HkxPrint Class Reference

Class to manage the print of the messages. More...

#include <HkxCommunication.h>

Public Member Functions

 HkxPrint ()
 Default constructor. More...
 
 HkxPrint (HardwareSerial &serialPrint, long baudrate)
 Active constructor with default values. More...
 
 HkxPrint (HardwareSerial &serialPrint, long baudrate, bool errorMessages, bool warningMessages, bool infoMessages)
 Active constructor. More...
 
 HkxPrint (HkxPrint hkxPrint, bool errorMessages, bool warningMessages, bool infoMessages)
 Copy constructor. More...
 
void errorPrint (const String &message) const
 Print error. More...
 
void warningPrint (const String &message) const
 Print warning. More...
 
void infoPrint (const String &message) const
 Print info. More...
 

Detailed Description

Class to manage the print of the messages.

This class manages the print of the messages (error, warning and info) for a serial monitor.

Constructor & Destructor Documentation

HkxPrint::HkxPrint ( )
inline

Default constructor.

The default constructor is used when no messages should be (user decision) or can be (for certain Arduino boards) sent.

Example for void print communication:

HkxPrint print = HkxPrint();
HkxPrint::HkxPrint ( HardwareSerial &  serialPrint,
long  baudrate 
)
inline

Active constructor with default values.

The active constructor with default values setup the serial communication for only error messages.

Parameters
[in]serialPrint: Serial port to use to send the messages. It will be most ot the time Serial.
[in]baudrate: value of the bauderate to send the messages. The same value shall be setup for the serial monitor.

Example to display only error messages over Serial port:

HkxPrint print = HkxPrint(Serial, 9600);
HkxPrint::HkxPrint ( HardwareSerial &  serialPrint,
long  baudrate,
bool  errorMessages,
bool  warningMessages,
bool  infoMessages 
)
inline

Active constructor.

The active constructor setup the serial communication and the type of messages to send (error, warning and info).

Parameters
[in]serialPrint: Serial port to use to send the messages. It will be most ot the time Serial.
[in]baudrate: value of the bauderate to send the messages. The same value shall be setup for the serial monitor.
[in]errorMessages: set true to display error messages, false otherwise.
[in]warningMessages: set true to display warning messages, false otherwise.
[in]infoMessages: set true to display info messages, false otherwise.

Example to display error and warning messages (but not info) over Serial port:

HkxPrint print = HkxPrint(Serial, 9600, true, true, false);
HkxPrint::HkxPrint ( HkxPrint  hkxPrint,
bool  errorMessages,
bool  warningMessages,
bool  infoMessages 
)
inline

Copy constructor.

The copy constructor copy the serial communication from reference hkxPrint, and setup the type of messages to send (error, warning and info).

Parameters
[in]hkxPrint: Reference HkxPrint for the copy.
[in]errorMessages: set true to display error messages, false otherwise.
[in]warningMessages: set true to display warning messages, false otherwise.
[in]infoMessages: set true to display info messages, false otherwise.

Example to copy print1 (that display only errors) but display error, warning and info messages over Serial port:

HkxPrint print1 = HkxPrint(Serial, 9600);
HkxPrint print2 = HkxPrint(print1, true, true, true);

Member Function Documentation

void HkxPrint::errorPrint ( const String &  message) const
inline

Print error.

Print an error message if setup.

Parameters
[in]message: content to print as an error.

Example:

HkxPrint print = HkxPrint(print1, true, true, true);
print.errorPrint(F("Hello world")); // F("...") stores the text in flash memory to save RAM memory
void HkxPrint::infoPrint ( const String &  message) const
inline

Print info.

Print an info message if setup.

Parameters
[in]message: content to print as an info.

Example:

HkxPrint print = HkxPrint(print1, true, true, true);
print.infoPrint(F("Hello world")); // F("...") stores the text in flash memory to save RAM memory
void HkxPrint::warningPrint ( const String &  message) const
inline

Print warning.

Print a warning message if setup.

Parameters
[in]message: content to print as a warning.

Example:

HkxPrint print = HkxPrint(print1, true, true, true);
print.warningPrint(F("Hello world")); // F("...") stores the text in flash memory to save RAM memory

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