mbed

Dependents:   DHTSensor_Test K64F_eCompass_OneNET_JW

Committer:
mbotkinl
Date:
Wed Feb 25 20:22:22 2015 +0000
Revision:
0:2cc6bb4d7fea
Working code to read Temperature and Humidity readings

Who changed what in which revision?

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