Ejemplo n.º 1
0
        public GetCameraResponse GetCamera(GetCameraRequest request)
        {
            try
            {
                if (request == null)
                {
                    throw new ArgumentNullException("request");
                }

                GetCameraResponse response = new GetCameraResponse();

                response.Camera = CameraTranslator.Translate(Locator.Get <ICameraManager>().GetCamera(request.CameraId));

                return(response);
            }
            catch (Exception ex)
            {
                throw new FaultException <DeviceConnectorServiceFault>(new DeviceConnectorServiceFault(ex.Message, ex), ex.Message);
            }
        }
Ejemplo n.º 2
0
        public GetCamerasResponse GetCameras(GetCamerasRequest request)
        {
            try
            {
                if (request == null)
                {
                    throw new ArgumentNullException("request");
                }

                GetCamerasResponse response = new GetCamerasResponse();
                response.Cameras = new CameraDataCollection();

                IList <Camera> list = Locator.Get <ICameraManager>().GetCameras();
                response.Cameras.AddRange((from c in list select CameraTranslator.Translate(c)).ToList());

                return(response);
            }
            catch (Exception ex)
            {
                throw new FaultException <DeviceConnectorServiceFault>(new DeviceConnectorServiceFault(ex.Message, ex), ex.Message);
            }
        }
Ejemplo n.º 3
0
        public UpdateCameraResponse UpdateCamera(UpdateCameraRequest request)
        {
            try
            {
                if (request == null)
                {
                    throw new ArgumentNullException("request");
                }

                UpdateCameraResponse response = new UpdateCameraResponse();

                response.Camera = CameraTranslator.Translate(
                    Locator.Get <ICameraManager>().UpdateCamera(
                        request.CameraId, request.CameraName, request.Description, request.Tags));

                return(response);
            }
            catch (Exception ex)
            {
                throw new FaultException <DeviceConnectorServiceFault>(new DeviceConnectorServiceFault(ex.Message, ex), ex.Message);
            }
        }
Ejemplo n.º 4
0
        public CreateCameraResponse CreateCamera(CreateCameraRequest request)
        {
            try
            {
                if (request == null)
                {
                    throw new ArgumentNullException("request");
                }

                CreateCameraResponse response = new CreateCameraResponse();

                response.Camera = CameraTranslator.Translate(
                    Locator.Get <ICameraManager>().CreateCamera(
                        CameraTranslator.Translate(request.Camera.Profile),
                        CameraTranslator.Translate(request.Camera.Config)));

                return(response);
            }
            catch (Exception ex)
            {
                throw new FaultException <DeviceConnectorServiceFault>(new DeviceConnectorServiceFault(ex.Message, ex), ex.Message);
            }
        }