Add vehicle position api (#2021)
This commit is contained in:
parent
a0e07e83a9
commit
981b23dd56
2 changed files with 13 additions and 0 deletions
|
|
@ -164,6 +164,11 @@ type VehicleOdometer interface {
|
|||
Odometer() (float64, error)
|
||||
}
|
||||
|
||||
// VehiclePosition returns the vehicles position in latitude and longitude
|
||||
type VehiclePosition interface {
|
||||
Position() (float64, float64, error)
|
||||
}
|
||||
|
||||
// VehicleStartCharge starts the charging session on the vehicle side
|
||||
type VehicleStartCharge interface {
|
||||
StartCharge() error
|
||||
|
|
|
|||
|
|
@ -162,6 +162,14 @@ func (d *dumper) Dump(name string, v interface{}) {
|
|||
}
|
||||
}
|
||||
|
||||
if v, ok := v.(api.VehiclePosition); ok {
|
||||
if lat, lon, err := v.Position(); err != nil {
|
||||
fmt.Fprintf(w, "Position:\t%v\n", err)
|
||||
} else {
|
||||
fmt.Fprintf(w, "Position:\t%v,%v\n", lat, lon)
|
||||
}
|
||||
}
|
||||
|
||||
if v, ok := v.(api.Vehicle); ok {
|
||||
fmt.Fprintf(w, "Capacity:\t%dkWh\n", v.Capacity())
|
||||
if len(v.Identifiers()) > 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue