Skip to content

Commit

Permalink
add new types to vehicle_data proto
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickdemers6 committed Sep 6, 2024
1 parent b0116cb commit db650dd
Show file tree
Hide file tree
Showing 16 changed files with 2,989 additions and 541 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:

- name: Set up protoc
run: |
wget https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protoc-25.1-linux-x86_64.zip
unzip protoc-25.1-linux-x86_64.zip
wget https://github.com/protocolbuffers/protobuf/releases/download/v26.1/protoc-26.1-linux-x86_64.zip
unzip protoc-26.1-linux-x86_64.zip
sudo mv bin/protoc /usr/local/bin/protoc
sudo mv include/* /usr/local/include/
Expand Down
77 changes: 74 additions & 3 deletions datastore/simple/transformers/payload.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package transformers

import (
"fmt"
"time"

logrus "github.com/teslamotors/fleet-telemetry/logger"
Expand Down Expand Up @@ -68,9 +69,79 @@ func transformValue(value interface{}, includeTypes bool) (interface{}, bool) {
case *protos.Value_ShiftStateValue:
outputType = "shiftStateValue"
outputValue = v.ShiftStateValue.String()
case *protos.Value_ChargingValue:
outputType = "chargingValue"
outputValue = v.ChargingValue.String()
case *protos.Value_LaneAssistLevelValue:
outputType = "laneAssistLevel"
outputValue = v.LaneAssistLevelValue.String()
case *protos.Value_ScheduledChargingModeValue:
outputType = "scheduledChargingMode"
outputValue = v.ScheduledChargingModeValue.String()
case *protos.Value_SentryModeStateValue:
outputType = "sentryModeState"
outputValue = v.SentryModeStateValue.String()
case *protos.Value_SpeedAssistLevelValue:
outputType = "speedAssistLevel"
outputValue = v.SpeedAssistLevelValue.String()
case *protos.Value_BmsStateValue:
outputType = "bmsState"
outputValue = v.BmsStateValue.String()
case *protos.Value_BuckleStatusValue:
outputType = "buckleStatus"
outputValue = v.BuckleStatusValue.String()
case *protos.Value_CarTypeValue:
outputType = "carType"
outputValue = v.CarTypeValue.String()
case *protos.Value_ChargePortValue:
outputType = "chargePort"
outputValue = v.ChargePortValue.String()
case *protos.Value_ChargePortLatchValue:
outputType = "chargePortLatch"
outputValue = v.ChargePortLatchValue.String()
case *protos.Value_CruiseStateValue:
outputType = "cruiseState"
outputValue = v.CruiseStateValue.String()
case *protos.Value_DoorValue:
outputType = "doorValue"
outputValue = map[string]bool{
"DriverFront": v.DoorValue.DriverFront,
"PassengerFront": v.DoorValue.PassengerFront,
"DriverRear": v.DoorValue.DriverRear,
"PassengerRear": v.DoorValue.PassengerRear,
"TrunkFront": v.DoorValue.TrunkFront,
"TrunkRear": v.DoorValue.TrunkRear,
}
case *protos.Value_DriveInverterStateValue:
outputType = "driveInverterState"
outputValue = v.DriveInverterStateValue.String()
case *protos.Value_HvilStatusValue:
outputType = "hvilStatus"
outputValue = v.HvilStatusValue.String()
case *protos.Value_WindowStateValue:
outputType = "windowState"
outputValue = v.WindowStateValue.String()
case *protos.Value_SeatFoldPositionValue:
outputType = "seatFoldPosition"
outputValue = v.SeatFoldPositionValue.String()
case *protos.Value_TractorAirStatusValue:
outputType = "tractorAirStatus"
outputValue = v.TractorAirStatusValue.String()
case *protos.Value_FollowDistanceValue:
outputType = "followDistance"
outputValue = v.FollowDistanceValue.String()
case *protos.Value_ForwardCollisionSensitivityValue:
outputType = "forwardCollisionSensitivity"
outputValue = v.ForwardCollisionSensitivityValue.String()
case *protos.Value_GuestModeMobileAccessValue:
outputType = "guestModeMobileAccess"
outputValue = v.GuestModeMobileAccessValue.String()
case *protos.Value_TrailerAirStatusValue:
outputType = "trailerAirStatus"
outputValue = v.TrailerAirStatusValue.String()
case *protos.Value_TimeValue:
outputType = "time"
outputValue = fmt.Sprintf("%02d:%02d:%02d", v.TimeValue.Hour, v.TimeValue.Minute, v.TimeValue.Second)
case *protos.Value_DetailedChargeStateValue:
outputType = "detailedChargeState"
outputValue = v.DetailedChargeStateValue.String()
default:
return nil, false
}
Expand Down
9 changes: 0 additions & 9 deletions datastore/simple/transformers/payload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,6 @@ var _ = Describe("Payload", func() {
"shiftStateValue": "ShiftStateD",
},
),
Entry("ChargeState with types excluded",
&protos.Datum{
Key: protos.Field_ChargeState,
Value: &protos.Value{Value: &protos.Value_ChargingValue{ChargingValue: protos.ChargingState_ChargeStateCharging}},
},
excludeTypes,
"ChargeState",
"ChargeStateCharging",
),
Entry("Invalid with types excluded",
&protos.Datum{
Key: protos.Field_BMSState,
Expand Down
6 changes: 3 additions & 3 deletions protos/python/vehicle_alert_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 60 additions & 16 deletions protos/python/vehicle_data_pb2.py

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions protos/python/vehicle_error_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions protos/python/vehicle_metric_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 1 addition & 23 deletions protos/ruby/vehicle_alert_pb.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 24 additions & 24 deletions protos/ruby/vehicle_data_pb.rb

Large diffs are not rendered by default.

24 changes: 1 addition & 23 deletions protos/ruby/vehicle_error_pb.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 1 addition & 23 deletions protos/ruby/vehicle_metric_pb.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion protos/vehicle_alert.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit db650dd

Please sign in to comment.