According to GSM 43.019, the sim.toolkit MEProfile class offers to possibility to copy the handset profile into a buffer:
public static short copy(short startOffset, byte dstBuffer, short dstOffset, short dstLength)
And based on the API, the list of facilities contains 134 items.
I've had a look on https://terminal-profile.osmocom.org/ and it seems like the length can vary a lot depending on the handset. They get the profile by using a spy tool (which sits between SIM and ME). I would like to retrieve the profile by using an STK Applet (copy-method).
The question is: How can I find out the length of the handset profile, so what should be the size of "dstLength" ?
Unfortunately, you can not get the Terminal Profile length send by ME/terminal from the API.
However, you can set dstLength as fixed 19 bytes (see 3GPP TS 11.14 chapter 5.2), and then calculate the length as the last non-zero bytes.
If you get exception when using 19 (most likely because MEProfile buffer size is smaller), set it to lower until there is no exception.
Hope that helps!
TP: FF 00 FF 00 FF 00 00 and TP: FF 00 FF 00 FF both have the same meaning (non-existent byte equals zeroes bit = facilities not supported by ME)
You shall discuss the requirement with the customer and choose between fixed length or consecutive non-zeroes.