* Adding userData to getweblogs callback.
Allows user-specific data to be available in the callback that returns weblog HTML data.
* Adding userData to getweblogs callback.
Allows user-specific data to be available in the callback that returns weblog HTML data.
Return HTTP response code and content type only when no weblog callback defined
If 4th parameter (the statusURL) is NULL, web logging will NOT be enabled BUT time server will still acquire time if server address and time zone were specified as 2nd and 3rd parameters.
Note that not having web logging enabled only impacts ability to acquire weblog from HTTP request. It has no effect on the actual logging of WEBLOG() messages and thus homeSpan.getWebLog() works as expected.
ALSO: Re-arranged include files so that StepperControl.h is now part of HomeSpan.h. No need to include anything except for HomeSpan.h to use any of the Stepper Motor classes. Must update documentation accordingly.
NOTE: Always including StepperControl.h DOES NOT increase size of compile if no stepper motors are instantiated.
To do: Consider doing the same for Pixel, PWM, and RMT as well.
Ensure users can access constants like TRIGGER_ON_HIGH, TRIGGER_ON_LOW, etc. using any of these equivalent fully-qualified names:
* PushButton::TRIGGER_ON_HIGH
* SpanButton::TRIGGER_ON_HIGH
* SpanToggle::TRIGGER_ON_HIGH
Default is SpanButton::TRIGGER_ON_LOW. Follows same options as SpanButton, including the ability to provide your own triggerType function of form:
boolean f(int pin)
Goal - eliminate sendEncrypted() completely by using hapOut in tlvRepond().
Next up: use function call instead of << operator so logic can be moved into TLV.h
This completes re-work of all JSON buffer memory management to use HAPOut.
Next up: Stress test with Max Accessories to see how many Accessories we can now handle.
This removes last of large-sized JSON buffers - everything has now been converted to using hapOut.
Next up: Must add prettyPrint to hapOut to support 'd' command
But declared Streamer inside HomeSpan.h instead of separate Streamer.h since it should only be used when HomeSpan.h is used.
Also, changed class structure so that it is "final" by removing virtual tags and making all protected variables private.
New class-level method SpanPoint::setEncryption(boolean encrypt). Default is to use encryption unless method is called with encrypt=false.
With encryption, 7 connections max; without encryption, 20 connections max.
Serial Monitor provides warnings if connections are exceeded.
Stylistic only. Cannot remove .get() when a TempBuffer is being re-cast. Also can't remove .get() when cast can't be determined, such as when used in Serial.printf() [potential to do: explore if this can be addressed, though this is stylistic only and has no impact on code]
New Operator now uses PSRAM if available, else uses Internal RAM. Obviates the need for the ps_new() macro, though will keep definition since it may be useful for any class that does not already override malloc() to use PSRAM.
Reduces NVS consumption by from 3 to only 1 records when storing numerical values.
Also: Fixed memory problem in getCharacteristics by replacing dynamically-sized stack buffers with TempBuffer (must do this everywhere), which was causing stack probllem when combination number of Accessories and number of Characteristics got very large.
When using PSRAM, changing the number of Accessories no longer creates any change to heap usage on internal RAM. The entire Accessory will be stored in PSRAM.
Forces all heap requests to be drawn from PSRAM, unless the device does not contain PSRAM.
To do: Provide easy-to-use NEW() macro; add custom allocator to unordered sets; auto-shrink vectors after updateDatabase()
Significantly reduces memory usage - unordered_sets take up much more memory and using std::find from <algorithm> is as efficient as using find() method of an unordered_set.
To do: Remove all uses of unordered_set across HomeSpan wherever possible
An optional callback used to track the number of times the device reboots, where a reboot is defined as any restart where the uptime was less than a specified number of milliseconds (default=5000)
Adds a second type of WiFi Callback that is called every time WiFi is established OR re-established after a disconnect. Passes the number of times WiFi has been connected as an argument.
Allows extension of initial table produced in WebLog, where f is a function that returns a String. The returned String is copied into the WebLog HTML just before the </table> tag is printed in the initial table.
* Added support for zero-length TLV
* Added SEPARATOR as a formal kTLVType (and updated listControllers() to use)
* Added `uint8_t *buf(tagType tag, uint8_t *src, int len);` to load buffer needing external memcpy (and updated listControllers() to use)
Optimized use of heap memory instead of stack memory for temporary variables, and makes code easier to read, provided all heap usage is free() at end of each function.
Also removed char *hostName as a member variable of homeSpan. It's never actually used since MDNS constructs its own copy of hostName as needed.