def create_802_response(self, params, echo_params): params = Parser.parse_800_params(params) if len(params) == 0: return ["", "640 <Invalid Request>"] echo_params = Parser.parse_echo_params(echo_params) if not echo_params.has_key('ROUTER'): return ["", "640 <No Router>"] app_id = "" if params.has_key('APP_ID'): app_id = params['APP_ID'] if app_id == '?' or not devices.has_key(app_id): app_id = RequestUtils.generateAppId() self.addDeviceData(app_id, params, echo_params) response = "802 <APP_ID=" + app_id + ">" else : response = "640 <No app_id in the request>" response = response.replace("####", "##"); return [app_id, response]