def camera_controller(request): if request.method == 'POST': result = ResCameraProcess.add_camera(request) if request.method == 'GET': result = ResCameraProcess.get_all_camera(request) if request.method == 'DELETE': result = ResCameraProcess.delete_camera(request) if request.method == 'PUT': result = ResCameraProcess.update_camera(request) if result.is_success(): return JsonResponse(Resp.success( message=result.get_message(), data=result.get_data()).to_dict(), safe=False) else: return JsonResponse(Resp.error(message=result.get_message()).to_dict(), safe=False)
def turn_on_camera(request): result = ResCameraProcess.turn_on_camera(request) if result.is_success(): return JsonResponse(Resp.success( message=result.get_message(), data=result.get_data()).to_dict(), safe=False) else: return JsonResponse(Resp.error(message=result.get_message()).to_dict(), safe=False)
def camera_group_list_camera(request): """ check camera url :param request: :return: the message is successful if the information of project , otherwise the error message. """ result = ResCameraProcess.camera_group_list_camera(request) if result.is_success(): return JsonResponse(Resp.success( message=result.get_message(), data=result.get_data()).to_dict(), safe=False) else: return JsonResponse(Resp.error(message=result.get_message()).to_dict(), safe=False)
def delete_camera_from_group(request): """ delete camera from group :param request: :return: the message is successful if the information of project , otherwise the error message. """ result = ResCameraProcess.delete_camera_from_group(request) if result.is_success(): return JsonResponse(Resp.success( message=result.get_message(), data=result.get_data()).to_dict(), safe=False) else: return JsonResponse(Resp.error(message=result.get_message()).to_dict(), safe=False)