Vehicle
The Vehicle API provides access to vehicle profile and status.
Try it online
Use the buttons above to load data
Import
ts
import woo from 'mini-sdk'
// 或
import { vehicle } from 'mini-sdk'API reference
getCurrentVehicleProfile
Get profile information for the currently bound vehicle.
ts
const profile = await woo.getCurrentVehicleProfile()Return value VehicleProfile:
| Field | Type | Description |
|---|---|---|
vin | string | Vehicle identification number (VIN) |
brand | string | Brand |
model | string | Model |
year | number | Model year |
color | string | Color |
licensePlate | string | License plate number |
ts
const profile = await woo.getCurrentVehicleProfile()
console.log(`${profile.brand} ${profile.model} (${profile.year})`)getCurrentVehicleStatus
Get real-time status for the current vehicle.
ts
const status = await woo.getCurrentVehicleStatus()Return value VehicleStatus:
| Field | Type | Description |
|---|---|---|
mileage | number | Total mileage (km) |
fuelLevel | number | Fuel level (percent) |
batteryLevel | number | Battery state of charge (percent) |
isLocked | boolean | Whether the vehicle is locked |
location | { lat: number, lng: number } | Vehicle position |
ts
const status = await woo.getCurrentVehicleStatus()
if (status.fuelLevel < 20) {
woo.showToast({ title: '油量不足,请及时加油', icon: 'none' })
}Quick reference
| Method | Description | Signature |
|---|---|---|
getVehicleInfo | Get basic vehicle information | () → Promise<VehicleInfo> |
getVehicleStatus | Get real-time vehicle status | () → Promise<VehicleStatus> |
onVehicleStatusChange | Listen for vehicle status changes | (callback) → void |