SafeString  4.1.27
SafeString is a safe, robust and debuggable replacement for string processing in Arduino
SerialComs Class Reference

The SerialComs class sends/recieves lines of text between Arduinos via Serial, see the detailed description. More...

#include <SerialComs.h>

Inherits SafeString.

Public Member Functions

 SerialComs (size_t sendSize=60, size_t receiveSize=60)
 
void setAsController ()
 
bool connect (Stream &io)
 
void sendAndReceive ()
 
SafeStringgetTextReceived ()
 
SafeStringgetTextToSend ()
 
bool isConnected ()
 
void noCheckSum ()
 
 ~SerialComs ()
 
- Public Member Functions inherited from SafeString
 SafeString (unsigned int maxLen, char *buf, const char *cstr, const char *_name=NULL, bool _fromBuffer=false, bool _fromPtr=true)
 SafeString Constructor called from the four (4) macros createSafeString or cSF, createSafeStringFromCharArray or cSFA, createSafeStringFromCharPtr or cSFP, createSafeStringFromCharPtrWithSize or cSFPS. More...
 
unsigned char hasError ()
 Returns non-zero if any error detected for this SafeString, each call clears the internal flag. More...
 
const char * debug (bool verbose=true)
 Output the details about the this SafeString to the output specified by setOutput(). More...
 
const char * debug (const char *title, bool verbose=true)
 Output the details about the this SafeString to the output specified by setOutput(). More...
 
const char * debug (const __FlashStringHelper *title, bool verbose=true)
 Output the details about the this SafeString to the output specified by setOutput(). More...
 
const char * debug (SafeString &stitle, bool verbose=true)
 Output the details about the this SafeString to the output specified by setOutput(). More...
 
virtual size_t write (uint8_t b)
 Write (concatinate) a byte to this SafeString, from Print class. More...
 
virtual size_t write (const uint8_t *buffer, size_t length)
 Write (concatinate) bytes to this SafeString, from Print class. More...
 
size_t printTo (Print &p) const
 Implements the Printable interface. More...
 
unsigned char reserve (unsigned int size)
 Checks there is enough free space in this SafeString for the current operation. More...
 
unsigned int length (void)
 Number of characters current in the SafeString, excluding the terminating '\0'. More...
 
unsigned int capacity (void)
 The maximum number of characters this SafeString can hold, excluding the terminating '\0'. More...
 
unsigned char isFull (void)
 Returns non-zero if the SafeString is full. More...
 
unsigned char isEmpty (void)
 Returns non-zero if the SafeString is empty. More...
 
int availableForWrite (void)
 Returns the number chars that can be added to this SafeString before it is full. More...
 
SafeStringclear (void)
 Empties this SafeString. More...
 
size_t print (unsigned char, int=DEC)
 
size_t print (int, int=DEC)
 
size_t print (unsigned int, int=DEC)
 
size_t print (long, int=DEC)
 
size_t print (unsigned long, int=DEC)
 
size_t print (double, int=2)
 
size_t print (const __FlashStringHelper *)
 
size_t print (const char *)
 
size_t print (char)
 
size_t print (SafeString &str)
 
size_t println (unsigned char, int=DEC)
 
size_t println (int, int=DEC)
 
size_t println (unsigned int, int=DEC)
 
size_t println (long, int=DEC)
 
size_t println (unsigned long, int=DEC)
 
size_t println (double, int=2)
 
size_t println (const __FlashStringHelper *)
 
size_t println (const char *)
 
size_t println (char)
 
size_t println (SafeString &str)
 
size_t println (void)
 
size_t println (double d, int decs, int width, bool forceSign=false)
 Prints a double (or long/int) to this SafeString padded with spaces (left or right) and limited to the specified width and adds a trailing CR NL. More...
 
size_t print (double d, int decs, int width, bool forceSign=false)
 Prints a double (or long/int) to this SafeString padded with spaces (left or right) and limited to the specified width. More...
 
SafeStringoperator= (char c)
 Clears this SafeString and concatinates a single char. More...
 
SafeStringoperator= (unsigned char num)
 Clears this SafeString and concatinates the text version of the argument. More...
 
SafeStringoperator= (int num)
 Clears this SafeString and concatinates the text version of the argument. More...
 
SafeStringoperator= (unsigned int num)
 Clears this SafeString and concatinates the text version of the argument. More...
 
SafeStringoperator= (long num)
 Clears this SafeString and concatinates the text version of the argument. More...
 
