----- Original Message -----
From: "cecile cheng" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 12, 2004 4:46 AM
Subject: [OCF] OCF programming problem
> I've a smart card applet class Purse, there are some static variable
> CLA_PURSE, INS_GET_BALANCE and a method getBalance just as follow:
>
> public class Purse extends javacard.framework.Applet {
>
> private final static byte CLA_PURSE = (byte)0x90;
> private final static byte INS_GET_BALANCE = (byte)0x10;
> .......
>
> public void process(APDU apdu) throws ISOException {
> .......
> }
>
> private void getBalance( APDU apdu ) {
> .......
> }
> }
>
> If i want to develop an OCF application to call the getBalance method, is
> that i must construct the CommandAPDU, 90 10 00 00 00, to call the
> getBalance method??
I assume your process() method will catch the command APDU and call the
getBalance. It is correct that you must somehow construct the command APDU
on
the host and transmit it to the card.
>
> Is there any method that i could use OCF to call the getBalance function
but
> no need to construct the Command APDU?
yes, and no.
If your card complies with an avaiable card service, then you will not need
to construct the APDU
or catch the response.. "The OCF cardservice encapsulates the card operating
system and on-card
application dependancies, sheilding the applicatino from changes in those
components" [Hansmann 2000]
However, if there is no purse cardservice avaialable to you that meets your
needs, then you need to develop
your own, and in it you will have to build the APDU (someone has to).
Otherwise you can just use passthru card service and build the APDU
directly. This tends to be easy, but
not really keeping in the true spirit of OCF.
> And, if i don't know the values of private final static byte CLA_PURSE and
> private final static byte INS_GET_BALANCE, then how can i construct the
APDU
> or how can i get this value in the program?
Hmm.... The card applet and the host client are part of the same application
and share a communication
protocol (which includes the CLA and INS). I'm unaware of standard methods
to use when these values
are not known by both halves of the application.
>
> Thanks for help!
>
> Cecile
>
Eric
---
> Visit the OpenCard web site at http://www.opencard.org/ for more
> information on OpenCard---binaries, source code, documents.
> This list is being archived at http://www.opencard.org/archive/opencard/
! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email
! to
! [EMAIL PROTECTED]
! containing the word
! unsubscribe
! in the body.