2

I am trying to talk to a ISO15693 Tag. Tag type is TI HF-I Plus. When I issue a Get System Info command, the command executes normally and a proper response is received. For most other commands sent to the tag, the framework does not seem to handle the response properly. TAG LOST exception is thrown for most other commands. Has anyone successfully implemented ISO15693 commands in Android ?

Source code:

@Override
protected byte[] doInBackground(byte[]... params) {

    NfcV mNfcVObject = NfcV.get(mTag);
    byte[] mCommand = null;

    switch(params[0][0]){
        case ReadSingleBlock:
            mCommand = new byte[]{0x02, 0x20, params[1][0]};
            break;
        case ReadMultipleBlocks:
            mCommand = new byte[]{0x02, 0x23,params[1][0],params[2][0]};
            break;
        case WriteSingleBlock:
            mCommand = new byte[]{0x42, 0x21, (byte)params[1][0],params[2][0],params[2][1],params[2][2],params[2][3]};
            break;
        case GetSystemInfo:
            mCommand = new byte[]{0x00,(byte)0x2B};
            break;
    }


    if (mNfcVObject != null) {
        try {
            mNfcVObject.connect();
        } catch (IOException e) {
            e.printStackTrace();
            Log.e(LOG_TAG, e.toString());
        }

        if (mNfcVObject.isConnected()) {

            int i = 0;

                try {
                    mResponse = mNfcVObject.transceive(mCommand);
                    String responseString = FlomioNdefHelper.mBytesToHexString(mResponse);
                    Log.d(String.format(LOG_TAG + " Response %d", i), responseString);
                } catch (IOException e) {
                    e.printStackTrace();
                    Log.e(LOG_TAG, e.toString());
                }

            try {
                mNfcVObject.close();
            } catch (IOException e) {
                e.printStackTrace();
                Log.e(LOG_TAG, e.toString());
            }
        }
    }

    return mResponse;
}

@Override
protected void onPostExecute(byte[] response) {
    super.onPostExecute(response);
    mOnCommandExecutedCallBack.onCommandExecuted(response);
    return;
}
Michael Roland
  • 39,663
  • 10
  • 99
  • 206
perceptron
  • 167
  • 2
  • 13
  • Could you show some of your source code? – NFC guy Jun 04 '13 at 22:28
  • @NFC guy updated the post to include the code. Actually, this problem still exists. However for time being I am reading back the each block from the ISO15693 tag(since Read Single Block command works) to verify my write operation(Write operation to single block or multiple blocks fails with TAG_LOST Exception). – perceptron Jun 12 '13 at 00:18
  • @NFC guy Also I see from your post here, http://stackoverflow.com/questions/10277337/why-i-cant-read-st-m24lr64-as-ndef-messages-with-android-nfc, you say NfcV Object is supported on Nexus 4. Are you saying, if TI's ISO15693 tag, Plus, Pro or Standard is tapped against a Nexus 4, the intent will go to to NDEF_Discovered instead of TAG_Discovered ? – perceptron Jun 12 '13 at 00:19
  • Yes, if the tag is formatted to contain NDEF content, the NFC intent action can be NDEF_DISCOVERED (if there are apps that filter for the specific NDEF message type read from the tag). – NFC guy Jun 29 '13 at 23:37

0 Answers0