SafeStringoperator= (unsigned long num)
 Clears this SafeString and concatinates the text version of the argument. More...
 
SafeStringoperator= (float num)
 Clears this SafeString and concatinates the text version of the argument. More...
 
SafeStringoperator= (double num)
 Clears this SafeString and concatinates the text version of the argument. More...
 
SafeStringoperator= (SafeString &sfStr)
 Clears this SafeString and copies and concatinates the contents of the argument. More...
 
SafeStringoperator= (const char *cstr)
 Clears this SafeString and copies and concatinates the contents of the argument. More...
 
SafeStringoperator= (const __FlashStringHelper *pstr)
 Clears this SafeString and copies and concatinates the contents of the argument. More...
 
SafeStringprefix (SafeString &s)
 prefix methods add to the front of the current SafeString. More...
 
SafeStringprefix (const char *cstr)
 
SafeStringprefix (char c)
 
SafeStringprefix (unsigned char c)
 
SafeStringprefix (int num)
 
SafeStringprefix (unsigned int num)
 
SafeStringprefix (long num)
 
SafeStringprefix (unsigned long num)
 
SafeStringprefix (float num)
 
SafeStringprefix (double num)
 
SafeStringprefix (const __FlashStringHelper *str)
 
SafeStringprefix (const char *cstr, size_t length)
 
SafeStringprefix (const __FlashStringHelper *str, size_t length)
 
SafeStringconcat (SafeString &str)
 concat methods add to the end of the current SafeString. More...
 
SafeStringconcat (const char *cstr)
 
SafeStringconcat (char c)
 
SafeStringconcat (unsigned char c)
 
SafeStringconcat (int num)
 
SafeStringconcat (unsigned int num)
 
SafeStringconcat (long num)
 
SafeStringconcat (unsigned long num)
 
SafeStringconcat (float num)
 
SafeStringconcat (double num)
 
SafeStringconcat (const __FlashStringHelper *str)
 
SafeStringconcat (const char *cstr, size_t length)
 
SafeStringconcat (const __FlashStringHelper *str, size_t length)
 
SafeStringnewline ()
 Adds \r\n to this SafeString. More...
 
SafeStringoperator-= (SafeString &rhs)
 -= operator prefixes the SafeString. More...
 
SafeStringoperator-= (const char *cstr)
 
SafeStringoperator-= (char c)
 
SafeStringoperator-= (unsigned char num)
 
SafeStringoperator-= (int num)
 
SafeStringoperator-= (unsigned int num)
 
SafeStringoperator-= (long num)
 
SafeStringoperator-= (unsigned long num)
 
SafeStringoperator-= (float num)
 
SafeStringoperator-= (double num)
 
SafeStringoperator-= (const __FlashStringHelper *str)
 
SafeStringoperator+= (SafeString &rhs)
 += operator concatinate to the SafeString. More...
 
SafeStringoperator+= (const char *cstr)
 
SafeStringoperator+= (char c)
 
SafeStringoperator+= (unsigned char num)
 
SafeStringoperator+= (int num)
 
SafeStringoperator+= (unsigned int num)
 
SafeStringoperator+= (long num)
 
SafeStringoperator+= (unsigned long num)
 
SafeStringoperator+= (float num)
 
SafeStringoperator+= (double num)
 
SafeStringoperator+= (const __FlashStringHelper *str)
 
int compareTo (SafeString &s)
 returns -1 if this SafeString is < s, 0 if this SafeString == s and +1 if this SafeString > s More...
 
int compareTo (const char *cstr)
 returns -1 if this SafeString is < cstr, 0 if this SafeString == cstr and +1 if this SafeString > cst More...
 
unsigned char equals (SafeString &s)
 
unsigned char equals (const char *cstr)
 
unsigned char equals (const char c)
 
unsigned char operator== (SafeString &rhs)
 
unsigned char operator== (const char *cstr)
 
unsigned char operator== (const char c)
 
unsigned char operator!= (SafeString &rhs)
 
unsigned char operator!= (const char *cstr)
 
unsigned char operator!= (const char c)
 
unsigned char operator< (SafeString &rhs)
 
unsigned char operator> (SafeString &rhs)
 
unsigned char operator<= (SafeString &rhs)
 
unsigned char operator>= (SafeString &rhs)
 
unsigned char operator< (const char *rhs)
 
unsigned char operator> (const char *rhs)
 
unsigned char operator<= (const char *rhs)
 
unsigned char operator>= (const char *rhs)
 
