Change webLogCallback() to pass String as reference

This commit is contained in:
Gregg 2023-10-24 13:43:04 -05:00
parent 0f96d0fff6
commit 4de61e5914
3 changed files with 4 additions and 6 deletions

View File

@ -1279,7 +1279,7 @@ int HAPClient::getStatusURL(){
response+="<tr><td>Max Log Entries:</td><td>" + String(homeSpan.webLog.maxEntries) + "</td></tr>\n";
if(homeSpan.weblogCallback)
response+=homeSpan.weblogCallback();
homeSpan.weblogCallback(response);
response+="</table>\n";
response+="<p></p>";

View File

@ -232,7 +232,7 @@ class Span{
uint16_t tcpPortNum=DEFAULT_TCP_PORT; // port for TCP communications between HomeKit and HomeSpan
char qrID[5]=""; // Setup ID used for pairing with QR Code
void (*wifiCallback)()=NULL; // optional callback function to invoke once WiFi connectivity is established
String (*weblogCallback)()=NULL; // optional callback function to invoke after header table in Web Log is produced
void (*weblogCallback)(String &)=NULL; // optional callback function to invoke after header table in Web Log is produced
void (*pairCallback)(boolean isPaired)=NULL; // optional callback function to invoke when pairing is established (true) or lost (false)
boolean autoStartAPEnabled=false; // enables auto start-up of Access Point when WiFi Credentials not found
void (*apFunction)()=NULL; // optional function to invoke when starting Access Point
@ -348,7 +348,7 @@ class Span{
}
Span& setWebLogCSS(const char *css){webLog.css="\n" + String(css) + "\n";return(*this);}
Span& setWebLogCallback(String (*f)()){weblogCallback=f;return(*this);}
Span& setWebLogCallback(void (*f)(String &)){weblogCallback=f;return(*this);}
void autoPoll(uint32_t stackSize=8192, uint32_t priority=1, uint32_t cpu=0){ // start pollTask()
xTaskCreateUniversal([](void *parms){for(;;)homeSpan.pollTask();}, "pollTask", stackSize, NULL, priority, &pollTaskHandle, cpu);

View File

@ -48,11 +48,9 @@ struct LED_Service : Service::LightBulb {
//////////////////////////////////////
String extraData(){
String r;
void extraData(String &r){
r+="<tr><td>Free RAM:</td><td>" + String((double)(esp_get_free_internal_heap_size() / 1024),2) + " Kb (" + String(esp_get_free_internal_heap_size()) + " bytes)</td></tr>\n";
r+="<tr><td>Free PSRAM:</td><td>" + String((double)(esp_get_free_heap_size() / 1024 / 1024),2) + " Mb (" + String(esp_get_free_heap_size()) + " bytes)</td></tr>\n";
return(r);
}
//////////////////////////////////////