Ejemplo n.º 1
0
 def addSensorWorker(sessionId):
     try:
         if not Config.isConfigured():
             util.debugPrint("Please configure system")
             return make_response("Please configure system", 500)
         if not authentication.checkSessionId(sessionId, ADMIN):
             return make_response("Session not found.", 403)
         requestStr = request.data
         sensorConfig = json.loads(requestStr)
         return jsonify(SensorDb.addSensor(sensorConfig))
     except:
         print "Unexpected error:", sys.exc_info()[0]
         print sys.exc_info()
         traceback.print_exc()
         util.logStackTrace(sys.exc_info())
         raise
def setupSensor(sensorConfigName):
    import SensorDb
    sensorConfig = json.load(open(sensorConfigName))
    SensorDb.addSensor(sensorConfig)