車両情報 Vehicle
Vehicle API は、車両のプロフィールとステータスを照会する機能を提供します。
オンラインで試す
上のボタンを押してデータを読み込みます
インポート
ts
import woo from 'mini-sdk'
// 或
import { vehicle } from 'mini-sdk'API リファレンス
getCurrentVehicleProfile
現在バインドされている車両のプロフィールを取得します。
ts
const profile = await woo.getCurrentVehicleProfile()戻り値 VehicleProfile:
| フィールド | 型 | 説明 |
|---|---|---|
vin | string | 車両識別番号(VIN) |
brand | string | ブランド |
model | string | 型式 |
year | number | 年式 |
color | string | 色 |
licensePlate | string | ナンバープレート |
ts
const profile = await woo.getCurrentVehicleProfile()
console.log(`${profile.brand} ${profile.model} (${profile.year})`)getCurrentVehicleStatus
現在の車両のリアルタイムのステータスを取得します。
ts
const status = await woo.getCurrentVehicleStatus()戻り値 VehicleStatus:
| フィールド | 型 | 説明 |
|---|---|---|
mileage | number | 総走行距離(km) |
fuelLevel | number | 燃料残量(パーセント) |
batteryLevel | number | バッテリー残量(パーセント) |
isLocked | boolean | 施錠されているか |
location | { lat: number, lng: number } | 車両の位置 |
ts
const status = await woo.getCurrentVehicleStatus()
if (status.fuelLevel < 20) {
woo.showToast({ title: '油量不足,请及时加油', icon: 'none' })
}早見表
| メソッド | 説明 | シグネチャ |
|---|---|---|
getVehicleInfo | 車両の基本情報を取得する | () → Promise<VehicleInfo> |
getVehicleStatus | 車両のリアルタイムのステータスを取得する | () → Promise<VehicleStatus> |
onVehicleStatusChange | 車両ステータスの変化を監視する | (callback) → void |