SecureDweet is a dweet.io library that works on HTTPS protocol using SecureHttpClient library. It'll be able to fetch or listen to Dweet APIs and JSON messages.

Committer:
faheem_chaudhary
Date:
Mon Aug 22 18:37:13 2016 +0000
Revision:
0:b30bbf6fe90d
First-cut library code check-in.  No guarantees to work.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
faheem_chaudhary 0:b30bbf6fe90d 1 /*
faheem_chaudhary 0:b30bbf6fe90d 2 * IHttpDataOut.h
faheem_chaudhary 0:b30bbf6fe90d 3 *
faheem_chaudhary 0:b30bbf6fe90d 4 * Created on: Aug 15, 2016
faheem_chaudhary 0:b30bbf6fe90d 5 * Author: Faheem Inayat
faheem_chaudhary 0:b30bbf6fe90d 6 * Created for: Renesas Electronics America HQ, Santa Clara, CA, USA
faheem_chaudhary 0:b30bbf6fe90d 7 *
faheem_chaudhary 0:b30bbf6fe90d 8 * Copyright (c) 2016 Renesas Electronics America (REA) and Faheem Inayat
faheem_chaudhary 0:b30bbf6fe90d 9 */
faheem_chaudhary 0:b30bbf6fe90d 10 /* Copyright (C) 2012 mbed.org, MIT License
faheem_chaudhary 0:b30bbf6fe90d 11 *
faheem_chaudhary 0:b30bbf6fe90d 12 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
faheem_chaudhary 0:b30bbf6fe90d 13 * and associated documentation files (the "Software"), to deal in the Software without restriction,
faheem_chaudhary 0:b30bbf6fe90d 14 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
faheem_chaudhary 0:b30bbf6fe90d 15 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
faheem_chaudhary 0:b30bbf6fe90d 16 * furnished to do so, subject to the following conditions:
faheem_chaudhary 0:b30bbf6fe90d 17 *
faheem_chaudhary 0:b30bbf6fe90d 18 * The above copyright notice and this permission notice shall be included in all copies or
faheem_chaudhary 0:b30bbf6fe90d 19 * substantial portions of the Software.
faheem_chaudhary 0:b30bbf6fe90d 20 *
faheem_chaudhary 0:b30bbf6fe90d 21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
faheem_chaudhary 0:b30bbf6fe90d 22 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
faheem_chaudhary 0:b30bbf6fe90d 23 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
faheem_chaudhary 0:b30bbf6fe90d 24 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
faheem_chaudhary 0:b30bbf6fe90d 25 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
faheem_chaudhary 0:b30bbf6fe90d 26 */
faheem_chaudhary 0:b30bbf6fe90d 27
faheem_chaudhary 0:b30bbf6fe90d 28 #ifndef IHTTPDATAOUT_H_
faheem_chaudhary 0:b30bbf6fe90d 29 #define IHTTPDATAOUT_H_
faheem_chaudhary 0:b30bbf6fe90d 30
faheem_chaudhary 0:b30bbf6fe90d 31 #include "stddef.h"
faheem_chaudhary 0:b30bbf6fe90d 32
faheem_chaudhary 0:b30bbf6fe90d 33 ///This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...)
faheem_chaudhary 0:b30bbf6fe90d 34 class IHttpDataOut
faheem_chaudhary 0:b30bbf6fe90d 35 {
faheem_chaudhary 0:b30bbf6fe90d 36 public:
faheem_chaudhary 0:b30bbf6fe90d 37 IHttpDataOut ();
faheem_chaudhary 0:b30bbf6fe90d 38 virtual ~IHttpDataOut ();
faheem_chaudhary 0:b30bbf6fe90d 39
faheem_chaudhary 0:b30bbf6fe90d 40 /** Reset stream to its beginning
faheem_chaudhary 0:b30bbf6fe90d 41 * Called by the HTTPClient on each new request
faheem_chaudhary 0:b30bbf6fe90d 42 */
faheem_chaudhary 0:b30bbf6fe90d 43 virtual void readReset() = 0;
faheem_chaudhary 0:b30bbf6fe90d 44
faheem_chaudhary 0:b30bbf6fe90d 45 /** Read a piece of data to be transmitted
faheem_chaudhary 0:b30bbf6fe90d 46 * @param buf Pointer to the buffer on which to copy the data
faheem_chaudhary 0:b30bbf6fe90d 47 * @param len Length of the buffer
faheem_chaudhary 0:b30bbf6fe90d 48 * @param pReadLen Pointer to the variable on which the actual copied data length will be stored
faheem_chaudhary 0:b30bbf6fe90d 49 */
faheem_chaudhary 0:b30bbf6fe90d 50 virtual int read(char* buf, size_t len, size_t* pReadLen) = 0;
faheem_chaudhary 0:b30bbf6fe90d 51
faheem_chaudhary 0:b30bbf6fe90d 52 /** Get MIME type
faheem_chaudhary 0:b30bbf6fe90d 53 * @param type Internet media type from Content-Type header
faheem_chaudhary 0:b30bbf6fe90d 54 */
faheem_chaudhary 0:b30bbf6fe90d 55 virtual int getDataType(char* type, size_t maxTypeLen) = 0; //Internet media type for Content-Type header
faheem_chaudhary 0:b30bbf6fe90d 56
faheem_chaudhary 0:b30bbf6fe90d 57 /** Determine whether the HTTP client should chunk the data
faheem_chaudhary 0:b30bbf6fe90d 58 * Used for Transfer-Encoding header
faheem_chaudhary 0:b30bbf6fe90d 59 */
faheem_chaudhary 0:b30bbf6fe90d 60 virtual bool getIsChunked() = 0;
faheem_chaudhary 0:b30bbf6fe90d 61
faheem_chaudhary 0:b30bbf6fe90d 62 /** If the data is not chunked, get its size
faheem_chaudhary 0:b30bbf6fe90d 63 * Used for Content-Length header
faheem_chaudhary 0:b30bbf6fe90d 64 */
faheem_chaudhary 0:b30bbf6fe90d 65 virtual size_t getDataLen() = 0;
faheem_chaudhary 0:b30bbf6fe90d 66 };
faheem_chaudhary 0:b30bbf6fe90d 67
faheem_chaudhary 0:b30bbf6fe90d 68 #endif /* IHTTPDATAOUT_H_ */
faheem_chaudhary 0:b30bbf6fe90d 69