public override bool Equals(object obj)
        {
            DriCasDescramblingStatus descramblingStatus = obj as DriCasDescramblingStatus;

            if (descramblingStatus != null && this == descramblingStatus)
            {
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// Upon receipt of the GetEntitlement action, the DRIT SHALL perform in sequence the following actions in less than 1s.
        /// 1.  Clear all the previous program PID from the PidList (Mux service) state variable.
        /// 2.  Configure the tuner based on the service information tables received from the Card and either of the
        ///     NewChannelNumber or the NewSourceId arguments. If both are defined and don’t point to the same
        ///     physical channel, then NewChannelNumber shall prevail.
        /// 3.  Set the ProgramNumber (Mux service) state variable.
        /// 4.  Reset the ACCI status message (see section 8.3) to 0.
        /// 5.  Setthe DescramblingStatus state variable to “Unknown”.
        /// 6.  Set the DescramblingMessage state variable to Null.
        /// 7.  Send a ca_pmt(Query) APDU to the Card.
        /// </summary>
        /// <param name="newChannelNumber">This argument sets the VirtualChannelNumber state variable.</param>
        /// <param name="newSourceId">This argument sets the VirtualChannelNumber state variable.</param>
        /// <param name="currentEntitlement">This argument provides the value of the DescramblingStatus state variable when the action response is created.</param>
        /// <param name="entitlementMessage">This argument provides the value of the DescramblingMessage state variable when the action response is created.</param>
        /// <returns><c>true</c> if the action is executed, otherwise <c>false</c></returns>
        public bool GetEntitlement(UInt32 newChannelNumber, UInt32 newSourceId, out DriCasDescramblingStatus currentEntitlement,
                                   out string entitlementMessage)
        {
            currentEntitlement = DriCasDescramblingStatus.Unknown;
            entitlementMessage = string.Empty;
            if (_getEntitlementAction == null)
            {
                Log.Log.Debug("DRI: device {0} does not implement a CAS GetEntitlement action", _device.UDN);
                return(false);
            }

            IList <object> outParams = _getEntitlementAction.InvokeAction(new List <object> {
                newChannelNumber, newSourceId
            });

            currentEntitlement = (DriCasDescramblingStatus)(string)outParams[0];
            entitlementMessage = (string)outParams[1];
            return(true);
        }
Exemple #3
0
    /// <summary>
    /// Upon receipt of the GetEntitlement action, the DRIT SHALL perform in sequence the following actions in less than 1s.
    /// 1.  Clear all the previous program PID from the PidList (Mux service) state variable.
    /// 2.  Configure the tuner based on the service information tables received from the Card and either of the
    ///     NewChannelNumber or the NewSourceId arguments. If both are defined and don’t point to the same
    ///     physical channel, then NewChannelNumber shall prevail.
    /// 3.  Set the ProgramNumber (Mux service) state variable.
    /// 4.  Reset the ACCI status message (see section 8.3) to 0.
    /// 5.  Setthe DescramblingStatus state variable to “Unknown”.
    /// 6.  Set the DescramblingMessage state variable to Null.
    /// 7.  Send a ca_pmt(Query) APDU to the Card.
    /// </summary>
    /// <param name="newChannelNumber">This argument sets the VirtualChannelNumber state variable.</param>
    /// <param name="newSourceId">This argument sets the VirtualChannelNumber state variable.</param>
    /// <param name="currentEntitlement">This argument provides the value of the DescramblingStatus state variable when the action response is created.</param>
    /// <param name="entitlementMessage">This argument provides the value of the DescramblingMessage state variable when the action response is created.</param>
    /// <returns><c>true</c> if the action is executed, otherwise <c>false</c></returns>
    public bool GetEntitlement(UInt32 newChannelNumber, UInt32 newSourceId, out DriCasDescramblingStatus currentEntitlement,
                                out string entitlementMessage)
    {
      currentEntitlement = DriCasDescramblingStatus.Unknown;
      entitlementMessage = string.Empty;
      if (_getEntitlementAction == null)
      {
        Log.Log.Debug("DRI: device {0} does not implement a CAS GetEntitlement action", _device.UDN);
        return false;
      }

      IList<object> outParams = _getEntitlementAction.InvokeAction(new List<object> { newChannelNumber, newSourceId });
      currentEntitlement = (DriCasDescramblingStatus)(string)outParams[0];
      entitlementMessage = (string)outParams[1];
      return true;
    }
 /// <summary>
 /// Handle UPnP evented state variable changes.
 /// </summary>
 /// <param name="stateVariable">The state variable that has changed.</param>
 /// <param name="newValue">The new value of the state variable.</param>
 private void OnStateVariableChanged(CpStateVariable stateVariable, object newValue)
 {
   try
   {
     if (stateVariable.Name.Equals("PCRLock") || stateVariable.Name.Equals("Lock"))
     {
       _tunerLocked = (bool)newValue;
       if (_eventSignalLock != null)
       {
         _eventSignalLock.Set();
       }
     }
     else if (stateVariable.Name.Equals("CardStatus"))
     {
       DriCasCardStatus oldStatus = _cardStatus;
       _cardStatus = (DriCasCardStatus)(string)newValue;
       if (oldStatus != _cardStatus)
       {
         Log.Log.Info("DRI CC: device {0} CableCARD status update, old status = {1}, new status = {2}", _cardId, oldStatus, _cardStatus);
       }
     }
     else if (stateVariable.Name.Equals("CardMessage"))
     {
       if (!string.IsNullOrEmpty(newValue.ToString()))
       {
         Log.Log.Info("DRI CC: device {0} received message from the CableCARD, current status = {1}, message = {2}", _cardId, _cardStatus, newValue);
       }
     }
     else if (stateVariable.Name.Equals("MMIMessage"))
     {
       HandleMmiMessage((byte[])newValue);
     }
     else if (stateVariable.Name.Equals("DescramblingStatus"))
     {
       DriCasDescramblingStatus oldStatus = _descramblingStatus;
       _descramblingStatus = (DriCasDescramblingStatus)(string)newValue;
       if (oldStatus != _descramblingStatus)
       {
         Log.Log.Info("DRI CC: device {0} descrambling status update, old status = {1}, new status = {2}", _cardId, oldStatus, _descramblingStatus);
       }
     }
     else if (stateVariable.Name.Equals("DrmPairingStatus"))
     {
       DriSecurityPairingStatus oldStatus = _pairingStatus;
       _pairingStatus = (DriSecurityPairingStatus)(string)newValue;
       if (oldStatus != _pairingStatus)
       {
         Log.Log.Info("DRI CC: device {0} pairing status update, old status = {1}, new status = {2}", _cardId, oldStatus, _pairingStatus);
       }
     }
     else
     {
       Log.Log.Debug("DRI CC: device {0} state variable {1} for service {2} changed to {3}", _cardId, stateVariable.Name, stateVariable.ParentService.FullQualifiedName, newValue ?? "[null]");
     }
   }
   catch (Exception ex)
   {
     Log.Log.Error("DRI CC: failed to handle state variable change\r\n{0}", ex);
   }
 }