def delete(self,deviceId,sensorId,command): # device和user都可以使用该method ret = self.userOrAccessKeyCheck(deviceId) if error.ERR_CODE_ERR_ == ret: return if error.ERR_CODE_USER_CHECK_OK == ret: #拥有该sensor的get权限,即可查询数据 if self.privilegeCheck(master='user',masterId=self.current_user,\ object='device',objectId=deviceId,operation='upd') != error.ERR_CODE_OK_: return responseApi = copy.deepcopy(restDef.RESTFUL_API[restDef.HTTP_RES['commandSetOne']]['@DELETE']['RESP']) requestApi = copy.deepcopy(restDef.RESTFUL_API[restDef.HTTP_RES['commandSetOne']]['@GET']['REQUEST']) self._getAllArguments(requestApi) if database.db_delete_commandset(deviceId, sensorId, command) != error.ERR_CODE_OK_: self.send_error_msg(self.__ERRCODE__['innererr']) return else: self.write(escape.json_encode(responseApi))
def deleteOneSensor(self,deviceId,sensorId): #delete all dataset and command database.db_delete_dataset(deviceId,sensorId) database.db_delete_commandset(deviceId,sensorId)