Small CLI monitoring tool to decode proprietary [...] protocol and display info in human readable representation
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ycli-mon/yabl/strings.go

129 lines
2.2 KiB

package yabl
import "fmt"
func (t BooleanType) String() string {
switch t {
case ON:
return "ON"
case OFF:
return "OFF"
default:
panic("BooleanType not defended")
}
}
func (t ErrorType) String() string {
switch t {
case NO_ERROR:
return "OK"
case ERROR:
return "ERROR"
default:
panic("ErrorType not defended")
}
}
func (t BoardReadyType) String() string {
switch t {
case BOARD_READY_OK:
return "OK"
case BOARD_READY_INFO:
return "INFO"
case BOARD_READY_WARNING:
return "WARNING"
case BOARD_READY_DEBUG:
return "DEBUG"
case BOARD_READY_DEP_ERROR:
return "DEP_ERROR"
case BOARD_READY_ERROR:
return "ERROR"
case BOARD_READY_CRITICAL:
return "CRITICAL"
default:
panic("BoardReadyType not defended")
}
}
func (t ContactorInternalOtherErrorType) String() string {
switch t {
case OTHER_NO_ERROR:
return "OK"
default:
return fmt.Sprintf("ERROR_CODE_%d", t)
}
}
func (t ContactorGroupChangedType) String() string {
switch t {
case NO_PENDING_CHANGES:
return "NO_PENDING"
case INITIALIZED_CHANGE:
return "INITIALIZED"
case CHANGE_IN_PROGRESS:
return "IN_PROGRESS"
default:
panic("ContactorGroupChangedType not defended")
}
}
func (t V2GModeType) String() string {
switch t {
case V2G_MODE_G2V:
return "G2V"
case V2G_MODE_V2G:
return "V2G"
case V2G_MODE_INV:
return "INV"
default:
panic("V2GModeType not defended")
}
}
func (t Voltage11BitType) String() string {
return fmt.Sprintf("%dV", t)
}
func (t Current10BitType) String() string {
return fmt.Sprintf("%dA", t)
}
func (t CpLineLevelType) String() string {
switch t {
case NOT_ENABLE:
return "NOT_ENABLE"
case TWELVE:
return "12V_NOT_CONNECTED"
case NINE:
return "9V_CONNECTED"
case SIX:
return "6V_CHARGING"
case THREE:
return "3V"
case MINUS_TWELVE:
return "-12V"
default:
panic("CpLineLevelType not defended")
}
}
func (t IsolationStateType) String() string {
switch t {
case UNKNOWN:
return "UNKNOWN"
case ONGOING:
return "ONGOING"
case PASSED:
return "PASSED"
case WARNING:
return "WARNING"
case FAILED:
return "FAILED"
default:
panic("IsolationStateType not defended")
}
}
func (t Voltage9BitType) String() string {
return fmt.Sprintf("%.1fV", t)
}