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

From Flowcode Help
Jump to navigationJump to search
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.

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.

FC6 Icon.png 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.

FC6 Icon.png ESP8266 Webserver FileSystem

ZIP Icon.png 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.

FC6 Icon.png Webserver FileSystem

ZIP Icon.png Webserver Files








Macro reference

CheckSocketActivity

Fc9-comp-macro.png 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. 
Fc9-string-icon.png - STRING Return


CreateServerSocket

Fc9-comp-macro.png 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 
Fc9-u16-icon.png - UINT Port
Default HTTP port = 80 
Fc9-u8-icon.png - BYTE Return


GetInValue

Fc9-comp-macro.png GetInValue
Returns the string value of a Request parameter 
Fc9-u8-icon.png - BYTE Index
Incoming string Index Range: 0 to Incoming Count - 1 
Fc9-string-icon.png - STRING Return


GetInValueFloat

Fc9-comp-macro.png GetInValueFloat
Returns the float value of an incoming Request parameter 
Fc9-u8-icon.png - BYTE Index
Range: 0 to IncomingCount - 1 
Fc9-f32-icon.png - FLOAT Return


GetInValueLong

Fc9-comp-macro.png GetInValueLong
Returns the integer value of an incoming Request parameter 
Fc9-u8-icon.png - BYTE Index
Range: 0 to IncomingCount - 1 
Fc9-s32-icon.png - LONG Return


Initialise

Fc9-comp-macro.png Initialise
Resets and initialises the Web Server component. 
Fc9-void-icon.png - VOID Return


SetOutValue

Fc9-comp-macro.png SetOutValue
Set the value of an outbound substitution string 
Fc9-u8-icon.png - BYTE Index
Incoming string Index Range: 0 to Outgoing Count - 1 
Fc9-string-icon.png - STRING Value
 
Fc9-void-icon.png - VOID Return


SetOutValueFloat

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


SetOutValueLong

Fc9-comp-macro.png SetOutValueLong
Sets one of the outgoing substitution values from a numeric value. 
Fc9-u8-icon.png - BYTE Index
Range: 0 to OutgoingCount - 1 
Fc9-s32-icon.png - LONG Value
signed long integer value to assign to the substitution 
Fc9-void-icon.png - VOID Return


Property reference

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