Fork HTTPClient and Modfiy code for mbed 6.0
Dependents: mbed-demo-http-get-json
data/HTTPJson.h@37:74c1c4527f70, 2016-12-17 (annotated)
- Committer:
- WiredHome
- Date:
- Sat Dec 17 15:19:55 2016 +0000
- Revision:
- 37:74c1c4527f70
Integrated the Json interface.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WiredHome | 37:74c1c4527f70 | 1 | /* HTTPJson.h */ |
WiredHome | 37:74c1c4527f70 | 2 | /* Copyright (C) 2012 mbed.org, MIT License |
WiredHome | 37:74c1c4527f70 | 3 | * |
WiredHome | 37:74c1c4527f70 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
WiredHome | 37:74c1c4527f70 | 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
WiredHome | 37:74c1c4527f70 | 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
WiredHome | 37:74c1c4527f70 | 7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
WiredHome | 37:74c1c4527f70 | 8 | * furnished to do so, subject to the following conditions: |
WiredHome | 37:74c1c4527f70 | 9 | * |
WiredHome | 37:74c1c4527f70 | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
WiredHome | 37:74c1c4527f70 | 11 | * substantial portions of the Software. |
WiredHome | 37:74c1c4527f70 | 12 | * |
WiredHome | 37:74c1c4527f70 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
WiredHome | 37:74c1c4527f70 | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
WiredHome | 37:74c1c4527f70 | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
WiredHome | 37:74c1c4527f70 | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
WiredHome | 37:74c1c4527f70 | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
WiredHome | 37:74c1c4527f70 | 18 | */ |
WiredHome | 37:74c1c4527f70 | 19 | |
WiredHome | 37:74c1c4527f70 | 20 | |
WiredHome | 37:74c1c4527f70 | 21 | #ifndef HTTPJSON_H_ |
WiredHome | 37:74c1c4527f70 | 22 | #define HTTPJSON_H_ |
WiredHome | 37:74c1c4527f70 | 23 | |
WiredHome | 37:74c1c4527f70 | 24 | #include "HTTPText.h" |
WiredHome | 37:74c1c4527f70 | 25 | |
WiredHome | 37:74c1c4527f70 | 26 | /** A data endpoint to store JSON text |
WiredHome | 37:74c1c4527f70 | 27 | */ |
WiredHome | 37:74c1c4527f70 | 28 | class HTTPJson : public HTTPText |
WiredHome | 37:74c1c4527f70 | 29 | { |
WiredHome | 37:74c1c4527f70 | 30 | public: |
WiredHome | 37:74c1c4527f70 | 31 | /** Create an HTTPJson instance for output |
WiredHome | 37:74c1c4527f70 | 32 | * @param json_str JSON string to be transmitted |
WiredHome | 37:74c1c4527f70 | 33 | */ |
WiredHome | 37:74c1c4527f70 | 34 | HTTPJson(char* json_str); |
WiredHome | 37:74c1c4527f70 | 35 | |
WiredHome | 37:74c1c4527f70 | 36 | /** Create an HTTPText instance for input |
WiredHome | 37:74c1c4527f70 | 37 | * @param json_str Buffer to store the incoming JSON string |
WiredHome | 37:74c1c4527f70 | 38 | * @param size Size of the buffer |
WiredHome | 37:74c1c4527f70 | 39 | */ |
WiredHome | 37:74c1c4527f70 | 40 | HTTPJson(char* json_str, size_t size); |
WiredHome | 37:74c1c4527f70 | 41 | |
WiredHome | 37:74c1c4527f70 | 42 | protected: |
WiredHome | 37:74c1c4527f70 | 43 | virtual int getDataType(char* type, size_t maxTypeLen); //Internet media type for Content-Type header |
WiredHome | 37:74c1c4527f70 | 44 | }; |
WiredHome | 37:74c1c4527f70 | 45 | |
WiredHome | 37:74c1c4527f70 | 46 | #endif /* HTTPJSON_H_ */ |