%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Option Explicit
Response.Buffer = True
Server.ScriptTimeOut = 1800
Call OpenConn()
Dim Conn, temp1, temp2, temp3, inputVoltage, dumpEnergy, str
temp1 = sqlSumLog("WTH10_1_Temp")
temp2 = sqlSumLog("WTH10_2_Temp")
temp3 = sqlSumLog("RC_netmate_line1InputCurrent")
inputVoltage = sqlSumLog("RC_netmate_line1InputCurrent")
dumpEnergy = sqlSumLog("RC_netmate_BatteryPowerSupplyTimeleft")
str = "" & vbCrLf
str = str & " " & now & "" & vbCrLf
str = str & " " & temp1 & "" & vbCrLf
str = str & " " & temp2 & "" & vbCrLf
str = str & " " & temp3 & "" & vbCrLf
str = str & " " & inputVoltage & "" & vbCrLf
str = str & " " & dumpEnergy & "" & vbCrLf
str = str & ""
response.write str
function sqlSumLog(varname)
dim rsSqlSumLog
set rsSqlSumLog = Conn.execute("select curr_value from t_summary_log where varname = '"&varname&"'")
if rsSqlSumLog.bof and rsSqlSumLog.eof then
sqlSumLog = -1
else
sqlSumLog = rsSqlSumLog(0)
end if
rsSqlSumLog.close
set rsSqlSumLog = nothing
end function
Sub OpenConn()
On Error Resume Next
Dim ConnStr
ConnStr = "DRIVER={PostgreSQL ODBC Driver(UNICODE)}; SERVER=127.0.0.1; port=5432; DATABASE=whdx; UID=postgres; PWD=stoneu;"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open ConnStr
If Err Then
Err.Clear
Set Conn = Nothing
Response.Write "Connection Error!"
Response.End
End If
End Sub
Sub CloseConn()
On Error Resume Next
If IsObject(Conn) Then
Conn.Close
Set Conn = Nothing
End If
End Sub
Call CloseConn()
%>