This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
r502-api-manual [2017/05/11 02:24] jinbiao [1. Constructor and initialization] |
r502-api-manual [2017/05/15 08:32] (current) Tarantino |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | + | ====== R502 Spy Library API Manual ====== | |
- | R502 Spy Library is an operation API library of R502 SPY reader. Now it contains ISO14443 TypeA protocol debug API interface, Mifare Classic card command debug API interface. | + | |
- | For any question, please contact [[https:/mailto:javacardos@gmail.com|javacardos@gmail.com]] . | + | R502 Spy Library is an operation API library of R502 SPY reader. Now it contains ISO14443 TypeA protocol debug API interface, Mifare Classic card command debug API interface. |
+ | For any question, please contact [[https:/mailto:javacardos@gmail.com|javacardos@gmail.com]] . | ||
Line 8: | Line 9: | ||
=== Constructor === | === Constructor === | ||
- | + | * Parameter: scinterface | |
- | * Parameter: scinterface | + | |
- | \\ | + | * Return: Smartcard debug object. |
- | + | ||
- | + | ||
- | + | ||
- | * Return: Smartcard debug object. | + | |
- | \\ | + | |
=== init() === | === init() === | ||
- | + | * Function: Initialization. | |
- | * Function: Initialization. | + | |
- | \\ | + | * Parameter: Null. |
- | + | ||
- | + | * Return: Null. | |
- | + | ||
- | *Parameter: Null. | + | |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: Null. | + | |
- | \\ | + | |
====2. Related contactless API==== | ====2. Related contactless API==== | ||
=== rfOn() === | === rfOn() === | ||
+ | * Function: Open smartcard reader electromagnetic field. | ||
- | *Function: Open smartcard reader electromagnetic field. | + | * Parameter: Null. |
- | \\ | + | |
- | + | * Return: | |
- | + | - True if the command is executed successfully. | |
- | + | - False if failed to execute the command. | |
- | *Parameter: Null. | + | |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - True if the command is executed successfully. | + | |
- | - False if failed to execute the command. | + | |
- | \\ | + | |
=== rfOff() === | === rfOff() === | ||
- | + | * Function: Close smartcard reader electromagnetic field. | |
- | *Function: Close smartcard reader electromagnetic field. | + | |
- | \\ | + | * Parameter: Null. |
- | + | ||
- | + | * Return: | |
- | + | - True if the command is executed successfully. | |
- | *Parameter: Null. | + | - False if failed to execute the command. |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - True if the command is executed successfully. | + | |
- | - False if failed to execute the command. | + | |
- | \\ | + | |
=== rfAuto() === | === rfAuto() === | ||
- | + | * Function: Set smartcard reader debug function to automatic status. In this status, anti-collision will be completed automatically. | |
- | *Function: Set smartcard reader debug function to automatic status. In this status, anti-collision will be completed automatically. | + | |
- | \\ | + | * Parameter: Null. |
- | + | ||
- | + | * Return: | |
- | + | - True if the command is executed successfully. | |
- | *Parameter: Null. | + | - False if failed to execute the command. |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - True if the command is executed successfully. | + | |
- | - False if failed to execute the command. | + | |
- | \\ | + | |
=== rfManaul() === | === rfManaul() === | ||
- | + | * Function: Set smartcard reader debug function to manual operation status. In this status, anti-collision program will be implemented by calling API interface. | |
- | *Function: Set smartcard reader debug function to manual operation status. In this status, anti-collision program will be implemented by calling API interface. | + | |
- | \\ | + | * Parameter: Null. |
- | + | ||
- | + | * Return: | |
- | + | - True if the command is executed successfully. | |
- | *Parameter: Null. | + | - False if failed to execute the command. |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - True if the command is executed successfully. | + | |
- | - False if failed to execute the command. | + | |
- | \\ | + | |
====3. ISO14443 TypeA protocol API==== | ====3. ISO14443 TypeA protocol API==== | ||
=== claREQA(commandValue) === | === claREQA(commandValue) === | ||
+ | * Function: Send REQA command of ISO14443 TypeA. | ||
+ | |||
+ | * Parameter: commandValue: the value of command. It is 0x26 as defined in ISO14443 specification. | ||
- | *Function: Send REQA command of ISO14443 TypeA. | + | * Return: |
- | \\ | + | - (True, command response value: ATQA) if the command is executed successfully. |
- | + | - (False, error code) if failed to execute the command. | |
- | + | ||
- | + | ||
- | *Parameter: commandValue: the value of command. It is 0x26 as defined in ISO14443 specification. | + | |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - (True, command response value: ATQA) if the command is executed successfully. | + | |
- | - (False, error code) if failed to execute the command. | + | |
- | \\ | + | |
=== claWUPA(commandValue) === | === claWUPA(commandValue) === | ||
- | + | * Function: Send WUPA command of ISO14443 TypeA. | |
- | *Function: Send WUPA command of ISO14443 TypeA. | + | |
- | \\ | + | * Parameter: commandValue: the value of command. It is 0x52 as defined in ISO14443 specification. |
- | + | ||
- | + | * Return: | |
- | + | - (True, command response value: ATQA) if the command is executed successfully. | |
- | *Parameter: commandValue: the value of command. It is 0x52 as defined in ISO14443 specification. | + | - (False, error code) if failed to execute the command. |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - (True, command response value: ATQA) if the command is executed successfully. | + | |
- | - (False, error code) if failed to execute the command. | + | |
- | \\ | + | |
=== claAnticollision(commandValue) === | === claAnticollision(commandValue) === | ||
+ | * Function: Send ANTICOLLISION command of ISO14443 TypeA. | ||
- | *Function: Send ANTICOLLISION command of ISO14443 TypeA. | + | * Parameter: commandValue: the value of command. e.g.: e.g.: ‘93 20’, ‘95 20’, ‘97 20’. |
- | \\ | + | |
- | + | * Return: | |
- | + | - (True, command response value: UID CLn) if the command is executed successfully. | |
- | + | - (False, error code) if failed to execute the command. | |
- | *Parameter: commandValue: the value of command. e.g.: ‘93 20’, ‘95 20’, ‘97 20’. | + | |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - (True, command response value: UID CLn) if the command is executed successfully. | + | |
- | - (False, error code) if failed to execute the command. | + | |
- | \\ | + | |
=== claSelect(commandValue) === | === claSelect(commandValue) === | ||
+ | * Function: Send SELECT command of ISO14443 TypeA. | ||
- | *Function: Send SELECT command of ISO14443 TypeA. | + | * Parameter: commandValue: the value of command. e.g.: ‘93 70’ + UID, ‘95 70’ + UID, ‘97 70’ + UID. |
- | \\ | + | |
- | + | * Return: | |
- | + | - (True, command response value: SAK) if the command is executed successfully. | |
- | + | - (False, error code) if failed to execute the command. | |
- | *Parameter: commandValue: the value of command. e.g.: ‘93 70’ + UID, ‘95 70’ + UID, ‘97 70’ + UID. | + | |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - (True, command response value: SAK) if the command is executed successfully. | + | |
- | - (False, error code) if failed to execute the command. | + | |
- | \\ | + | |
=== claRATS(commandValue) === | === claRATS(commandValue) === | ||
- | *Function: Send RATScommand of ISO14443 TypeA. | + | * Function: Send RATScommand of ISO14443 TypeA. |
- | \\ | + | |
- | + | * Parameter: commandValue: the value of command. The format defined in specification: he format defined in specification: ‘E0’ + Parameter byte. | |
- | + | ||
- | + | * Return: | |
- | *Parameter: commandValue: the value of command. The format defined in specification: ‘E0’ + Parameter byte. | + | - (True, command response value: ATS) if the command is executed successfully. |
- | \\ | + | - (False, error code) if failed to execute the command. |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - (True, command response value: ATS) if the command is executed successfully. | + | |
- | - (False, error code) if failed to execute the command. | + | |
- | \\ | + | |
=== claHLTA(commandValue) === | === claHLTA(commandValue) === | ||
+ | * Function:Send HLTA command of ISO14443 TypeA. | ||
- | *Function:Send HLTA command of ISO14443 TypeA. | + | * Parameter: commandValue: the value of command. The format defined in specification: ‘50 00’. |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Parameter: commandValue: the value of command. The format defined in specification: ‘50 00’. | + | |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - (True, command response value) if the command is executed successfully. | + | |
- | - (False, error code) if failed to execute the command. | + | |
- | \\ | + | |
+ | * Return: | ||
+ | - (True, command response value) if the command is executed successfully. | ||
+ | - (False, error code) if failed to execute the command. | ||
+ | |||
=== claPPS(commandValue) === | === claPPS(commandValue) === | ||
+ | * Function:Send PPS command of ISO14443 TypeA. | ||
- | *Function:Send PPS command of ISO14443 TypeA. | + | * Parameter: commandValue: the value of command. The format defined in specification: PPSS + PPS0 + PPS1. |
- | \\ | + | |
- | + | * Return: | |
- | + | - (True, command response value) if the command is executed successfully. | |
- | + | - (False, error code) if failed to execute the command. | |
- | *Parameter: commandValue: the value of command. The format defined in specification: PPSS + PPS0 + PPS1. | + | |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - (True, command response value) if the command is executed successfully. | + | |
- | - (False, error code) if failed to execute the command. | + | |
- | \\ | + | |
====4. ISO14443 Block protocol API==== | ====4. ISO14443 Block protocol API==== | ||
=== clTransmit(commandValue) === | === clTransmit(commandValue) === | ||
- | + | * Function: Send ISO14443 block. | |
- | *Function: Send ISO14443 block. | + | |
- | \\ | + | * Parameter: commandValue: the value of command. It can be I-Block, R-Block or S-Block. |
- | + | ||
- | + | * Return: | |
- | + | - (True, block response value) if the command is executed successfully. | |
- | *Parameter: commandValue: the value of command. It can be I-Block, R-Block or S-Block. | + | - (False, error code) if failed to execute the command. |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - (True, block response value) if the command is executed successfully. | + | |
- | - (False, error code) if failed to execute the command. | + | |
- | \\ | + | |
====5. MIFARE Command API==== | ====5. MIFARE Command API==== | ||
=== mifareAuthentication(commandValue) === | === mifareAuthentication(commandValue) === | ||
- | + | * Function: Send MIFARE Authentication command. | |
- | *Function: Send MIFARE Authentication command. | + | |
- | \\ | + | * Parameter: commandValue: the value of command.Auth type + Mifare Block Addr + (authentication key(6 bytes) + UID). |
- | + | ||
- | + | * Return: | |
- | + | - (True, ‘’) if the command is executed successfully. | |
- | *Parameter: commandValue: the value of command.Auth type + Mifare Block Addr + (authentication key(6 bytes) + UID). | + | - (False, error code) if failed to execute the command. |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - (True, ‘’) if the command is executed successfully. | + | |
- | - (False, error code) if failed to execute the command. | + | |
- | \\ | + | |
=== mifareBlockRead(commandValue) === | === mifareBlockRead(commandValue) === | ||
+ | * Function: Send MIFARE Read command. | ||
- | *Function: Send MIFARE Read command. | + | * Parameter: commandValue: the value of command.It is 0x30 + Mifare Block Addr. |
- | \\ | + | |
- | + | * Return: | |
- | + | - (True, block data) if the command is executed successfully. | |
- | *Parameter: commandValue: the value of command.It is 0x30 + Mifare Block Addr. | + | - (False, error code) if failed to execute the command. |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - (True, block data) if the command is executed successfully. | + | |
- | - (False, error code) if failed to execute the command. | + | |
- | \\ | + | |
=== mifareBlockWrite(commandValue) === | === mifareBlockWrite(commandValue) === | ||
+ | * Function: Send MIFARE Write command. | ||
- | *Function: Send MIFARE Write command. | + | * Parameter: commandValue: the value of command It is 0xA0 + Mifare Block Addr + Data(16bytes). |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Parameter: commandValue: the value of command.It is 0xA0 + Mifare Block Addr + Data(16bytes). | + | |
- | \\ | + | |
- | + | ||
- | *Return: | + | * Return: |
- | - (True, ‘’) if the command is executed successfully. | + | - (True, ‘’) if the command is executed successfully. |
- | - (False, error code) if failed to execute the command. | + | - (False, error code) if failed to execute the command. |
- | \\ | + | |
=== mifareIncrement(commandValue) === | === mifareIncrement(commandValue) === | ||
+ | * Function: Send MIFARE Increment command. | ||
- | *Function: Send MIFARE Increment command. | + | * Parameter: commandValue: the value of command.It is 0xC1 + Mifare Block Addr + Data(16 bytes). |
- | \\ | + | |
- | + | * Return: | |
- | + | - (True, ‘’) if the command is executed successfully. | |
- | *Parameter: commandValue: the value of command.It is 0xC1 + Mifare Block Addr + Data(16 bytes). | + | - (False, error code) if failed to execute the command. |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - (True, ‘’) if the command is executed successfully. | + | |
- | - (False, error code) if failed to execute the command. | + | |
- | \\ | + | |
=== mifareDecrement(commandValue) === | === mifareDecrement(commandValue) === | ||
+ | * Function: Send MIFARE Decrement command. | ||
- | *Function: Send MIFARE Decrement command. | + | * Parameter: commandValue: the value of command.It is 0xC0 + Mifare Block Addr + Data(16bytes). |
- | \\ | + | |
- | + | * Return: | |
- | + | - (True, ‘’) if the command is executed successfully. | |
- | *Parameter: commandValue: the value of command.It is 0xC0 + Mifare Block Addr + Data(16bytes). | + | - (False, error code) if failed to execute the command. |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - (True, ‘’) if the command is executed successfully. | + | |
- | - (False, error code) if failed to execute the command. | + | |
- | \\ | + | |
=== mifareRestore (commandValue) === | === mifareRestore (commandValue) === | ||
+ | * Function: Send MIFARE Restore command. | ||
- | * Function: Send MIFARE Restore command. | + | * Parameter: commandValue: the value of command.It is 0xC2 + Mifare Block Addr + Data(16bytes). |
- | \\ | + | |
- | + | * Return: | |
- | + | - (True, ‘’) if the command is executed successfully. | |
- | *Parameter: commandValue: the value of command.It is 0xC2 + Mifare Block Addr + Data(16bytes). | + | - (False, error code) if failed to execute the command. |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Return: | + | |
- | - (True, ‘’) if the command is executed successfully. | + | |
- | - (False, error code) if failed to execute the command. | + | |
- | \\ | + | |
=== mifareTransfer(commandValue) === | === mifareTransfer(commandValue) === | ||
+ | * Function: Send MIFARE Transfer command. | ||
- | *Function: Send MIFARE Transfer command. | + | * Parameter: commandValue: the value of command.It is 0xB0. |
- | \\ | + | |
- | + | ||
- | + | ||
- | + | ||
- | *Parameter: commandValue: the value of command.It is 0xB0. | + | |
- | \\ | + | |
- | + | ||
- | *Return: | + | * Return: |
- | - (True, ‘’) if the command is executed successfully. | + | - (True, ‘’) if the command is executed successfully. |
- | - (False, error code) if failed to execute the command. | + | - (False, error code) if failed to execute the command. |
- | \\ | + | |