PCSC4Java  0.2
Library PCSC for Java language.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
D:/Affaire/Perso/SmartCardToolBox/pcsc4java-framework-0.2/src/fr/redbilled/pcscforjava/PCSCResource.java
Go to the documentation of this file.
00001 /*
00002  * To change this template, choose Tools | Templates
00003  * and open the template in the editor.
00004  */
00005 package fr.redbilled.pcscforjava;
00006 
00007 import java.util.logging.Level;
00008 import java.util.logging.Logger;
00009 
00014 public class PCSCResource 
00015 {
00016     static String           m_sLibraryName = "";
00017     
00018     public static String getVersion()
00019     {
00020         return "0.0.1";
00021     }
00022     
00023     public static String getLibraryName()
00024     {
00025         if(m_sLibraryName.contains("###"))
00026         {
00027             m_sLibraryName.replaceAll("###", "");
00028             return "Impossible to load the library: " + m_sLibraryName;
00029         }
00030         return m_sLibraryName;
00031     }  
00032     
00033     public static void setLibraryName(String sLibraryName)
00034     {
00035         if(m_sLibraryName.isEmpty())
00036             m_sLibraryName = sLibraryName;
00037     }
00038     
00039     public static String getPlugAndPlayStatus()
00040     {
00041         try 
00042         {
00043             CardTerminals _terms = TerminalFactory.getDefault().terminals();
00044             
00045             if(_terms != null)
00046             {
00047                 if(_terms.isPlugAndPlaySupported())
00048                     return "Enabled";
00049                 else
00050                     return "Disabled";
00051             }
00052             
00053             return "Disabled";
00054         } 
00055         catch (CardException ex) 
00056         {
00057             return "Disabled";
00058         }
00059     }
00060 }