def main(): form = cgi.FieldStorage() msg="" if 'cmd' in form: command=form['cmd'].value if (command=='cleanup'): msg, errorcode=execute("sudo " + gpio + " reset") else: errorcode="140" else: pinID = form['id'].value pinTypeOfChange = pinID.split('GPIO')[0] pinName = form['pinNumber'].value pinNo = pinName.split('GPIO')[1] wiringPiIndex, err = execute("sudo gpio-query wiringpi \"GPIO " + str(pinNo) + "\"") pinNo = wiringPiIndex errorcode = None if pinTypeOfChange == 'V' : pinValue = form['value'].value msg, errorcode = set_pin_value(pinNo, pinValue) elif pinTypeOfChange == 'D' : pinDirection = form['direction'].value msg, errorcode = set_pin_direction(pinNo, pinDirection) else: msg="Uknown command" errorcode="130" response = Response(errorcode) response.buildResponse(errorcode, message=msg) composeXMLDocument(response.xml)
def main(): form = cgi.FieldStorage() chain = form['chain'].value protocol=form['protocol'].value action=form['action'].value addProtocolRule(chain, action, protocol) response = Response(0) response.buildResponse(errorcode) composeXMLDocument(response.xml)
def main(): form = cgi.FieldStorage() #form={'action':'uninstall', 'packageName':'tree'} pName = form['packageName'].value output = '' if form['action'].value == 'install' : output, errorcode = installPackage(pName) elif form['action'].value == 'uninstall' : output, errorcode = uninstallPackage(pName) response = Response(0) response.buildResponse(errorcode) composeXMLDocument(response.xml)
def main(): form = cgi.FieldStorage() #form={'action':'uninstall', 'packageName':'tree'} pName = form['packageName'].value output = '' if form['action'].value == 'install': output, errorcode = installPackage(pName) elif form['action'].value == 'uninstall': output, errorcode = uninstallPackage(pName) response = Response(0) response.buildResponse(errorcode) composeXMLDocument(response.xml)
def main(): form = cgi.FieldStorage() cameraAction = form['action'].value output = '' if cameraAction == 'snapshot': output, errorcode = takeSnapshot() elif cameraAction == 'play': output, errorcode = play() elif cameraAction == 'startrecord': output, errorcode = startRecord() elif cameraAction == 'stoprecord': output, errorcode = stopRecord() response = Response(0) response.buildResponse(errorcode) composeXMLDocument(response.xml)
def main(): form = cgi.FieldStorage() cameraAction = form['action'].value output = '' if cameraAction == 'snapshot' : output, errorcode = takeSnapshot() elif cameraAction == 'play' : output, errorcode = play() elif cameraAction == 'startrecord' : output, errorcode = startRecord() elif cameraAction == 'stoprecord' : output, errorcode = stopRecord() response = Response(0) response.buildResponse(errorcode) composeXMLDocument(response.xml)