mbed IoT Gateway board demo. This program received wireless data from JeeNode and uploads to Pachube. http://www.skpang.co.uk/catalog/mbed-iot-gateway-board-p-1051.html Full kit: http://www.skpang.co.uk/catalog/mbed-iot-gateway-full-kit-p-1052.html
Dependencies: EthernetNetIf mbed
Pachube/Pachube.h@1:63b6db2e24a5, 2012-01-30 (annotated)
- Committer:
- pangsk
- Date:
- Mon Jan 30 21:44:36 2012 +0000
- Revision:
- 1:63b6db2e24a5
- Parent:
- 0:7f301f08b68f
Correct init code in RF12B.cpp
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pangsk | 0:7f301f08b68f | 1 | /** |
pangsk | 0:7f301f08b68f | 2 | * Pachube API interface driver. (Version 0.0.1) |
pangsk | 0:7f301f08b68f | 3 | * |
pangsk | 0:7f301f08b68f | 4 | * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems) |
pangsk | 0:7f301f08b68f | 5 | * http://shinta.main.jp/ |
pangsk | 0:7f301f08b68f | 6 | */ |
pangsk | 0:7f301f08b68f | 7 | |
pangsk | 0:7f301f08b68f | 8 | #ifndef _PACHUBE_H_ |
pangsk | 0:7f301f08b68f | 9 | #define _PACHUBE_H_ |
pangsk | 0:7f301f08b68f | 10 | |
pangsk | 0:7f301f08b68f | 11 | #include <string> |
pangsk | 0:7f301f08b68f | 12 | |
pangsk | 0:7f301f08b68f | 13 | class Pachube { |
pangsk | 0:7f301f08b68f | 14 | public: |
pangsk | 0:7f301f08b68f | 15 | |
pangsk | 0:7f301f08b68f | 16 | explicit Pachube(std::string APIKEY); |
pangsk | 0:7f301f08b68f | 17 | |
pangsk | 0:7f301f08b68f | 18 | virtual ~Pachube(); |
pangsk | 0:7f301f08b68f | 19 | |
pangsk | 0:7f301f08b68f | 20 | /* |
pangsk | 0:7f301f08b68f | 21 | * ================================================================= |
pangsk | 0:7f301f08b68f | 22 | * Environments (feeds) |
pangsk | 0:7f301f08b68f | 23 | * ================================================================= |
pangsk | 0:7f301f08b68f | 24 | */ |
pangsk | 0:7f301f08b68f | 25 | |
pangsk | 0:7f301f08b68f | 26 | /** |
pangsk | 0:7f301f08b68f | 27 | * List all available feeds: GET /v2/feeds |
pangsk | 0:7f301f08b68f | 28 | * |
pangsk | 0:7f301f08b68f | 29 | * @param page Integer indicating which page of results you are requesting. |
pangsk | 0:7f301f08b68f | 30 | * @param per_page Integer defining how many results to return per page (1 to 1000). |
pangsk | 0:7f301f08b68f | 31 | * @param content String parameter ('full' or 'summary') describing whether we want full or summary results. Full results means all datastream values are returned, summary just returns the environment meta data for each feed. |
pangsk | 0:7f301f08b68f | 32 | * @param q Full text search parameter. Should return any feeds matching this string. |
pangsk | 0:7f301f08b68f | 33 | * @param tag Returns feeds containing datastreams tagged with the search query. |
pangsk | 0:7f301f08b68f | 34 | * @param user Returns feeds created by the user specified. |
pangsk | 0:7f301f08b68f | 35 | * @param units Returns feeds containing datastreams with units specified by the search query. |
pangsk | 0:7f301f08b68f | 36 | * @param status Possible values ('live', 'frozen', or 'all'). Whether to search for only live feeds, only frozen feeds, or all feeds. Defaults to all. |
pangsk | 0:7f301f08b68f | 37 | * @param order Order of returned feeds. Possible values ('created_at', 'retrieved_at', or 'relevance'). |
pangsk | 0:7f301f08b68f | 38 | */ |
pangsk | 0:7f301f08b68f | 39 | virtual int listAllAvailableFeeds( |
pangsk | 0:7f301f08b68f | 40 | int page, |
pangsk | 0:7f301f08b68f | 41 | int per_page, |
pangsk | 0:7f301f08b68f | 42 | std::string content, |
pangsk | 0:7f301f08b68f | 43 | std::string q, |
pangsk | 0:7f301f08b68f | 44 | std::string tag, |
pangsk | 0:7f301f08b68f | 45 | std::string user, |
pangsk | 0:7f301f08b68f | 46 | std::string units, |
pangsk | 0:7f301f08b68f | 47 | std::string status, |
pangsk | 0:7f301f08b68f | 48 | std::string order, |
pangsk | 0:7f301f08b68f | 49 | std::string &datatext) = 0; |
pangsk | 0:7f301f08b68f | 50 | |
pangsk | 0:7f301f08b68f | 51 | /** |
pangsk | 0:7f301f08b68f | 52 | * Create new feed: POST /v2/feeds |
pangsk | 0:7f301f08b68f | 53 | */ |
pangsk | 0:7f301f08b68f | 54 | virtual int createNewFeed(void) = 0; |
pangsk | 0:7f301f08b68f | 55 | |
pangsk | 0:7f301f08b68f | 56 | /** |
pangsk | 0:7f301f08b68f | 57 | * Read feed: GET /v2/feeds/<feed_id> |
pangsk | 0:7f301f08b68f | 58 | */ |
pangsk | 0:7f301f08b68f | 59 | virtual int readFeed(int feed_id, std::string &datatext) = 0; |
pangsk | 0:7f301f08b68f | 60 | |
pangsk | 0:7f301f08b68f | 61 | /** |
pangsk | 0:7f301f08b68f | 62 | * Update feed: PUT /v2/feeds/<feed_id> |
pangsk | 0:7f301f08b68f | 63 | */ |
pangsk | 0:7f301f08b68f | 64 | virtual int updateFeed(int feed_id) = 0; |
pangsk | 0:7f301f08b68f | 65 | |
pangsk | 0:7f301f08b68f | 66 | /** |
pangsk | 0:7f301f08b68f | 67 | * Delete feed: DELETE /v2/feeds/<feed_id> |
pangsk | 0:7f301f08b68f | 68 | */ |
pangsk | 0:7f301f08b68f | 69 | virtual int deleteFeed(int feed_id) = 0; |
pangsk | 0:7f301f08b68f | 70 | |
pangsk | 0:7f301f08b68f | 71 | /* |
pangsk | 0:7f301f08b68f | 72 | * ================================================================= |
pangsk | 0:7f301f08b68f | 73 | * Datastreams |
pangsk | 0:7f301f08b68f | 74 | * ================================================================= |
pangsk | 0:7f301f08b68f | 75 | */ |
pangsk | 0:7f301f08b68f | 76 | |
pangsk | 0:7f301f08b68f | 77 | /** |
pangsk | 0:7f301f08b68f | 78 | * Create new datastream: POST /v2/feeds/<feed_id>/datastreams |
pangsk | 0:7f301f08b68f | 79 | * |
pangsk | 0:7f301f08b68f | 80 | * @param feed_id Feed ID. |
pangsk | 0:7f301f08b68f | 81 | * @param stream_id Stream ID text. |
pangsk | 0:7f301f08b68f | 82 | * @param value value. |
pangsk | 0:7f301f08b68f | 83 | * |
pangsk | 0:7f301f08b68f | 84 | * @return Return code from a web server. |
pangsk | 0:7f301f08b68f | 85 | */ |
pangsk | 0:7f301f08b68f | 86 | virtual int createNewDataStream(int feed_id, std::string stream_id, std::string value) = 0; |
pangsk | 0:7f301f08b68f | 87 | |
pangsk | 0:7f301f08b68f | 88 | /** |
pangsk | 0:7f301f08b68f | 89 | * Read datastream - GET /v2/feeds/<feed_id>/datastreams/<datastream_id> |
pangsk | 0:7f301f08b68f | 90 | * |
pangsk | 0:7f301f08b68f | 91 | * @param feed_id Feed ID. |
pangsk | 0:7f301f08b68f | 92 | * @param stream_id Stream ID text. |
pangsk | 0:7f301f08b68f | 93 | * |
pangsk | 0:7f301f08b68f | 94 | * @return Return code from a web server. |
pangsk | 0:7f301f08b68f | 95 | */ |
pangsk | 0:7f301f08b68f | 96 | virtual int readDataStream(int feed_id, std::string stream_id, std::string &datatext) = 0; |
pangsk | 0:7f301f08b68f | 97 | |
pangsk | 0:7f301f08b68f | 98 | /** |
pangsk | 0:7f301f08b68f | 99 | * Update datastream: PUT /v2/feeds/<feed_id>/datastreams/<datastream_id> |
pangsk | 0:7f301f08b68f | 100 | * |
pangsk | 0:7f301f08b68f | 101 | * @param feed_id Feed ID. |
pangsk | 0:7f301f08b68f | 102 | * @param stream_id Stream ID text. |
pangsk | 0:7f301f08b68f | 103 | * @param value value. |
pangsk | 0:7f301f08b68f | 104 | * |
pangsk | 0:7f301f08b68f | 105 | * @return Return code from a web server. |
pangsk | 0:7f301f08b68f | 106 | */ |
pangsk | 0:7f301f08b68f | 107 | virtual int updateDataStream(int feed_id, std::string stream_id, std::string value) = 0; |
pangsk | 0:7f301f08b68f | 108 | |
pangsk | 0:7f301f08b68f | 109 | /** |
pangsk | 0:7f301f08b68f | 110 | * Delete datastream: DELETE /v2/feeds/<feed_id>/datastreams/<datastream_id> |
pangsk | 0:7f301f08b68f | 111 | * |
pangsk | 0:7f301f08b68f | 112 | * @param feed_id Feed ID. |
pangsk | 0:7f301f08b68f | 113 | * @param stream_id Stream ID text. |
pangsk | 0:7f301f08b68f | 114 | * |
pangsk | 0:7f301f08b68f | 115 | * @return Return code from a web server. |
pangsk | 0:7f301f08b68f | 116 | */ |
pangsk | 0:7f301f08b68f | 117 | virtual int deleteDataStream(int feed_id, std::string stream_id) = 0; |
pangsk | 0:7f301f08b68f | 118 | |
pangsk | 0:7f301f08b68f | 119 | protected: |
pangsk | 0:7f301f08b68f | 120 | const std::string APIKEY; |
pangsk | 0:7f301f08b68f | 121 | static const std::string REQUESTHEADER; |
pangsk | 0:7f301f08b68f | 122 | static const std::string URLBASE_V2; |
pangsk | 0:7f301f08b68f | 123 | }; |
pangsk | 0:7f301f08b68f | 124 | |
pangsk | 0:7f301f08b68f | 125 | #endif |
pangsk | 0:7f301f08b68f | 126 | |
pangsk | 0:7f301f08b68f | 127 | /* |
pangsk | 0:7f301f08b68f | 128 | Pachube v2 API Documentation |
pangsk | 0:7f301f08b68f | 129 | http://api.pachube.com/v2/ |
pangsk | 0:7f301f08b68f | 130 | |
pangsk | 0:7f301f08b68f | 131 | # Environments (feeds) |
pangsk | 0:7f301f08b68f | 132 | |
pangsk | 0:7f301f08b68f | 133 | o * List all available feeds: GET /v2/feeds |
pangsk | 0:7f301f08b68f | 134 | o * Create new feed: POST /v2/feeds |
pangsk | 0:7f301f08b68f | 135 | o * Read feed: GET /v2/feeds/<feed_id> |
pangsk | 0:7f301f08b68f | 136 | o * Update feed: PUT /v2/feeds/<feed_id> |
pangsk | 0:7f301f08b68f | 137 | o * Delete feed: DELETE /v2/feeds/<feed_id> |
pangsk | 0:7f301f08b68f | 138 | |
pangsk | 0:7f301f08b68f | 139 | # Datastreams |
pangsk | 0:7f301f08b68f | 140 | |
pangsk | 0:7f301f08b68f | 141 | o * Create new datastream: POST /v2/feeds/<feed_id>/datastreams |
pangsk | 0:7f301f08b68f | 142 | o * Read datastream - GET /v2/feeds/<feed_id>/datastreams/<datastream_id> |
pangsk | 0:7f301f08b68f | 143 | o * Update datastream: PUT /v2/feeds/<feed_id>/datastreams/<datastream_id> |
pangsk | 0:7f301f08b68f | 144 | o * Delete datastream: DELETE /v2/feeds/<feed_id>/datastreams/<datastream_id> |
pangsk | 0:7f301f08b68f | 145 | |
pangsk | 0:7f301f08b68f | 146 | # Datapoints |
pangsk | 0:7f301f08b68f | 147 | |
pangsk | 0:7f301f08b68f | 148 | * Create datapoint: POST /v2/feeds/<feed_id>/datastreams/<datastream_id>/datapoints |
pangsk | 0:7f301f08b68f | 149 | * Read datapoint: GET /v2/feeds/<feed_id>/datastreams/<datastream_id>/datapoints/<timestamp> |
pangsk | 0:7f301f08b68f | 150 | * Update datapoint: PUT /v2/feeds/<feed_id>/datastreams/<datastream_id>/datapoints/<timestamp> |
pangsk | 0:7f301f08b68f | 151 | * Delete datapoint: DELETE /v2/feeds/<feed_id>/datastreams/<datastream_id>/datapoints/<timestamp> |
pangsk | 0:7f301f08b68f | 152 | |
pangsk | 0:7f301f08b68f | 153 | # Triggers |
pangsk | 0:7f301f08b68f | 154 | |
pangsk | 0:7f301f08b68f | 155 | * List triggers: GET /v2/triggers |
pangsk | 0:7f301f08b68f | 156 | * Create trigger: POST /v2/triggers |
pangsk | 0:7f301f08b68f | 157 | * Read trigger: GET /v2/triggers/<trigger_id> |
pangsk | 0:7f301f08b68f | 158 | * Update trigger: PUT /v2/triggers/<trigger_id> |
pangsk | 0:7f301f08b68f | 159 | * Delete trigger: DELETE /v2/triggers/<trigger_id> |
pangsk | 0:7f301f08b68f | 160 | |
pangsk | 0:7f301f08b68f | 161 | # Users |
pangsk | 0:7f301f08b68f | 162 | |
pangsk | 0:7f301f08b68f | 163 | * List all users: GET /v2/users |
pangsk | 0:7f301f08b68f | 164 | * Create user: POST /v2/users |
pangsk | 0:7f301f08b68f | 165 | * Read user: GET /v2/users/<user_id> |
pangsk | 0:7f301f08b68f | 166 | * Update user: PUT /v2/users/<user_id> |
pangsk | 0:7f301f08b68f | 167 | * Delete user: DELETE /v2/users/<user_id> |
pangsk | 0:7f301f08b68f | 168 | */ |