page({
data: {
buttons: [
{ method: 'getdeviceid', label: '获取红外测温仪设备id' },
{ method: 'setemittance', label: '设置辐射率' },
{ method: 'setmodel', label: '设置温度模型' },
{ method: 'setautocalibration', label: '设置自动校准' },
],
switch: false,
monitor: false,
src: '',
temperature: ''
},
onload() {
this.setdata({
message: '红外测温仪测试'
});
},
//切换开始/停止监听红外测温仪
togglemonitorir() {
if (this.data.monitor) {
//停止监听红外测温仪
my.ix.offmonitorir({
complete: (r) => {
this.setdata({
message: "已停止监听红外测温仪"
})
},
});
} else {
//开始监听红外测温仪
my.ix.onmonitorir((r) => {
if (r.temperature != null) {
var temp = r.temperature.tostring();
temp = temp.substring(0, temp.indexof('.') 2);