unsigned char equalsIgnoreCase (SafeString &s)
 
unsigned char equalsIgnoreCase (const char *str2)
 
unsigned char equalsConstantTime (SafeString &s)
 
unsigned char startsWith (const char c, unsigned int fromIndex=0)
 returns non-zero of this SafeString starts this argument looking from fromIndex onwards. More...
 
unsigned char startsWith (const char *str2, unsigned int fromIndex=0)
 returns non-zero of this SafeString starts this argument looking from fromIndex onwards. More...
 
unsigned char startsWith (SafeString &s2, unsigned int fromIndex=0)
 returns non-zero of this SafeString starts this argument looking from fromIndex onwards. More...
 
unsigned char startsWithIgnoreCase (const char c, unsigned int fromIndex=0)
 returns non-zero of this SafeString starts this argument, ignoring case, looking from fromIndex onwards. More...
 
unsigned char startsWithIgnoreCase (const char *str2, unsigned int fromIndex=0)
 returns non-zero of this SafeString starts this argument, ignoring case, looking from fromIndex onwards. More...
 
unsigned char startsWithIgnoreCase (SafeString &s2, unsigned int fromIndex=0)
 returns non-zero of this SafeString starts this argument, ignoring case, looking from fromIndex onwards. More...
 
unsigned char endsWith (const char c)
 returns non-zero of this SafeString ends with the argument More...
 
unsigned char endsWith (SafeString &suffix)
 returns non-zero of this SafeString ends with the argument More...
 
unsigned char endsWith (const char *suffix)
 returns non-zero of this SafeString ends with the argument More...
 
unsigned char endsWithCharFrom (SafeString &suffix)
 returns non-zero of this SafeString ends any one of the chars in the argument More...
 
unsigned char endsWithCharFrom (const char *suffix)
 returns non-zero of this SafeString ends any one of the chars in the argument More...
 
char charAt (unsigned int index)
 returns the char at that location in this SafeString. More...
 
char operator[] (unsigned int index)
 returns the char at that location in this SafeString. More...
 
void setCharAt (unsigned int index, char c)
 sets the char at that location in this SafeString. More...
 
const char * c_str ()
 returns a const char* to the underlying char[ ] in this SafeString. More...
 
int indexOf (char ch, unsigned int fromIndex=0)
 returns the index of the char, searching from fromIndex. More...
 
int indexOf (const char *str, unsigned int fromIndex=0)
 returns the index of the string, searching from fromIndex. More...
 
int indexOf (SafeString &str, unsigned int fromIndex=0)
 returns the index of the SafeString, searching from fromIndex. More...
 
int lastIndexOf (char ch)
 returns the last index of the char, searching backwards from fromIndex (inclusive). More...
 
int lastIndexOf (char ch, unsigned int fromIndex)
 returns the last index of the char, searching backwards from fromIndex (inclusive). More...
 
int lastIndexOf (SafeString &str)
 returns the last index of the arguement, searching backwards from fromIndex (inclusive). More...
 
int lastIndexOf (SafeString &str, unsigned int fromIndex)
 returns the last index of the char, searching backwards from fromIndex (inclusive). More...
 
int lastIndexOf (const char *cstr)
 returns the last index of the arguement, searching backwards from fromIndex (inclusive). More...
 
int lastIndexOf (const char *cstr, unsigned int fromIndex)
 returns the last index of the char, searching backwards from fromIndex (inclusive). More...
 
int indexOfCharFrom (SafeString &str, unsigned int fromIndex=0)
 returns the first index of any char from the argument. More...
 
int indexOfCharFrom (const char *chars, unsigned int fromIndex=0)
 returns the first index of any char from the argument More...
 
SafeStringsubstring (SafeString &result, unsigned int beginIdx)
 The result is the substring from the beginIdx to the end of the SafeString. More...
 
SafeStringsubstring (SafeString &result, unsigned int beginIdx, unsigned int endIdx)
 The result is the substring from the beginIdx to endIdx (exclusive), that is the endIdx is NOT included. More...
 
void replace (char findChar, char replaceChar)
 replace the findChar with the replaceChar More...
 
void replace (const char findChar, const char *replaceStr)
 replace the findChar with the replace string More...
 
void replace (const char findChar, SafeString &sfReplace)
 replace the findChar with the sfReplace SafeString contents More...
 
void replace (const char *findStr, const char *replaceStr)
 replace the findStr string with the replace string More...
 
