feat: expand vehicle data platform capabilities

This commit is contained in:
lingniu
2026-07-27 16:46:15 +08:00
parent e3a1f80f86
commit 3c4bece72c
650 changed files with 62155 additions and 2552 deletions

View File

@@ -0,0 +1,34 @@
// Package vehicleprotocol owns the canonical protocol identifiers shared by
// the vehicle data platform, statistics services and the open platform API.
package vehicleprotocol
import "strings"
const (
GB32960 = "GB32960"
YutongMQTT = "YUTONG_MQTT"
JT808 = "JT808"
)
// All returns a copy so callers cannot mutate the platform-wide catalog.
func All() []string {
return []string{GB32960, JT808, YutongMQTT}
}
// MileagePriority is the source-selection order for total mileage.
func MileagePriority() []string {
return []string{GB32960, YutongMQTT, JT808}
}
// Canonical accepts only the identifiers persisted by ingestion and
// statistics. Public aliases are deliberately rejected to avoid a second
// protocol vocabulary at the API boundary.
func Canonical(value string) (string, bool) {
value = strings.TrimSpace(value)
switch value {
case GB32960, YutongMQTT, JT808:
return value, true
default:
return "", false
}
}