Пример #1
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);
        }
        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);
            }
        }
        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);
              }
        }
Пример #4
0
        public PublishCameraResponse PublishCamera(PublishCameraRequest request)
        {
            try
            {
                if (request == null)
                {
                    throw new ArgumentNullException("request");
                }

                PublishCameraResponse response = new PublishCameraResponse();

                Locator.Get <IStreamingManager>().PublishCamera(request.CameraId, PublishedCameraTranslator.Translate(request.Destination));

                return(response);
            }
            catch (Exception ex)
            {
                throw new FaultException <DeviceConnectorServiceFault>(new DeviceConnectorServiceFault(ex.Message, ex), ex.Message);
            }
        }
Пример #5
0
        private static Camera PublishCameraSync(Camera camera, string address, int port)
        {
            MediaService service = GetDeviceConnectorServiceSync(camera.HostUri);

            if (service != null)
            {
                PublishCameraRequest request = new PublishCameraRequest()
                {
                    CameraId    = camera.Id,
                    Destination = new PublishDestinationData()
                    {
                        Address = address,
                        Port    = port,
                    },
                };
                PublishCameraResponse response =
                    ServiceProvider
                    .GetService <IDeviceConnectorService, IDeviceConnectorCallbackService>(
                        DeviceConnectorServiceClient.ServiceClient, service.HostName, service.Uri.ToString())
                    .PublishCamera(request);
            }

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

            PublishCameraResponse response = new PublishCameraResponse();

            Locator.Get<IStreamingManager>().PublishCamera(request.CameraId, PublishedCameraTranslator.Translate(request.Destination));

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