This commit is contained in:
proddy
2020-08-12 23:17:22 +02:00
parent f0151fcfc6
commit eef86cc9f9
3 changed files with 18 additions and 6 deletions

View File

@@ -22,6 +22,8 @@
namespace emsesp {
using namespace std::placeholders; // for `_1` etc
EMSESPDevicesService::EMSESPDevicesService(AsyncWebServer * server, SecurityManager * securityManager)
: _device_dataHandler(DEVICE_DATA_SERVICE_PATH,
securityManager->wrapCallback(std::bind(&EMSESPDevicesService::device_data, this, _1, _2), AuthenticationPredicates::IS_AUTHENTICATED)) {
@@ -39,7 +41,7 @@ EMSESPDevicesService::EMSESPDevicesService(AsyncWebServer * server, SecurityMana
}
void EMSESPDevicesService::scan_devices(AsyncWebServerRequest * request) {
EMSESP::send_read_request(EMSdevice::EMS_TYPE_UBADevices, EMSdevice::EMS_DEVICE_ID_BOILER);
EMSESP::scan_devices();
request->send(200);
}
@@ -55,7 +57,7 @@ void EMSESPDevicesService::all_devices(AsyncWebServerRequest * request) {
obj["type"] = emsdevice->device_type_name();
obj["brand"] = emsdevice->brand_to_string();
obj["name"] = emsdevice->name();
obj["deviceid"] = emsdevice->device_id();
obj["deviceid"] = emsdevice->get_device_id();
obj["productid"] = emsdevice->product_id();
obj["version"] = emsdevice->version();
}

View File

@@ -24,8 +24,7 @@
#include <ESPAsyncWebServer.h>
#include <SecurityManager.h>
// #define MAX_EMSESP_STATUS_SIZE 1024
#define MAX_EMSESP_DEVICE_SIZE 1280
#define MAX_EMSESP_DEVICE_SIZE 1536
#define EMSESP_DEVICES_SERVICE_PATH "/rest/allDevices"
#define SCAN_DEVICES_SERVICE_PATH "/rest/scanDevices"
@@ -33,8 +32,6 @@
namespace emsesp {
using namespace std::placeholders; // for `_1`
class EMSESPDevicesService {
public:
EMSESPDevicesService(AsyncWebServer * server, SecurityManager * securityManager);