MBED_DEMOS / Mbed 2 deprecated mbed_mqtt_endpoint_ublox_cellular

Dependencies:   C027_Support C12832 StatusReporter LM75B MQTT-ansond c027_radios endpoint_core endpoint_mqtt mbed-rtos mbed

Committer:
ansond
Date:
Thu Feb 27 22:07:45 2014 +0000
Revision:
21:d1ce325d1d32
Parent:
12:952dce085876
updates

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 0:ae2a45502448 1 /* Copyright C2013 Doug Anson, MIT License
ansond 0:ae2a45502448 2 *
ansond 0:ae2a45502448 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
ansond 0:ae2a45502448 4 * and associated documentation files the "Software", to deal in the Software without restriction,
ansond 0:ae2a45502448 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
ansond 0:ae2a45502448 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
ansond 0:ae2a45502448 7 * furnished to do so, subject to the following conditions:
ansond 0:ae2a45502448 8 *
ansond 0:ae2a45502448 9 * The above copyright notice and this permission notice shall be included in all copies or
ansond 0:ae2a45502448 10 * substantial portions of the Software.
ansond 0:ae2a45502448 11 *
ansond 0:ae2a45502448 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
ansond 0:ae2a45502448 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
ansond 0:ae2a45502448 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
ansond 0:ae2a45502448 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
ansond 0:ae2a45502448 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ansond 0:ae2a45502448 17 */
ansond 0:ae2a45502448 18
ansond 0:ae2a45502448 19 #ifndef ___HTTPTRANSPORT_H_
ansond 0:ae2a45502448 20 #define ___HTTPTRANSPORT_H_
ansond 0:ae2a45502448 21
ansond 0:ae2a45502448 22 // Base Class
ansond 0:ae2a45502448 23 #include "Transport.h"
ansond 0:ae2a45502448 24
ansond 0:ae2a45502448 25 // HTTP Client Library Support
ansond 0:ae2a45502448 26 #include "HTTPClient.h"
ansond 0:ae2a45502448 27
ansond 0:ae2a45502448 28 class HTTPTransport : public Transport {
ansond 0:ae2a45502448 29 private:
ansond 0:ae2a45502448 30 HTTPClient *m_http;
ansond 10:748fc7052e61 31 char m_url_buffer[IOC_REST_URL_LEN+1];
ansond 11:59ee476fda24 32
ansond 0:ae2a45502448 33 public:
ansond 7:f570eb3f38cd 34 HTTPTransport(ErrorHandler *error_handler,void *endpoint);
ansond 0:ae2a45502448 35 virtual ~HTTPTransport();
ansond 0:ae2a45502448 36
ansond 0:ae2a45502448 37 bool httpGet(char *url,char *result,int result_length);
ansond 0:ae2a45502448 38 bool httpPut(char *url,char *data,int data_length,char *result,int result_length);
ansond 0:ae2a45502448 39 bool httpPost(char *url,char *data,int data_length,char *result,int result_length);
ansond 0:ae2a45502448 40 bool httpDelete(char *url,char *data,int data_length);
ansond 0:ae2a45502448 41
ansond 11:59ee476fda24 42 virtual bool loadEndpoint(char *data,int data_length,char *result,int result_length);
ansond 12:952dce085876 43 virtual bool updateEndpoint(int ioc_id,char *data,int data_length,char *result,int result_length);
ansond 9:ff877db53cfd 44
ansond 0:ae2a45502448 45 virtual bool connect();
ansond 0:ae2a45502448 46 virtual bool disconnect();
ansond 10:748fc7052e61 47
ansond 10:748fc7052e61 48 private:
ansond 10:748fc7052e61 49 char *createIOCLoadURL();
ansond 21:d1ce325d1d32 50 char *packageData(char *verb,char *data,int ioc_id);
ansond 10:748fc7052e61 51 char *createIOCUpdateURL(int ioc_id);
ansond 21:d1ce325d1d32 52 char *createIOCUpdateURL(int ioc_id,bool useRedirector);
ansond 11:59ee476fda24 53 };
ansond 0:ae2a45502448 54
ansond 0:ae2a45502448 55 #endif // ___HTTPTRANSPORT_H_