source: rtos_arduino/trunk/arduino_lib/libraries/Ciao/src/lib/rest.h@ 175

Last change on this file since 175 was 175, checked in by ertl-honda, 8 years ago

ライブラリを Arduino IDE 1.7.9 にupdate

File size: 1.3 KB
Line 
1/**
2 * \file
3 * ESP8266 RESTful Bridge
4 * \author
5 * Tuan PM <tuanpm@live.com>
6 */
7#ifndef _REST_H_
8#define _REST_H_
9
10#include <stdint.h>
11#include <Arduino.h>
12#include "FP.h"
13#include "espduino.h"
14
15#define DEFAULT_REST_TIMEOUT 7000
16
17typedef enum {
18 HEADER_GENERIC = 0,
19 HEADER_CONTENT_TYPE,
20 HEADER_USER_AGENT
21} HEADER_TYPE;
22
23typedef enum {
24 HTTP_STATUS_OK = 200
25} HTTP_STATUS;
26
27class REST {
28private:
29 uint32_t remote_instance, timeout;
30 ESP *esp;
31 void restCallback(void* resp);
32 FP<void, void*> restCb;
33 boolean response;
34 void *res;
35
36public:
37
38 REST(ESP *e);
39 boolean begin(const char* host, uint16_t port, boolean security);
40 boolean begin(const char* host);
41 void request(const char* path, const char* method, const char* data);
42 void request(const char* path, const char* method, const char* data, int len);
43 void get(const char* path, const char* data);
44 void get(const char* path);
45 void post(const char* path, const char* data);
46 void put(const char* path, const char* data);
47 void del(const char* path, const char* data);
48
49 // void setTimeout(uint32_t ms);
50 uint16_t getResponse(char* data, uint16_t maxLen);
51 // void setUserAgent(const char* value);
52 // Set Content-Type Header
53 // void setContentType(const char* value);
54 // void setHeader(const char* value);
55
56};
57#endif
Note: See TracBrowser for help on using the repository browser.