# Database for Stream Logic
# Provides the glue to keep the stream plugins working together

record( mbbo, "$(P)$(R)StreamType" )
{
   field( PINI, "YES" )
   field( DOL,  "$(TYPE=Viewer)" )
   field( ZRST, "Data" )
   field( ZRVL, "0" )
   field( ONST, "Viewer" )
   field( ONVL, "1" )
   field( TWST, "Thumbnail" )
   field( TWVL, "2" )
}

record( mbbo, "$(P)$(R)StreamInput" )
{
	field( PINI, "YES" )
	field( DOL,  "0" )
	field( ZRVL, "0" ) field( ZRST, "CAM" )
	field( ONVL, "1" ) field( ONST, "ROI1" )
	field( TWVL, "2" ) field( TWST, "ROI2" )
	field( THVL, "3" ) field( THST, "ROI3" )
	field( FRVL, "4" ) field( FRST, "ROI4" )
	field( FVVL, "5" ) field( FVST, "Proc1" )
	field( SXVL, "6" ) field( SXST, "Trans1" )
	field( SVVL, "7" ) field( SVST, "CC1" )
	field( EIVL, "8" ) field( EIST, "CC2" )
	field( FLNK, "$(P)$(R)StreamPort" )
    info( autosaveFields, "VAL" )
}

record( stringout, "$(P)$(R)StreamPort" )
{
	field( OMSL, "closed_loop" )
    field( DOL,  "$(P)$(R)StreamInput" )
}

# Stream Target Height and Width, use zero for auto-sizing
record( longout, "$(P)$(R)StreamHeight" )
{
    field( PINI, "YES")
    field( DOL,  "$(HEIGHT=0)" )
    info( autosaveFields, "VAL" )
}
record( longout, "$(P)$(R)StreamWidth" )
{
    field( PINI, "YES")
    field( DOL,  "$(WIDTH=0)" )
    info( autosaveFields, "VAL" )
}

# Stream Target Rate
record( ao, "$(P)$(R)StreamRate" )
{
    field( PINI, "YES")
    field( DOL,  "$(RATE=0.0)" )
    field( EGU,  "Hz" )
    info( autosaveFields, "VAL" )
}

# Set FLNK for the stream's stdArray ArrayData to update the timestamp
record( waveform, "$(P)$(R)ArrayData" )
{
	field( FLNK, "$(P)$(R)StreamTimeStampStr" )
}

# TODO: Move this to ADCore so it can be shown on NDPluginBase screen
# Stream Timestamp formatted as a string
record( stringin, "$(P)$(R)StreamTimeStampStr" )
{
	field( DESC,	"Image Capture Time" )
	field( DTYP,	"Soft Timestamp" )
	field( TSEL,	"$(P)$(R)ArrayData.TIME")
	field( INP,		"@%m-%d %H:%M:%S.%01f" )
    info( autosaveFields, "INP" )
}

# May want to drop this seq record
record( seq, "$(P)$(R)ResetStream" )
{
	field( SELM, "All" )
	field( SELN, "0" )
	field( DLY1, "0" )

	# Defaults
	field( DOL1, 1 )
	field( DOL2, 1 )
	field( DOL3, 1 )
	field( DOL4, 1 )

	# Plugin values
	field( LNK1, "$(P)$(R)ResetPlugin.PROC" )
	field( LNK2, "$(P)$(R)CC:ResetPlugin.PROC" )
	field( LNK3, "$(P)$(R)Over:ResetPlugin.PROC" )
	field( LNK4, "$(P)$(R)ROI:ResetPlugin.PROC" )

	info( autosaveFields, "DLY1 DLY2 DLY3 DLY4 DLY5 DLY6 DLY7 DLY8 DLY9 DLYA" )
}
