Implementation of 3G USB Modem Huawei E372

Dependents:   PYRN

Committer:
clemounet
Date:
Tue Apr 14 13:27:07 2015 +0000
Revision:
2:61ac95f0af72
.up (working)

Who changed what in which revision?

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