void replace (SafeString &sfFind, SafeString &sfReplace)
 replace the occurances of the sfFind string, with the sfReplace SafeString contents More...
 
void removeFrom (unsigned int startIndex)
 remove all chars from startIndex to the end of the SafeString (inclusive) More...
 
void removeBefore (unsigned int startIndex)
 remove all chars from 0 to startIndex (exclusive), that is the char at startIndex is NOT removed More...
 
void remove (unsigned int index)
 remove all chars from index to the end of the SafeString (inclusive) More...
 
void remove (unsigned int index, unsigned int count)
 remove count chars starting from index More...
 
void removeLast (unsigned int count)
 remove the last count chars More...
 
void keepLast (unsigned int count)
 keep the last count chars and remove the rest More...
 
void toLowerCase (void)
 convert this SafeString to all lower case More...
 
void toUpperCase (void)
 convert this SafeString to all lower case More...
 
void trim (void)
 remove all white space from the front and back of this SafeString. More...
 
void processBackspaces (void)
 recursively remove backspaces, '\b' and the preceeding char. More...
 
unsigned char toInt (int &i)
 convert the SafeString to an int. More...
 
unsigned char toLong (long &l)
 convert the SafeString to a long. More...
 
unsigned char binToLong (long &l)
 convert the SafeString to a long assuming the SafeString in binary (0/1). More...
 
unsigned char octToLong (long &l)
 convert the SafeString to a long assuming the SafeString in octal (0 to 7). More...
 
unsigned char hexToLong (long &l)
 convert the SafeString to a long assuming the SafeString in HEX (0 to f or 0 to F). More...
 
unsigned char toUnsignedLong (unsigned long &l)
 convert the SafeString to an unsigned long. More...
 
unsigned char binToUnsignedLong (unsigned long &l)
 convert the SafeString to an unsigned long assuming the SafeString in binary (0/1). More...
 
unsigned char octToUnsignedLong (unsigned long &l)
 convert the SafeString to an unsigned long assuming the SafeString in octal (0 to 7). More...
 
unsigned char hexToUnsignedLong (unsigned long &l)
 convert the SafeString to an unsigned long assuming the SafeString in HEX (0 to f or 0 to F). More...
 
unsigned char toFloat (float &f)
 convert the SafeString to a float assuming the SafeString in the decimal format (not scientific) More...
 
unsigned char toDouble (double &d)
 convert the SafeString to a float assuming the SafeString in the decimal format (not scientific) More...
 
int stoken (SafeString &token, unsigned int fromIndex, const char delimiter, bool returnEmptyFields=false, bool useAsDelimiters=true)
 break into the SafeString into tokens using the char delimiter, the end of the SafeString is always a delimiter More...
 
int stoken (SafeString &token, unsigned int fromIndex, const char *delimiters, bool returnEmptyFields=false, bool useAsDelimiters=true)
 break into the SafeString into tokens using the delimiters, the end of the SafeString is always a delimiter More...
 
int stoken (SafeString &token, unsigned int fromIndex, SafeString &delimiters, bool returnEmptyFields=false, bool useAsDelimiters=true)
 break into the SafeString into tokens using the delimiters, the end of the SafeString is always a delimiter More...
 
unsigned char firstToken (SafeString &token, char delimiter, bool returnLastNonDelimitedToken=true)
 returns true if a delimited token is found, removes the first delimited token from this SafeString and returns it in the token argument
by default a leading delimiter is stepped over before scanning for a delimited token when nextToken() is called
this firstToken() method overrides this and returns true and an empty token if the first char is a delimiter More...
 
unsigned char nextToken (SafeString &token, char delimiter, bool returnEmptyFields=false, bool returnLastNonDelimitedToken=true, bool firstToken=false)
 returns true if a delimited token is found, removes the first delimited token from this SafeString and returns it in the token argument
by default a leading delimiter is stepped over before scanning for a delimited token, the firstToken argument can override this
setting the firstToken arguemnent = true, suppresses this so that an empty first token can be returned if the first char is a delimiter AND if returnEmptyFields is true More...
 
unsigned char firstToken (SafeString &token, SafeString delimiters, bool returnLastNonDelimitedToken=true)
 returns true if a delimited token is found, removes the first delimited token from this SafeString and returns it in the token argument
by default a leading delimiter is stepped over before scanning for a delimited token when nextToken() is called
this firstToken() method overrides this and returns true and an empty token if the first char is a delimiter More...
 
