Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
545 B

  1. /*
  2. API MODULE
  3. Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
  4. */
  5. #pragma once
  6. #include "espurna.h"
  7. #include "web.h"
  8. #include <functional>
  9. #if WEB_SUPPORT && API_SUPPORT
  10. #include <ESPAsyncTCP.h>
  11. #include <ArduinoJson.h>
  12. using api_get_callback_f = std::function<void(char * buffer, size_t size)>;
  13. using api_put_callback_f = std::function<void(const char * payload)> ;
  14. void apiRegister(const char * key, api_get_callback_f getFn, api_put_callback_f putFn = nullptr);
  15. void apiSetup();
  16. #endif // API_SUPPORT == 1