|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const alarmDemo = { |
|
|
const alarmDemo = { |
|
|
title: ' Alarm System demo', // Thêm mới warning |
|
|
|
|
|
|
|
|
title: ' Demo Alarm System', // Thêm mới warning |
|
|
detail: { |
|
|
detail: { |
|
|
position: 'Vinhomes Quận 9', |
|
|
position: 'Vinhomes Quận 9', |
|
|
coordinates: { |
|
|
coordinates: { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
onMessage(message: any) { |
|
|
onMessage(message: any) { |
|
|
if (message.id === '0' && message.type === 'get') { |
|
|
|
|
|
|
|
|
if (message.id == '0' && message.type === 'get') { |
|
|
this.state1 = message.state1 === '0';// 1 OFF // alarm 12h |
|
|
this.state1 = message.state1 === '0';// 1 OFF // alarm 12h |
|
|
this.state2 = message.state2 === '0'; // 1 OFF // alarm 1h |
|
|
this.state2 = message.state2 === '0'; // 1 OFF // alarm 1h |
|
|
this.state5 = message.state5 === '1';// alarm 9h && 6h // 1 ON, 0 OFF |
|
|
|
|
|
|
|
|
this.state5 = message.state5 === '1';// 1 ON, 0 OFF |
|
|
this.isReady = message.ready === '1'; |
|
|
this.isReady = message.ready === '1'; |
|
|
this.updateIcons(); |
|
|
this.updateIcons(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.bindPopup(this.popupDetail(item)) |
|
|
.bindPopup(this.popupDetail(item)) |
|
|
.addTo(this.markers); |
|
|
.addTo(this.markers); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const iconDemo = this.getIcon(this.state5, this.isReady, this.state1, this.state2); |
|
|
const iconDemo = this.getIcon(this.state5, this.isReady, this.state1, this.state2); |
|
|
L.marker([this.alarmDemo.detail.coordinates.lat,this.alarmDemo.detail.coordinates.lng], { icon: iconDemo }) |
|
|
L.marker([this.alarmDemo.detail.coordinates.lat,this.alarmDemo.detail.coordinates.lng], { icon: iconDemo }) |
|
|
.bindPopup(this.popupDetail(this.alarmDemo)) |
|
|
.bindPopup(this.popupDetail(this.alarmDemo)) |