feat: cache protocol realtime raw

This commit is contained in:
lingniu
2026-07-02 11:19:46 +08:00
parent e7d024405a
commit 3a67f6e05f
8 changed files with 304 additions and 27 deletions

View File

@@ -6,15 +6,15 @@ import (
)
func TestFrameEnvelopeVehicleKeyPrefersVIN(t *testing.T) {
e := FrameEnvelope{Protocol: ProtocolJT808, VIN: "LNBVIN00000000001", Phone: "013307795425"}
e := FrameEnvelope{Protocol: ProtocolJT808, VIN: "LNBVIN00000000001", Phone: "13307795425"}
if got := e.VehicleKey(); got != "LNBVIN00000000001" {
t.Fatalf("VehicleKey() = %q", got)
}
}
func TestFrameEnvelopeVehicleKeyFallsBackToPhone(t *testing.T) {
e := FrameEnvelope{Protocol: ProtocolJT808, Phone: "013307795425"}
if got := e.VehicleKey(); got != "JT808:013307795425" {
e := FrameEnvelope{Protocol: ProtocolJT808, Phone: "13307795425"}
if got := e.VehicleKey(); got != "JT808:13307795425" {
t.Fatalf("VehicleKey() = %q", got)
}
}