12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <%@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 = "<?xml>" & vbCrLf
- str = str & " <date>" & now & "</date>" & vbCrLf
- str = str & " <temp1>" & temp1 & "</temp1>" & vbCrLf
- str = str & " <temp2>" & temp2 & "</temp2>" & vbCrLf
- str = str & " <temp3>" & temp3 & "</temp3>" & vbCrLf
- str = str & " <input voltage>" & inputVoltage & "</input voltage>" & vbCrLf
- str = str & " <dump energy>" & dumpEnergy & "</dump energy>" & vbCrLf
- str = str & "</xml>"
- 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()
- %>
|