public PublishedCamera PublishCamera(PublishedCameraProfile profile, PublishedDestination destination) { lock (_syncRoot) { if (profile == null) { throw new ArgumentNullException("profile"); } if (destination == null) { throw new ArgumentNullException("destination"); } PublishedCamera camera = _cameras.Find(c => c.Profile.CameraId == profile.CameraId && c.Destination == destination); if (camera == null) { camera = new PublishedCamera(profile, destination); Locator.Get <IStreamingManager>().StartCameraStreaming(camera); _cameras.Add(camera); DA::PublishedCamera entity = new DA::PublishedCamera() { Id = camera.Id, Profile = new DA::PublishedCameraProfile() { CameraId = profile.CameraId, CameraName = profile.CameraName, CameraThumbnail = profile.CameraThumbnail, DeviceServiceHostName = profile.DeviceServiceHostName, DeviceServiceUri = profile.DeviceServiceUri, }, Destination = new DA::Destination() { Port = camera.Destination.Port, }, }; Locator.Get <IPublishedCameraRepository>().Save(entity); } return(camera); } }
public PublishedCamera PublishCamera(PublishedCameraProfile profile, PublishedDestination destination) { lock (_syncRoot) { if (profile == null) throw new ArgumentNullException("profile"); if (destination == null) throw new ArgumentNullException("destination"); PublishedCamera camera = _cameras.Find(c => c.Profile.CameraId == profile.CameraId && c.Destination == destination); if (camera == null) { camera = new PublishedCamera(profile, destination); Locator.Get<IStreamingManager>().StartCameraStreaming(camera); _cameras.Add(camera); DA::PublishedCamera entity = new DA::PublishedCamera() { Id = camera.Id, Profile = new DA::PublishedCameraProfile() { CameraId = profile.CameraId, CameraName = profile.CameraName, CameraThumbnail = profile.CameraThumbnail, DeviceServiceHostName = profile.DeviceServiceHostName, DeviceServiceUri = profile.DeviceServiceUri, }, Destination = new DA::Destination() { Port = camera.Destination.Port, }, }; Locator.Get<IPublishedCameraRepository>().Save(entity); } return camera; } }