Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
111:4336505e4b1c
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 65:5798e58a58b1 1 /* mbed Microcontroller Library
bogdanm 65:5798e58a58b1 2 * Copyright (c) 2006-2013 ARM Limited
bogdanm 65:5798e58a58b1 3 *
bogdanm 65:5798e58a58b1 4 * Licensed under the Apache License, Version 2.0 (the "License");
bogdanm 65:5798e58a58b1 5 * you may not use this file except in compliance with the License.
bogdanm 65:5798e58a58b1 6 * You may obtain a copy of the License at
bogdanm 65:5798e58a58b1 7 *
bogdanm 65:5798e58a58b1 8 * http://www.apache.org/licenses/LICENSE-2.0
bogdanm 65:5798e58a58b1 9 *
bogdanm 65:5798e58a58b1 10 * Unless required by applicable law or agreed to in writing, software
bogdanm 65:5798e58a58b1 11 * distributed under the License is distributed on an "AS IS" BASIS,
bogdanm 65:5798e58a58b1 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
bogdanm 65:5798e58a58b1 13 * See the License for the specific language governing permissions and
bogdanm 65:5798e58a58b1 14 * limitations under the License.
bogdanm 65:5798e58a58b1 15 */
bogdanm 65:5798e58a58b1 16 #ifndef MBED_STREAM_H
bogdanm 65:5798e58a58b1 17 #define MBED_STREAM_H
bogdanm 65:5798e58a58b1 18
bogdanm 65:5798e58a58b1 19 #include "platform.h"
bogdanm 65:5798e58a58b1 20 #include "FileLike.h"
Kojto 111:4336505e4b1c 21 #include <cstdarg>
bogdanm 65:5798e58a58b1 22
bogdanm 65:5798e58a58b1 23 namespace mbed {
bogdanm 65:5798e58a58b1 24
Kojto 93:e188a91d3eaa 25 extern void mbed_set_unbuffered_stream(FILE *_file);
Kojto 93:e188a91d3eaa 26 extern int mbed_getc(FILE *_file);
Kojto 93:e188a91d3eaa 27 extern char* mbed_gets(char *s, int size, FILE *_file);
Kojto 93:e188a91d3eaa 28
bogdanm 65:5798e58a58b1 29 class Stream : public FileLike {
bogdanm 65:5798e58a58b1 30
bogdanm 65:5798e58a58b1 31 public:
bogdanm 65:5798e58a58b1 32 Stream(const char *name=NULL);
bogdanm 65:5798e58a58b1 33 virtual ~Stream();
bogdanm 65:5798e58a58b1 34
bogdanm 65:5798e58a58b1 35 int putc(int c);
bogdanm 65:5798e58a58b1 36 int puts(const char *s);
bogdanm 65:5798e58a58b1 37 int getc();
bogdanm 65:5798e58a58b1 38 char *gets(char *s, int size);
bogdanm 65:5798e58a58b1 39 int printf(const char* format, ...);
bogdanm 65:5798e58a58b1 40 int scanf(const char* format, ...);
Kojto 111:4336505e4b1c 41 int vprintf(const char* format, std::va_list args);
Kojto 111:4336505e4b1c 42 int vscanf(const char* format, std::va_list args);
bogdanm 65:5798e58a58b1 43
bogdanm 65:5798e58a58b1 44 operator std::FILE*() {return _file;}
bogdanm 65:5798e58a58b1 45
bogdanm 65:5798e58a58b1 46 protected:
bogdanm 65:5798e58a58b1 47 virtual int close();
bogdanm 65:5798e58a58b1 48 virtual ssize_t write(const void* buffer, size_t length);
bogdanm 65:5798e58a58b1 49 virtual ssize_t read(void* buffer, size_t length);
bogdanm 65:5798e58a58b1 50 virtual off_t lseek(off_t offset, int whence);
bogdanm 65:5798e58a58b1 51 virtual int isatty();
bogdanm 65:5798e58a58b1 52 virtual int fsync();
bogdanm 65:5798e58a58b1 53 virtual off_t flen();
bogdanm 65:5798e58a58b1 54
bogdanm 65:5798e58a58b1 55 virtual int _putc(int c) = 0;
bogdanm 65:5798e58a58b1 56 virtual int _getc() = 0;
bogdanm 65:5798e58a58b1 57
bogdanm 65:5798e58a58b1 58 std::FILE *_file;
bogdanm 85:024bf7f99721 59
bogdanm 85:024bf7f99721 60 /* disallow copy constructor and assignment operators */
bogdanm 85:024bf7f99721 61 private:
bogdanm 85:024bf7f99721 62 Stream(const Stream&);
bogdanm 85:024bf7f99721 63 Stream & operator = (const Stream&);
bogdanm 65:5798e58a58b1 64 };
bogdanm 65:5798e58a58b1 65
bogdanm 65:5798e58a58b1 66 } // namespace mbed
bogdanm 65:5798e58a58b1 67
bogdanm 65:5798e58a58b1 68 #endif