Skip to content

車両情報 Vehicle

Vehicle API は、車両のプロフィールとステータスを照会する機能を提供します。

オンラインで試す

getCurrentVehicleProfilegetCurrentVehicleStatus両方取得

上のボタンを押してデータを読み込みます

Vehicle API デモ

現在紐づいている車両のプロフィールとリアルタイムのステータスを取得し、キーと値の形式で表示します(モックデータ)

インポート

ts
import woo from 'mini-sdk'
// 或
import { vehicle } from 'mini-sdk'

API リファレンス

getCurrentVehicleProfile

現在バインドされている車両のプロフィールを取得します。

ts
const profile = await woo.getCurrentVehicleProfile()

戻り値 VehicleProfile

フィールド説明
vinstring車両識別番号(VIN)
brandstringブランド
modelstring型式
yearnumber年式
colorstring
licensePlatestringナンバープレート
ts
const profile = await woo.getCurrentVehicleProfile()
console.log(`${profile.brand} ${profile.model} (${profile.year})`)

getCurrentVehicleStatus

現在の車両のリアルタイムのステータスを取得します。

ts
const status = await woo.getCurrentVehicleStatus()

戻り値 VehicleStatus

フィールド説明
mileagenumber総走行距離(km)
fuelLevelnumber燃料残量(パーセント)
batteryLevelnumberバッテリー残量(パーセント)
isLockedboolean施錠されているか
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

MiniDev Studio — ミニアプリ開発ツールキット