Uci
Use the Uci functions to manipulate user control interfaces in Q-SYS.
Display a dialog in a UCI that contains a title, message, and button selection list.
Syntax
Uci.ShowDialog( UCI_Name, DialogTable )
Arguments
UCI_Name : String. The name of the target UCI for which to display the dialog.
DialogTable : A table consisting of the following elements
Title = "UCI dialog titlebar string",
Message = "Dialog message string",
Buttons = { "Button_String", "Button_String", "Button_String", "etc." }
The button list is a table consisting of strings – one string per desired response button.
Handler = EventHandler_Function
The EventHandler Function receives an integer index of which button was pressed. The EventHandler argument is zero-based, so add 1 to the integer to match a Lua table entry. See example.
Example
In this example, the ShowDialog control and event handler activates the dialog. The UCIDialogHandler event handler function calls the WhichButton control to provide feedback of which button was pushed, defined by a list of strings (ButtonText).
ButtonText = {
"Button 1 was pushed",
"Button 2 was pushed",
"Button 3 was pushed",
}
function UCIDialogHandler(choiceInt)
print(choiceInt,ButtonText[choiceInt+1])
Controls.WhichButton.String = ButtonText[choiceInt+1]
end
function ShowDialog()
Uci.ShowDialog(
"Main UCI",
{
Title = "UCI Dialog Titlebar",
Message = "Which button would you like to push?",
Buttons = {
"Button 1",
"Button 2",
"Button 3",
},
Handler = UCIDialogHandler,
}
)
end
Controls.ShowDialog.EventHandler = ShowDialog
Set the screen status of a TSC touchscreen controller or UCI Viewer.
Syntax
Uci.SetScreen( TSC_Name, State )
Arguments
TSC_Name : The name of the TSC touchscreen controller or UCI Viewer.
State : "On" | "Off" | "Dim"
Example
-- Control Alias
TSC = Controls.TSC_Name -- This textbox should contain the name of the TSC or UCI Viewer Inventory instance
-- Set Screen
for _,state in pairs{"On","Off","Dim"} do
Controls[state].EventHandler = function()
local TSC_Name = TSC.String
Uci.SetScreen(TSC_Name,state)
end
end
Set which UCI to display on a TSC touchscreen controller or UCI Viewer.
Note: To avoid errors when using the Uci.SetUCI function, the UCI Assignment property for the TSC touchscreen controller or UCI Viewer must be set to "Dynamic". For more information, see Status/Control (Touch Screen) and Status/Control (UCI Viewer).
Syntax
Uci.SetUCI( TSC_Name, UCI_Name )
Arguments
TSC_Name : The name of the TSC touchscreen controller or UCI Viewer.
UCI_Name : String. The name of the UCI.
Example
-- Control Alias
TSC = Controls.TSC_Name -- This textbox should contain the name of the TSC or UCI Viewer Inventory instance
-- Set UCI
Controls["Main UCI"].EventHandler = function() local
TSC_Name = TSC.String
Uci.SetUCI(TSC_Name,"Main UCI")
end
Controls["Other UCI"].EventHandler = function()
local TSC_Name = TSC.String
Uci.SetUCI(TSC_Name,"Other UCI")
end
Set which UCI page to display on a TSC touchscreen controller or UCI Viewer.
Syntax
Uci.SetPage( TSC_Name, Page_in_UCI )
Arguments
TSC_Name : The name of the TSC touchscreen controller or UCI Viewer.
Page_in_UCI : The UCI page to show.
Example
-- Control Alias
TSC = Controls.TSC_Name -- This textbox should contain the name of the TSC or UCI Viewer Inventory instance
-- Set UCI Page
for key,ctl in ipairs(Controls.Page) do
ctl.EventHandler = function()
local TSC_Name = TSC.String
Uci.SetPage(TSC_Name,"Page "..key)
end
end
Set whether and how a layer is made visible within a specified UCI name and page.
Syntax
Uci.SetLayerVisibility( UCI_Name, Page_Name, Layer_Name, Visibility, Transition_Type )
Arguments
UCI_Name : String. The name of the UCI.
Page_Name : String. The name of the UCI page.
Layer_Name : String. The name of the UCI layer.
Visibility : true | false
Transition_Type : "none" | "fade" | "left" | "right" | "bottom" | "top"
Example
--Set Layer Visibility
trans = Controls.Transition
trans.Choices = {"none","fade","left","right","bottom","top"}
if #trans.String==0 then trans.String = "none" end
for ix,layer in ipairs{"The Top Layer","The Middle Layer","The Bottom Layer"} do
Controls[layer].EventHandler = function(ctl)
Uci.SetLayerVisibility( "Main UCI", "Page 1", layer, ctl.Boolean, trans.String )
end
Uci.SetLayerVisibility( "Main UCI", "Page 1", layer, Controls[layer].Boolean, trans.String )
end
Set whether and how a shared layer is made visible within a specified UCI name and page.
Note: Uci.SetSharedLayerVisibility is similar to UciSetLayerVisibility, but because Shared Layers can exist on multiple UCI pages, there is no argument for Page_Name. For more information about Shared Layers, see User Control Interface (UCI) Design Overview.
Syntax
Uci.SetSharedLayerVisibility( 'UCI_Name', 'Layer_Name', Visibility, Transition_Type )
Arguments
UCI_Name : String. The name of the UCI.
Layer_Name : String. The name of the UCI layer.
Visibility : true | false
Transition_Type : "none" | "fade" | "left" | "right" | "bottom" | "top"
Enable the ability to log off from a specified TSC touchscreen controller or UCI Viewer.
Note: Uci.LogOff can log out only if PIN security is enabled in Q-SYS Core Manager. For more information, see User Control Interfaces.
Syntax
Uci.LogOff( TSC_Name )
Arguments
TSC_Name : The name of the TSC touchscreen controller or UCI Viewer.
Example
-- Control Alias
TSC = Controls.TSC_Name -- This textbox should contain the name of the TSC or UCI Viewer Inventory instance
-- UCI Log Off
Controls["Log Me Out"].EventHandler = function()
print("Uci.LogOff() can only log out if PIN security is enabled on the panel")
Uci.LogOff(TSC.String)
end