Data sources
Files, HTTP and ports whose data the layouts bind to as Sources.<Name>, with an example for each.
Data sources bring live data into the layouts without a client sending it: a file another program writes, a web service, or a device on a serial, TCP or UDP port. Every layout binds to their data as Sources.<Name>, as in ScreensPro Server:
<div data-bind="Sources.Results.Value.Title"></div>
<sp-items items="Sources.Results.Value.Row"> ... </sp-items>
<span data-bind="Sources.Timer.Mappings.Time"></span>In XAML layouts: {Binding Sources.Results.Value.Row}.
The Data sources button in the header lists them with their state and their data - a click on a value copies its binding - and adds and edits them. Import from ScreensPro Server… takes the data sources of a .ScreensProServerConfig.
File (XML or JSON)
Read again whenever it changes
Results, start lists, scores another program writes to disk
HTTP (JSON)
A GET request every few seconds
Web services: live results, standings, weather, social media walls
Port
Lines from a serial port, a TCP connection or UDP
Timing devices, scoreboards, controllers that send text lines
Every source has these values:
Value
The data as objects (file, HTTP)
Line, Mappings.<Name>
The last line and its parts (port)
IsSuccess
Whether the last read worked
StatusText, ErrorText
State, and the reason of an error
UpdatedAt
When it last changed
FileContent / ResponseString, HttpCode
The text as it was read, and the HTTP status (for troubleshooting)
Unlike ScreensPro Server, a source that fails or can't be parsed (a file read while it is written, cut-off XML, invalid JSON) keeps its last value, with IsSuccess false and the reason in ErrorText - the layouts don't go empty.
Example: results from an XML file
A timing program writes the results of a heat to D:\Timing\results.xml after every finish:
Name
Results
Source
File
File on this computer
D:\Timing\results.xml
Format
XML
The XML becomes objects as in ScreensPro Server: the root's attributes are values, and children that all have the same name are a list under that name (even a single one). So Sources.Results.Value is:
A results layout that updates by itself whenever the file changes, 8 rows per page:
Example: a score from a JSON file
A scoring app writes D:\Scoreboard\score.json:
Name Score, Source File, Format JSON. JSON comes in as it is:
With data-context the paths get shorter: <div data-context="Sources.Score.Value"> … data-bind="Home.Score".
Example: standings from a web service (HTTP)
A results service answers https://results.example.com/api/standings with:
Name
Standings
Source
HTTP
URL (GET, JSON)
https://results.example.com/api/standings
Every (seconds)
5
The request is made again 5 seconds after each answer. The layout shows the standings, and a hint when the service can't be reached - the last standings stay on screen meanwhile:
The same works with any service that answers a GET request with JSON: your own scoring system, a weather API, a sponsor rotation list on a web server.
Example: a timer on a serial port
A timing device sends a line every tenth of a second on COM3, ended by a carriage return (byte 13):
Name
Timer
Source
Port
Port
Serial port COM3, Baud rate 9600, Data bits 8, Parity None, Stop bits One
Line end (bytes)
13
Text encoding
ASCII
Mappings cut the parts out of each line by position (the first character is 0):
Time
6
7
on
Lap
18
2
on
Sources.Timer.Line is the whole last line, handy while you set up the mappings: the dialog shows it once a line has come in. Lines that come faster than every 20 ms reach the layouts as the last one of that time.
The same device on the network instead of a serial cable:
TCP client (connects to)
Host 192.168.1.50, Port 4001
The device is a TCP server (typical for timing and scoreboard controllers). ScreensPro Native connects to it and reconnects every 2 seconds when the connection is gone
TCP server (listens)
Port 4001
The device or program connects to ScreensPro Native
UDP (receives)
Port 5000, optionally Only from host
The device sends datagrams. "Every datagram ends a line too" for devices that send one value per datagram without a line end
For more about the source settings, see Sources.