|
|
|
|
|
|
|
|
private statusSubscription?: Subscription; |
|
|
private statusSubscription?: Subscription; |
|
|
private messageSubscription?: Subscription; |
|
|
private messageSubscription?: Subscription; |
|
|
private intervalId: any; |
|
|
private intervalId: any; |
|
|
|
|
|
|
|
|
|
|
|
isShowingToastr: boolean = false; |
|
|
|
|
|
|
|
|
constructor( |
|
|
constructor( |
|
|
private socketService$: SocketService, |
|
|
private socketService$: SocketService, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.Sstate1 = this.state1 === 'ON';// alarm 12h |
|
|
this.Sstate1 = this.state1 === 'ON';// alarm 12h |
|
|
this.Sstate2 = this.state2 === 'ON';// alarm 1h |
|
|
this.Sstate2 = this.state2 === 'ON';// alarm 1h |
|
|
if (message.ready === '0'){ |
|
|
|
|
|
this.toastr.warning('System not ready', 'Warning', {timeOut: 5000}); |
|
|
|
|
|
|
|
|
this.handleMessage(message); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
handleMessage(message: any) { |
|
|
|
|
|
if (message.ready === '0' && !this.isShowingToastr) { |
|
|
|
|
|
this.showToastr(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
showToastr() { |
|
|
|
|
|
this.toastr.warning('System not ready', 'Warning', { timeOut: 5000 }); |
|
|
|
|
|
this.isShowingToastr = true; |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
this.isShowingToastr = false; |
|
|
|
|
|
}, 5000); |
|
|
|
|
|
} |
|
|
} |
|
|
} |