scinpower-cabinet-subscribe
v1.0.1
Published
Subscribe to the data content reported by the cabinet from Zhixiang Cloud
Downloads
5
Readme
Install
npm install scinpower-cabinet-subscribe
TypeScript
import * as c from "scinpower-cabinet-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.CabinetClient(key, secret)
client.subscribe(topics,1, async (message: c.Message, data: any) => {
if (data === undefined) {
throw new Error("Unknown data type")
}
if (data instanceof c.StructureData) {}
if (data instanceof c.CaFactoryData) {}
if (data instanceof c.CaVersionData) {}
if (data instanceof c.BaseConfigData) {}
if (data instanceof c.WarnConfigData) {}
if (data instanceof c.FrequencyConfigData) {}
if (data instanceof c.BusinessConfigData) {}
if (data instanceof c.StatusData) {}
if (data instanceof c.DeviceData) {}
if (data instanceof c.CabinetData) {}
if (data instanceof c.BoxData) {}
if (data instanceof c.CaBatteryData) {}
if (data instanceof c.ChargerData) {}
if (data instanceof c.CabinetInitData) {}
if (data instanceof c.StepData) {}
if (data instanceof c.TakeBatteryData) {}
if (data instanceof c.SwapBatteryData) {}
if (data instanceof c.StatisticsData) {}
if (data instanceof c.InductionSwapData) {}
if (data instanceof c.BoxInitData) {}
if (data instanceof c.GpsSimpleCommon) {}
if (data instanceof c.GpsComplexCommon) {}
if (data instanceof c.GsmCommon) {}
if (data instanceof c.DeviceWarn) {}
if (data instanceof c.CabinetWarnData) {}
if (data instanceof c.BoxWarnData) {}
if (data instanceof c.ChargerWarnData) {}
if (data instanceof c.NewCabinetWarnData) {}
}).then()
NodeJs
const c = require("scinpower-cabinet-subscribe")
const key = "key"
const secret = "secret"
const topics = ["parse.report.key","parse.warn.key","rsp.status.key","parse.gps.key"]
const client = new c.CabinetClient(key, secret)
client.subscribe(topics,1, async (message, data) => {
if (data === undefined) {
throw new Error("Unknown data type")
}
if (data instanceof c.StructureData) {}
if (data instanceof c.CaFactoryData) {}
if (data instanceof c.CaVersionData) {}
if (data instanceof c.BaseConfigData) {}
if (data instanceof c.WarnConfigData) {}
if (data instanceof c.FrequencyConfigData) {}
if (data instanceof c.BusinessConfigData) {}
if (data instanceof c.StatusData) {}
if (data instanceof c.DeviceData) {}
if (data instanceof c.CabinetData) {}
if (data instanceof c.BoxData) {}
if (data instanceof c.CaBatteryData) {}
if (data instanceof c.ChargerData) {}
if (data instanceof c.CabinetInitData) {}
if (data instanceof c.StepData) {}
if (data instanceof c.TakeBatteryData) {}
if (data instanceof c.SwapBatteryData) {}
if (data instanceof c.StatisticsData) {}
if (data instanceof c.InductionSwapData) {}
if (data instanceof c.BoxInitData) {}
if (data instanceof c.GpsSimpleCommon) {}
if (data instanceof c.GpsComplexCommon) {}
if (data instanceof c.GsmCommon) {}
if (data instanceof c.DeviceWarn) {}
if (data instanceof c.CabinetWarnData) {}
if (data instanceof c.BoxWarnData) {}
if (data instanceof c.ChargerWarnData) {}
if (data instanceof c.NewCabinetWarnData) {}
}).then()