-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathumbcontroller_node.html
More file actions
180 lines (165 loc) · 6.15 KB
/
umbcontroller_node.html
File metadata and controls
180 lines (165 loc) · 6.15 KB
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<script type="text/javascript">
RED.nodes.registerType('umbcontroller',{
category: 'function',
color: '#a6bbcf',
defaults: {
name: {value:""},
dev_address: {value:"28673", required:true},
com_intf: {value:"0", required:true},
ip_address: {value:"192.168.0.10", required:true},
ip_port: {value:"9750", required:true},
sp_tty: {value:"", required:false},
sp_baud: {value: "19200", required:true},
sp_parity: {value: "8N1", required:true},
channels: {value:"", type:"umbchannels"},
},
inputs:1,
outputs:1,
icon: "file.png",
label: function() {
return "UMB Controller";
},
oneditprepare: function () {
var node = this;
var tty_list = Array();
$.getJSON('ttys', function(ttylist) {
console.log(ttylist);
$.each(ttylist, function(i, cur_tty) {
console.log(i);
tty_list.push({
value: cur_tty,
label: cur_tty,
});
});
$("#node-input-sp_tty").typedInput({
types: [
{
value: "sp_tty",
options: tty_list,
}
]
});
});
$("#node-input-name").typedInput({
type:"str",
types:["str"],
});
$("#node-input-ip_port").typedInput({
type:"num",
types:["num"],
});
$("#node-input-com_intf").typedInput({
types: [
{
value: "com_intf",
options: [
{ value: "0", label: "Serial"},
{ value: "1", label: "IP"},
]
}
]
});
$("#node-input-sp_parity").typedInput({
types: [
{
value: "sp_parity",
options: [
{ value: "8N1", label: "8N1"},
{ value: "8E1", label: "8E1"},
]
}
]
});
$("#node-input-sp_baud").typedInput({
type:"num",
types:["num"],
});
},
oneditsave: function() {
var node = this;
node.sp_tty = $("#node-input-ps_tty").val();
},
});
</script>
<script type="text/html" data-template-name="umbcontroller" >
<style>
fieldset.groupbox {
margin: 8px;
margin-left: 0px;
margin-right: 0px;
border: 1px solid silver;
padding: 0px;
padding-left:8px;
padding-right:8px;
border-radius: 4px;
}
legend.groupbox-legend{
font-size: 14px;
text-decoration: none;
border: 0;
margin: 2px;
width: auto;
}
</style>
<body>
<div class="form-row" >
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name" placeholder="Devicename">
</div>
<div class="form-row">
<label for="node-input-dev_address"><i class="icon-tag"></i>Device Address</label>
<div class="red-ui-typedInput-container">
<button class="red-ui-typedInput-type-select disabled" tabindex="-1" title="string">
<i class="red-ui-typedInput-icon fa fa-caret-down" style="display: none;"></i>
<span class="red-ui-typedInput-type-label" style="margin: 2px">
0x
</span>
</button>
<input id="node-input-dev_address" class="red-ui-typedInput-input" type="text" placeholder="Device address (hex)" pattern="[a-fA-F\d]+" autocomplete="off" style="width: 100%; margin-right: 0px; margin-left: 0px;">
</div>
</div>
<div class="form-row">
<label for="node-input-channels"><i class="icon-tag"></i> Channels</label>
<input type="text" id="node-input-channels">
</div>
<div class="form-row">
<label for="node-input-com_intf"><i class="icon-tag"></i> Interface</label>
<input id="node-input-com_intf" type="text">
</div>
<fieldset class="groupbox" id="fieldset-ip-config">
<legend class="groupbox-legend">
IP configuration
</legend>
<div class="panel-body">
<div class="form-row">
<label for="node-input-ip_address"><i class="fa fa-globe"></i> Device IP</label>
<input type="text" id="node-input-ip_address" placeholder="ip.address" style="width:45%" dir="">
</div>
<div class="form-row">
<label for="node-input-ip_port">Port</label>
<input type="text" id="node-input-ip_port" style="width:200px" dir="" placeholder="TCP Port">
</div>
</div>
</fieldset>
<fieldset class="groupbox" id="fieldset-sp-config">
<legend class="groupbox-legend">
Serial configuration
</legend>
<div class="form-row">
<label for="node-input-sp_tty"><i class="icon-tag"></i> Serial Port</label>
<input id="node-input-sp_tty" type="text">
</div>
<div class="form-row">
<label for="node-input-sp_baud"><i class="icon-tag"></i>Baudrate</label>
<input type="text" id="node-input-sp_baud" style="width:200px">
</div>
<div class="form-row">
<label for="node-input-sp_parity"><i class="icon-tag"></i>Parity</label>
<input type="text" id="node-input-sp_parity" style="width:200px">
</div>
</fieldset>
</body>
</script>
<script type="text/html" data-help-name="umbgenerator">
<p>This is a generator for UMB frames</p>
</script>