Revision 6 hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/LogicRequestController.groovy
LogicRequestController.groovy | ||
---|---|---|
3 | 3 |
class LogicRequestController { |
4 | 4 |
|
5 | 5 |
def reportService |
6 |
def hciLogicCommService |
|
6 | 7 |
|
7 | 8 |
def testConnection = { |
8 | 9 |
|
... | ... | |
12 | 13 |
output += reportService.println("Logic port number: " + InternalConfig.findByConfigId('logic-port').configVal) |
13 | 14 |
|
14 | 15 |
output += reportService.println("Test started") |
15 |
output += reportService.println("<span style='color:red;'>Error: " + "Connection implementation missing.</span>") |
|
16 |
|
|
17 |
String reqStr = "<hci-request type='checkConnection'><data>012345</data></hci-request>" |
|
18 |
Map testReply = hciLogicCommService.getReplyToRequest(reqStr) |
|
19 |
|
|
20 |
if(testReply['status'] == "error") { |
|
21 |
output += reportService.println("<span style='color:red;'>Error: " + testReply['content'] + "</span>") |
|
22 |
} else { |
|
23 |
output += reportService.println("Connection established succesfully") |
|
24 |
if(testReply['content'] == "012345") { |
|
25 |
output += "<span style='color:green;'>Logic unit replied! The eneraptor system is set up properly.</span>" |
|
26 |
} else { |
|
27 |
output += reportService.println("<span style='color:red;'>The connection was established, but there was no reply from the logic unit.</span>") |
|
28 |
output += reportService.println("<span style='color:red;'>You should check the logic's port number and IP address.</span>"); |
|
29 |
} |
|
30 |
} |
|
31 |
|
|
16 | 32 |
output += reportService.println("Test ended") |
17 | 33 |
|
18 | 34 |
[output:output] |
Also available in: Unified diff