# pfodParser
The pfodParser library is handles commands sent from the pfodWeb.html and the Android pfodApp.  

pfodWeb.html (included in this library) runs in your brower and connects to any Arduino board via Serial. It can also connect via BLE or HTTP.  See the pfodWeb examples and the [pfodWeb Installation and Tutorials](https://www.forward.com.au/pfod/pfodWeb/index.html)<br>
pfodApp (Android app) supports WiFi, BLE, Bluetooth and SMS connections.<br>  
The entire GUI is completely controlled by your micro's sketch.  

This library includes:-  
* **pfodParser**, parses pfodApp commands 
* **pfodWeb**, browser version of pfodApp that connects via Serial, BLE or HTTP to display interactive GUI's   
* **pfodSecurity**, alternative to pfodParser that adds 128bit sercuity   
* **pfodDwgs**, classes for sending dwg commands to create interactive GUI's 
* **pfodWeb_data_src**, the source files .html / .js for pfodWeb.  See examples HelloWorld_serial and LedOnOff_http

# pfodWeb
The pfodWeb sub-directory contains index.html, pfodWeb.html and pfodWebDebug.html that combine html and js files combined in to single loadable files. No local server is required. 
No additional downloads are required. You can run pfodWeb on a completely isolated network with no internet access.  

index.html prompts to use either pfodWeb or pfodWebDebug.  pfodWebDebug has extensive console logging and also shows the dotted outlines of touchZones  
pfodWeb.html and pfodWebDebug.html prompt for the connection to use and then requests the pfod menu/dwg and displays it.  

There is a raw message view, accessed via the right click menu, that displays all data sent from your micro, including interspersed debug msgs.

**pfodWeb.html?targetIP**  pre-selects http as the connection type.   
**pfodWeb.html?targetIP=**_\<ip\>_  immediately attempts to connect the the specified IP.    
**pfodWeb.html?serial**  pre-selectes Serial as the connection type.    
**pfodWeb.html?serial=**_\<baudrate\>_  pre-selectes Serial with the specified baudrate as the connection type.    
**pfodWeb.html?ble**  pre-selectes BLE as the connection type.    

The sub-directory pfodWeb_src contains the individual files.  **build.bat** / **build.sh** generates the combined files.

The individual files making up these webpages can also be served from the pfodDevice itself if there is a file system with sufficient space less than 200kB.  
The subdirectory data contains the .gz files to be loaded into the microprocessor's file system. 

**build_data.bat** / **build_data.sh** in pfodWeb_src generate the .gz files in the data subdirectory  
**data_index.html** -> **index.gz** in that case to be served by the microprocessor.  

When pfodWeb.html or pfodWebDebug.html is served from the pfodDevice (microprocessor) they are redirected to pfodWeb.html?target=<pfodDeviceIP> and pfodWebDebug.html?target=<pfodDeviceIP>  
to automatically connect to that pfodDevice to serve the pfod messages.  

You can use the pfodWeb files served from your microprocessor to connect to another pfodDevice via http by requesting  
**http://**_\<pfodDeviceIP\>_**/pfodWeb.html?targetIP**
to display the connection dialog from which you can select which device to connect to.  
Note: Browser security restrictions prevents connecting to Serial or BLE when pfodWeb served from **http://**_\<pfodDeviceIP\>_**  need to be served as https.       

# How-To
See [pfodWeb Installation and Tutorials](https://www.forward.com.au/pfod/pfodWeb/index.html)  
See [pfodParser Documentation](https://www.forward.com.au/pfod/pfodParserLibraries/index.html)  
See [pfodParser Examples](https://www.forward.com.au/pfod/index.html)  

# Software License
(c)2014-2025 Forward Computing and Control Pty. Ltd.  
NSW Australia, www.forward.com.au  
This code is not warranted to be fit for any purpose. You may only use it at your own risk.  
This code may be freely used for both private and commercial use  
Provide this copyright is maintained.  

# Revisions
Version 3.66.5 Added cache control setting for pfodWeb http. Updated data subdir. Now needs 1M FS space   
Version 3.66.4 Fixed pfodWeb value display and added basic charting to pfodWeb
Version 3.66.3 Fixed scaling of nested drawings.  
Version 3.66.2 Fixed display of nested drawings.      
Version 3.66.1 Added support for pfodWeb to connect Serial and BLE connection.    
Version 3.65.1 revised pfodWeb examples and serving of pfodWeb files. Added support for Serial and BLE connection  
Version 3.64.1 Breaking Change. pfodDrawing sub-classes now need to call init() to complete initialization and to add them to the pfodParser linked list. Added source files .html / .js for pfodWeb  
Version 3.64.0 added pfodWeb support for Pi PicoW/2W, ESP32 and ESP8266, added pfodDebugPtr, pfodESPBufferedClient now supports Pi Pico W/2W  
Version 3.63.11 pfodESPBufferedClient now also supports Pi Pico W / 2W  
Version 3.63.10 added clear() method to pfodStreamString for Pi PicoW  
Version 3.63.9 added JSON escaping of control chars in the range 0x00 to 0x1F  
Version 3.63.8 fix newline fitering in pfodStreamString add JSON escapes  
Version 3.63.7 added newline fitering to pfodStreamString  
Version 3.63.6 added DOWN_DRAG_UP alias for DOWN_UP  
Version 3.63.5 added pfodStreamString  
Version 3.63.4 corrected empty cmd test  
Version 3.63.3 added specification to docs (mainly for AI reference)  
Version 3.63.2 added parse timeout  
Version 3.63.1 added multiple connections support  
Version 3.62 added default initializations  
Version 3.61 added linked list for processing dwg cmds, added pfodESPBufferedClient, fixed label/touchActionInput encoding  
Version 3.60 revised arguments to supports pfodSecurity  
Version 3.59 added minor edit  
Version 3.58 added pfodDrawing for pfodGUIdesigner
Version 3.57 added pfodAutoCmd, mods for pfodGUIdesigner
Version 3.56 added cmdEquals  
Version 3.55 added pfodAutoIdx  
Version 3.54 added xRadius, yRadius as an alterative to arc().start(..).angle(0)  
Version 3.53 minor edit to remove code warning  
Version 3.52 added support for multi-char dwg cmds, menu cmds already supported multi-char  
Version 3.51 fixed ESP32, ESP8266 request for version when none set  
Version 3.50 added hide/unhide/erase insertDwg  
Version 3.49 more fixes for mbed Stream  
Version 3.48 fixed more warnings  
Version 3.47 fixed warnings  
Version 3.46 for Arduino Nano 33 IoT  
Version 3.45 for Arduino Nano 33 BLE  
Version 3.44 pfodNonBlockingInput for empty lines  
Version 3.42-43 enhanced pfodNonBlockingInput  
Version 3.41 Gauge spelling corrections  
Version 3.40 added copyTo to pfodRingBuffer and parser.flush() now calls underlying stream flush()  
Version 3.39 fixed millisDelay.h include in pfodNonBlockingInput.h  
Version 3.38 fixed pfodNonBlockingInput.h  
Version 3.37 added alignment options .left() .right() to dwg label()  Needs pfodApp V3.0.371+   
Version 3.36 added NonBlockingInput and Bluetooth Classic Buffered Stream  
Version 3.35 renamed pfodDelay.isFinished() to pfodDelay.justFinished()  
Version 3.34 added setBLEBlockSendDelay and clear ble send buffer on connection  
Version 3.33 fixed Redbear NanoV2 Stream compile errors  
Version 3.32 made pfodBLEBufferedSerial blocking   
Version 3.31 added getStartTime() to pfodDelay  
Version 3.30 added pfodDelay  
Version 3.29 added blocking option to pfodBufferedStream  
Version 3.28 added Teensy to pfodEEPROM.h  
Version 3.27 added markWrite, resetWrite to pfodRingBuffer  
Version 3.26 fix availableForWrite and for different EEPROM classes begin(),commit(), added pfodRadio and pfodSecurityClient  
Version 3.25 added support for pfodSecurity without EEPROM and fixes some bugs in pfodSecurity powerCycling. Also includes fixes for non-8bit processors  
Version 3.24 added SIM_5320 examples  
Version 3.23 added ESP32 examples  
Version 3.22 fixed runtime error RedBear BLE boards  
Version 3.21 fixed compile error (NanoV2) and rolled back ESP32 support until complete  
Version 3.20 added support for ESP32  
Version 3.19 fixed float to label conversion in drawings  
Version 3.18 fixed pfodBLEBufferedSerial compile errors under Nano  
Version 3.17 added Feather52 example  
Version 3.16 ignore non-printable seqNo e.g. CR LF TAB SPACE etc  
Version 3.15 added BLE cmd sequence numbers support  
Version 3.14 added Adafruit nRF52 Feather support  
Version 3.13 added pfodBLEBufferedSerial and example  
Version 3.11 added BLE Nano V2 example screens example  
Version 3.10 added support for RedBear BLE NanoV2  
Version 3.9 added Redbear BLE Nano example file  
Version 3.8 revised examples to add dwgs and removed the un-reliable pfodESP8266_AT support files  
Version 3.7 added support for mbed builds, i.e. Redbear Nano etc  
Version 3.6 pfodEEPROM include fix  
Version 3.5 correction to keywords.txt  
Version 3.4 added insertDwg and fixed unsigned int sizes  
Version 3.3 added hide/unhide and index  
Version 3.2 renamed DISABLED to TOUCH_DISABLED to avoid conflict with ESP8266 define  
Version 3.1 added Drawing Primitive support  
For earlier revisions see the [pfodParser LibraryVersion.txt file](https://www.forward.com.au/pfod/pfodParserLibraries/LibraryVersion.txt)  
