Jump to content

Component: Webserver (GENERIC - Flash / File) (Comms: Networking)

From Flowcode Help
Author Matrix Ltd.
Version 1.7
Category Comms: Networking


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.

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 Embedded


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.

ESP8266 Webserver FileSystem

Webserver Files


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.

Webserver FileSystem

Webserver Files








Macro reference

CheckSocketActivity

CheckSocketActivity
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. 
- STRING Return


CreateServerSocket

CreateServerSocket
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 
- UINT Port
Default HTTP port = 80 
- BYTE Return


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

SetOutValueFloat
Sets one of the outgoing substitution values from a floating point value. 
- BYTE Index
Range: 0 to OutgoingCount - 1 
- FLOAT Value
Floating point value to assign to the substitution 
- BYTE NumDP
Number of decimal points to add 
- VOID Return


SetOutValueLong

SetOutValueLong
Sets one of the outgoing substitution values from a numeric value. 
- BYTE Index
Range: 0 to OutgoingCount - 1 
- LONG Value
signed long integer value to assign to the substitution 
- VOID Return


Property reference

Properties
Label
Label used to help identify the component on the panel. 
RX Buffer Size
Number of received bytes to buffer used to process URL and incoming parameters. 
Timeout
Number of milliseconds to wait when performing the CheckSocketActivity macro. 
LinkTo
 
Source Files
HTML Source
Sets the method for streaming data, we can either host it loacally using a property or refer to external files. 
Customise Header
 
Use Callback
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. 
HTML Pages
Max Pages
Maximum number of pages we can serve using the embedded page type webserver. Currently limited to 4 pages. 
Name Page 1
Name of HTML page 1 - index.htm is the default page that will be presented. 
HTML Page 1
Embedded HTML code used for page 1 
Name Page 2
Name of HTML page 2 
HTML Page 2
Embedded HTML code used for page 2  
Substitutions
Outgoing
Count
Maximum number of outbound string substitutions 
Length 0
Number of bytes to reserve for data string. 
Incoming
Count
Maximum number of inbound string substitutions 
Length 0
Number of bytes to reserve for data string. 
Length 1
Number of bytes to reserve for data string. 

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