public:
using Ptr = std::shared_ptr<RequestHandler>;
+ static constexpr int DEFAULT_ERROR_CODE = 200;
+ static constexpr OCEntityHandlerResult DEFAULT_RESULT = OC_EH_OK;
+
virtual ~RequestHandler()
{
}
class SimpleRequestHandler: public RequestHandler
{
public:
- SimpleRequestHandler(const OCEntityHandlerResult& result = OC_EH_OK,
- int errorCode = 200);
+ SimpleRequestHandler(const OCEntityHandlerResult& result = DEFAULT_RESULT,
+ int errorCode = DEFAULT_ERROR_CODE);
std::shared_ptr< OC::OCResourceResponse > buildResponse(
PrimitiveServerResource&, const ResourceAttributes&) override;
public:
template <typename T>
CustomAttrRequestHandler(T&& attrs,
- const OCEntityHandlerResult& result = OC_EH_OK, int errorCode = 200) :
+ const OCEntityHandlerResult& result = DEFAULT_RESULT,
+ int errorCode = DEFAULT_ERROR_CODE) :
SimpleRequestHandler{ result, errorCode }, m_attrs{ std::forward<T>(attrs) }
{
}
namespace Service
{
+ constexpr OCEntityHandlerResult RequestHandler::DEFAULT_RESULT;
+
SimpleRequestHandler::SimpleRequestHandler(const OCEntityHandlerResult& result,
int errorCode) :
m_result{ result }, m_errorCode{ errorCode }