Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

how to get the available space of chip?

JavaCard Applet Development Related Questions and Answers.
AlexLiu
Posts: 17
Joined: Thu Sep 22, 2016 4:52 am
Points :206
Contact:

how to get the available space of chip?

Post by AlexLiu » Tue Oct 16, 2018 2:09 am

how to get the available space of chip?

DaHuFa
Posts: 53
Joined: Mon Jun 04, 2018 5:07 am
Points :392
Contact:

Re: how to get the available space of chip?

Post by DaHuFa » Tue Oct 16, 2018 2:14 am

In JavaCardAPI, the JCSystem.getAvailableMemory() API may help you get your want.

AlexLiu
Posts: 17
Joined: Thu Sep 22, 2016 4:52 am
Points :206
Contact:

Re: how to get the available space of chip?

Post by AlexLiu » Tue Oct 16, 2018 5:40 am

but why the space size obtained by API is smaller than the actual space size?

scplatform
Posts: 39
Joined: Wed Aug 31, 2016 9:55 pm
Points :372
Contact:

Re: how to get the available space of chip?

Post by scplatform » Wed Oct 24, 2018 12:18 am

do it like this:

Code: Select all

while (true) {
	try {
		bbb = JCSystem.makeTransientByteArray(memsize, JCSystem.MEMORY_TYPE_TRANSIENT_DESELECT);
		allmemsize += memsize;
		if(memsize != 0x7fff)
			break;
	} catch (CardRuntimeException ex) {
		memsize -= 1;
		continue;
	}
}

DaHuFa
Posts: 53
Joined: Mon Jun 04, 2018 5:07 am
Points :392
Contact:

Re: how to get the available space of chip?

Post by DaHuFa » Wed Oct 24, 2018 2:17 am

In 《JavaCardAPI》, one item in Notes of getAvailableMemory() is "If the number of available bytes is greater than 32767, then this method returns 32767."
So, if the return value is 32767, you should call getAvailableMeory() again to look up whether the card has more available memory.

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: Google [Bot] and 56 guests

JavaCard OS : Disclaimer