Skip to content

Commit 6dc8841

Browse files
committed
Beep capability added to Alarms Viewer (tabular.html).
1 parent 87ba7dc commit 6dc8841

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

src/htdocs/tabular.html

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
var NUM_VAR_ANT = 0; // estado anterior da variável NUM_VAR
6464
var GROUP1_LIST = []; // list of possible group1 values
6565
var ALARMBEEP = 0; // alarm beep status
66+
var ALARMBEEP_TYPE = 0; // alarm beep type
6667
var BEEP_POINTKEY = -1;
6768
var CNTUPDATES_POINTKEY = -2;
6869

@@ -1610,7 +1611,7 @@
16101611

16111612
prop = element._Properties;
16121613
var pointKey = prop._id;
1613-
1614+
16141615
var dateAlarm = "";
16151616
if (prop.alarmed && prop.timeTagAlarm!==null)
16161617
if ((new Date(prop.timeTagAlarm)).getFullYear()>1980){
@@ -1838,6 +1839,9 @@
18381839
prop = element._Properties;
18391840
var pointKey = prop._id;
18401841

1842+
if ( pointKey === BEEP_POINTKEY && "beepType" in prop )
1843+
ALARMBEEP_TYPE = prop.beepType;
1844+
18411845
if (element.Value.Type === OpcValueTypes.Boolean) {
18421846
V[pointKey] = element.Value.Body?0:1;
18431847
F[pointKey] = (element.Value.Body ? 0x02 : 0x01);
@@ -2990,6 +2994,30 @@
29902994

29912995
// desabilita o botão direito
29922996
document.oncontextmenu = function() { return false; };
2997+
2998+
// alarm beep sound
2999+
if (WebSAGE.isAlarmsViewer())
3000+
document.getElementById('btSound').style.display='';
3001+
document.getElementById('btSound').addEventListener("click", function () {
3002+
if (document.getElementById('btSound').value === '🔊'){
3003+
document.getElementById('btSound').value = '🔈';
3004+
clearInterval(window.sndIntervalHandle);
3005+
} else {
3006+
document.getElementById('nonCriticalSound').play();
3007+
document.getElementById('btSound').value = '🔊';
3008+
window.sndIntervalHandle = setInterval( function(){
3009+
if (window.WebSAGE.getValue(BEEP_POINTKEY))
3010+
switch (ALARMBEEP_TYPE) {
3011+
default:
3012+
document.getElementById('nonCriticalSound').play();
3013+
break;
3014+
case 2:
3015+
document.getElementById('criticalSound').play();
3016+
break;
3017+
}
3018+
}, 1000);
3019+
}
3020+
});
29933021
}
29943022
};
29953023
Core.start(WebSAGE);
@@ -3007,6 +3035,9 @@
30073035
<img id="imgFontSizeDown" alt='' src='' align='middle' width="27" height="27" onclick='WebSAGE.fontSize(0)' style='cursor:pointer;' />
30083036
<img id='imgReconheceTudo' alt='' src='' align='middle' width="32" height="32" onclick='WebSAGE.ackAllAlarms(0);' style='cursor:pointer;display:none' />
30093037
<img id='imgClipboard' alt='' src='' onclick='CopyClipboard("TBLEVE")' align='middle' border='0' width='32' height='32' style='cursor:pointer;' />
3038+
<input id="btSound" title="Beep ON/OFF" style="display:none;cursor:pointer;vertical-align:middle;background:none;border:0px;font-size:20px;transform: translateY(3px);" type="button" value="🔈" />&nbsp;
3039+
<audio id="criticalSound"><source src="sounds/critical.wav" muted type="audio/wav"></audio>
3040+
<audio id="nonCriticalSound"><source src="sounds/nonCritical.wav" muted type="audio/wav"></audio>
30103041
<img id='SILENCIA_ID' alt='' src='' align='middle' width="32" height="32" onclick='document.getElementById("SILENCIA_ID").style.display="none";WebSAGE.doSilenceBeep();' style='display:none; cursor:pointer;' />
30113042
&nbsp;&nbsp;&nbsp;&nbsp;
30123043
<div id='OPC_CMDANORM' style='display:none' >

0 commit comments

Comments
 (0)