telemetry service and telemetry agents interface

This commit is contained in:
2026-03-05 16:26:30 +00:00
parent c9086cae56
commit e65358ea1d
16 changed files with 388 additions and 314 deletions
+18 -7
View File
@@ -1,6 +1,12 @@
package views
import "github.com/rivo/tview"
import (
"esdi/telemetry"
"fmt"
"strings"
"github.com/rivo/tview"
)
// Car data lengths
const (
@@ -10,10 +16,6 @@ const (
BrakeBiasLen = 6
)
const (
streamingBoxID = "streaming-box"
)
type StreamView struct {
TextView *tview.TextView
}
@@ -27,6 +29,15 @@ func NewStreamView() *StreamView {
}
}
func (sv *StreamView) Update(str string) {
sv.TextView.SetText(str)
func (sv *StreamView) Update(data telemetry.TelemetryData) {
sv.TextView.SetText(stringify(data))
}
func stringify(data telemetry.TelemetryData) string {
var buffer strings.Builder
buffer.WriteString(fmt.Sprintf("Gear: %d, RPM: %d, Speed: %d\n\n",
data.Values["Gear"], data.Values["RPM"], data.Values["Speed"]))
return buffer.String()
}