@@ -45,32 +45,41 @@ type (
45
45
StateData string `json:"state_data,omitempty"`
46
46
Timestamp string `json:"timestamp,omitempty"`
47
47
}
48
+
49
+ OtaStatusPrint struct {
50
+ Ota Ota `json:"ota"`
51
+ Details []State `json:"details,omitempty"`
52
+ }
48
53
)
49
54
50
55
func (o Ota ) GetWideCSVHeader () string {
51
- return "id ,device_id,status,started_at,ended_at,error_reason"
56
+ return "ota_id ,device_id,status,started_at,ended_at,error_reason"
52
57
}
53
58
54
59
func (o Ota ) ToWideCSV () string {
55
60
return fmt .Sprintf ("%s,%s,%s,%s,%s,%s" , o .ID , o .DeviceID , o .Status , o .StartedAt , o .EndedAt , o .ErrorReason )
56
61
}
57
62
58
63
func (o Ota ) GetCSVHeader () string {
59
- return "id ,status,started_at,ended_at"
64
+ return "ota_id ,status,started_at,ended_at"
60
65
}
61
66
62
67
func (o Ota ) ToCSV () string {
63
68
return fmt .Sprintf ("%s,%s,%s,%s" , o .ID , o .Status , o .StartedAt , o .EndedAt )
64
69
}
65
70
66
71
func (o Ota ) ToText () string {
67
- out := fmt .Sprintf ("ID : %s\n Status : %s\n StartedAt : %s\n EndedAt : %s" , o .ID , o .Status , o .StartedAt , o .EndedAt )
72
+ out := fmt .Sprintf ("ota_id : %s\n status : %s\n started_at : %s\n ended_at : %s" , o .ID , o .Status , o .StartedAt , o .EndedAt )
68
73
if o .ErrorReason != "" {
69
- out += fmt .Sprintf ("\n ErrorReason : %s" , o .ErrorReason )
74
+ out += fmt .Sprintf ("\n error_reason : %s" , o .ErrorReason )
70
75
}
71
76
return out
72
77
}
73
78
74
79
func (s State ) ToText () string {
75
- return fmt .Sprintf ("Timestamp: %s, State: %s" , s .Timestamp , s .State )
80
+ rep := fmt .Sprintf ("time: %s, status: %s" , s .Timestamp , s .State )
81
+ if s .StateData != "" {
82
+ rep += fmt .Sprintf (", detail: %s" , s .StateData )
83
+ }
84
+ return rep
76
85
}
0 commit comments