public PublishCameraResponse PublishCamera(PublishCameraRequest request)
        {
            try
              {
            if (request == null)
              throw new ArgumentNullException("request");

            PublishCameraResponse response = new PublishCameraResponse();

            Locator.Get<IPublishedCameraManager>().PublishCamera(
              new PublishedCameraProfile(request.Profile.CameraId, request.Profile.CameraName)
              {
            CameraThumbnail = request.Profile.CameraThumbnail,
            DeviceServiceHostName = request.Profile.DeviceServiceHostName,
            DeviceServiceUri = request.Profile.DeviceServiceUri,
              },
              new PublishedDestination(request.Destination.Port));

            return response;
              }
              catch (Exception ex)
              {
            throw new FaultException<MediaPublisherServiceFault>(new MediaPublisherServiceFault(ex.Message, ex), ex.Message);
              }
        }
Beispiel #2
0
        private static bool PublishCameraSync(string hostUri, PublishedCameraProfile profile, PublishedDestination destination)
        {
            MediaService service = GetMediaPublisherServiceSync(hostUri);

              if (service != null)
              {
            PublishCameraRequest request = new PublishCameraRequest()
            {
              Profile = new PublishedCameraProfileData()
              {
            CameraId = profile.CameraId,
            CameraName = profile.CameraName,
            CameraThumbnail = profile.CameraThumbnail,
            DeviceServiceHostName = profile.DeviceServiceHostName,
            DeviceServiceUri = profile.DeviceServiceUri,
              },
              Destination = new PublishedDestinationData()
              {
            Port = destination.Port,
              },
            };
            PublishCameraResponse response =
              ServiceProvider
            .GetService<IMediaPublisherService>(service.HostName, service.Uri.ToString())
            .PublishCamera(request);
              }

              return true;
        }