/// <summary>
 /// Initializes object with default values.
 /// </summary>
 public TsCAeSubscription(TsCAeServer server, ITsCAeSubscription subscription, TsCAeSubscriptionState state)
 {
     server_       = server ?? throw new ArgumentNullException(nameof(server));
     subscription_ = subscription ?? throw new ArgumentNullException(nameof(subscription));
     state_        = (TsCAeSubscriptionState)state.Clone();
     name_         = state.Name;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the current state of the subscription.
        /// </summary>
        /// <returns>The current state of the subscription.</returns>
        public TsCAeSubscriptionState GetState()
        {
            if (_subscription == null)
            {
                throw new NotConnectedException();
            }

            _state      = _subscription.GetState();
            _state.Name = _name;

            return((TsCAeSubscriptionState)_state.Clone());
        }
Exemplo n.º 3
0
        ///////////////////////////////////////////////////////////////////////
        #region Constructors, Destructor, Initialization

        /// <summary>
        /// Initializes object with default values.
        /// </summary>
        public TsCAeSubscription(TsCAeServer server, ITsCAeSubscription subscription, TsCAeSubscriptionState state)
        {
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }
            if (subscription == null)
            {
                throw new ArgumentNullException("subscription");
            }

            _server       = server;
            _subscription = subscription;
            _state        = (Ae.TsCAeSubscriptionState)state.Clone();
            _name         = state.Name;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Changes the state of a subscription.
        /// </summary>
        /// <param name="masks">A bit mask that indicates which elements of the subscription state are changing.</param>
        /// <param name="state">The new subscription state.</param>
        /// <returns>The actual subscription state after applying the changes.</returns>
        public Ae.TsCAeSubscriptionState ModifyState(int masks, Ae.TsCAeSubscriptionState state)
        {
            if (_subscription == null)
            {
                throw new NotConnectedException();
            }

            _state = _subscription.ModifyState(masks, state);

            if ((masks & (int)TsCAeStateMask.Name) != 0)
            {
                _state.Name = _name = state.Name;
            }
            else
            {
                _state.Name = _name;
            }

            return((Ae.TsCAeSubscriptionState)_state.Clone());
        }