scinpower-vehicle-subscribe
v1.0.1
Published
Subscribe to the data content reported by the vehicle from Zhixiang Cloud
Downloads
2
Readme
Install
npm install scinpower-vehicle-subscribe
TypeScript
import * as v from "scinpower-vehicle-subscribe";
const key = "key"
const secret = "secret"
const topics = ["parse.report.key","parse.warn.key","rsp.status.key","parse.gps.key"]
const client = new b.VehicleClient(key, secret)
client.subscribe(topics,1, async (message: v.Message, data: any) => {
if (data === undefined) {
throw new Error("Unknown data type")
}
if (data instanceof v.FactoryData) {}
if (data instanceof v.PerformanceData) {}
if (data instanceof v.VersionData) {}
if (data instanceof v.ConnectData) {}
if (data instanceof v.ConfigData) {}
if (data instanceof v.StatusData) {}
if (data instanceof v.VehicleData) {}
if (data instanceof v.CyclingData) {}
if (data instanceof v.LightData) {}
if (data instanceof v.CyclingStatus) {}
if (data instanceof v.DynamicData) {}
if (data instanceof v.BatteryData) {}
if (data instanceof v.VeBindBtInfo) {}
if (data instanceof v.CenterControlFault) {}
if (data instanceof v.MotorFault) {}
if (data instanceof v.GpsSimpleCommon) {}
if (data instanceof v.GpsComplexCommon) {}
if (data instanceof v.GsmCommon) {}
}).then()
NodeJs
const v = require("scinpower-vehicle-subscribe")
const key = "key"
const secret = "secret"
const topics = ["parse.report.key","parse.warn.key","rsp.status.key","parse.gps.key"]
const client = new v.VehicleClient(key, secret)
client.subscribe(topics,1, async (message, data) => {
if (data === undefined) {
throw new Error("Unknown data type")
}
if (data instanceof v.FactoryData) {}
if (data instanceof v.PerformanceData) {}
if (data instanceof v.VersionData) {}
if (data instanceof v.ConnectData) {}
if (data instanceof v.ConfigData) {}
if (data instanceof v.StatusData) {}
if (data instanceof v.VehicleData) {}
if (data instanceof v.CyclingData) {}
if (data instanceof v.LightData) {}
if (data instanceof v.CyclingStatus) {}
if (data instanceof v.DynamicData) {}
if (data instanceof v.BatteryData) {}
if (data instanceof v.VeBindBtInfo) {}
if (data instanceof v.CenterControlFault) {}
if (data instanceof v.MotorFault) {}
if (data instanceof v.GpsSimpleCommon) {}
if (data instanceof v.GpsComplexCommon) {}
if (data instanceof v.GsmCommon) {}
}).then()