public GetCamerasResponse GetCameras(GetCamerasRequest request) { try { if (request == null) throw new ArgumentNullException("request"); GetCamerasResponse response = new GetCamerasResponse(); IList<BE::Camera> list = Locator.Get<ICameraManager>().GetCameras(); foreach (var item in list) { DC::Camera camera = new DC::Camera() { Id = item.Id, Name = item.Name, Url = item.Url, Port = item.Port, }; response.Cameras.Add(camera); } return response; } catch (Exception ex) { throw new FaultException<DeviceProfileServiceFault>(new DeviceProfileServiceFault(ex.Message, ex), ex.Message); } }
public GetCameraResponse GetCamera(GetCameraRequest request) { try { if (request == null) throw new ArgumentNullException("request"); GetCameraResponse response = new GetCameraResponse(); BE::Camera c = Locator.Get<ICameraManager>().GetCamera(request.CameraId); if (c != null) { DC::Camera camera = new DC::Camera() { Id = c.Id, Name = c.Name, Url = c.Url, Port = c.Port, }; response.Camera = camera; } return response; } catch (Exception ex) { throw new FaultException<DeviceProfileServiceFault>(new DeviceProfileServiceFault(ex.Message, ex), ex.Message); } }