Difference between revisions of "Component: Webserver (GENERIC - Flash / File) (Comms: Networking)"
(3 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
|- | |- | ||
| width="20%" style="color:gray;" | Version | | width="20%" style="color:gray;" | Version | ||
− | | 1. | + | | 1.7 |
|- | |- | ||
| width="20%" style="color:gray;" | Category | | width="20%" style="color:gray;" | Category | ||
Line 108: | Line 108: | ||
{{Zip|WebserverFiles.zip|Webserver Files}} | {{Zip|WebserverFiles.zip|Webserver Files}} | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
Line 116: | Line 124: | ||
==Macro reference== | ==Macro reference== | ||
− | === | + | ===CheckSocketActivity=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckSocketActivity''' |
|- | |- | ||
− | | colspan="2" | Returns | + | | colspan="2" | Checks for activity on the server socket and serves out the webpages to any requesting parties. Returns: URL string request, or null string if no activity has occured. |
|- | |- | ||
|- | |- | ||
− | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING | |
− | |||
− | |||
− | |||
− | |||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===CreateServerSocket=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CreateServerSocket''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Creates a listening socket on the selected port ready to accept incoming web page requests. Returns: 1 = OK / 0 = Listen Err / 255 = Socket Open Err |
|- | |- | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT |
− | | width="90%" | | + | | width="90%" | Port |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Default HTTP port = 80 |
|- | |- | ||
− | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===GetInValue=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetInValue''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Returns the string value of a Request parameter |
|- | |- | ||
|- | |- | ||
Line 176: | Line 169: | ||
| width="90%" | Index | | width="90%" | Index | ||
|- | |- | ||
− | | colspan="2" | Range: 0 to | + | | colspan="2" | Incoming string Index Range: 0 to Incoming Count - 1 |
|- | |- | ||
− | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING | |
− | |||
− | |||
− | |||
− | |||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===GetInValueFloat=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetInValueFloat''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Returns the float value of an incoming Request parameter |
|- | |- | ||
|- | |- | ||
Line 200: | Line 188: | ||
| width="90%" | Index | | width="90%" | Index | ||
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Range: 0 to IncomingCount - 1 |
|- | |- | ||
− | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT | |
− | |||
− | |||
− | |||
− | |||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===GetInValueLong=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetInValueLong''' |
|- | |- | ||
− | | colspan="2" | Returns the | + | | colspan="2" | Returns the integer value of an incoming Request parameter |
|- | |- | ||
|- | |- | ||
Line 224: | Line 207: | ||
| width="90%" | Index | | width="90%" | Index | ||
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Range: 0 to IncomingCount - 1 |
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s32-icon.png]] - LONG |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===Initialise=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Resets and initialises the Web Server component. |
|- | |- | ||
|- | |- | ||
− | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | |
− | |||
− | |||
− | |||
− | |||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===SetOutValue=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetOutValue''' |
+ | |- | ||
+ | | colspan="2" | Set the value of an outbound substitution string | ||
+ | |- | ||
|- | |- | ||
− | | | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
+ | | width="90%" | Index | ||
|- | |- | ||
+ | | colspan="2" | Incoming string Index Range: 0 to Outgoing Count - 1 | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING |
− | | width="90%" | | + | | width="90%" | Value |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | |
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===SetOutValueFloat=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetOutValueFloat''' |
+ | |- | ||
+ | | colspan="2" | Sets one of the outgoing substitution values from a floating point value. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Index | ||
+ | |- | ||
+ | | colspan="2" | Range: 0 to OutgoingCount - 1 | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT | ||
+ | | width="90%" | Value | ||
+ | |- | ||
+ | | colspan="2" | Floating point value to assign to the substitution | ||
|- | |- | ||
− | | | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
+ | | width="90%" | NumDP | ||
|- | |- | ||
+ | | colspan="2" | Number of decimal points to add | ||
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===SetOutValueLong=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetOutValueLong''' |
+ | |- | ||
+ | | colspan="2" | Sets one of the outgoing substitution values from a numeric value. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Index | ||
+ | |- | ||
+ | | colspan="2" | Range: 0 to OutgoingCount - 1 | ||
|- | |- | ||
− | | | + | | width="10%" align="center" | [[File:Fc9-s32-icon.png]] - LONG |
+ | | width="90%" | Value | ||
|- | |- | ||
+ | | colspan="2" | signed long integer value to assign to the substitution | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | |||
− | |||
Line 315: | Line 321: | ||
| width="90%" | RX Buffer Size | | width="90%" | RX Buffer Size | ||
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Number of received bytes to buffer used to process URL and incoming parameters. |
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
+ | | width="90%" | Timeout | ||
+ | |- | ||
+ | | colspan="2" | Number of milliseconds to wait when performing the CheckSocketActivity macro. | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
Line 331: | Line 342: | ||
| colspan="2" | Sets the method for streaming data, we can either host it loacally using a property or refer to external files. | | colspan="2" | Sets the method for streaming data, we can either host it loacally using a property or refer to external files. | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9-type- | + | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] |
− | | width="90%" | | + | | width="90%" | Customise Header |
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] | ||
+ | | width="90%" | Use Callback | ||
+ | |- | ||
+ | | colspan="2" | If set to 'yes', a macro called 'HtmlCallback' with 4 parameters is required: * name - STRING[32] - the name of the web page * params - STRING[128] - a string of parameters sent to the webpage * idx - UINT - an increasing number * html - byref STRING[256] - the returned html to send The return type should be a BOOL and the macro should return true if this is the last callback iteration and the response is complete. This callback macro is repeatedly called with an increasing value of 'idx' when a page request is detected. | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | HTML Pages | ||
+ | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | | width="10%" align="center" | [[File:Fc9-type-14-icon.png]] |
Latest revision as of 10:26, 20 October 2023
Author | Matrix Ltd. |
Version | 1.7 |
Category | Comms: Networking |
Contents
Webserver (GENERIC - Flash / File) component
Webserver component designed to work with Network Comms abstraction layer. Provides a very simple interface to allow webpages to be hosted from hardware or simulation. Webpages can be embedded into ROM or can be pulled directly from a local file or a SD card via the File component. The File mode allows for images and other media to be served to the web client.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_WebServer.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_WebServer.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Webserver Embedded Files
A simple example demonstrating how to host a website with fixed HTTP content including dynamic sections that can be passed in and out of Flowcode SCADA.
For example a dynamic section could be used to display a variable value on a webpage such as a temperature or used to control Flowcode e.g. turn on an output.
Webserver Dynamic Files
Flowcode Embedded
A simple example demonstrating how to host a website with dynamic content based on external files including dynamic sections that can be passed in and out of an embedded system using an SD card and an ESP8266 module.
For example a dynamic section could be used to display a variable value on a webpage such as a temperature or used to control Flowcode e.g. turn on an output.
Flowcode App Developer
A simple example demonstrating how to host a website with dynamic content based on external files including dynamic sections that can be passed in and out of Flowcode App Developer.
For example a dynamic section could be used to display a variable value on a webpage such as a temperature or used to control Flowcode e.g. turn on an output.
Macro reference
CheckSocketActivity
CreateServerSocket
GetInValue
GetInValue | |
Returns the string value of a Request parameter | |
- BYTE | Index |
Incoming string Index Range: 0 to Incoming Count - 1 | |
- STRING | Return |
GetInValueFloat
GetInValueFloat | |
Returns the float value of an incoming Request parameter | |
- BYTE | Index |
Range: 0 to IncomingCount - 1 | |
- FLOAT | Return |
GetInValueLong
GetInValueLong | |
Returns the integer value of an incoming Request parameter | |
- BYTE | Index |
Range: 0 to IncomingCount - 1 | |
- LONG | Return |
Initialise
Initialise | |
Resets and initialises the Web Server component. | |
- VOID | Return |
SetOutValue
SetOutValue | |
Set the value of an outbound substitution string | |
- BYTE | Index |
Incoming string Index Range: 0 to Outgoing Count - 1 | |
- STRING | Value |
- VOID | Return |
SetOutValueFloat
SetOutValueLong