@@ -29,6 +29,7 @@ import (
29
29
"strconv"
30
30
"strings"
31
31
32
+ "github.com/arduino/arduino-cli/table"
32
33
"github.com/arduino/arduino-cloud-cli/internal/lzss"
33
34
)
34
35
@@ -93,6 +94,32 @@ type OtaMetadata struct {
93
94
OtaSHA256 string // SHA256 of the whole file (header + payload).
94
95
}
95
96
97
+ func (r OtaMetadata ) Data () interface {} {
98
+ return r
99
+ }
100
+
101
+ func (r OtaMetadata ) String () string {
102
+ t := table .New ()
103
+
104
+ t .SetHeader ("Entry" , "Value" )
105
+
106
+ t .AddRow ([]interface {}{"Length" , fmt .Sprintf ("%d bytes" , r .Length )}... )
107
+ t .AddRow ([]interface {}{"CRC32" , fmt .Sprintf ("%d" , r .CRC32 )}... )
108
+ t .AddRow ([]interface {}{"Magic Number" , fmt .Sprintf ("0x%08X" , r .MagicNumber )}... )
109
+ t .AddRow ([]interface {}{"Board Type" , r .BoardType }... )
110
+ if r .FQBN != nil {
111
+ t .AddRow ([]interface {}{"FQBN" , * r .FQBN }... )
112
+ }
113
+ t .AddRow ([]interface {}{"VID" , r .VID }... )
114
+ t .AddRow ([]interface {}{"PID" , r .PID }... )
115
+ t .AddRow ([]interface {}{"Is Arduino Board" , strconv .FormatBool (r .IsArduinoBoard )}... )
116
+ t .AddRow ([]interface {}{"Compressed" , strconv .FormatBool (r .Compressed )}... )
117
+ t .AddRow ([]interface {}{"Payload SHA256" , r .PayloadSHA256 }... )
118
+ t .AddRow ([]interface {}{"OTA SHA256" , r .OtaSHA256 }... )
119
+
120
+ return t .Render ()
121
+ }
122
+
96
123
// Read header starting from the first byte of the file
97
124
func readHeader (file OtaFileReader ) ([]byte , error ) {
98
125
bytes := make ([]byte , HeaderSize )
0 commit comments