Exemplo n.º 1
0
        /// <summary>
        /// Subscribes for change events for all state variables of this service.
        /// </summary>
        /// <remarks>
        /// If the event subscription fails, the delegate <see cref="EventSubscriptionFailed"/> will be called.
        /// </remarks>
        /// <exception cref="IllegalCallException">If the state variables are already subscribed
        /// (see <see cref="IsStateVariablesSubscribed"/>).</exception>
        public void SubscribeStateVariables()
        {
            DeviceConnection connection = _connection;

            if (connection == null)
            {
                throw new IllegalCallException("UPnP service is not connected to a UPnP network service");
            }
            if (connection.IsServiceSubscribedForEvents(this))
            {
                throw new IllegalCallException("State variables are already subscribed");
            }
            connection.OnSubscribeEvents(this);
        }