-
Notifications
You must be signed in to change notification settings - Fork 0
/
Userful Interface.usp
156 lines (118 loc) · 5.87 KB
/
Userful Interface.usp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*******************************************************************************************
SIMPL+ Module Information
(Fill in comments below)
*******************************************************************************************/
/*
Dealer Name: IMS Technologies
System Name: Userful Interface
System Number:
Programmer: MJP
Comments:
*/
/*******************************************************************************************
Compiler Directives
*******************************************************************************************/
//#SYMBOL_NAME ""
//#CATEGORY "0" // Miscellaneous
#DEFAULT_VOLATILE
#ENABLE_TRACE
#DEFINE_CONSTANT DEBUG 1
#HELP_BEGIN
[Inputs]
GetSystemInfo - A rising edge on this input will send a poll to the Userful system and retrieve all of the Sources,
Zones, and Preset info. Once recieved it will review all the sources and update SourceAvailable[] if a source is
being used. This signal is also called internally any time a Source or Preset is changed.
SetPreset[x] - A rising edge on this input will switch the active preset inside the Userful server. The preset names are
entered in through the SourceName[] serial inputs.
SetZone[x] - A change on the this analog input will change the source being sent to the zone by "destinationSourceName".
The zone names are entered in through the ZoneName[] serial inputs. The source names are entered in through the
SourceName[] serial inputs.
SetDisplay[x] - A change on the this analog input will change the source being sent to the display by "destinationSourceName".
Currently, these inputs are disconnected and DO NOT function. Would like to instantiate these fields by
retrieving them from the Userful server when they are requested/created/modified.
[Outputs]
SourceAvaialbe[x] - On any change or GetSystemInfo request, the module will compare the Zones and sources to see if any source
is in use. If a source is in use, the signal will go low. Only a single Live Video source can be routed to a zone at one
time unless a mirror group is in use. It is recommended to tie these signals to the Source Enabled Joins unless you are not
using a Live input source, such as a capture card.
SourceID$[x] - These signals will be updated with the SourceID's from the Userful system. These are only used for debugging.
Zone_Fb[x] - This signal shows the value of the zone's current source selection. Currently, this is disconnected and
will need a delegate function created to facilitate the feedback from the USerful server.
Display_Fb[x] - This signal shows the value of the display's current source selection. Currently, this is disconnected and
will need a delegate function created to facilitate the feedback from the USerful server.
[Parameters]
Url$ - Enter the address of the Userful server with port #9000 (http://xxx.xxx.xxx.xxx:9000).
UserName$ - Enter the username created inside of the Userful server to access the API.
Password$ - Enter the password created inside of the Userful server to access the API.
#HELP_END
/*******************************************************************************************
Include Libraries
(Uncomment and include additional libraries as needed)
*******************************************************************************************/
// #CRESTRON_LIBRARY ""
// #USER_LIBRARY ""
#USER_SIMPLSHARP_LIBRARY "Userful"
/*******************************************************************************************
DIGITAL, ANALOG and SERIAL INPUTS and OUTPUTS
*******************************************************************************************/
DIGITAL_INPUT GetSystemInfo, _SKIP_, _SKIP_, _SKIP_, _SKIP_, _SKIP_, SetPreset[8], _SKIP_;
ANALOG_INPUT SetDisplay[10], _SKIP_, SetZoneSource[10];
STRING_INPUT SourceName[10][64], _SKIP_, ZoneName[10][64], _SKIP_, DisplayName[10][64], _SKIP_, PresetName[8][64];
DIGITAL_OUTPUT SourceAvailable[10];
STRING_OUTPUT _SKIP_, _SKIP_, _SKIP_, _SKIP_, _SKIP_, _SKIP_, _SKIP_, SourceID$[8];
ANALOG_OUTPUT _SKIP_, Zone_Fb[10], _SKIP_, Display_Fb[10];
/*******************************************************************************************
Parameters
(Uncomment and declare parameters as needed)
*******************************************************************************************/
STRING_PARAMETER _SKIP_, _SKIP_, _SKIP_, Url$[100],UserName$[50],Password$[50];
/*******************************************************************************************
Global Variables
*******************************************************************************************/
UserfulControl UF;
/*******************************************************************************************
Functions
*******************************************************************************************/
/*******************************************************************************************
Event Handlers
*******************************************************************************************/
PUSH GetSystemInfo
{
UF.getSysInfo();
}
PUSH SetPreset
{
Integer i;
i = GetLastModifiedArrayIndex();
UF.setPreset(PresetName[i]);
}
CHANGE SetZoneSource
{
Integer i, val;
i = GetLastModifiedArrayIndex();
val = SetZoneSource[GetLastModifiedArrayIndex()];
UF.setZoneSources(ZoneName[i], SourceName[val+1]);
}
CHANGE SetDisplay
{
}
eventhandler updateSources (UserfulSource sender, EventArgs args)
{
integer i;
for(i = 1 to 10)
{
SourceAvailable[i] = !UF.SourceInUseByName(SourceName[i]);
}
}
/*******************************************************************************************
Main()
*******************************************************************************************/
Function Main()
{
WaitForInitializationComplete();
UF.usr.user = UserName$;
UF.usr.password = Password$;
UF.hostAddress = Url$;
UF.debug = DEBUG;
RegisterEvent(UF, UpdateSourcesInUse, updateSources);
}