it.dtt.ca
Class SmartCard

java.lang.Object
  extended by it.dtt.ca.CAObject
      extended by it.dtt.ca.SmartCard

public abstract class SmartCard
extends CAObject

This is the class used to retrieve information from the smart card currently inserted in one of the STB slots.


Constructor Summary
protected SmartCard(Slot slot)
          Create an instance of a SmartCard.
 
Method Summary
 void addSmartCardListener(SmartCardListener listener)
          A SmartCardListener is notified if any change occur in the smart card.
abstract  byte[] getATR()
          Retrieves the byte array representing the Answer-to-Reset.
abstract  java.util.Date getExpiryDate()
          Get the expiry date of this smart card.
abstract  java.util.Properties getMoreInfo()
          Retrieves more CA related properties that cannot be retrieved with other methods (such as revisions or sw details).
abstract  java.lang.String getNumber()
          Gets the smart card identification number for the given card.
abstract  Pin[] getPins()
          Get all Personal Identification Numbers that are stored on the smart card.
abstract  java.lang.String getProvider()
          Get the name of the smart card provider (normally the same as the CA provider name).
abstract  java.lang.String getServiceProviderName()
          Retrieves the name of the service provider who delivered the card.
abstract  int getStatus()
          Return the smart card status.
 Wallet getUsedWallet()
          Get the wallet currently in use.
 byte[] getUserData()
          Read the User Data field from the smart card.
abstract  java.lang.String getVersion()
          Gets the smart card version for the given card.
abstract  Wallet[] getWallets()
          Get the array of wallets provided by this smart card.
 void removeSmartCardListener(SmartCardListener listener)
          Remove a previously added SmartCardListener.
 void setUsedWallet(Wallet wallet)
          Set the wallet currently in use.
 boolean setUserData(byte[] userData)
          Write the User Data field on the smart card.
 
Methods inherited from class it.dtt.ca.CAObject
checkSession, closeSession, getParent, getSession, sessionClosed, sessionClosing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmartCard

protected SmartCard(Slot slot)
Create an instance of a SmartCard.

Parameters:
slot - the slot which owns this SmartCard.
Method Detail

getPins

public abstract Pin[] getPins()
                       throws CardNotFoundException,
                              SessionClosedException
Get all Personal Identification Numbers that are stored on the smart card.

Returns:
a vector of PinController objects.
Throws:
CardNotFoundException - if the smart card is removed or is not present in the slot.
SessionClosedException - if the session is closed.

getWallets

public abstract Wallet[] getWallets()
                             throws CardNotFoundException,
                                    SessionClosedException
Get the array of wallets provided by this smart card.

Returns:
the array of Wallets.
Throws:
CardNotFoundException - if the smart card is removed or is not present in the slot.
SessionClosedException - if the session is closed.

setUsedWallet

public void setUsedWallet(Wallet wallet)
                   throws CardNotFoundException,
                          SessionClosedException,
                          AccessDeniedException,
                          UnsupportedFeatureException
Set the wallet currently in use.

Parameters:
wallet - the wallet to use from now on.
Throws:
CardNotFoundException - if the smart card is removed or is not present in the slot.
SessionClosedException - if the session is closed.
AccessDeniedException - if access is denied for security reasons.
UnsupportedFeatureException - if the smart card does not support setting a different wallet than the default one.

getUsedWallet

public Wallet getUsedWallet()
                     throws CardNotFoundException,
                            SessionClosedException
Get the wallet currently in use.

Returns:
the wallet currently in use.
Throws:
CardNotFoundException - if the smart card is removed or is not present in the slot.
SessionClosedException - if the session is closed.

getNumber

public abstract java.lang.String getNumber()
                                    throws CardNotFoundException,
                                           SessionClosedException
Gets the smart card identification number for the given card.

Returns:
the smart card id.
Throws:
CardNotFoundException - if the smart card is removed or is not present in the slot.
SessionClosedException - if the session is closed.

getVersion