unsigned char nextToken (SafeString &token, SafeString &delimiters, bool returnEmptyFields=false, bool returnLastNonDelimitedToken=true, bool firstToken=false)
 returns true if a delimited token is found, removes the first delimited token from this SafeString and returns it in the token argument
by default a leading delimiter is stepped over before scanning for a delimited token, the firstToken argument can override this
setting the firstToken arguemnent = true, suppresses this so that an empty first token can be returned if the first char is a delimiter AND if returnEmptyFields is true More...
 
unsigned char firstToken (SafeString &token, const char *delimiters, bool returnLastNonDelimitedToken=true)
 returns true if a delimited token is found, removes the first delimited token from this SafeString and returns it in the token argument
by default a leading delimiter is stepped over before scanning for a delimited token when nextToken() is called
this firstToken() method overrides this and returns true and an empty token if the first char is a delimiter More...
 
unsigned char nextToken (SafeString &token, const char *delimiters, bool returnEmptyFields=false, bool returnLastNonDelimitedToken=true, bool firstToken=false)
 returns true if a delimited token is found, removes the first delimited token from this SafeString and returns it in the token argument
by default a leading delimiter is stepped over before scanning for a delimited token, the firstToken argument can override this
setting the firstToken arguemnent = true, suppresses this so that an empty first token can be returned if the first char is a delimiter AND if returnEmptyFields is true More...
 
unsigned int readFrom (SafeString &sfInput, unsigned int startIdx=0)
 reads from the SafeString argument, starting at startIdx, into this SafeString. More...
 
unsigned int readFrom (const char *strPtr, unsigned int maxCharsToRead=((unsigned int) -1))
 reads from the const char* argument, starting at 0 and read up to maxCharToRead, into this SafeString. More...
 
unsigned int writeTo (SafeString &output, unsigned int startIdx=0)
 writes from this SafeString, starting from startIdx, into the SafeString output arguement. More...
 
unsigned char read (Stream &input)
 reads from the Stream (if chars available) into the SafeString. More...
 
unsigned char readUntil (Stream &input, const char delimiter)
 reads chars into this SafeString until either it is full OR a delimiter is read OR there are no more chars available
returns true if a delimiter found or SafeString is full, else false
if a delimiter is found it is returned at the end of the SafeString
Only at most one delimiter is added per call
Multiple sucessive delimiters require multiple calls to read them More...
 
unsigned char readUntil (Stream &input, const char *delimiters)
 reads chars into this SafeString until either it is full OR a delimiter is read OR there are no more chars available
returns true if a delimiter found or SafeString is full, else false
if a delimiter is found it is returned at the end of the SafeString
Only at most one delimiter is added per call
Multiple sucessive delimiters require multiple calls to read them More...
 
unsigned char readUntil (Stream &input, SafeString &delimiters)
 reads chars into this SafeString until either it is full OR a delimiter is read OR there are no more chars available
returns true if a delimiter found or SafeString is full, else false
if a delimiter is found it is returned at the end of the SafeString
Only at most one delimiter is added per call
Multiple sucessive delimiters require multiple calls to read them More...
 
unsigned char readUntilToken (Stream &input, SafeString &token, const char delimiter, bool &skipToDelimiter, uint8_t echoInput=false, unsigned long timeout_ms=0)
 returns true if a delimited token is found, else false
ONLY delimited tokens of length less than this SafeString's capacity will return true with a non-empty token. More...
 
unsigned char readUntilToken (Stream &input, SafeString &token, const char *delimiters, bool &skipToDelimiter, uint8_t echoInput=false, unsigned long timeout_ms=0)
 returns true if a delimited token is found, else false
ONLY delimited tokens of length less than this SafeString's capacity will return true with a non-empty token. More...
 
unsigned char readUntilToken (Stream &input, SafeString &token, SafeString &delimiters, bool &skipToDelimiter, uint8_t echoInput=false, unsigned long timeout_ms=0)
 returns true if a delimited token is found, else false
ONLY delimited tokens of length less than this SafeString's capacity will return true with a non-empty token. More...
 
size_t getLastReadCount ()
 returns the number of chars read on previous calls to read, readUntil or readUntilToken (includes '\0' read if any). More...
 

Additional Inherited Members

- Static Public Member Functions inherited from SafeString
static void setOutput (Print &debugOut, bool verbose=true)
 Turns on Error msgs and debug( ) output for all SafeStrings. More...
 
static void turnOutputOff (void)
 Turns off all debugging messages, both error messages AND debug() method output. More...
 
