Integrating the ublox LISA C200 modem
Fork of SprintUSBModemHTTPClientTest by
HTTPClient/IHTTPData.h@5:3f93dd1d4cb3, 2013-09-26 (annotated)
- Committer:
- sam_grove
- Date:
- Thu Sep 26 00:44:20 2013 -0500
- Revision:
- 5:3f93dd1d4cb3
Exported program and replaced contents of the repo with the source
to build and debug using keil mdk. Libs NOT upto date are lwip, lwip-sys
and socket. these have newer versions under mbed_official but were starting
from a know working point
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove | 5:3f93dd1d4cb3 | 1 | /* IHTTPData.h */ |
sam_grove | 5:3f93dd1d4cb3 | 2 | /* Copyright (C) 2012 mbed.org, MIT License |
sam_grove | 5:3f93dd1d4cb3 | 3 | * |
sam_grove | 5:3f93dd1d4cb3 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
sam_grove | 5:3f93dd1d4cb3 | 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
sam_grove | 5:3f93dd1d4cb3 | 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
sam_grove | 5:3f93dd1d4cb3 | 7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
sam_grove | 5:3f93dd1d4cb3 | 8 | * furnished to do so, subject to the following conditions: |
sam_grove | 5:3f93dd1d4cb3 | 9 | * |
sam_grove | 5:3f93dd1d4cb3 | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
sam_grove | 5:3f93dd1d4cb3 | 11 | * substantial portions of the Software. |
sam_grove | 5:3f93dd1d4cb3 | 12 | * |
sam_grove | 5:3f93dd1d4cb3 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
sam_grove | 5:3f93dd1d4cb3 | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
sam_grove | 5:3f93dd1d4cb3 | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
sam_grove | 5:3f93dd1d4cb3 | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
sam_grove | 5:3f93dd1d4cb3 | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
sam_grove | 5:3f93dd1d4cb3 | 18 | */ |
sam_grove | 5:3f93dd1d4cb3 | 19 | |
sam_grove | 5:3f93dd1d4cb3 | 20 | #ifndef IHTTPDATA_H |
sam_grove | 5:3f93dd1d4cb3 | 21 | #define IHTTPDATA_H |
sam_grove | 5:3f93dd1d4cb3 | 22 | |
sam_grove | 5:3f93dd1d4cb3 | 23 | #include <cstring> |
sam_grove | 5:3f93dd1d4cb3 | 24 | |
sam_grove | 5:3f93dd1d4cb3 | 25 | using std::size_t; |
sam_grove | 5:3f93dd1d4cb3 | 26 | |
sam_grove | 5:3f93dd1d4cb3 | 27 | ///This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...) |
sam_grove | 5:3f93dd1d4cb3 | 28 | class IHTTPDataOut |
sam_grove | 5:3f93dd1d4cb3 | 29 | { |
sam_grove | 5:3f93dd1d4cb3 | 30 | protected: |
sam_grove | 5:3f93dd1d4cb3 | 31 | friend class HTTPClient; |
sam_grove | 5:3f93dd1d4cb3 | 32 | |
sam_grove | 5:3f93dd1d4cb3 | 33 | /** Reset stream to its beginning |
sam_grove | 5:3f93dd1d4cb3 | 34 | * Called by the HTTPClient on each new request |
sam_grove | 5:3f93dd1d4cb3 | 35 | */ |
sam_grove | 5:3f93dd1d4cb3 | 36 | virtual void readReset() = 0; |
sam_grove | 5:3f93dd1d4cb3 | 37 | |
sam_grove | 5:3f93dd1d4cb3 | 38 | /** Read a piece of data to be transmitted |
sam_grove | 5:3f93dd1d4cb3 | 39 | * @param buf Pointer to the buffer on which to copy the data |
sam_grove | 5:3f93dd1d4cb3 | 40 | * @param len Length of the buffer |
sam_grove | 5:3f93dd1d4cb3 | 41 | * @param pReadLen Pointer to the variable on which the actual copied data length will be stored |
sam_grove | 5:3f93dd1d4cb3 | 42 | */ |
sam_grove | 5:3f93dd1d4cb3 | 43 | virtual int read(char* buf, size_t len, size_t* pReadLen) = 0; |
sam_grove | 5:3f93dd1d4cb3 | 44 | |
sam_grove | 5:3f93dd1d4cb3 | 45 | /** Get MIME type |
sam_grove | 5:3f93dd1d4cb3 | 46 | * @param type Internet media type from Content-Type header |
sam_grove | 5:3f93dd1d4cb3 | 47 | */ |
sam_grove | 5:3f93dd1d4cb3 | 48 | virtual int getDataType(char* type, size_t maxTypeLen) = 0; //Internet media type for Content-Type header |
sam_grove | 5:3f93dd1d4cb3 | 49 | |
sam_grove | 5:3f93dd1d4cb3 | 50 | /** Determine whether the HTTP client should chunk the data |
sam_grove | 5:3f93dd1d4cb3 | 51 | * Used for Transfer-Encoding header |
sam_grove | 5:3f93dd1d4cb3 | 52 | */ |
sam_grove | 5:3f93dd1d4cb3 | 53 | virtual bool getIsChunked() = 0; |
sam_grove | 5:3f93dd1d4cb3 | 54 | |
sam_grove | 5:3f93dd1d4cb3 | 55 | /** If the data is not chunked, get its size |
sam_grove | 5:3f93dd1d4cb3 | 56 | * Used for Content-Length header |
sam_grove | 5:3f93dd1d4cb3 | 57 | */ |
sam_grove | 5:3f93dd1d4cb3 | 58 | virtual size_t getDataLen() = 0; |
sam_grove | 5:3f93dd1d4cb3 | 59 | |
sam_grove | 5:3f93dd1d4cb3 | 60 | }; |
sam_grove | 5:3f93dd1d4cb3 | 61 | |
sam_grove | 5:3f93dd1d4cb3 | 62 | ///This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...) |
sam_grove | 5:3f93dd1d4cb3 | 63 | class IHTTPDataIn |
sam_grove | 5:3f93dd1d4cb3 | 64 | { |
sam_grove | 5:3f93dd1d4cb3 | 65 | protected: |
sam_grove | 5:3f93dd1d4cb3 | 66 | friend class HTTPClient; |
sam_grove | 5:3f93dd1d4cb3 | 67 | |
sam_grove | 5:3f93dd1d4cb3 | 68 | /** Reset stream to its beginning |
sam_grove | 5:3f93dd1d4cb3 | 69 | * Called by the HTTPClient on each new request |
sam_grove | 5:3f93dd1d4cb3 | 70 | */ |
sam_grove | 5:3f93dd1d4cb3 | 71 | virtual void writeReset() = 0; |
sam_grove | 5:3f93dd1d4cb3 | 72 | |
sam_grove | 5:3f93dd1d4cb3 | 73 | /** Write a piece of data transmitted by the server |
sam_grove | 5:3f93dd1d4cb3 | 74 | * @param buf Pointer to the buffer from which to copy the data |
sam_grove | 5:3f93dd1d4cb3 | 75 | * @param len Length of the buffer |
sam_grove | 5:3f93dd1d4cb3 | 76 | */ |
sam_grove | 5:3f93dd1d4cb3 | 77 | virtual int write(const char* buf, size_t len) = 0; |
sam_grove | 5:3f93dd1d4cb3 | 78 | |
sam_grove | 5:3f93dd1d4cb3 | 79 | /** Set MIME type |
sam_grove | 5:3f93dd1d4cb3 | 80 | * @param type Internet media type from Content-Type header |
sam_grove | 5:3f93dd1d4cb3 | 81 | */ |
sam_grove | 5:3f93dd1d4cb3 | 82 | virtual void setDataType(const char* type) = 0; |
sam_grove | 5:3f93dd1d4cb3 | 83 | |
sam_grove | 5:3f93dd1d4cb3 | 84 | /** Determine whether the data is chunked |
sam_grove | 5:3f93dd1d4cb3 | 85 | * Recovered from Transfer-Encoding header |
sam_grove | 5:3f93dd1d4cb3 | 86 | */ |
sam_grove | 5:3f93dd1d4cb3 | 87 | virtual void setIsChunked(bool chunked) = 0; |
sam_grove | 5:3f93dd1d4cb3 | 88 | |
sam_grove | 5:3f93dd1d4cb3 | 89 | /** If the data is not chunked, set its size |
sam_grove | 5:3f93dd1d4cb3 | 90 | * From Content-Length header |
sam_grove | 5:3f93dd1d4cb3 | 91 | */ |
sam_grove | 5:3f93dd1d4cb3 | 92 | virtual void setDataLen(size_t len) = 0; |
sam_grove | 5:3f93dd1d4cb3 | 93 | |
sam_grove | 5:3f93dd1d4cb3 | 94 | }; |
sam_grove | 5:3f93dd1d4cb3 | 95 | |
sam_grove | 5:3f93dd1d4cb3 | 96 | #endif |