public abstract java.lang.String getVersion()
                                     throws CardNotFoundException,
                                            SessionClosedException
Gets the smart card version for the given card.

Returns:
the smart card version.
Throws:
CardNotFoundException - if the smart card is removed or is not present in the slot.
SessionClosedException - if the session is closed.

getExpiryDate

public abstract java.util.Date getExpiryDate()
                                      throws CardNotFoundException,
                                             SessionClosedException
Get the expiry date of this smart card.

Returns:
the expiry date of this smart card.
Throws:
CardNotFoundException - if the smart card is removed or is not present in the slot.
SessionClosedException - if the session is closed.

getServiceProviderName

public abstract java.lang.String getServiceProviderName()
                                                 throws CardNotFoundException,
                                                        SessionClosedException
Retrieves the name of the service provider who delivered the card.

Returns:
name of the broadcaster providing the service.
Throws:
CardNotFoundException - if the smart card is removed or is not present in the slot.
SessionClosedException - if the session is closed.

getMoreInfo

public abstract java.util.Properties getMoreInfo()
                                          throws CardNotFoundException,
                                                 SessionClosedException
Retrieves more CA related properties that cannot be retrieved with other methods (such as revisions or sw details).

Returns:
a list of properties
Throws:
CardNotFoundException - if the smart card is removed or is not present in the slot.
SessionClosedException - if the session is closed.

getATR

public abstract byte[] getATR()
                       throws UnsupportedFeatureException,
                              CardNotFoundException,
                              SessionClosedException
Retrieves the byte array representing the Answer-to-Reset.

Returns:
the smart card Answer-to-Reset
Throws:
UnsupportedFeatureException - if the CAS does not support ATR retrieval
CardNotFoundException - if the smart card is removed or is not present in the slot.
SessionClosedException - if the session is closed.

addSmartCardListener

public void addSmartCardListener(SmartCardListener listener)
                          throws SessionClosedException
A SmartCardListener is notified if any change occur in the smart card.

Parameters:
listener - object listening to smart card changes.
Throws:
SessionClosedException - if the session is closed.

removeSmartCardListener

public void removeSmartCardListener(SmartCardListener listener)
                             throws SessionClosedException
Remove a previously added SmartCardListener.

Parameters:
listener - object to be removed.
Throws:
SessionClosedException - if the session is closed.

getStatus

public abstract int getStatus()
                       throws CardNotFoundException,
                              SessionClosedException
Return the smart card status. The return value is one of the values specified in it.dtt.ca.event.SmartCardStatusEvent.

Returns:
an int representing a SmartCardEvent costant value.
Throws:
CardNotFoundException - if the smart card is removed or is not present in the slot.
SessionClosedException - if the session is closed.
See Also:
SmartCardEvent

getUserData

public byte[] getUserData()
                   throws UnsupportedFeatureException,
                          CardNotFoundException,
                          SessionClosedException
Read the User Data field from the smart card.

Returns:
array of bytes stored in the smart card as user data.
Throws:
UnsupportedFeatureException - if the Smart Card does not support user data retrieval
CardNotFoundException - if the smart card is removed or is not present in the slot.
SessionClosedException - if the session is closed.

setUserData

public boolean setUserData(byte[] userData)
                    throws UnsupportedFeatureException,
                           CardNotFoundException,
                           SessionClosedException
Write the User Data field on the smart card.

Parameters:
userData - the data to write in the user data field of the smart card
Returns:
true if the write operation on the smart card is successful, false otherwise.
Throws:
UnsupportedFeatureException - if the Smart Card does not support user data storage
CardNotFoundException - if the smart card is removed or is not present in the slot.
SessionClosedException - if the session is closed.

getProvider

public abstract java.lang.String getProvider()
                                      throws CardNotFoundException,
                                             SessionClosedException
Get the name of the smart card provider (normally the same as the CA provider name).

Returns:
a string containing the name of the smart card provider.
Throws:
CardNotFoundException - if the smart card is removed or is not present in the slot.
SessionClosedException - if the session is closed.