You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/projects/WebMVC/wwwroot/js/iot.js

109 lines
3.7 KiB

var time = '1d';
if (window.WXInlinePlayer && WXInlinePlayer.isSupport()) {
WXInlinePlayer.init({
asmUrl: '/lib/WXInlinePlayer/prod.all.asm.combine.js',
wasmUrl: '/lib/WXInlinePlayer/prod.all.wasm.combine.js'
});
}
function getDeviceDataValue(device, name) {
var data = Enumerable.from(device.data).where(o => o.name === name).firstOrDefault();
if (data) {
return data['value'];
}
return null;
}
function getDeviceDataDescription(device, name) {
var data = Enumerable.from(device.data).where(o => o.name === name).firstOrDefault();
if (data) {
return data['description'];
}
return null;
}
function getDeviceDataUnit(device, name) {
var data = Enumerable.from(device.data).where(o => o.name === name).firstOrDefault();
if (data) {
return data['unit'];
}
return null;
}
function getDeviceData(device, name) {
var data = Enumerable.from(device.data).where(o => o.name === name).firstOrDefault();
if (data) {
return data['value'] + ' ' + data['unit'];
}
return null;
}
function getData(device, name) {
return Enumerable.from(device.data).where(o => o.name === name).firstOrDefault();
}
//devices
Vue.component('iot-gateway', function (resolve, reject) {
axios.get("/components/device/gateway.html").then(function (response) {
resolve(parseModel(response));
});
});
Vue.component('iot-light', function (resolve, reject) {
axios.get("/components/device/light.html").then(function (response) {
resolve(parseModel(response));
});
});
Vue.component('iot-humiture', function (resolve, reject) {
axios.get("/components/device/humiture.html").then(function (response) {
resolve(parseModel(response));
});
});
Vue.component('iot-smoke', function (resolve, reject) {
axios.get("/components/device/smoke.html").then(function (response) {
resolve(parseModel(response));
});
});
Vue.component('iot-person', function (resolve, reject) {
axios.get("/components/device/person.html").then(function (response) {
resolve(parseModel(response));
});
});
Vue.component('iot-curtain', function (resolve, reject) {
axios.get("/components/device/curtain.html").then(function (response) {
resolve(parseModel(response));
});
});
Vue.component('iot-switch', function (resolve, reject) {
axios.get("/components/device/switch.html").then(function (response) {
resolve(parseModel(response));
});
});
Vue.component('iot-switch3', function (resolve, reject) {
axios.get("/components/device/switch3.html").then(function (response) {
resolve(parseModel(response));
});
});
Vue.component('iot-socket', function (resolve, reject) {
axios.get("/components/device/socket.html").then(function (response) {
resolve(parseModel(response));
});
});
Vue.component('iot-ir', function (resolve, reject) {
axios.get("/components/device/ir.html").then(function (response) {
resolve(parseModel(response));
});
});
Vue.component('iot-color-light', function (resolve, reject) {
axios.get("/components/device/color-light.html").then(function (response) {
resolve(parseModel(response));
});
});
Vue.component('iot-door', function (resolve, reject) {
axios.get("/components/device/door.html").then(function (response) {
resolve(parseModel(response));
});
});
Vue.component('iot-camera', function (resolve, reject) {
axios.get("/components/device/camera.html").then(function (response) {
resolve(parseModel(response));
});
});
Vue.component('iot-serial-port', function (resolve, reject) {
axios.get("/components/device/serial-port.html").then(function (response) {
resolve(parseModel(response));
});
});