rest controller update

This commit is contained in:
2018-04-25 00:04:47 +02:00
parent a539a82792
commit 3d48295a46
8 changed files with 199 additions and 17 deletions

View File

@@ -27,8 +27,11 @@
#include <stdint.h>
#include <string>
#include <vector>
#include <core/web-controller.h>
#include <rest/ubus.h>
/*--------------------------------- Define ----------------------------------*/
@@ -38,16 +41,21 @@
/*----------------------------- Dependencies --------------------------------*/
struct json_object;
/*--------------------------------- CLASS ----------------------------------*/
class RestController : public WebController
{
public:
RestController(void);
RestController(const std::string &a_path, const std::string &a_method_get = "", const std::string &a_method_put = "", int a_timeout = kDefaultTimeout, bool a_raw_response = false);
virtual ~RestController(void);
WebConnection *new_connection(struct uhttpd_ops *an_ops, struct client *a_client, const std::string &a_parameters);
bool from_json(struct json_object *a_node);
std::string get_method_get(void);
std::string get_method_put(void);
uint16_t get_timeout(void);
@@ -56,12 +64,18 @@ class RestController : public WebController
std::string get_method(uint8_t a_method);
protected:
uint8_t m_method;
std::vector<std::string> m_endpoint;
Ubus m_ubus;
/*
std::string m_name;
std::string m_path;
std::string m_method_get;
std::string m_method_put;
uint16_t m_timeout;
bool mf_raw_response;
*/
};
#endif /* _REST_CONTROLLER_H */