-
Notifications
You must be signed in to change notification settings - Fork 0
/
vehicle-convert-funcs.go
229 lines (190 loc) · 6.7 KB
/
vehicle-convert-funcs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
package vss
import (
"fmt"
"time"
)
// This file is automatically populated with conversion functions for each field of the model struct.
// any conversion functions already defined in this package will not be generated.
// Code generated by model-garage.
// ToChassisAxleRow1WheelLeftTirePressure0 converts data as float64 to float64.
func ToChassisAxleRow1WheelLeftTirePressure0(val float64) (float64, error) {
return val, nil
}
// ToChassisAxleRow1WheelRightTirePressure0 converts data as float64 to float64.
func ToChassisAxleRow1WheelRightTirePressure0(val float64) (float64, error) {
return val, nil
}
// ToChassisAxleRow2WheelLeftTirePressure0 converts data as float64 to float64.
func ToChassisAxleRow2WheelLeftTirePressure0(val float64) (float64, error) {
return val, nil
}
// ToChassisAxleRow2WheelRightTirePressure0 converts data as float64 to float64.
func ToChassisAxleRow2WheelRightTirePressure0(val float64) (float64, error) {
return val, nil
}
// ToCurrentLocationAltitude0 converts data as float64 to float64.
func ToCurrentLocationAltitude0(val float64) (float64, error) {
return val, nil
}
// ToCurrentLocationLatitude0 converts data as float64 to float64.
func ToCurrentLocationLatitude0(val float64) (float64, error) {
return val, nil
}
// ToCurrentLocationLongitude0 converts data as float64 to float64.
func ToCurrentLocationLongitude0(val float64) (float64, error) {
return val, nil
}
// ToCurrentLocationTimestamp0 converts data as string to []time.Time.
func ToCurrentLocationTimestamp0(val string) (float64, error) {
ts, err := time.Parse(time.RFC3339, val)
if err != nil {
return 0, fmt.Errorf("error parsing time: %w", err)
}
return float64(ts.UTC().Unix()), nil
}
// ToCurrentLocationTimestamp1 converts data as float64 to []time.Time.
func ToCurrentLocationTimestamp1(val float64) (float64, error) {
return val, nil
}
// ToExteriorAirTemperature0 converts data as float64 to float64.
func ToExteriorAirTemperature0(val float64) (float64, error) {
return val, nil
}
// ToLowVoltageBatteryCurrentVoltage0 converts data as float64 to float64.
func ToLowVoltageBatteryCurrentVoltage0(val float64) (float64, error) {
return val, nil
}
// ToOBDBarometricPressure0 converts data as float64 to float64.
func ToOBDBarometricPressure0(val float64) (float64, error) {
return val, nil
}
// ToOBDEngineLoad0 converts data as float64 to float64.
func ToOBDEngineLoad0(val float64) (float64, error) {
return val, nil
}
// ToOBDIntakeTemp0 converts data as float64 to float64.
func ToOBDIntakeTemp0(val float64) (float64, error) {
return val, nil
}
// ToOBDRunTime0 converts data as float64 to float64.
func ToOBDRunTime0(val float64) (float64, error) {
return val, nil
}
// ToPowertrainCombustionEngineECT0 converts data as float64 to float64.
func ToPowertrainCombustionEngineECT0(val float64) (float64, error) {
return val, nil
}
// ToPowertrainCombustionEngineEngineOilLevel0 converts data as float64 to any.
func ToPowertrainCombustionEngineEngineOilLevel0(oilLevel float64) (string, error) {
switch {
case oilLevel < 0.25:
return "CRITICALLY_LOW", nil
case oilLevel < 0.5:
return "LOW", nil
case oilLevel < 0.75:
return "NORMAL", nil
case oilLevel < .99:
return "HIGH", nil
default:
return "CRITICALLY_HIGH", nil
}
}
// ToPowertrainCombustionEngineSpeed0 converts data as float64 to float64.
func ToPowertrainCombustionEngineSpeed0(val float64) (float64, error) {
return val, nil
}
// ToPowertrainCombustionEngineTPS0 converts data as float64 to float64.
func ToPowertrainCombustionEngineTPS0(val float64) (float64, error) {
return val, nil
}
// ToPowertrainFuelSystemAbsoluteLevel0 converts data as float64 to float64.
func ToPowertrainFuelSystemAbsoluteLevel0(val float64) (float64, error) {
return val, nil
}
// ToPowertrainFuelSystemSupportedFuelTypes0 converts data as string to any.
func ToPowertrainFuelSystemSupportedFuelTypes0(val string) (string, error) {
switch val {
case "Gasoline":
return "GASOLINE", nil
case "Ethanol":
return "E85", nil
case "Diesel":
return "DIESEL", nil
case "LPG":
return "LPG", nil
default:
return "OTHER", nil
}
}
// ToPowertrainRange0 converts data as float64 to float64.
func ToPowertrainRange0(val float64) (float64, error) {
return val, nil
}
// ToPowertrainTractionBatteryChargingChargeLimit0 converts data as float64 to float64.
func ToPowertrainTractionBatteryChargingChargeLimit0(val float64) (float64, error) {
return val, nil
}
// ToPowertrainTractionBatteryChargingIsCharging0 converts data as bool to float64.
func ToPowertrainTractionBatteryChargingIsCharging0(val bool) (float64, error) {
if val {
return 1, nil
}
return 0, nil
}
// ToPowertrainTractionBatteryGrossCapacity0 converts data as float64 to float64.
func ToPowertrainTractionBatteryGrossCapacity0(val float64) (float64, error) {
return val, nil
}
// ToPowertrainTractionBatteryStateOfChargeCurrent0 converts data as float64 to float64.
func ToPowertrainTractionBatteryStateOfChargeCurrent0(val float64) (float64, error) {
return val, nil
}
// ToPowertrainTransmissionTravelledDistance0 converts data as float64 to float64.
func ToPowertrainTransmissionTravelledDistance0(val float64) (float64, error) {
return val, nil
}
// ToPowertrainType0 converts data as string to string.
func ToPowertrainType0(val string) (string, error) {
// possible arguments Gasoline, Ethanol, Diesel, Not available, Electric, LPG
// deault to combustion
if val == "Electric" {
return "ELECTRIC", nil
}
return "COMBUSTION", nil
}
// ToSpeed0 converts data as float64 to float64.
func ToSpeed0(val float64) (float64, error) {
return val, nil
}
// ToVehicleIdentificationBrand0 converts data as string to string.
func ToVehicleIdentificationBrand0(val string) (string, error) {
return val, nil
}
// ToVehicleIdentificationModel0 converts data as string to string.
func ToVehicleIdentificationModel0(val string) (string, error) {
return val, nil
}
// ToVehicleIdentificationYear0 converts data as float64 to float64.
func ToVehicleIdentificationYear0(val float64) (float64, error) {
return val, nil
}
// ToPowertrainCombustionEngineMAF0 converts data as float64 to float64.
func ToPowertrainCombustionEngineMAF0(val float64) (float64, error) {
return val, nil
}
// ToDIMOAftermarketHDOP0 converts data as float64 to float64.
func ToDIMOAftermarketHDOP0(val float64) (float64, error) {
return val, nil
}
// ToDIMOAftermarketNSAT0 converts data as float64 to float64.
func ToDIMOAftermarketNSAT0(val float64) (float64, error) {
return val, nil
}
// ToDIMOAftermarketSSID0 converts data as string to string.
func ToDIMOAftermarketSSID0(val string) (string, error) {
return val, nil
}
// ToDIMOAftermarketWPAState0 converts data as string to string.
func ToDIMOAftermarketWPAState0(val string) (string, error) {
return val, nil
}