diff --git a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/HardwareSerial.h b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/HardwareSerial.h index 0556be8..ecba701 100644 --- a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/HardwareSerial.h +++ b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/HardwareSerial.h @@ -21,9 +21,9 @@ #include -#include "WStream.h" +#include "Stream.h" -class HardwareSerial : public WStream +class HardwareSerial : public Stream { public: void begin( const uint32_t dwBaudRate ); diff --git a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/WStream.cpp b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/Stream.cpp similarity index 89% rename from arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/WStream.cpp rename to arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/Stream.cpp index 815b75f..6c58c56 100644 --- a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/WStream.cpp +++ b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/Stream.cpp @@ -22,13 +22,13 @@ */ #include "Arduino.h" -#include "WStream.h" +#include "Stream.h" #define PARSE_TIMEOUT 1000 // default number of milli-seconds to wait #define NO_SKIP_CHAR 1 // a magic char not found in a valid ASCII numeric field // private method to read stream with timeout -int WStream::timedRead() +int Stream::timedRead() { int c; _startMillis = millis(); @@ -40,7 +40,7 @@ int WStream::timedRead() } // private method to peek stream with timeout -int WStream::timedPeek() +int Stream::timedPeek() { int c; _startMillis = millis(); @@ -53,7 +53,7 @@ int WStream::timedPeek() // returns peek of the next digit in the stream or -1 if timeout // discards non-numeric characters -int WStream::peekNextDigit() +int Stream::peekNextDigit() { int c; while (1) { @@ -68,26 +68,26 @@ int WStream::peekNextDigit() // Public Methods ////////////////////////////////////////////////////////////// -void WStream::setTimeout(unsigned long timeout) // sets the maximum number of milliseconds to wait +void Stream::setTimeout(unsigned long timeout) // sets the maximum number of milliseconds to wait { _timeout = timeout; } // find returns true if the target string is found -bool WStream::find(char *target) +bool Stream::find(char *target) { return findUntil(target, NULL); } // reads data from the stream until the target string of given length is found // returns true if target string is found, false if timed out -bool WStream::find(char *target, size_t length) +bool Stream::find(char *target, size_t length) { return findUntil(target, length, NULL, 0); } // as find but search ends if the terminator string is found -bool WStream::findUntil(char *target, char *terminator) +bool Stream::findUntil(char *target, char *terminator) { return findUntil(target, strlen(target), terminator, strlen(terminator)); } @@ -95,7 +95,7 @@ bool WStream::findUntil(char *target, char *terminator) // reads data from the stream until the target string of the given length is found // search terminated if the terminator string is found // returns true if target string is found, false if terminated or timed out -bool WStream::findUntil(char *target, size_t targetLen, char *terminator, size_t termLen) +bool Stream::findUntil(char *target, size_t targetLen, char *terminator, size_t termLen) { size_t index = 0; // maximum target string length is 64k bytes! size_t termIndex = 0; @@ -129,14 +129,14 @@ bool WStream::findUntil(char *target, size_t targetLen, char *terminator, size_t // returns the first valid (long) integer value from the current position. // initial characters that are not digits (or the minus sign) are skipped // function is terminated by the first character that is not a digit. -long WStream::parseInt() +long Stream::parseInt() { return parseInt(NO_SKIP_CHAR); // terminate on first non-digit character (or timeout) } // as above but a given skipChar is ignored // this allows format characters (typically commas) in values to be ignored -long WStream::parseInt(char skipChar) +long Stream::parseInt(char skipChar) { boolean isNegative = false; long value = 0; @@ -166,14 +166,14 @@ long WStream::parseInt(char skipChar) // as parseInt but returns a floating point value -float WStream::parseFloat() +float Stream::parseFloat() { return parseFloat(NO_SKIP_CHAR); } // as above but the given skipChar is ignored // this allows format characters (typically commas) in values to be ignored -float WStream::parseFloat(char skipChar){ +float Stream::parseFloat(char skipChar){ boolean isNegative = false; boolean isFraction = false; long value = 0; @@ -215,7 +215,7 @@ float WStream::parseFloat(char skipChar){ // returns the number of characters placed in the buffer // the buffer is NOT null terminated. // -size_t WStream::readBytes(char *buffer, size_t length) +size_t Stream::readBytes(char *buffer, size_t length) { size_t count = 0; while (count < length) { @@ -232,7 +232,7 @@ size_t WStream::readBytes(char *buffer, size_t length) // terminates if length characters have been read, timeout, or if the terminator character detected // returns the number of characters placed in the buffer (0 means no valid data found) -size_t WStream::readBytesUntil(char terminator, char *buffer, size_t length) +size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length) { if (length < 1) return 0; size_t index = 0; @@ -245,7 +245,7 @@ size_t WStream::readBytesUntil(char terminator, char *buffer, size_t length) return index; // return number of characters, not including null terminator } -String WStream::readString() +String Stream::readString() { String ret; int c = timedRead(); @@ -257,7 +257,7 @@ String WStream::readString() return ret; } -String WStream::readStringUntil(char terminator) +String Stream::readStringUntil(char terminator) { String ret; int c = timedRead(); diff --git a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/WStream.h b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/Stream.h similarity index 97% rename from arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/WStream.h rename to arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/Stream.h index 81ce6e6..163ae03 100644 --- a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/WStream.h +++ b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/Stream.h @@ -20,8 +20,8 @@ parsing functions based on TextFinder library by Michael Margolis */ -#ifndef WStream_h -#define WStream_h +#ifndef Stream_h +#define Stream_h #include #include "Print.h" @@ -36,7 +36,7 @@ readBytesBetween( pre_string, terminator, buffer, length) */ -class WStream : public Print +class Stream : public Print { private: unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read @@ -51,7 +51,7 @@ class WStream : public Print virtual int peek() = 0; virtual void flush() = 0; - WStream() {_timeout=1000;} + Stream() {_timeout=1000;} // parsing methods diff --git a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/Stream.h b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/MStream.h similarity index 91% rename from arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/Stream.h rename to arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/MStream.h index ca5dfe6..4697b46 100644 --- a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/Stream.h +++ b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/MStream.h @@ -26,11 +26,11 @@ extern void mbed_set_unbuffered_stream(FILE *_file); extern int mbed_getc(FILE *_file); extern char* mbed_gets(char *s, int size, FILE *_file); -class Stream : public FileLike { +class MStream : public FileLike { public: - Stream(const char *name=NULL); - virtual ~Stream(); + MStream(const char *name=NULL); + virtual ~MStream(); int putc(int c); int puts(const char *s); @@ -59,8 +59,8 @@ class Stream : public FileLike { /* disallow copy constructor and assignment operators */ private: - Stream(const Stream&); - Stream & operator = (const Stream&); + MStream(const MStream&); + MStream & operator = (const MStream&); }; } // namespace mbed diff --git a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/Serial.h b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/Serial.h index aa06540..a3278b6 100644 --- a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/Serial.h +++ b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/Serial.h @@ -20,7 +20,7 @@ #if DEVICE_SERIAL -#include "Stream.h" +#include "MStream.h" #include "SerialBase.h" #include "serial_api.h" @@ -44,7 +44,7 @@ namespace mbed { * } * @endcode */ -class Serial : public SerialBase, public Stream { +class Serial : public SerialBase, public MStream { public: #if DEVICE_SERIAL_ASYNCH diff --git a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/SerialBase.h b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/SerialBase.h index 51aeb33..e7daa7b 100644 --- a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/SerialBase.h +++ b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/SerialBase.h @@ -20,7 +20,7 @@ #if DEVICE_SERIAL -#include "Stream.h" +#include "MStream.h" #include "FunctionPointer.h" #include "serial_api.h" diff --git a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/Stream.cpp b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/MStream.cpp similarity index 74% rename from arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/Stream.cpp rename to arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/MStream.cpp index 2b3105f..3a2afbf 100644 --- a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/Stream.cpp +++ b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/MStream.cpp @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "Stream.h" +#include "MStream.h" namespace mbed { -Stream::Stream(const char *name) : FileLike(name), _file(NULL) { +MStream::MStream(const char *name) : FileLike(name), _file(NULL) { /* open ourselves */ char buf[12]; /* :0x12345678 + null byte */ std::sprintf(buf, ":%p", this); @@ -25,32 +25,32 @@ Stream::Stream(const char *name) : FileLike(name), _file(NULL) { mbed_set_unbuffered_stream(_file); } -Stream::~Stream() { +MStream::~MStream() { fclose(_file); } -int Stream::putc(int c) { +int MStream::putc(int c) { fflush(_file); return std::fputc(c, _file); } -int Stream::puts(const char *s) { +int MStream::puts(const char *s) { fflush(_file); return std::fputs(s, _file); } -int Stream::getc() { +int MStream::getc() { fflush(_file); return mbed_getc(_file); } -char* Stream::gets(char *s, int size) { +char* MStream::gets(char *s, int size) { fflush(_file); return mbed_gets(s,size,_file); } -int Stream::close() { +int MStream::close() { return 0; } -ssize_t Stream::write(const void* buffer, size_t length) { +ssize_t MStream::write(const void* buffer, size_t length) { const char* ptr = (const char*)buffer; const char* end = ptr + length; while (ptr != end) { @@ -61,7 +61,7 @@ ssize_t Stream::write(const void* buffer, size_t length) { return ptr - (const char*)buffer; } -ssize_t Stream::read(void* buffer, size_t length) { +ssize_t MStream::read(void* buffer, size_t length) { char* ptr = (char*)buffer; char* end = ptr + length; while (ptr != end) { @@ -72,23 +72,23 @@ ssize_t Stream::read(void* buffer, size_t length) { return ptr - (const char*)buffer; } -off_t Stream::lseek(off_t offset, int whence) { +off_t MStream::lseek(off_t offset, int whence) { return 0; } -int Stream::isatty() { +int MStream::isatty() { return 0; } -int Stream::fsync() { +int MStream::fsync() { return 0; } -off_t Stream::flen() { +off_t MStream::flen() { return 0; } -int Stream::printf(const char* format, ...) { +int MStream::printf(const char* format, ...) { std::va_list arg; va_start(arg, format); fflush(_file); @@ -97,7 +97,7 @@ int Stream::printf(const char* format, ...) { return r; } -int Stream::scanf(const char* format, ...) { +int MStream::scanf(const char* format, ...) { std::va_list arg; va_start(arg, format); fflush(_file); @@ -106,13 +106,13 @@ int Stream::scanf(const char* format, ...) { return r; } -int Stream::vprintf(const char* format, std::va_list args) { +int MStream::vprintf(const char* format, std::va_list args) { fflush(_file); int r = vfprintf(_file, format, args); return r; } -int Stream::vscanf(const char* format, std::va_list args) { +int MStream::vscanf(const char* format, std::va_list args) { fflush(_file); int r = vfscanf(_file, format, args); return r; diff --git a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/Serial.cpp b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/Serial.cpp index 602c87a..66d15bf 100644 --- a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/Serial.cpp +++ b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/Serial.cpp @@ -20,7 +20,7 @@ namespace mbed { -Serial::Serial(PinName tx, PinName rx, const char *name) : SerialBase(tx, rx), Stream(name) { +Serial::Serial(PinName tx, PinName rx, const char *name) : SerialBase(tx, rx), MStream(name) { } int Serial::_getc() { diff --git a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/Wire/Wire.h b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/Wire/Wire.h index a65072f..176801e 100644 --- a/arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/Wire/Wire.h +++ b/arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/Wire/Wire.h @@ -30,7 +30,7 @@ #ifndef _WIRE_H_ #define _WIRE_H_ -#include "WStream.h" +#include "Stream.h" #include "Arduino.h" @@ -41,7 +41,7 @@ #define TWI_FREQUENCY_400K 400000 -class TwoWire : public WStream +class TwoWire : public Stream { public : enum TwoWireStatus {