A data feed object responds to several messages, including Connect and Set Script. These are detailed above as arguments for Open Datafeed(). They can also be sent as messages to a data feed object that already exists:
The following messages could also be used as arguments to On Datafeed(). However, it would be more common to send them as messages to a data feed object that is already present.
You can send lines to a data feed from a script. This is a quick way to test a data feed. If you do not have a device available, Queue Line does not send data to a device; it simulates getting data from a device. Include a text argument or a global that stores text:
图 14.2 Datafeed: 5 Lines Queued
To get the first line currently waiting in the queue, use a Get Line (singular) message. When you get a line, it is removed from the queue. Five lines were queued with the test script above, and Get Line returns the first line and removes it from the queue:
图 14.3 Datafeed: 4 Lines Queued
To empty all lines from the queue into a list, use Get Lines (plural). This returns the next four lines from the test script in list { } format.
图 14.4 Datafeed: 0 Lines Queued
To stop and later restart the processing of queued lines, either click the Stop and Restart buttons in the Datafeed window, or send the equivalent messages:
Creates a data feed object. Any of the following can be used as commands inside Open Datafeed or sent as messages to an existing data feed object. Datafeed is a synonym.
|
||
Assigns the script that is run each time a line of data is received.
|
||
feed << Queue Line( string )
|
||