From 436a39bb1ea3402c381827d0bc470c01cda0d2cf Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 9 Oct 2015 20:00:06 +0200 Subject: Readable status --- csta/system-status.go | 26 ++++++++++++++++++++++++++ kxtde/main.go | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/csta/system-status.go b/csta/system-status.go index 9e0ea22..7afe858 100644 --- a/csta/system-status.go +++ b/csta/system-status.go @@ -23,3 +23,29 @@ type SystemStatusArg struct { type SystemStatusRes struct { asn1.Null } + +type SystemStatus asn1.Enumerated + +func (s SystemStatus) String() string { + switch asn1.Enumerated(s) { + case SystemStatusInitializing: + return "Initializing" + case SystemStatusEnabled: + return "Enabled" + case SystemStatusNormal: + return "Normal" + case SystemStatusMessagesLost: + return "Message Lost" + case SystemStatusDisabled: + return "Disabled" + case SystemStatusOverloadImminent: + return "Overload Imminent" + case SystemStatusOverloadReached: + return "Overload Reached" + case SystemStatusOverloadRelieved: + return "Overload Relieved" + case SystemStatusPartiallyDisabled: + return "Partially Disabled" + } + return "" +} diff --git a/kxtde/main.go b/kxtde/main.go index 98e5038..60624e9 100644 --- a/kxtde/main.go +++ b/kxtde/main.go @@ -60,7 +60,7 @@ func main() { if err != nil { log.Fatal(err) } - log.Println(id, "System Status", ss.SystemStatus) + log.Println(id, "System Status", csta.SystemStatus(ss.SystemStatus)) null, _ := asn1.Marshal(asn1.Null{}) res, err := rose.Marshal(id, opcode, null) if err != nil { -- cgit v1.2.3