static void setVerbose (bool verbose)
 Controls size of error messages, setOutput sets verbose to true. More...
 
static unsigned char errorDetected ()
 Returns non-zero if any SafeString has detected and error, each call clears the internal global static flag. More...
 
- Static Public Attributes inherited from SafeString
static SafeString::DebugPrint Output
 
- Protected Member Functions inherited from SafeString
SafeStringconcatln (const __FlashStringHelper *pstr)
 
SafeStringconcatln (char c)
 
SafeStringconcatln (const char *cstr, size_t length)
 
void outputName () const
 
SafeStringconcatInternal (const char *cstr, size_t length, bool assignOp=false)
 
SafeStringconcatInternal (const __FlashStringHelper *str, size_t length, bool assignOp=false)
 
SafeStringconcatInternal (const char *cstr, bool assignOp=false)
 
SafeStringconcatInternal (char c, bool assignOp=false)
 
SafeStringconcatInternal (const __FlashStringHelper *str, bool assignOp=false)
 
size_t printInternal (long, int=DEC, bool assignOp=false)
 
size_t printInternal (unsigned long, int=DEC, bool assignOp=false)
 
size_t printInternal (double, int=2, bool assignOp=false)
 
void setError ()
 
void printlnErr () const
 
void debugInternalMsg (bool _fullDebug) const
 
size_t limitedStrLen (const char *p, size_t limit)
 
size_t printInt (double d, int decs, int width, bool forceSign, bool addNL)
 
- Protected Attributes inherited from SafeString
char * buffer
 
size_t _capacity
 
size_t len
 
- Static Protected Attributes inherited from SafeString
static Print * debugPtr
 
static bool fullDebug
 
static SafeString::noDebugPrint emptyPrint
 
static Print * currentOutput
 

Detailed Description

The SerialComs class sends/recieves lines of text between Arduinos via Serial, see the detailed description.


#include "SerialComs.h"
SerialComs coms; // instantsiate the SerialComs object default is 60 chars sendSize, 60 chars receiveSize
// sendSize and receiveSize limits are actual number of message chars that can be handled
// excluding the checksum,XON and terminating '\0' which are handled internally

in setup() add

void setup() {
   Serial.begin(115200);
  
   // comment this line out once everything is running to suppress the SerialComs debug output
   SafeString::setOutput(Serial); // for SafeString error messages and SerialComs debug output
  
   // set one side (and ONLY one side) as the controller.
   // If one side is using SoftwareSerial it MUST be set as the controller
   coms.setAsController();
  
   // connect the coms to the stream to send/receive from
   // ALWAYS check the return
   if (!coms.connect(Serial1)) {
     while(1) {
       Serial.println(F("Out-Of-Memory"));
       delay(3000);
   }
}

in loop()

void loop() {
   // sendAndReceive() MUST be called every loop!!
   coms.sendAndReceive(); // clears coms.textReceived every time before checking for new received message
   // . . .
   if (!coms.textReceived.isEmpty()) {
     // got a message from the other side process it here
   }
   // . . .
   if (coms.textToSend.isEmpty()) {
     // last msg has been sent, can set new message to be sent
     coms.textToSend.print("... ");
     coms.textToSend.print(number); // etc
   }

coms.textToSend and coms.textReceived are both SafeStrings of fixed capacity.
coms.textToSend has sendSize capacity and will not accept any more than that many chars
Once the text is sent the coms.textToSend is cleared.

Any text received, upto the receiveSize appears in coms.textReceived.
coms.textRecieved is cleared each time sendAndReceive() is called

See Arduino to Arduino via Serial for an example of using SerialComs

Definition at line 84 of file SerialComs.h.

Constructor & Destructor Documentation

◆ SerialComs()

SerialComs::SerialComs ( size_t  sendSize = 60,
size_t  receiveSize = 60 
)

◆ ~SerialComs()

SerialComs::~SerialComs ( )

Member Function Documentation

◆ connect()

bool SerialComs::connect ( Stream &  io)

◆ getTextReceived()

SafeString& SerialComs::getTextReceived ( )

◆ getTextToSend()

SafeString& SerialComs::getTextToSend ( )

◆ isConnected()

bool SerialComs::isConnected ( )

◆ noCheckSum()

void SerialComs::noCheckSum ( )

◆ sendAndReceive()

void SerialComs::sendAndReceive ( )

◆ setAsController()

void SerialComs::setAsController ( )