Fixed code to use <screen> tags as base for the xml. Confirmed layout works now.
This commit is contained in:
@@ -11,7 +11,11 @@ internal esp_err_t api_devices_get_handler(httpd_req_t *req)
|
||||
httpd_resp_set_type(req, "application/json");
|
||||
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
|
||||
|
||||
cJSON *root = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(root, "default_layout", kDefaultLayoutXml);
|
||||
|
||||
cJSON *arr = cJSON_CreateArray();
|
||||
cJSON_AddItemToObject(root, "devices", arr);
|
||||
|
||||
for (int i = 0; i < MAX_DEVICES; i++)
|
||||
{
|
||||
@@ -25,11 +29,11 @@ internal esp_err_t api_devices_get_handler(httpd_req_t *req)
|
||||
}
|
||||
}
|
||||
|
||||
const char *json = cJSON_PrintUnformatted(arr);
|
||||
const char *json = cJSON_PrintUnformatted(root);
|
||||
httpd_resp_sendstr(req, json);
|
||||
|
||||
free((void *)json);
|
||||
cJSON_Delete(arr);
|
||||
cJSON_Delete(root);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user