Lora Personalized device for Everynet

Dependencies:   LMiCPersonalizedforEverynet SX1276Lib X_NUCLEO_IKS01A1 cantcoap lwip mbed-rtos mbed

Fork of LoRaWAN-test-10secs by Alcatel-Lucent IoT Development

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers IOStream.h Source File

IOStream.h

00001 /* IOStream.h */
00002 /*
00003 Copyright (C) 2011 ARM Limited.
00004 
00005 Permission is hereby granted, free of charge, to any person obtaining a copy of
00006 this software and associated documentation files (the "Software"), to deal in
00007 the Software without restriction, including without limitation the rights to
00008 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
00009 of the Software, and to permit persons to whom the Software is furnished to do
00010 so, subject to the following conditions:
00011 
00012 The above copyright notice and this permission notice shall be included in all
00013 copies or substantial portions of the Software.
00014 
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00018 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00019 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00020 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00021 SOFTWARE.
00022 */
00023 
00024 #ifndef IOSTREAM_H_
00025 #define IOSTREAM_H_
00026 
00027 #include "fwk.h"
00028 
00029 #include "rtos.h"
00030 
00031 class IStream
00032 {
00033 public:
00034   //IStream();
00035   //virtual ~IStream();
00036 
00037     //0 for non-blocking (returns immediately), osWaitForever for infinite blocking
00038     virtual int read(uint8_t* buf, size_t* pLength, size_t maxLength, uint32_t timeout=osWaitForever) = 0;
00039     virtual size_t available() = 0;
00040     virtual int waitAvailable(uint32_t timeout=osWaitForever) = 0; //Wait for data to be available
00041     virtual int abortRead() = 0; //Abort current reading (or waiting) operation
00042 };
00043 
00044 class OStream
00045 {
00046 public:
00047   //OStream();
00048   //virtual ~OStream();
00049 
00050     //0 for non-blocking (returns immediately), osWaitForever for infinite blocking
00051     virtual int write(uint8_t* buf, size_t length, uint32_t timeout=osWaitForever) = 0;
00052     virtual size_t space() = 0;
00053     virtual int waitSpace(uint32_t timeout=osWaitForever) = 0; //Wait for space to be available
00054     virtual int abortWrite() = 0; //Abort current writing (or waiting) operation
00055 };
00056 
00057 class IOStream : public IStream, public OStream
00058 {
00059 public:
00060   //IOStream();
00061   //virtual ~IOStream();
00062 };
00063 
00064 
00065 #endif /* IOSTREAM_H_ */