Hi. This is the feed program for Cosm. (The previous name of the services is Pachube.)

Dependencies:   mbed ThermistorPack Pachube ConfigFile EthernetNetIf TextLCD HTTPClient_ToBeRemoved FatFileSystem SDFileSystem

Committer:
shintamainjp
Date:
Mon Aug 06 12:37:59 2012 +0000
Revision:
0:521ba375aa0f
Pachube renamed to Cosm.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shintamainjp 0:521ba375aa0f 1
shintamainjp 0:521ba375aa0f 2 /*
shintamainjp 0:521ba375aa0f 3 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
shintamainjp 0:521ba375aa0f 4
shintamainjp 0:521ba375aa0f 5 Permission is hereby granted, free of charge, to any person obtaining a copy
shintamainjp 0:521ba375aa0f 6 of this software and associated documentation files (the "Software"), to deal
shintamainjp 0:521ba375aa0f 7 in the Software without restriction, including without limitation the rights
shintamainjp 0:521ba375aa0f 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
shintamainjp 0:521ba375aa0f 9 copies of the Software, and to permit persons to whom the Software is
shintamainjp 0:521ba375aa0f 10 furnished to do so, subject to the following conditions:
shintamainjp 0:521ba375aa0f 11
shintamainjp 0:521ba375aa0f 12 The above copyright notice and this permission notice shall be included in
shintamainjp 0:521ba375aa0f 13 all copies or substantial portions of the Software.
shintamainjp 0:521ba375aa0f 14
shintamainjp 0:521ba375aa0f 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
shintamainjp 0:521ba375aa0f 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
shintamainjp 0:521ba375aa0f 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
shintamainjp 0:521ba375aa0f 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
shintamainjp 0:521ba375aa0f 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
shintamainjp 0:521ba375aa0f 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
shintamainjp 0:521ba375aa0f 21 THE SOFTWARE.
shintamainjp 0:521ba375aa0f 22 */
shintamainjp 0:521ba375aa0f 23
shintamainjp 0:521ba375aa0f 24 /** \file
shintamainjp 0:521ba375aa0f 25 HTTP Text data source/sink header file
shintamainjp 0:521ba375aa0f 26 */
shintamainjp 0:521ba375aa0f 27
shintamainjp 0:521ba375aa0f 28 #ifndef HTTP_TEXT_H
shintamainjp 0:521ba375aa0f 29 #define HTTP_TEXT_H
shintamainjp 0:521ba375aa0f 30
shintamainjp 0:521ba375aa0f 31 #include "../HTTPData.h"
shintamainjp 0:521ba375aa0f 32 #include "mbed.h"
shintamainjp 0:521ba375aa0f 33
shintamainjp 0:521ba375aa0f 34 #define DEFAULT_MAX_MEM_ALLOC 512 //Avoid out-of-memory problems
shintamainjp 0:521ba375aa0f 35
shintamainjp 0:521ba375aa0f 36 ///HTTP Client data container for text
shintamainjp 0:521ba375aa0f 37 /**
shintamainjp 0:521ba375aa0f 38 This is a simple "Text" data repository for HTTP requests.
shintamainjp 0:521ba375aa0f 39 */
shintamainjp 0:521ba375aa0f 40 class HTTPText : public HTTPData //Simple Text I/O
shintamainjp 0:521ba375aa0f 41 {
shintamainjp 0:521ba375aa0f 42 public:
shintamainjp 0:521ba375aa0f 43 ///Instantiates the object.
shintamainjp 0:521ba375aa0f 44 /**
shintamainjp 0:521ba375aa0f 45 @param encoding encoding of the data, it defaults to text/html.
shintamainjp 0:521ba375aa0f 46 @param maxSize defines the maximum memory size that can be allocated by the object. It defaults to 512 bytes.
shintamainjp 0:521ba375aa0f 47 */
shintamainjp 0:521ba375aa0f 48 HTTPText(const string& encoding = "text/html", int maxSize = DEFAULT_MAX_MEM_ALLOC);
shintamainjp 0:521ba375aa0f 49 virtual ~HTTPText();
shintamainjp 0:521ba375aa0f 50
shintamainjp 0:521ba375aa0f 51 ///Gets text
shintamainjp 0:521ba375aa0f 52 /**
shintamainjp 0:521ba375aa0f 53 Returns the text in the container as a zero-terminated char*.
shintamainjp 0:521ba375aa0f 54 The array returned points to the internal buffer of the object and remains owned by the object.
shintamainjp 0:521ba375aa0f 55 */
shintamainjp 0:521ba375aa0f 56 const char* gets() const;
shintamainjp 0:521ba375aa0f 57
shintamainjp 0:521ba375aa0f 58 //Puts text
shintamainjp 0:521ba375aa0f 59 /**
shintamainjp 0:521ba375aa0f 60 Sets the text in the container using a zero-terminated char*.
shintamainjp 0:521ba375aa0f 61 */
shintamainjp 0:521ba375aa0f 62 void puts(const char* str);
shintamainjp 0:521ba375aa0f 63
shintamainjp 0:521ba375aa0f 64 ///Gets text
shintamainjp 0:521ba375aa0f 65 /**
shintamainjp 0:521ba375aa0f 66 Returns the text in the container as string.
shintamainjp 0:521ba375aa0f 67 */
shintamainjp 0:521ba375aa0f 68 string& get();
shintamainjp 0:521ba375aa0f 69
shintamainjp 0:521ba375aa0f 70 ///Puts text
shintamainjp 0:521ba375aa0f 71 /**
shintamainjp 0:521ba375aa0f 72 Sets the text in the container as string.
shintamainjp 0:521ba375aa0f 73 */
shintamainjp 0:521ba375aa0f 74 void set(const string& str);
shintamainjp 0:521ba375aa0f 75
shintamainjp 0:521ba375aa0f 76 ///Clears the content.
shintamainjp 0:521ba375aa0f 77 /**
shintamainjp 0:521ba375aa0f 78 If this container is used as a data sink, it is cleared by the HTTP Client at the beginning of the request.
shintamainjp 0:521ba375aa0f 79 */
shintamainjp 0:521ba375aa0f 80 virtual void clear();
shintamainjp 0:521ba375aa0f 81
shintamainjp 0:521ba375aa0f 82 protected:
shintamainjp 0:521ba375aa0f 83 virtual int read(char* buf, int len);
shintamainjp 0:521ba375aa0f 84 virtual int write(const char* buf, int len);
shintamainjp 0:521ba375aa0f 85
shintamainjp 0:521ba375aa0f 86 virtual string getDataType(); //Internet media type for Content-Type header
shintamainjp 0:521ba375aa0f 87 virtual void setDataType(const string& type); //Internet media type from Content-Type header
shintamainjp 0:521ba375aa0f 88
shintamainjp 0:521ba375aa0f 89 virtual bool getIsChunked(); //For Transfer-Encoding header
shintamainjp 0:521ba375aa0f 90 virtual void setIsChunked(bool chunked); //From Transfer-Encoding header
shintamainjp 0:521ba375aa0f 91
shintamainjp 0:521ba375aa0f 92 virtual int getDataLen(); //For Content-Length header
shintamainjp 0:521ba375aa0f 93 virtual void setDataLen(int len); //From Content-Length header, or if the transfer is chunked, next chunk length
shintamainjp 0:521ba375aa0f 94
shintamainjp 0:521ba375aa0f 95 private:
shintamainjp 0:521ba375aa0f 96 string m_buf;
shintamainjp 0:521ba375aa0f 97 string m_encoding;
shintamainjp 0:521ba375aa0f 98 int m_maxSize;
shintamainjp 0:521ba375aa0f 99 };
shintamainjp 0:521ba375aa0f 100
shintamainjp 0:521ba375aa0f 101 #endif