fork of VodafoneUSBModem with updated USBHost library
Dependencies: Socket USBHost lwip-sys lwip
Dependents: VodafoneUSBModemSMSTest
core/IOStream.h@23:21046ba01b7b, 2012-08-17 (annotated)
- Committer:
- donatien
- Date:
- Fri Aug 17 14:36:32 2012 +0000
- Revision:
- 23:21046ba01b7b
- Parent:
- 16:02db4f537955
Fixed mis-renaming
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 16:02db4f537955 | 1 | /* IOStream.h */ |
donatien | 16:02db4f537955 | 2 | /* Copyright (C) 2012 mbed.org, MIT License |
donatien | 16:02db4f537955 | 3 | * |
donatien | 16:02db4f537955 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
donatien | 16:02db4f537955 | 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
donatien | 16:02db4f537955 | 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
donatien | 16:02db4f537955 | 7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
donatien | 16:02db4f537955 | 8 | * furnished to do so, subject to the following conditions: |
donatien | 16:02db4f537955 | 9 | * |
donatien | 16:02db4f537955 | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
donatien | 16:02db4f537955 | 11 | * substantial portions of the Software. |
donatien | 16:02db4f537955 | 12 | * |
donatien | 16:02db4f537955 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
donatien | 16:02db4f537955 | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
donatien | 16:02db4f537955 | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
donatien | 16:02db4f537955 | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
donatien | 16:02db4f537955 | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
donatien | 16:02db4f537955 | 18 | */ |
donatien | 16:02db4f537955 | 19 | |
donatien | 16:02db4f537955 | 20 | #ifndef IOSTREAM_H_ |
donatien | 16:02db4f537955 | 21 | #define IOSTREAM_H_ |
donatien | 16:02db4f537955 | 22 | |
donatien | 16:02db4f537955 | 23 | #include "fwk.h" |
donatien | 16:02db4f537955 | 24 | |
donatien | 16:02db4f537955 | 25 | #include "rtos.h" |
donatien | 16:02db4f537955 | 26 | |
donatien | 16:02db4f537955 | 27 | class IStream |
donatien | 16:02db4f537955 | 28 | { |
donatien | 16:02db4f537955 | 29 | public: |
donatien | 16:02db4f537955 | 30 | //IStream(); |
donatien | 16:02db4f537955 | 31 | //virtual ~IStream(); |
donatien | 16:02db4f537955 | 32 | |
donatien | 16:02db4f537955 | 33 | //0 for non-blocking (returns immediately), osWaitForever for infinite blocking |
donatien | 16:02db4f537955 | 34 | virtual int read(uint8_t* buf, size_t* pLength, size_t maxLength, uint32_t timeout=osWaitForever) = 0; |
donatien | 16:02db4f537955 | 35 | virtual size_t available() = 0; |
donatien | 16:02db4f537955 | 36 | virtual int waitAvailable(uint32_t timeout=osWaitForever) = 0; //Wait for data to be available |
donatien | 16:02db4f537955 | 37 | virtual int abortRead() = 0; //Abort current reading (or waiting) operation |
donatien | 16:02db4f537955 | 38 | }; |
donatien | 16:02db4f537955 | 39 | |
donatien | 16:02db4f537955 | 40 | class OStream |
donatien | 16:02db4f537955 | 41 | { |
donatien | 16:02db4f537955 | 42 | public: |
donatien | 16:02db4f537955 | 43 | //OStream(); |
donatien | 16:02db4f537955 | 44 | //virtual ~OStream(); |
donatien | 16:02db4f537955 | 45 | |
donatien | 16:02db4f537955 | 46 | //0 for non-blocking (returns immediately), osWaitForever for infinite blocking |
donatien | 16:02db4f537955 | 47 | virtual int write(uint8_t* buf, size_t length, uint32_t timeout=osWaitForever) = 0; |
donatien | 16:02db4f537955 | 48 | virtual size_t space() = 0; |
donatien | 16:02db4f537955 | 49 | virtual int waitSpace(uint32_t timeout=osWaitForever) = 0; //Wait for space to be available |
donatien | 16:02db4f537955 | 50 | virtual int abortWrite() = 0; //Abort current writing (or waiting) operation |
donatien | 16:02db4f537955 | 51 | }; |
donatien | 16:02db4f537955 | 52 | |
donatien | 16:02db4f537955 | 53 | class IOStream : public IStream, public OStream |
donatien | 16:02db4f537955 | 54 | { |
donatien | 16:02db4f537955 | 55 | public: |
donatien | 16:02db4f537955 | 56 | //IOStream(); |
donatien | 16:02db4f537955 | 57 | //virtual ~IOStream(); |
donatien | 16:02db4f537955 | 58 | }; |
donatien | 16:02db4f537955 | 59 | |
donatien | 16:02db4f537955 | 60 | |
donatien | 16:02db4f537955 | 61 | #endif /* IOSTREAM_H_ */ |