Continuously retrieve data from a device that is sending data repeatedly without additional commands. The streamed data can then be accessed with the getStream command(s) that are defined in the spec file.


dc_GenStream [spec_file=filename]



Optional. Specify the spec filename to read and configure the task.


dc_GenStream /specs/hydrometer.spec &


You can change the size of a message by changing the environmental variable streamSize in the terminal, default is 1023.

Also normally used in conjunction with devcom_mon task to run the commands.

A sample spec file can be found at cyflex/specs.def/ called genstream.spec.

A sample devcom_mon can be found at cyflex/specs.def/ called genstream_mon.spec.

# serail port:baud,bits,stobits,parity,flow control(HW,XON,NONE$-$HW default)  
# maximum message rate is 1000 messages per second.  
# default timeout in milliseconds  
#want to be higher than the amount it takes to get a message, usually 2 to 3 times higher  
#Name task will attach to, or key name so multiple device of same type can be supported.  
 #GenSync – general asynchronous (streams data) serial/socket protocol  
#message structure  
# This section shows the sequence of message elements  
# H = header string  
# S = station identifier  
# M = message  
# T = trailer string  
# C = crc  
# response structure if any response expected  
# trailer  

# NOTE: NONE supported at this time 7/1/10, will be added as needed.
 #put True if you want to replaces commas, will not work in ReplaceItems 
#not including commas because that is what seperates the list  
 #example: :,;,*,/  to replace : ; * and / all with spaces  
#note: does not work with the $ symbol  
 #Command formats  
 #Command format Response format [timeout]  
 #Control Commands have no data response  
#CommandString formats AK_Command [Timeout(msec)]  
 #comma or tab delmited  
#Command key, [command arguments],[response],[timeout]  
#The getStream command is how you retrieve data from a device that is  streaming information.

#You can have multiple getStream commands for  different formats, but you need to add numbers #at the end of the original command. Example: #getStream1, getStream2, etcldots  
#the format for the getStream command, you must find out what the device  
#output looks like. Once you have that, you must separate the output into  
#segments by spaces and tabs separating the segments. This includes the  
#spaces from the ReplaceItems.  

#A device is streaming   tds:mv=.45 dp=31 ret54d1
#Before any replacements there are three segments. tds:mv=.45 , dp=31 ,  
#and ret54d1. If we wanted the tds and the .45 from the first segment, we  
#would put ‘:’ for or ReplaceItems list and it would split the 1st segment  
#into 2 segments, tds and mv=.45 for a total of 4 segments now. To get  
#the .45 and 31, we do not need to replace anything additionally. The  
#format %f is smart enough to parse the first number it sees. However,  
#that would not be enough to parse the last segment, so if we wanted  
#certain data there, we would need to parse further. So with the first  
#parse, %s %f %f %s would be enough if we did not need anything from the  
#last segment.  
getStream, -,%s %f %f %s  
# this section should end with a $ 


See Also: