Package uk.co.nimp.scard

Examples of uk.co.nimp.scard.MP300Exception


        int bu=win32Stcp250Dll.GetDLLTimeOutValue();
        win32Stcp250Dll.SetDLLTimeOutValue(1);
        boolean is260=false;
        try{      
            status = win32Stcp250Dll.StartDebug(readerBytes);
            if (RET_OK != status) throw new MP300Exception("Fail to establish communication with " + ip, status);

            status = win32Stcp250Dll.MPS_ResetHard();
            if (RET_OK != status) throw new MP300Exception("Fail to establish communication with " + ip, status);

            byte[] version=new byte[256];
            status=win32Stcp250Dll.MPS_GetVersion(version);
            if (RET_OK != status) {
                throw new MP300Exception("MPS_GetVersion failed: ", status);
            }
            String versionStr=AStringUtilities.bytesToString(version);

            /*if(versionStr.indexOf("260")!=-1)
                is260=true;*/
 
View Full Code Here


    }
    static void SCardSetVdd(int couplerId, int vddMillivolts) throws ScardException {
        int status;
        int timeout=win32Stcp250Dll.GetDLLTimeOutValue();
        status = win32Stcp250Dll.MPS_VCCSelectMV(couplerId, vddMillivolts);
        if (RET_OK != status) throw new MP300Exception("MPS_VCCSelectMV failed, couplerId="+couplerId+", vddMillivolts="+vddMillivolts+", Dll Timeout="+timeout, status);
    }
View Full Code Here

        int status;
        //this does not work: switch to synchronous mode seems to reset async mode parameters...
        //status = win32Stcp250Dll.MPS_ModeSelect(couplerId, Win32Stcp250Dll.CMM_MODE_ASYNC);
        //if (RET_OK != status) throw new MP300Exception("MPS_ModeSelect failed", status);
        status = win32Stcp250Dll.MPS_FrequencySelect(couplerId, clkHertz);
        if (RET_OK != status) throw new MP300Exception("MPS_FrequencySelect failed", status);
    }
View Full Code Here

        int status;
        //this does not work: switch to synchronous mode seems to reset async mode parameters...
        //status = win32Stcp250Dll.MPS_ModeSelect(couplerId, Win32Stcp250Dll.CMM_MODE_SYNC);
        //if (RET_OK != status) throw new MP300Exception("MPS_ModeSelect failed", status);
        status = win32Stcp250Dll.MPS_PinWrite( couplerId, Win32Stcp250Dll.PIN_CLOCK, PinState);
        if (RET_OK != status) throw new MP300Exception("MPS_PinWrite failed", status);
    }
View Full Code Here

        int status;
        //this does not work: switch to synchronous mode seems to reset async mode parameters...
        //status = win32Stcp250Dll.MPS_ModeSelect(couplerId, Win32Stcp250Dll.CMM_MODE_ASYNC);
        //if (RET_OK != status) throw new MP300Exception("MPS_ModeSelect failed", status);
        status = win32Stcp250Dll.MPS_PinWrite( couplerId, Win32Stcp250Dll.PIN_CLOCK, Win32Stcp250Dll.ON);
        if (RET_OK != status) throw new MP300Exception("MPS_PinWrite failed", status);
    }
View Full Code Here

        int status;
        byte atrBuf[] = new byte[256];
        int timeout=win32Stcp250Dll.GetDLLTimeOutValue();
        status = win32Stcp250Dll.MPS_VCCSelectMV(couplerId, vddMillivolts);
        if (RET_OK != status) {
            throw new MP300Exception("MPS_VCCSelectMV failed, couplerId="+couplerId+", vddMillivolts="+vddMillivolts+", Dll Timeout="+timeout, status);
        }
        status = win32Stcp250Dll.MPS_OnCmm(couplerId, clkHertz, atrLenRef, atrBuf);
        if (RET_OK != status) {
            throw new MP300Exception("MPS_OnCmm failed", status);
        }
        short len = atrLenRef.getValue();
        AnswerToReset out=new AnswerToReset(atrBuf,0,len);
        int fi=out.getSupportedFiDi()>>4;
        int di=out.getSupportedFiDi()&0x0F;
        //System.out.println("ATR:" + out.toString());
        if(out.acceptPps() & (out.getSupportedFiDi()!=0x11)){
            byte ppsBuf[] = new byte[10];
            for (int i = 0; i < ppsBuf.length; i++) {
                ppsBuf[i] = 0;
            }
            int p=0;
            if(GenericTerminal.PROTOCOL_T_1==protocol)
                p=1;
           
           
            if(7==di){
                //not supported by STAR265
                byte fakeAtr[]=out.getData();
                di=0x06;
                fakeAtr[2]=(byte) ((out.getSupportedFiDi()&0xF0)|di);
                status = win32Stcp250Dll.MPS_ChangeProtocolParameters(couplerId, win32Stcp250Dll.CPP_SIM_ATR ,fakeAtr,fakeAtr.length);
                if (RET_OK != status) {
                    throw new MP300Exception("MPS_ChangeProtocolParameters failed",status);
                }
            }

            status = win32Stcp250Dll.MPS_SendPPSCmm( couplerId, p, fi, di);
            if (RET_OK != status) throw new MP300Exception("MPS_SendPPSCmm failed",status);
        }
        cyclesPerEtu.value= AnswerToReset.fiDi2cyclesPerEtu(fi, di);
        return out;
    }
View Full Code Here

        int status = win32Stcp250Dll.MPS_SendAPDU( couplerId, command, lc,  lcData,
            internalLe, leData, actualLeByRef,internalSw);
        if (RET_OK != status) {
            int timeout=win32Stcp250Dll.GetDLLTimeOutValue();

            throw new MP300Exception("MPS_SendAPDU failed, timeout value="+timeout,status);
        }
        int actualLe=(int)actualLeByRef.getValue();
        if(actualLe!=le){
            byte[] actualLeData=new byte[actualLe];
            for(int i=0;i<actualLe;i++)
View Full Code Here

    }

    static void SCardDisconnect(int couplerId) throws MP300Exception {
        int status = win32Stcp250Dll.MPS_OffCmm(couplerId);
        if (RET_OK != status) {
            throw new MP300Exception("MPS_OffCmm failed",status);
        }
    }
View Full Code Here

        }
    }
    static void ScardForceDisconnection(int couplerId) throws MP300Exception {
        int status = win32Stcp250Dll.MPS_ResetHard();
        if (RET_OK != status) {
            throw new MP300Exception("MPS_ResetHard",status);
        }
    }
View Full Code Here

                break;
            case CRET_ABSENT:
                out = GenericTerminal.State.CARD_ABSENT;
                break;
            default:
                throw new MP300Exception("MPS_CardDetect failed", status);
        }
        return out;
    }
View Full Code Here

TOP

Related Classes of uk.co.nimp.scard.MP300Exception

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.