Rev 2160 | Rev 2164 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 2160 | Rev 2162 | ||
|---|---|---|---|
| 1 | 1 | ||
| 2 | Node_ResetNodeId = null; |
2 | Node_ResetNodeId = null; |
| 3 | Node_ResetClientId = null; |
3 | Node_ResetClientId = null; |
| 4 | 4 | ||
| 5 | Node_ProgramNodeId = null; |
5 | Node_ProgramNodeId = null; |
| 6 | Node_ProgramClientId = null; |
6 | Node_ProgramClientId = null; |
| 7 | 7 | ||
| 8 | Node_WaitClientId = null; |
8 | Node_WaitClientId = null; |
| 9 | 9 | ||
| 10 | Node_Native_Reset = false; |
10 | Node_Native_Reset = false; |
| 11 | Node_Native_Program = false; |
11 | Node_Native_Program = false; |
| 12 |
|
12 | Node_Native_WaitNodeId = false; |
| 13 | 13 | ||
| 14 | Node_HexData = ""; |
14 | Node_HexData = ""; |
| 15 | Node_HexNumLines = 0; |
15 | Node_HexNumLines = 0; |
| 16 | 16 | ||
| 17 | function Node_OnChange(node_id, available) |
17 | function Node_OnChange(node_id, available) |
| 18 | { |
18 | { |
| 19 | Log |
19 | //Log("Node_OnChange "+Node_ResetNodeId+" "+Node_ProgramNodeId+" "+node_id+" "+available+"\n"); |
| 20 | if (node_id == Node_ResetNodeId && available) |
20 | if (node_id == Node_ResetNodeId && available) |
| 21 | { |
21 | { |
| 22 | Log |
22 | //Log("ResetNodeId "+Node_Native_Reset+"\n"); |
| 23 | Console_LogToClient(Node_ResetClientId, "\033[32m" + Node_ResetNodeId + " started okay.\033[0m\n"); |
23 | Console_LogToClient(Node_ResetClientId, "\033[32m" + Node_ResetNodeId + " started okay.\033[0m\n"); |
| 24 | 24 | ||
| 25 | Console_NewConnection(Node_ResetClientId); // This is a ugly hack for a bad design for multiusers |
25 | Console_NewConnection(Node_ResetClientId); // This is a ugly hack for a bad design for multiusers |
| 26 | Node_ResetNodeId = null; |
26 | Node_ResetNodeId = null; |
| 27 | Node_ResetClientId = null; |
27 | Node_ResetClientId = null; |
| 28 | 28 | ||
| 29 | Node_Native_Reset = true; |
29 | Node_Native_Reset = true; |
| 30 | } |
30 | } |
| 31 | 31 | ||
| 32 | if (node_id == Node_ProgramNodeId && available) |
32 | if (node_id == Node_ProgramNodeId && available) |
| 33 | { |
33 | { |
| 34 | Log |
34 | //Log("ProgramNodeId "+Node_Native_Program+"\n"); |
| 35 | Console_LogToClient(Node_ProgramClientId, "\033[32m" + Node_ProgramNodeId + " started okay.\033[0m\n"); |
35 | Console_LogToClient(Node_ProgramClientId, "\033[32m" + Node_ProgramNodeId + " started okay.\033[0m\n"); |
| 36 | 36 | ||
| 37 | Console_NewConnection(Node_ProgramClientId); // This is a ugly hack for a bad design for multiusers |
37 | Console_NewConnection(Node_ProgramClientId); // This is a ugly hack for a bad design for multiusers |
| 38 | Node_ProgramNodeId = null; |
38 | Node_ProgramNodeId = null; |
| 39 | Node_ProgramClientId = null; |
39 | Node_ProgramClientId = null; |
| 40 | 40 | ||
| 41 | Node_Native_Program = true; |
41 | Node_Native_Program = true; |
| 42 | } |
42 | } |
| 43 | 43 | ||
| 44 | if (Node_WaitClientId != null && available) |
44 | if (Node_WaitClientId != null && available) |
| 45 | { |
45 | { |
| 46 | var result = NodeExport_GetNodeInformation(node_id); |
46 | var result = NodeExport_GetNodeInformation(node_id); |
| - | 47 | Node_Native_WaitNodeId = node_id; |
|
| 47 | 48 | ||
| 48 | if (!result) |
49 | if (!result) |
| 49 | { |
50 | { |
| 50 | Console_LogToClient(Node_WaitClientId, "\033[31mNo node with id " + node_id + " found.\033[0m\n"); |
51 | Console_LogToClient(Node_WaitClientId, "\033[31mNo node with id " + node_id + " found.\033[0m\n"); |
| 51 | return false; |
52 | return false; |
| 52 | } |
53 | } |
| 53 | 54 | ||
| 54 | var date = new Date(result["LastActive"] * 1000); |
55 | var date = new Date(result["LastActive"] * 1000); |
| 55 | 56 | ||
| 56 | Console_LogToClient(Node_WaitClientId, "Id: " + result["Id"] + "\n"); |
57 | Console_LogToClient(Node_WaitClientId, "Id: " + result["Id"] + "\n"); |
| 57 | Console_LogToClient(Node_WaitClientId, "Valid: " + result["Valid"] + "\n"); |
58 | Console_LogToClient(Node_WaitClientId, "Valid: " + result["Valid"] + "\n"); |
| 58 | Console_LogToClient(Node_WaitClientId, "Bios Version: " + result["BiosVersion"] + "\n"); |
59 | Console_LogToClient(Node_WaitClientId, "Bios Version: " + result["BiosVersion"] + "\n"); |
| 59 | Console_LogToClient(Node_WaitClientId, "Device Type: " + result["DeviceType"] + "\n"); |
60 | Console_LogToClient(Node_WaitClientId, "Device Type: " + result["DeviceType"] + "\n"); |
| 60 | Console_LogToClient(Node_WaitClientId, "Has Application: " + result["HasApplication"] + "\n"); |
61 | Console_LogToClient(Node_WaitClientId, "Has Application: " + result["HasApplication"] + "\n"); |
| 61 | Console_LogToClient(Node_WaitClientId, "Last Active: " + date.toString() + "\n"); |
62 | Console_LogToClient(Node_WaitClientId, "Last Active: " + date.toString() + "\n"); |
| 62 | 63 | ||
| 63 | Console_NewConnection(Node_WaitClientId); // This is a ugly hack for a bad design for multiusers |
64 | Console_NewConnection(Node_WaitClientId); // This is a ugly hack for a bad design for multiusers |
| 64 | Node_WaitClientId = null; |
65 | Node_WaitClientId = null; |
| 65 | } |
66 | } |
| 66 | } |
67 | } |
| 67 | 68 | ||
| 68 | function Node_GetAvailableIds() |
69 | function Node_GetAvailableIds() |
| 69 | { |
70 | { |
| 70 | var result_list = []; |
71 | var result_list = []; |
| 71 | var available_nodes = NodeExport_GetAvailableNodes(); |
72 | var available_nodes = NodeExport_GetAvailableNodes(); |
| 72 | 73 | ||
| 73 | for (var n in available_nodes) |
74 | for (var n in available_nodes) |
| 74 | { |
75 | { |
| 75 | var id_parts = available_nodes[n].split(",", 2); |
76 | var id_parts = available_nodes[n].split(",", 2); |
| 76 | 77 | ||
| 77 | result_list.push(id_parts[0]); |
78 | result_list.push(id_parts[0]); |
| 78 | } |
79 | } |
| 79 | 80 | ||
| 80 | return result_list; |
81 | return result_list; |
| 81 | } |
82 | } |
| 82 | 83 | ||
| 83 | function Node_ListAvailable() |
84 | function Node_ListAvailable() |
| 84 | { |
85 | { |
| 85 | var available_nodes = NodeExport_GetAvailableNodes(); |
86 | var available_nodes = NodeExport_GetAvailableNodes(); |
| 86 | 87 | ||
| 87 | var lines = [["Id", "Modules"]]; |
88 | var lines = [["Id", "Modules"]]; |
| 88 | 89 | ||
| 89 | for (var n in available_nodes) |
90 | for (var n in available_nodes) |
| 90 | { |
91 | { |
| 91 | var parts = available_nodes[n].split(","); |
92 | var parts = available_nodes[n].split(","); |
| 92 | var id = parts.shift(); |
93 | var id = parts.shift(); |
| 93 | var modules = "<none>"; |
94 | var modules = "<none>"; |
| 94 | 95 | ||
| 95 | if (parts.length > 0) |
96 | if (parts.length > 0) |
| 96 | { |
97 | { |
| 97 | modules = parts.join(", "); |
98 | modules = parts.join(", "); |
| 98 | } |
99 | } |
| 99 | 100 | ||
| 100 | lines.push([id, modules]); |
101 | lines.push([id, modules]); |
| 101 | } |
102 | } |
| 102 | 103 | ||
| 103 | var table_lines = create_table(lines); |
104 | var table_lines = create_table(lines); |
| 104 | 105 | ||
| 105 | Log("\033[29;1m" + table_lines[0] + "\033[0m\n"); |
106 | Log("\033[29;1m" + table_lines[0] + "\033[0m\n"); |
| 106 | 107 | ||
| 107 | for (var n = 1; n < table_lines.length; n++) |
108 | for (var n = 1; n < table_lines.length; n++) |
| 108 | { |
109 | { |
| 109 | Log(table_lines[n] + "\n"); |
110 | Log(table_lines[n] + "\n"); |
| 110 | } |
111 | } |
| 111 | 112 | ||
| 112 | return true; |
113 | return true; |
| 113 | } |
114 | } |
| 114 | Console_RegisterCommand(Node_ListAvailable); |
115 | Console_RegisterCommand(Node_ListAvailable); |
| - | 116 | ||
| - | 117 | function Node_WaitNodePollNative() |
|
| - | 118 | { |
|
| - | 119 | if (Node_Native_WaitNodeId) |
|
| - | 120 | { |
|
| - | 121 | var result = NodeExport_GetNodeInformation(Node_Native_WaitNodeId); |
|
| - | 122 | ||
| - | 123 | if (!result) |
|
| - | 124 | { |
|
| - | 125 | return "\033[31mError: No node with id " + Node_Native_WaitNodeId + " found.\033[0m"; |
|
| - | 126 | } |
|
| - | 127 | ||
| - | 128 | var date = new Date(result["LastActive"] * 1000); |
|
| - | 129 | ||
| - | 130 | return "Id: " + result["Id"] + "\t"+ |
|
| - | 131 | "Valid: " + result["Valid"] + "\t"+ |
|
| - | 132 | "Bios Version: " + result["BiosVersion"] + "\t"+ |
|
| - | 133 | "Device Type: " + result["DeviceType"] + "\t"+ |
|
| - | 134 | "Has Application: " + result["HasApplication"] + "\t"+ |
|
| - | 135 | "Last Active: " + date.toString(); |
|
| - | 136 | } |
|
| - | 137 | else |
|
| - | 138 | { |
|
| - | 139 | return false; |
|
| - | 140 | } |
|
| - | 141 | } |
|
| - | 142 | ||
| - | 143 | function Node_WaitForInformationNative() |
|
| - | 144 | { |
|
| - | 145 | Node_WaitClientId = Console_GetClientId(); |
|
| - | 146 | Node_Native_WaitNodeId = false; |
|
| - | 147 | } |
|
| 115 | 148 | ||
| 116 | function Node_ResetPollNative() |
149 | function Node_ResetPollNative() |
| 117 | { |
150 | { |
| 118 | return Node_Native_Reset; |
151 | return Node_Native_Reset; |
| 119 | } |
152 | } |
| 120 | 153 | ||
| 121 | function Node_ResetNative(node_id) |
154 | function Node_ResetNative(node_id) |
| 122 | { |
155 | { |
| 123 | if (arguments.length < 1) |
156 | if (arguments.length < 1) |
| 124 | { |
157 | { |
| 125 | return "\033[31mError: Not enough parameters given.\033[0m"; |
158 | return "\033[31mError: Not enough parameters given.\033[0m"; |
| 126 | } |
159 | } |
| 127 | 160 | ||
| 128 | Node_Native_Reset = false; |
161 | Node_Native_Reset = false; |
| 129 | if (!NodeExport_ResetNode(node_id)) |
162 | if (!NodeExport_ResetNode(node_id)) |
| 130 | { |
163 | { |
| 131 | return "\033[31mError: Failed to send reset, this can happen if node only contains bios and it was connected before atom was started/restarted.\033[0m"; |
164 | return "\033[31mError: Failed to send reset, this can happen if node only contains bios and it was connected before atom was started/restarted.\033[0m"; |
| 132 | } |
165 | } |
| 133 | 166 | ||
| 134 | Node_ResetClientId = Console_GetClientId(); |
167 | Node_ResetClientId = Console_GetClientId(); |
| 135 | Node_ResetNodeId = node_id; |
168 | Node_ResetNodeId = node_id; |
| 136 | 169 | ||
| 137 | return "Reset command sent successfully"; |
170 | return "Reset command sent successfully"; |
| 138 | } |
171 | } |
| 139 | 172 | ||
| 140 | function Node_Reset(node_id) |
173 | function Node_Reset(node_id) |
| 141 | { |
174 | { |
| 142 | if (arguments.length < 1) |
175 | if (arguments.length < 1) |
| 143 | { |
176 | { |
| 144 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
177 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
| 145 | return false; |
178 | return false; |
| 146 | } |
179 | } |
| 147 | 180 | ||
| 148 | Log("Sending reset to " + node_id + "...\n"); |
181 | Log("Sending reset to " + node_id + "...\n"); |
| 149 | 182 | ||
| 150 | if (!NodeExport_ResetNode(node_id)) |
183 | if (!NodeExport_ResetNode(node_id)) |
| 151 | { |
184 | { |
| 152 | Log("\033[31mFailed to send reset, this can happen if node only contains bios and it was connected before atom was started/restarted.\033[0m\n"); |
185 | Log("\033[31mFailed to send reset, this can happen if node only contains bios and it was connected before atom was started/restarted.\033[0m\n"); |
| 153 | return false; |
186 | return false; |
| 154 | } |
187 | } |
| 155 | 188 | ||
| 156 | Node_ResetClientId = Console_GetClientId(); |
189 | Node_ResetClientId = Console_GetClientId(); |
| 157 | Node_ResetNodeId = node_id; |
190 | Node_ResetNodeId = node_id; |
| 158 | Console_PreventDefaultPrompt(); |
191 | Console_PreventDefaultPrompt(); |
| 159 | 192 | ||
| 160 | return true; |
193 | return true; |
| 161 | } |
194 | } |
| 162 | Console_RegisterCommand(Node_Reset, function(arg_index, args) { return Console_StandardAutocomplete(arg_index, args, Node_GetAvailableIds()); }); |
195 | Console_RegisterCommand(Node_Reset, function(arg_index, args) { return Console_StandardAutocomplete(arg_index, args, Node_GetAvailableIds()); }); |
| 163 | 196 | ||
| 164 | function Node_ProgramPollNative() |
197 | function Node_ProgramPollNative() |
| 165 | { |
198 | { |
| 166 | return Node_Native_Program; |
199 | return Node_Native_Program; |
| 167 | } |
200 | } |
| 168 | 201 | ||
| 169 | function Node_AppendHexNative(hexrow) |
202 | function Node_AppendHexNative(hexrow) |
| 170 | { |
203 | { |
| 171 | if (arguments.length < 1) |
204 | if (arguments.length < 1) |
| 172 | { |
205 | { |
| 173 | return "\033[31mError: Not enough parameters given.\033[0m"; |
206 | return "\033[31mError: Not enough parameters given.\033[0m"; |
| 174 | } |
207 | } |
| 175 | 208 | ||
| 176 | Node_HexData = Node_HexData + hexrow + "\n"; |
209 | Node_HexData = Node_HexData + hexrow + "\n"; |
| 177 | Node_HexNumLines += 1; |
210 | Node_HexNumLines += 1; |
| 178 | 211 | ||
| 179 | return true; |
212 | return true; |
| 180 | } |
213 | } |
| 181 | 214 | ||
| 182 | function Node_ProgramNative(node_id, bios, hexnumlines) |
215 | function Node_ProgramNative(node_id, bios, hexnumlines) |
| 183 | { |
216 | { |
| 184 | if (arguments.length < 3) |
217 | if (arguments.length < 3) |
| 185 | { |
218 | { |
| 186 | return "\033[31mError: Not enough parameters given.\033[0m"; |
219 | return "\033[31mError: Not enough parameters given.\033[0m"; |
| 187 | } |
220 | } |
| 188 | if (Node_HexNumLines != hexnumlines) |
221 | if (Node_HexNumLines != hexnumlines) |
| 189 | { |
222 | { |
| 190 | return "\033[31mError: Number of hex lines does not match received (" + Node_HexNumLines + " received, should be " + hexnumlines + ").\033[0m"; |
223 | return "\033[31mError: Number of hex lines does not match received (" + Node_HexNumLines + " received, should be " + hexnumlines + ").\033[0m"; |
| 191 | } |
224 | } |
| 192 | 225 | ||
| 193 | Node_Native_Program = false; |
226 | Node_Native_Program = false; |
| 194 | if (!NodeExport_ProgramNodeHex(node_id, bios > 0, Node_HexData)) |
227 | if (!NodeExport_ProgramNodeHex(node_id, bios > 0, Node_HexData)) |
| 195 | { |
228 | { |
| 196 | return "\033[31mError: Failed to start programming, this can happen if node only contains bios and it was connected before atom was started/restarted.\033[0m"; |
229 | return "\033[31mError: Failed to start programming, this can happen if node only contains bios and it was connected before atom was started/restarted.\033[0m"; |
| 197 | } |
230 | } |
| 198 | 231 | ||
| 199 | Node_ProgramClientId = Console_GetClientId(); |
232 | Node_ProgramClientId = Console_GetClientId(); |
| 200 | Node_ProgramNodeId = node_id; |
233 | Node_ProgramNodeId = node_id; |
| 201 | Node_HexData = ""; |
234 | Node_HexData = ""; |
| 202 | Node_HexNumLines = 0; |
235 | Node_HexNumLines = 0; |
| 203 | 236 | ||
| 204 | return "Program command sent successfully"; |
237 | return "Program command sent successfully"; |
| 205 | } |
238 | } |
| 206 | 239 | ||
| 207 | function Node_Program(node_id, bios, filename) |
240 | function Node_Program(node_id, bios, filename) |
| 208 | { |
241 | { |
| 209 | if (arguments.length < 3) |
242 | if (arguments.length < 3) |
| 210 | { |
243 | { |
| 211 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
244 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
| 212 | return false; |
245 | return false; |
| 213 | } |
246 | } |
| 214 | 247 | ||
| 215 | Log("Initiating programming of " + node_id + "...\n"); |
248 | Log("Initiating programming of " + node_id + "...\n"); |
| 216 | 249 | ||
| 217 | if (!NodeExport_ProgramNode(node_id, bios > 0, filename)) |
250 | if (!NodeExport_ProgramNode(node_id, bios > 0, filename)) |
| 218 | { |
251 | { |
| 219 | Log("\033[31mFailed to start programming, this can happen if node only contains bios and it was connected before atom was started/restarted.\033[0m\n"); |
252 | Log("\033[31mFailed to start programming, this can happen if node only contains bios and it was connected before atom was started/restarted.\033[0m\n"); |
| 220 | return false; |
253 | return false; |
| 221 | } |
254 | } |
| 222 | 255 | ||
| 223 | Node_ProgramClientId = Console_GetClientId(); |
256 | Node_ProgramClientId = Console_GetClientId(); |
| 224 | Node_ProgramNodeId = node_id; |
257 | Node_ProgramNodeId = node_id; |
| 225 | Console_PreventDefaultPrompt(); |
258 | Console_PreventDefaultPrompt(); |
| 226 | 259 | ||
| 227 | return true; |
260 | return true; |
| 228 | } |
261 | } |
| 229 | Console_RegisterCommand(Node_Program, function(arg_index, args) { return Console_StandardAutocomplete(arg_index, args, Node_GetAvailableIds(), [0, 1]); }); |
262 | Console_RegisterCommand(Node_Program, function(arg_index, args) { return Console_StandardAutocomplete(arg_index, args, Node_GetAvailableIds(), [0, 1]); }); |
| 230 | 263 | ||
| 231 | function Node_ProgramHex(node_id, bios, hexnumlines) |
264 | function Node_ProgramHex(node_id, bios, hexnumlines) |
| 232 | { |
265 | { |
| 233 | if (arguments.length < 2) |
266 | if (arguments.length < 2) |
| 234 | { |
267 | { |
| 235 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
268 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
| 236 | return false; |
269 | return false; |
| 237 | } |
270 | } |
| 238 | if (Node_HexNumLines != hexnumlines) |
271 | if (Node_HexNumLines != hexnumlines) |
| 239 | { |
272 | { |
| 240 | Log("\033[31mNumber of hex lines does not match received (" + Node_HexNumLines + " received, should be " + hexnumlines + ").\033[0m\n"); |
273 | Log("\033[31mNumber of hex lines does not match received (" + Node_HexNumLines + " received, should be " + hexnumlines + ").\033[0m\n"); |
| 241 | return false; |
274 | return false; |
| 242 | } |
275 | } |
| 243 | 276 | ||
| 244 | Log("Initiating programming of " + node_id + "...\n"); |
277 | Log("Initiating programming of " + node_id + "...\n"); |
| 245 | 278 | ||
| 246 | if (!NodeExport_ProgramNodeHex(node_id, bios > 0, Node_HexData)) |
279 | if (!NodeExport_ProgramNodeHex(node_id, bios > 0, Node_HexData)) |
| 247 | { |
280 | { |
| 248 | Log("\033[31mFailed to start programming, this can happen if node only contains bios and it was connected before atom was started/restarted.\033[0m\n"); |
281 | Log("\033[31mFailed to start programming, this can happen if node only contains bios and it was connected before atom was started/restarted.\033[0m\n"); |
| 249 | return false; |
282 | return false; |
| 250 | } |
283 | } |
| 251 | 284 | ||
| 252 | Node_ProgramClientId = Console_GetClientId(); |
285 | Node_ProgramClientId = Console_GetClientId(); |
| 253 | Node_ProgramNodeId = node_id; |
286 | Node_ProgramNodeId = node_id; |
| 254 | Console_PreventDefaultPrompt(); |
287 | Console_PreventDefaultPrompt(); |
| 255 | 288 | ||
| 256 | Node_HexData = ""; |
289 | Node_HexData = ""; |
| 257 | Node_HexNumLines = 0; |
290 | Node_HexNumLines = 0; |
| 258 | 291 | ||
| 259 | 292 | ||
| 260 | return true; |
293 | return true; |
| 261 | } |
294 | } |
| 262 | Console_RegisterCommand(Node_ProgramHex, function(arg_index, args) { return Console_StandardAutocomplete(arg_index, args, Node_GetAvailableIds(), [0, 1]); }); |
295 | Console_RegisterCommand(Node_ProgramHex, function(arg_index, args) { return Console_StandardAutocomplete(arg_index, args, Node_GetAvailableIds(), [0, 1]); }); |
| 263 | 296 | ||
| 264 | function Node_ClearHex() |
297 | function Node_ClearHex() |
| 265 | { |
298 | { |
| 266 | // Log("Clearing hexdata...\n"); |
299 | // Log("Clearing hexdata...\n"); |
| 267 | 300 | ||
| 268 | Node_HexData = ""; |
301 | Node_HexData = ""; |
| 269 | Node_HexNumLines = 0; |
302 | Node_HexNumLines = 0; |
| 270 | 303 | ||
| 271 | return true; |
304 | return true; |
| 272 | } |
305 | } |
| 273 | Console_RegisterCommand(Node_ClearHex); |
306 | Console_RegisterCommand(Node_ClearHex); |
| 274 | 307 | ||
| 275 | function Node_AppendHex(hexrow) |
308 | function Node_AppendHex(hexrow) |
| 276 | { |
309 | { |
| 277 | if (arguments.length < 1) |
310 | if (arguments.length < 1) |
| 278 | { |
311 | { |
| 279 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
312 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
| 280 | return false; |
313 | return false; |
| 281 | } |
314 | } |
| 282 | 315 | ||
| 283 | // Log("Appending hexrow...\n"); |
316 | // Log("Appending hexrow...\n"); |
| 284 | 317 | ||
| 285 | Node_HexData = Node_HexData + hexrow + "\n"; |
318 | Node_HexData = Node_HexData + hexrow + "\n"; |
| 286 | Node_HexNumLines += 1; |
319 | Node_HexNumLines += 1; |
| 287 | 320 | ||
| 288 | return true; |
321 | return true; |
| 289 | } |
322 | } |
| 290 | Console_RegisterCommand(Node_AppendHex); |
323 | Console_RegisterCommand(Node_AppendHex); |
| 291 | 324 | ||
| 292 | function Node_GetInformation(node_id) |
325 | function Node_GetInformation(node_id) |
| 293 | { |
326 | { |
| 294 | if (arguments.length < 1) |
327 | if (arguments.length < 1) |
| 295 | { |
328 | { |
| 296 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
329 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
| 297 | return false; |
330 | return false; |
| 298 | } |
331 | } |
| 299 | 332 | ||
| 300 | var result = NodeExport_GetNodeInformation(node_id); |
333 | var result = NodeExport_GetNodeInformation(node_id); |
| 301 | 334 | ||
| 302 | if (!result) |
335 | if (!result) |
| 303 | { |
336 | { |
| 304 | Log("\033[31mNo node with id " + node_id + " found.\033[0m\n"); |
337 | Log("\033[31mNo node with id " + node_id + " found.\033[0m\n"); |
| 305 | return false; |
338 | return false; |
| 306 | } |
339 | } |
| 307 | 340 | ||
| 308 | var date = new Date(result["LastActive"] * 1000); |
341 | var date = new Date(result["LastActive"] * 1000); |
| 309 | 342 | ||
| 310 | Log("\033[96mId: \033[0;1m" + result["Id"] + "\033[0m\n"); |
343 | Log("\033[96mId: \033[0;1m" + result["Id"] + "\033[0m\n"); |
| 311 | Log("\033[96mValid: \033[0;1m" + result["Valid"] + "\033[0m\n"); |
344 | Log("\033[96mValid: \033[0;1m" + result["Valid"] + "\033[0m\n"); |
| 312 | Log("\033[96mBios Version: \033[0;1m" + result["BiosVersion"] + "\033[0m\n"); |
345 | Log("\033[96mBios Version: \033[0;1m" + result["BiosVersion"] + "\033[0m\n"); |
| 313 | Log("\033[96mDevice Type: \033[0;1m" + result["DeviceType"] + "\033[0m\n"); |
346 | Log("\033[96mDevice Type: \033[0;1m" + result["DeviceType"] + "\033[0m\n"); |
| 314 | Log("\033[96mHas Application: \033[0;1m" + result["HasApplication"] + "\033[0m\n"); |
347 | Log("\033[96mHas Application: \033[0;1m" + result["HasApplication"] + "\033[0m\n"); |
| 315 | Log("\033[96mLast Active: \033[0;1m" + date.toString() + "\033[0m\n"); |
348 | Log("\033[96mLast Active: \033[0;1m" + date.toString() + "\033[0m\n"); |
| 316 | 349 | ||
| 317 | return true; |
350 | return true; |
| 318 | } |
351 | } |
| 319 | Console_RegisterCommand(Node_GetInformation, function(arg_index, args) { return Console_StandardAutocomplete(arg_index, args, Node_GetAvailableIds()); }); |
352 | Console_RegisterCommand(Node_GetInformation, function(arg_index, args) { return Console_StandardAutocomplete(arg_index, args, Node_GetAvailableIds()); }); |
| 320 | 353 | ||
| 321 | function Node_WaitForInformation() |
354 | function Node_WaitForInformation() |
| 322 | { |
355 | { |
| 323 | Node_WaitClientId = Console_GetClientId(); |
356 | Node_WaitClientId = Console_GetClientId(); |
| 324 | Console_PreventDefaultPrompt(); |
357 | Console_PreventDefaultPrompt(); |
| 325 | 358 | ||
| 326 | return true; |
359 | return true; |
| 327 | } |
360 | } |
| 328 | Console_RegisterCommand(Node_WaitForInformation); |
361 | Console_RegisterCommand(Node_WaitForInformation); |
| 329 | 362 | ||