# @author rouble matta import sys sys.path.append('/etc/raspwave/pylib') from SecurityUtils import getCurrentAlarmState,isPanic,getLastStateChangeTime,getLastPanicTime,getLastAlertTime,getPreviousAlarmState,getDesiredAlarmState,getDesiredAlarmStateDelay,getAlertPanicTime,getGuiUpdateTime,isPersistent from LoggerUtils import setupSecurityLogger import cgi, cgitb from controlpanel import getBaseUrl cgitb.enable() logger = setupSecurityLogger() alarmState = getCurrentAlarmState() alarmPanic = isPanic() report = "" report += "Alarm State: " + alarmState + "\n" report += "Alarm Panic: " + str(alarmPanic) + "\n" report += "Persistence: " + str(isPersistent()) + "\n" report += "Last Panic time: " + str(getLastPanicTime()) + "\n" report += "Last Alert time: " + str(getLastAlertTime()) + "\n" report += "Last State Change time: " + str(getLastStateChangeTime()) + "\n" report += "Previous State: " + str(getPreviousAlarmState()) + "\n" report += "Desired State: " + str(getDesiredAlarmState()) + "\n" report += "Desired State Delay: " + str(getDesiredAlarmStateDelay()) + "\n" report += "Alert will become panic at: " + str(getAlertPanicTime()) + "\n" report += "GUI needs to be updated last at: " + str(getGuiUpdateTime()) + "\n\n" print 'Content-Type: text/html' print # HTTP says you have to have a blank line between headers and content
for state in AlarmState: color = "" if desiredAlarmState == state: #color = "color:grey;border-style:inset;" color = "color:grey;" if currentAlarmState == state: #color = "color:red;border-style:inset;" color = "color:red;" print ' <button type="button" id="' + state + '" onClick=\'setState("' + state + '")\' style="' + color + 'font: bold 60px Arial">' + state + '</button>' if state == "DISARMED": print ' Alarm Code:' print ' <input type="password" id="AlarmCodeDisarmed" style="font: bold 60px Arial" maxlength="10" size="8">' print ' <br><br>' print ' <h3> Panic/UnPanic</h3>' color = "" if isPanic(): #color = "color:red;border-style:inset;" color = "color:red;" print ' <button type="button" id="PANIC" onClick=\'panic("PANIC")\' style="' + color + 'font: bold 60px Arial">PANIC</button>' print ' <br><br>' print ' <button type="button" id="UNPANIC" onClick=\'panic("UNPANIC")\' style="font: bold 60px Arial">UNPANIC</button>' print ' Alarm Code:' print ' <input type="password" id="AlarmCodeUnpanic" style="font: bold 60px Arial" maxlength="10" size="8">' print ' <br><br>' print ' </form>' print ' <h3>Advanced Features</h3>' color = "" if isPersistent(): #color = "color:red;border-style:inset;" color = "color:red;" print ' <button type="button" id="PERSISTENT" onClick=\'persistent()\' style="' + color + 'font: bold 60px Arial">PERSISTENT</button>'
#!/usr/bin/python -u # @author rouble matta import sys sys.path.append('/etc/raspwave/pylib') from SecurityUtils import isPanic import cgi, cgitb cgitb.enable() if __name__ == '__main__': print 'Content-Type: text/html' print '' print isPanic()
# @author rouble matta import sys sys.path.append('/etc/raspwave/pylib') from SecurityUtils import getCurrentAlarmState, isPanic, getLastStateChangeTime, getLastPanicTime, getLastAlertTime, getPreviousAlarmState, getDesiredAlarmState, getDesiredAlarmStateDelay, getAlertPanicTime, getGuiUpdateTime, isPersistent from LoggerUtils import setupSecurityLogger import cgi, cgitb from controlpanel import getBaseUrl cgitb.enable() logger = setupSecurityLogger() alarmState = getCurrentAlarmState() alarmPanic = isPanic() report = "" report += "Alarm State: " + alarmState + "\n" report += "Alarm Panic: " + str(alarmPanic) + "\n" report += "Persistence: " + str(isPersistent()) + "\n" report += "Last Panic time: " + str(getLastPanicTime()) + "\n" report += "Last Alert time: " + str(getLastAlertTime()) + "\n" report += "Last State Change time: " + str(getLastStateChangeTime()) + "\n" report += "Previous State: " + str(getPreviousAlarmState()) + "\n" report += "Desired State: " + str(getDesiredAlarmState()) + "\n" report += "Desired State Delay: " + str(getDesiredAlarmStateDelay()) + "\n" report += "Alert will become panic at: " + str(getAlertPanicTime()) + "\n" report += "GUI needs to be updated last at: " + str( getGuiUpdateTime()) + "\n\n" print 'Content-Type: text/html'
for state in AlarmState: color = "" if desiredAlarmState == state: #color = "color:grey;border-style:inset;" color = "color:grey;" if currentAlarmState == state: #color = "color:red;border-style:inset;" color = "color:red;" print ' <button type="button" id="' + state + '" onClick=\'setState("' + state +'")\' style="' + color + 'font: bold 60px Arial">' + state + '</button>' if state == "DISARMED": print ' Alarm Code:' print ' <input type="password" id="AlarmCodeDisarmed" style="font: bold 60px Arial" maxlength="10" size="8">' print ' <br><br>' print ' <h3> Panic/UnPanic</h3>' color = "" if isPanic(): #color = "color:red;border-style:inset;" color = "color:red;" print ' <button type="button" id="PANIC" onClick=\'panic("PANIC")\' style="' + color + 'font: bold 60px Arial">PANIC</button>' print ' <br><br>' print ' <button type="button" id="UNPANIC" onClick=\'panic("UNPANIC")\' style="font: bold 60px Arial">UNPANIC</button>' print ' Alarm Code:' print ' <input type="password" id="AlarmCodeUnpanic" style="font: bold 60px Arial" maxlength="10" size="8">' print ' <br><br>' print ' </form>' print ' <h3>Advanced Features</h3>' color = "" if isPersistent(): #color = "color:red;border-style:inset;" color = "color:red;" print ' <button type="button" id="PERSISTENT" onClick=\'persistent()\' style="' + color + 'font: bold 60px Arial">PERSISTENT</button>'