Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of C027_Support by
Diff: MDM.h
- Revision:
- 101:edfeb8af206e
- Parent:
- 98:c786461edd40
- Child:
- 103:197fa7920ad8
--- a/MDM.h Tue Jul 01 05:46:06 2014 +0000 +++ b/MDM.h Tue Jul 01 06:41:26 2014 +0000 @@ -409,6 +409,10 @@ */ virtual int getLine(char* buf, int len) = 0; + /* clear the pending input data + */ + virtual void purge(void) = 0; + /** Write data to the device \param buf the buffer to write \param buf size of the buffer to write @@ -596,6 +600,13 @@ NOT_FOUND if nothing was found */ virtual int getLine(char* buffer, int length); + + /* clear the pending input data */ + virtual void purge(void) + { + while (readable()) + getc(); + } protected: /** Write bytes to the physical interface. \param buf the buffer to write @@ -617,6 +628,7 @@ //! Destructor virtual ~MDMUsb(void); virtual int getLine(char* buffer, int length); + virtual void purge(void) { } protected: virtual int _send(const void* buf, int len); };