1

How to Know Available bytes in Serial Port?

  • private InputStream mInputStream;
    int readavailableBytes = mInputStream.available();

Answer: A private InputStream mInputStream;
int readavailableBytes = mInputStream.available();
Description:

2

How to read available bytes from Serial Port?

  • private InputStream mInputStream;
    int readavailableBytes = mInputStream.available();
    private byte Buffer = new byte[20];
    mInputStream.read(Buffer, 0, readavailableBytes);

Answer: A private InputStream mInputStream;
int readavailableBytes = mInputStream.available();
private byte Buffer = new byte[20];
mInputStream.read(Buffer, 0, readavailableBytes);
Description:

3

What is LineNumberReader ?

  • Constructs a new LineNumberReader on the Reader in. The internal buffer gets the default size (8 KB).

Answer: A Constructs a new LineNumberReader on the Reader in. The internal buffer gets the default size (8 KB).
Description:

4

how to know available drivers in Serial Port ?

  • LineNumberReader r = new LineNumberReader(new FileReader("/proc/tty/drivers"));

Answer: A LineNumberReader r = new LineNumberReader(new FileReader("/proc/tty/drivers"));
Description:

5

What are the steps to load JNI files into Android?

  • private native static FileDescriptor open(String path, int baudrate);
    public native void close();
    static {
    System.loadLibrary("serial_port");
    }

Answer: A private native static FileDescriptor open(String path, int baudrate);
public native void close();
static {
System.loadLibrary("serial_port");
}
Description:

6

How do you check File Check access permission ?

  • public SerialPort(File device, int baudrate) throws SecurityException, IOException {
    device.canRead()
    device.canWrite()) here

    File : The actual file referenced by a File may or may not exist. It may also, despite the name File, be a directory or other non-regular file.

    This class provides limited functionality for getting/setting file permissions, file type, and last modified time.

Answer: A public SerialPort(File device, int baudrate) throws SecurityException, IOException {
device.canRead()
device.canWrite()) here

File : The actual file referenced by a File may or may not exist. It may also, despite the name File, be a directory or other non-regular file.

This class provides limited functionality for getting/setting file permissions, file type, and last modified time.
Description:

7

What is Baud Rate?

  • a data transmission rate (bits/second)

Answer: A a data transmission rate (bits/second)
Description:

8

Near Field Communication (NFC) is a set of short-range wireless technologies, typically requiring a distance of 4cm or less to initiate a connection.

  • Near Field Communication (NFC) is a set of short-range wireless technologies, typically requiring a distance of 4cm or less to initiate a connection.

Answer: A Near Field Communication (NFC) is a set of short-range wireless technologies, typically requiring a distance of 4cm or less to initiate a connection.

Description:

9

Which type of RFID cards work with NFC?

  • SIZE_1K Tag contains 16 sectors, each with 4 blocks.
    SIZE_2K Tag contains 32 sectors, each with 4 blocks.
    SIZE_4K Tag contains 40 sectors.
    SIZE_MINI Tag contains 5 sectors, each with 4 blocks.
    TYPE_CLASSIC A MIFARE Classic tag
    TYPE_PLUS A MIFARE Plus tag
    TYPE_PRO A MIFARE Pro tag
    TYPE_UNKNOWN A MIFARE Classic compatible card of unknown type

Answer: A SIZE_1K Tag contains 16 sectors, each with 4 blocks.
SIZE_2K Tag contains 32 sectors, each with 4 blocks.
SIZE_4K Tag contains 40 sectors.
SIZE_MINI Tag contains 5 sectors, each with 4 blocks.
TYPE_CLASSIC A MIFARE Classic tag
TYPE_PLUS A MIFARE Plus tag
TYPE_PRO A MIFARE Pro tag
TYPE_UNKNOWN A MIFARE Classic compatible card of unknown type
Description:

10

How to discover Tag automatically?

  • if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)
    || NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)
    || NfcAdapter.ACTION_TECH_DISCOVERED.equals(action))

Answer: A if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)
|| NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)
|| NfcAdapter.ACTION_TECH_DISCOVERED.equals(action))
Description:

11

What is NFC Tag?

  • Tag is an immutable object that represents the state of a NFC tag at the time of discovery. It can be used as a handle to TagTechnology classes to perform advanced operations, or directly queried for its ID via getId() and the set of technologies it contains via getTechList(). Arrays passed to and returned by this class are not cloned, so be careful not to modify them

Answer: A Tag is an immutable object that represents the state of a NFC tag at the time of discovery. It can be used as a handle to TagTechnology classes to perform advanced operations, or directly queried for its ID via getId() and the set of technologies it contains via getTechList(). Arrays passed to and returned by this class are not cloned, so be careful not to modify them
Description:

12

how to find TAG UID?

  • Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
    String UID = tag.getId()

Answer: A Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
String UID = tag.getId()
Description:

13

What are the methods to Authenticate Sectors?

  • MifareClassic mfc = MifareClassic.get(TAG);
    mfc.connect();
    auth = mfc.authenticateSectorWithKeyA(0, MifareClassic.KEY_DEFAULT);
    auth = mfc.authenticateSectorWithKeyB(0, MifareClassic.KEY_DEFAULT);

Answer: A MifareClassic mfc = MifareClassic.get(TAG);
mfc.connect();
auth = mfc.authenticateSectorWithKeyA(0, MifareClassic.KEY_DEFAULT);
auth = mfc.authenticateSectorWithKeyB(0, MifareClassic.KEY_DEFAULT);

Description:

14

How do you read and write mifare cards

  • to write

    public void writeBlock (int blockIndex, byte[] data)
    before writing find MifareClassic.BLOCK_SIZE

    to Read
    public byte[] readBlock (int blockIndex)

Answer: B to write

public void writeBlock (int blockIndex, byte[] data)
before writing find MifareClassic.BLOCK_SIZE

to Read
public byte[] readBlock (int blockIndex)
Description:

15

How to protect data in Mifare Card?

  • Write block with Custom Key instead of MifareClassic.KEY_DEFAULT

Answer: A Write block with Custom Key instead of MifareClassic.KEY_DEFAULT

16

How to Lunch App when TAG detected?

  • add these to your MainActivity in Manifest File

    <intent-filter android:priority="100" >
    <action android:name="android.nfc.action.TAG_DISCOVERED" />

    <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
    <intent-filter android:priority="101" > <action android:name="android.nfc.action.NDEF_DISCOVERED" />

    <category android:name="android.intent.category.DEFAULT" />
    <intent-filter>
    <intent-filter android:priority="102" >
    <action android:name="android.nfc.action.TECH_DISCOVERED" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>

Answer: A add these to your MainActivity in Manifest File

<intent-filter android:priority="100" >
<action android:name="android.nfc.action.TAG_DISCOVERED" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter android:priority="101" > <action android:name="android.nfc.action.NDEF_DISCOVERED" />

<category android:name="android.intent.category.DEFAULT" />
<intent-filter>
<intent-filter android:priority="102" >
<action android:name="android.nfc.action.TECH_DISCOVERED" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
Description: