<!DOCTYPE html>
<% language=javascript %>
<html>
<head lang="en">
    <meta charset="GB2312">
    <title></title>
    <link href="css/style.css" title="style" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.6.3.min.js"></script>
    <script src="js/omara.js"></script>

</head>
<body style="background: #F3F3F3">
<div class='empty' style=' margin: 10px;'>
  <table width="100%">
    <tr>
    <td width="300px" style="text-align: center;"><img src="img/ico-cyber.png" style="width: 60%;text-align: center;"></td>
    <td>
    <table width='100%'>
        <tr><td style='border: none'> <h1>空调监测</h1></td></tr>
        <tr><td style='width: 200px;'>基本信息</td><td>SID:<span class='SID2092'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr2092'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port2092'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd2092'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State2092'> </span></td></tr>
    </table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>基本信息</h1></td></tr>
		<tr><td width='25%'>室外温度:<span class='TemOut2092'></span></td>
		    <td width='25%'>室内温度:<span class='TemIn2092'></span></td>
			<td width='25%'>室外湿度:<span class='HumOut2092'></span></td>
		    <td width='25%'>室内湿度:<span class='HumIn2092'></span></td></tr>
	</table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>状态信息</h1></td></tr>
		<tr><td width='25%'>空调状态:<span class='StRun2092'></span></td>
		    <td width='25%'>门禁:<span class='StDoor2092'></span></td>
			<td width='25%'>烟雾报警:<span class='StFire2092'></span></td>
		    <td width='25%'>室外风机:<span class='StFanOut2092'></span></td></tr>
		<tr><td width='25%'>室内风机:<span class='StFanIn2092'></span></td>
		    <td width='25%'><span class='2092'></span></td>
			<td width='25%'><span class='2092'></span></td>
		    <td width='25%'><span class='2092'></span></td></tr>
	</table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>告警信息</h1></td></tr>
		<tr><td width='25%'>室内温度:<span class='AlmTemIn2092'></span></td>
		    <td width='25%'>室内湿度:<span class='AlmHumIn2092'></span></td>
			<td width='25%'>风机:<span class='AlmFan2092'></span></td>
		    <td width='25%'>室内温度传感器:<span class='AlmTemSenIn2092'></span></td></tr>
		<tr><td width='25%'>室内湿度传感器:<span class='AlmHumSenIn2092'></span></td>
		    <td width='25%'>室外温度传感器:<span class='AlmTemSenOut2092'></span></td>
			<td width='25%'>室外湿度传感器:<span class='AlmHumSenOut2092'></span></td>
		    <td width='25%'><span class='2092'></span></td></tr>
    </table>
    </table>
    </td>
    </tr>
  </table>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
</div>
<script>
var itype=2092;
var tescape= 5000,time;
  
<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var json=<% db_QryAdv("select * from tbCyberZhX12 where SID="+sid,0);%>;
<% db_Close(); %>
	
$(function(){
   time=setInterval(ajax,tescape)
});
function ajax(){
    $.ajax({
        type: "POST",
        url: "omdev/smdat0.asp",
        data: "itype="+itype+"&sid="+sid,
        dataType:"json",
        success: function(msg){
            list3(msg); 
			
        }
    });
}

list3(json);
function list3(data){
	if (data.reccnt == 0)
		return;
    $.each(data.recs,function(i,n){
        $(".SID2092").html(n.SID);
        $(".Addr2092").html(n.Addr);
        $(".Port2092").html(n.Port%256);
        $(".DateUpd2092").html(n.DateUpd);
        $(".State2092").html(parseState(n.State));
		
		$(".TemOut2092").html((n.TemOut/10) + "℃");
		$(".TemIn2092").html((n.TemIn/10) + "℃");
		$(".HumOut2092").html((n.HumOut/10) + "%");
		$(".HumIn2092").html((n.HumIn/10) + "%");
		
		$(".StRun2092").html((n.StRun) ? "开机" : "关机");
		$(".StDoor2092").html((n.StDoor) ? "开启" : "关闭");
		$(".StFire2092").html((n.StFire) ? "开启" : "关闭");
		$(".StFanOut2092").html((n.StFanOut) ? "开启" : "关闭");
		$(".StFanIn2092").html((n.StFanIn) ? "开启" : "关闭");
		
		$(".AlmTemIn2092").html((n.AlmTemIn) ? "过高" : "正常");
		$(".AlmHumIn2092").html((n.AlmHumIn) ? "过高" : "正常");
		$(".AlmFan2092").html((n.AlmFan) ? "故障" : "正常");
		$(".AlmTemSenIn2092").html(alarmState(n.AlmTemSenIn));
		$(".AlmHumSenIn2092").html(alarmState(n.AlmHumSenIn));
		$(".AlmTemSenOut2092").html(alarmState(n.AlmTemSenOut));
		$(".AlmHumSenOut2092").html(alarmState(n.AlmHumSenOut));
    })

	$("span:contains('故障'),span:contains('告警'),,span:contains('关闭'),span:contains('开机')").addClass("red").removeClass("ger");
    $("span:contains('正常'),span:contains('开启'),span:contains('关机')").addClass("ger").removeClass("red");
}

function parseAlm(istate){
    if(istate==0) return "正常";
    else   if(istate==1) return "告警";
    else return "无效";
}

function parseState(istate){
    if(istate==0) return "正常";
    else   if(istate==1) return "告警";
    else return "故障";
}

function alarmState(istate){
    if(istate==0) return "正常";
    else   if(istate==1) return "短路";
    else return "开路";
}

</script>
</body>
</html>