com.BTPaySDK
Class BTPay_SDK

java.lang.Object
  extended by com.BTPaySDK.BTPay_SDK
All Implemented Interfaces:
com.BTPaySDK.OnReceiverBluetooth

public class BTPay_SDK
extends java.lang.Object
implements com.BTPaySDK.OnReceiverBluetooth

It is the constructor of the main class BTPay_SDK.

Version:
V1.04.
Author:
Nianlong Yu ID TECH(ShangHai).

Nested Class Summary
static class BTPay_SDK.CAPTURE_ENCODE_TYPE
          Define Card type.
static class BTPay_SDK.CAPTURE_ENCRYPT_TYPE
          Define encrypted type.
static class BTPay_SDK.EVENT_MSR_Types
          Define MSR type.
 
Constructor Summary
BTPay_SDK(OnReceiverListener mL, Context c)
          Create SDK object and implement interface OnMSRListener.
 
Method Summary
 void close()
          Close and release the Bluetooth resource.
 int config_getDateTime(java.lang.StringBuilder dateTime)
          Get the date and time of device.
 int config_getInterfaceDeviceSN(java.lang.StringBuilder serialNumber)
          Get interface device's serial number.
 int config_getLanguageType(byte[] lanType)
          Get Language Type.
 int config_getModelNumber(java.lang.StringBuilder modNumber)
          Get the model number of device.
 int config_getSDKVersion(java.lang.StringBuilder sdkVersion)
          Get the version of SDK.
 int config_getSerialNumber(java.lang.StringBuilder serialNumber)
          Get the serial number of device.
 int config_getTerminalIdentification(java.lang.StringBuilder termIden)
          Get Get terminal identification.
 int config_setBluetoothAddress(java.lang.String strAddress)
          Set Bluetooth address.
 int config_setDateTime(java.lang.String dateTime)
          Set the date and time to device.
 int config_setInterfaceDeviceSN(java.lang.String serNumber)
          Set Interface device's serial number.
 int config_setLanguageType(byte lanType)
          Set Language Type.
 int config_setSerialNumber(java.lang.String serNumber)
          Set the serial number to device.
 int config_setTerminalIdentification(java.lang.String termIden)
          Set terminal identification.
 void connect()
          Connect device with the Bluetooth interface.
 void connect(java.lang.String address)
          Connect device with the Bluetooth interface.
 int device_getFirmwareVersion(java.lang.StringBuilder version)
          Get the firmware version of device.
 java.lang.String device_getResponseCodeString(int errorCode)
          Get Response Code String.
 int device_rebootDevice()
          Reboot device.The device will restart and need to reconnect device if success.
 int device_sendBeep(int frequency, int duration)
          Control the device's beeper.
 int device_uploadJPEG(int pID, int pType, byte[] pData)
          Store picture in the device.
 int emv_completeOnlineEMVTransaction(byte onlineAuth, byte[] dataBuf)
          Complete Online Authorization transaction;the API need to be used if API emv_startEMVTransaction returns EMV_RESULT_CODE_GO_ONLINE.
 int emv_getEMVKernelVersion(java.lang.StringBuilder emvVersion)
          Get the EMV L2 Version.
 int emv_removeApplicationData(java.lang.String strAID)
          Removes the Application Data by AID name passed as the parameter.
 int emv_removeCAPK(java.lang.String rid, java.lang.String index)
          Removes Certificate Authority Public Key by the RID/Index.
 int emv_removeCRL(CRLDataStruct dataBuf)
          Removes all CRL as specified by the RID and Index passed as a parameter in the CRLDataStruct class.
 int emv_removeCRLUnit(CRLDataStruct dataBuf)
          Removes a single CRL data as specified by the RID/Index/Serial Number passed as a parameter in the CRLDataStruct class.
 int emv_removeTerminalData()
          Removes the Terminal data.
 int emv_retrieveAIDList(ResDataStruct dataBuf)
          Retrieves all the AID name/length.
 int emv_retrieveApplicationData(java.lang.String AID, ApplicationIDStruct ResponseAID)
          Retrieves Application Data by AID.Retrieves the Application Data as specified by the AID name passed as a parameter.
 int emv_retrieveCAPK(java.lang.String rid, java.lang.String index, CAKeyStruct dataBuf)
          Retrieves Certificate Authority Public Key by the RID/Index.
 int emv_retrieveCAPKList(ResDataStruct dataBuf)
          Retrieves the Certificate Authority Public Key list.
 int emv_retrieveCRLForRID(java.lang.String rid, ResDataStruct dataBuf)
          Retrieve the Certificate Revocation List specific to RID,returns all the serial numbers for a specific RID on the CRL.
 int emv_retrieveCRLList(ResDataStruct dataBuf)
          Retrieves all the RID in the CRL.
 int emv_retrieveTerminalData(TerminalDataStruct dataBuf)
          Retrieves the Terminal data.
 int emv_setApplicationData(ApplicationIDStruct data)
          Set application data by AID.
 int emv_setCAPK(CAKeyStruct dataBuf)
          Sets Certificate Authority Public Key .
 int emv_setCRL(CRLDataStruct dataBuf)
          Sets the CRL data as specified by the CRLDataStruct class.
 int emv_setTerminalData(TerminalDataStruct dataBuf)
          Sets the Terminal data.
 int emv_startEMVTransaction(float amount, float amtOther, int timeOut1, int timeOut2, byte transType, byte[] dataBuf)
          Start EMV transaction request,Authorizes the EMV transaction for an ICC card.
The result code,tags and error code will be returned by emvTransactionData in interface OnReceiverListener.
 int icc_exchangeAPDU(byte[] dataAPDU, APDUResponseStruct response)
          Exchange APDU between the currently selected microprocessor card in the ICC reader.
 int icc_exchangeEncryptedAPDU(byte[] dataAPDU, byte[] ksn, APDUResponseStruct response)
          Exchange APDU between the currently selected microprocessor card in the ICC reader.
 int icc_getCurrentKSN(ResDataStruct resKSN)
          Get the current KSN for Smart card.
 int icc_getICCReaderStatus(ICCReaderStatusStruct ICCStatus)
          Get ICC Reader microprocessor card status.
 int icc_powerOffICC()
          Power down the currently selected microprocessor card in the ICC reader.
 int icc_powerOnICC(PowerOnStructure options, ResDataStruct atrPPS)
          Power up the currently selected microprocessor card in the ICC reader.
 int lcd_displayMessage(java.lang.String line1, java.lang.String line2, java.lang.String line3, java.lang.String line4)
          Display message.
 int lcd_setIdleTimeForSleep(int idleTime)
          Set the time before the device into sleep mode.
 int lcd_setSleepMode(boolean sleepMode)
          Change device the state of sleep mode.
 int lcd_showJPEG(int pID, int X0, int Y0, int X1, int Y1)
          Show stored picture on the LCD.
 int msr_cancelMSRSwipe()
          Disable MSR swipe card.
 int msr_defaultAllSetting()
          Default all setting of Mask and Encryption.
 int msr_getSingleSetting(byte funcID, byte[] response)
          Get single setting of Mask and Encryption by Function ID.
 int msr_reviewAllSetting(MSRSettingStruct msrSetting)
          Review all setting of Mask and Encryption.
 int msr_setSingleSetting(byte funcID, byte setData)
          Set single setting of Mask and Encryption by Function ID.
 int msr_startMSRSwipeWithDisplay(java.lang.String line1, java.lang.String line2, java.lang.String line3, java.lang.String line4)
          Enable MSR swipe card.
 void OnConnectBluetooth()
           
 int pin_cancelPin()
          Cancel enter from keypad,includes PIN,Numeric,Account,Encrypted data,Function Key and Amount.
 int pin_getAmount(byte iMax, byte iMin, int kID, java.lang.String lang)
          Get amount key code from keypad, Returns value of entered amount in pinpadData of interface OnReceiverListener.
 int pin_getCardAccount(int iMax, int iMin, java.lang.String line1, java.lang.String line2)
          Get Card account number from keyboad,Returns value of entered account numbers in pinpadData of interface OnReceiverListener.
 int pin_getEncryptedData(boolean eFlag, int iMax, int iMin, int kID, java.lang.String lang)
          Get encrypted data,Returns value of entered data in pinpadData of interface OnReceiverListener.
 int pin_getEncryptedPIN(byte kType, java.lang.String account, java.lang.String line1, java.lang.String line2, java.lang.String line3)
          Get Encrypted PIN from keyboard,Returns pinblock/ksn of entered PIN value in pinpadData of interface OnReceiverListener.
 int pin_getFunctionKey()
          Get Function Key from keyboard, Returns value of pressed key in pinpadData of interface OnReceiverListener.
 int pin_getNumeric(boolean m_eFlag, byte m_iMax, byte m_iMin, int kID, java.lang.String lang)
          Get numeric key code from keypad,Returns value of entered numeric key in pinpadData of interface OnReceiverListener.
.
 int pin_getPinLength(byte[] lenBuf)
          Get Encrypted PIN length.
 int pin_getPINpadStatus(byte[] response)
          Get PINPad status.
 int pin_setPinLength(int m_iMin, int m_iMax)
          Set Encrypted PIN length.
 int StringToHex(java.lang.String str, byte[] buff)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BTPay_SDK

public BTPay_SDK(OnReceiverListener mL,
                 Context c)
Create SDK object and implement interface OnMSRListener.

Parameters:
mL - for object of interface OnMSRListener.
Method Detail

connect

public void connect(java.lang.String address)
Connect device with the Bluetooth interface. It need "connect" the device before calling any other API.
success:Fires deviceConnected.
Fail: Fires deviceDisconnected.

Parameters:
address - the Bluetooth MAC address.
Valid Bluetooth hardware addresses must be upper case, in a format such as "00:11:22:33:AA:BB".

connect

public void connect()
Connect device with the Bluetooth interface. It need "connect" the device before calling any other API.
success:Fires deviceConnected.


close

public void close()
Close and release the Bluetooth resource.


device_getResponseCodeString

public java.lang.String device_getResponseCodeString(int errorCode)
Get Response Code String.

Parameters:
errorCode - Error code returns by other APIs.
Returns:
the string for error code.

device_getFirmwareVersion

public int device_getFirmwareVersion(java.lang.StringBuilder version)
Get the firmware version of device.

Parameters:
version - for version string.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

config_getSDKVersion

public int config_getSDKVersion(java.lang.StringBuilder sdkVersion)
Get the version of SDK.

Parameters:
sdkVersion - for version string.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

config_getModelNumber

public int config_getModelNumber(java.lang.StringBuilder modNumber)
Get the model number of device.

Parameters:
modNumber - for Model Number.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

config_getSerialNumber

public int config_getSerialNumber(java.lang.StringBuilder serialNumber)
Get the serial number of device.

Parameters:
serialNumber - for Serial Number.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

config_setSerialNumber

public int config_setSerialNumber(java.lang.String serNumber)
Set the serial number to device.

Parameters:
serNumber - for Serial Number string;9 or 10 bytes ASCII, from 0x20 to 0x7F.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

config_getDateTime

public int config_getDateTime(java.lang.StringBuilder dateTime)
Get the date and time of device.

Parameters:
dateTime - the device's date and time, 20121123122459.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

config_setDateTime

public int config_setDateTime(java.lang.String dateTime)
Set the date and time to device.

Parameters:
dateTime - the date and time in hex string,12 characters.If date is: 2012/11/23 12:24:59, dateTime should be 121123122459.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

config_getLanguageType

public int config_getLanguageType(byte[] lanType)
Get Language Type.

Parameters:
lanType - lanType[0]is the Language type. 0x01:English;0x02:Portuguese;0x03:Spanish.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

config_setLanguageType

public int config_setLanguageType(byte lanType)
Set Language Type.

Parameters:
lanType - lanType is the Language type.0x01:English;0x02:Portuguese;0x03:Spanish.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

device_sendBeep

public int device_sendBeep(int frequency,
                           int duration)
Control the device's beeper.

Parameters:
frequency - the Frequency of beeper;the range from 2000 to 4000.
duration - the duration of beeper; the range from 0 to 65536.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

lcd_setSleepMode

public int lcd_setSleepMode(boolean sleepMode)
Change device the state of sleep mode.

Parameters:
sleepMode - true:set the device to sleep mode; false:exit sleep mode.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

lcd_setIdleTimeForSleep

public int lcd_setIdleTimeForSleep(int idleTime)
Set the time before the device into sleep mode.

Parameters:
idleTime - the time(Second).
Returns:
success or error code.
See Also:
BTPay_ErrorCode

device_rebootDevice

public int device_rebootDevice()
Reboot device.The device will restart and need to reconnect device if success.

Returns:
success or error code.
See Also:
BTPay_ErrorCode

config_setBluetoothAddress

public int config_setBluetoothAddress(java.lang.String strAddress)
Set Bluetooth address. Note:This command mandatory modify the Bluetooth address, and then must re-start the BTPay device.

Parameters:
strAddress - Bluetooth address 12 characters.example "00:27:15:08:27:F7".
Returns:
success or error code.
See Also:
BTPay_ErrorCode

device_uploadJPEG

public int device_uploadJPEG(int pID,
                             int pType,
                             byte[] pData)
Store picture in the device. The picture's dimensions must not exceed the display resolution of 128 X 64.The picture must be RGB JPEG.

Parameters:
pID - for the identifier for the picture.
pType - for the picture's type.
pData - for the data of JPEG format.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

lcd_showJPEG

public int lcd_showJPEG(int pID,
                        int X0,
                        int Y0,
                        int X1,
                        int Y1)
Show stored picture on the LCD. Show stored picture on the LCD defined by top left point (X0,Y0) and bottom right point (X1,Y1).

Parameters:
pID - for the identifier for the picture;
X0 - for X-coordinate of top left point;
Y0 - for Y-coordinate of top left point;
X1 - for X-coordinate of bottom right point;
Y1 - for Y-coordinate of bottom right point. {X0}{Y0}{X1}{Y1} is scope of LCD, 0<="X0" < "X1"< 128, 0<="Y0" < "Y1" < 64.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

lcd_displayMessage

public int lcd_displayMessage(java.lang.String line1,
                              java.lang.String line2,
                              java.lang.String line3,
                              java.lang.String line4)
Display message.

Parameters:
line1 - Display line 1, up to 12 characters.
line2 - Display line 2, up to 16 characters.
line3 - Display line 3, up to 16 characters.
line4 - Display line 4, up to 16 characters.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

config_getInterfaceDeviceSN

public int config_getInterfaceDeviceSN(java.lang.StringBuilder serialNumber)
Get interface device's serial number.

Parameters:
serialNumber - for interface device's serial number string.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

config_setInterfaceDeviceSN

public int config_setInterfaceDeviceSN(java.lang.String serNumber)
Set Interface device's serial number. EMV serial Number can be set only once.

Parameters:
serNumber - for Serial Number string;8 bytes ASCII, from 0x20 to 0x7F.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

config_getTerminalIdentification

public int config_getTerminalIdentification(java.lang.StringBuilder termIden)
Get Get terminal identification.

Parameters:
termIden - for device terminal identification string.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

config_setTerminalIdentification

public int config_setTerminalIdentification(java.lang.String termIden)
Set terminal identification.

Parameters:
termIden - for terminal identification string;8 bytes ASCII, from 0x20 to 0x7F.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

icc_getICCReaderStatus

public int icc_getICCReaderStatus(ICCReaderStatusStruct ICCStatus)
Get ICC Reader microprocessor card status.

Parameters:
ICCStatus - the class for the microprocessor card status.please see ICCReaderStatusStruct class for more information.
Returns:
success or error code.
See Also:
ICCReaderStatusStruct, BTPay_ErrorCode

icc_powerOnICC

public int icc_powerOnICC(PowerOnStructure options,
                          ResDataStruct atrPPS)
Power up the currently selected microprocessor card in the ICC reader. It follows the ISO7816-3 power up sequence and returns the ATR as its response.

Parameters:
options - the options is optional.
please see PowerOnStructure class for more information.
atrPPS - the class for ATR string.
the ATR string is following:
1. 2D01: Card Not Supported;
2. 2D03: Card Not Supported, wants CRC;
3. 690D: Command not supported on reader without ICC support;
4. 8100: ICC error time out on power-up;
5. 8200: invalid TS character received;
6. 8500: PPS confirmation error;
7. 8600: Unsupported F, D, or combination of F and D;
8. 8700: protocol not supported EMV TD1 out of range;
9. 8800: power not at proper level;
10. 8900: ATR length too long;
11. 8B01: EMV invalid TA1 byte value*;
12. 8B02: EMV TB1 required*;
13. 8B03: EMV Unsupported TB1 only 00 allowed*;
14. 8B04: EMV Card Error, invalid BWI or CWI*;
15. 8B06: EMV TB2 not allowed in ATR*;
16. 8B07: EMV TC2 out of range*;
17. 8B08: EMV TC2 out of range*;
18. 8B09: per EMV96 TA3 must be > 0xF*;
20. 8B10: ICC error on power-up;
21. 8B11: EMV T=1 then TB3 required*;
22. 8B12: Card Error, invalid BWI or CWI;
23. 8B13: Card Error, invalid BWI or CWI;
24. 8B17: EMV TC1/TB3 conflict*;
25. 8B20: EMV TD2 out of range must be T=1*;
26. 8C00: TCK error;
27. A304: connector has no voltage setting;
28. A305: ICC error on power-up invalid (SBLK(IFSD) exchange;
29. E301: ICC error after session start

Returns:
success or error code.
See Also:
PowerOnStructure, BTPay_ErrorCode

icc_powerOffICC

public int icc_powerOffICC()
Power down the currently selected microprocessor card in the ICC reader.

Returns:
success or error code.
See Also:
BTPay_ErrorCode

icc_exchangeAPDU

public int icc_exchangeAPDU(byte[] dataAPDU,
                            APDUResponseStruct response)
Exchange APDU between the currently selected microprocessor card in the ICC reader. The max length of APDU is 512 bytes and the C-APDU is Plaintext.

Parameters:
dataAPDU - Plaintext APDU data buffer.
response - the class for response APDU,please see class APDUResponseStruct for more information.
The format of Raw response APDU Data Structure of [n bytes Encrypted R-APDU without Status Bytes] is below:
2 bytes Valid R-APDU Length + x bytes Valid R-APDU without Status Bytes + y bytes Padding.
Returns:
success or error code.
See Also:
APDUResponseStruct, BTPay_ErrorCode

icc_exchangeEncryptedAPDU

public int icc_exchangeEncryptedAPDU(byte[] dataAPDU,
                                     byte[] ksn,
                                     APDUResponseStruct response)
Exchange APDU between the currently selected microprocessor card in the ICC reader. The max length of APDU is 512 bytes and the C-APDU is Encrypted.

Parameters:
dataAPDU - Encrypted APDU data buffer.
The format of Raw C-APDU Data Structure of [m bytes Encrypted C-APDU] is below:
m = 2 bytes Valid C-APDU Length + x bytes Valid C-APDU + y bytes Padding (0x00).
ksn - 10 bytes Key Serial Number.
response - the class for response APDU,please see class APDUResponseStruct for more information.
The format of Raw response APDU Data Structure of [n bytes Encrypted R-APDU] is below:.
2 bytes Valid R-APDU Length + x bytes Valid R-APDU + y bytes Padding.
Returns:
success or error code.
See Also:
APDUResponseStruct, BTPay_ErrorCode

icc_getCurrentKSN

public int icc_getCurrentKSN(ResDataStruct resKSN)
Get the current KSN for Smart card. *

Parameters:
resKSN - the class for current KSN.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

emv_getEMVKernelVersion

public int emv_getEMVKernelVersion(java.lang.StringBuilder emvVersion)
Get the EMV L2 Version.

Parameters:
emvVersion - for Version.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

emv_startEMVTransaction

public int emv_startEMVTransaction(float amount,
                                   float amtOther,
                                   int timeOut1,
                                   int timeOut2,
                                   byte transType,
                                   byte[] dataBuf)
Start EMV transaction request,Authorizes the EMV transaction for an ICC card.
The result code,tags and error code will be returned by emvTransactionData in interface OnReceiverListener.

Parameters:
amount - Transaction amount value.Example 15.00.
amtOther - Other transaction amount value.
timeOut1 - The timeout is define send "Transaction" command until command detect IC card.0 means disable timeout.
timeOut2 - The timeout is define Online required Time out.0 means disable timeout.
transType - Transaction type, 1 byte.
dataBuf - the buffer for input data of TLV format.
Returns:
success or error code.
See Also:
OnReceiverListener, BTPay_ErrorCode

emv_completeOnlineEMVTransaction

public int emv_completeOnlineEMVTransaction(byte onlineAuth,
                                            byte[] dataBuf)
Complete Online Authorization transaction;the API need to be used if API emv_startEMVTransaction returns EMV_RESULT_CODE_GO_ONLINE. The result code,tags and error code will be returned by emvTransactionData in interface OnReceiverListener.

Parameters:
onlineAuth - for Online Authorization Result.
0x00:Authorization Accepted.
0x01:Authorization Unable to Go Online.
0x02:Authorization Technical Issue.
0x03:Authorization Declined.
0x04:Authorization Issuer Referral.
dataBuf - the buffer for input TLV data.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

emv_retrieveApplicationData

public int emv_retrieveApplicationData(java.lang.String AID,
                                       ApplicationIDStruct ResponseAID)
Retrieves Application Data by AID.Retrieves the Application Data as specified by the AID name passed as a parameter. The AID will be in the response parameter responseAID

Parameters:
AID - the application's ID in hex string,the length is 5~16 bytes,example "A000000004F303".
ResponseAID - the responseAID PROCESSING data data according to giving AID,please see class ApplicationIDStruct for more information.
Returns:
success or error code.
See Also:
ApplicationIDStruct, BTPay_ErrorCode

emv_removeApplicationData

public int emv_removeApplicationData(java.lang.String strAID)
Removes the Application Data by AID name passed as the parameter.

Parameters:
strAID - the application's ID in hex string,the length is 5~16 bytes,example "A000000004F303".
Returns:
success or error code.
See Also:
BTPay_ErrorCode

emv_setApplicationData

public int emv_setApplicationData(ApplicationIDStruct data)
Set application data by AID.

Parameters:
data - the class for application data,please see class ApplicationIDStruct for more information.
Returns:
success or error code.
See Also:
ApplicationIDStruct, BTPay_ErrorCode

emv_retrieveAIDList

public int emv_retrieveAIDList(ResDataStruct dataBuf)
Retrieves all the AID name/length.

Parameters:
dataBuf - the class for all AID name/length. the format is {AID_num (n)} {AID_Len 1} {AID 1} ...{AID_Len n} {AID n}.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

emv_retrieveTerminalData

public int emv_retrieveTerminalData(TerminalDataStruct dataBuf)
Retrieves the Terminal data.

Parameters:
dataBuf - the class for Terminal data,please see TerminalDataStruct define for more information.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

emv_removeTerminalData

public int emv_removeTerminalData()
Removes the Terminal data.

Returns:
success or error code.
See Also:
BTPay_ErrorCode

emv_setTerminalData

public int emv_setTerminalData(TerminalDataStruct dataBuf)
Sets the Terminal data.

Parameters:
dataBuf - the class for Terminal data.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

emv_retrieveCAPKList

public int emv_retrieveCAPKList(ResDataStruct dataBuf)
Retrieves the Certificate Authority Public Key list.

Parameters:
dataBuf - the class for all the CAPK RID and index,every item is 6 bytes, bytes 1-5 RID,bytes 6 index.
the format is {CAKey number (n)} {RID 1} {Index 1} ... {RID n} {Index n}.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

emv_retrieveCAPK

public int emv_retrieveCAPK(java.lang.String rid,
                            java.lang.String index,
                            CAKeyStruct dataBuf)
Retrieves Certificate Authority Public Key by the RID/Index.

Parameters:
rid - The RID of the key to retrieve, the format is hex string,example "A000000003".
index - the index of the key to retrieve, the format is hex string,example "57".
dataBuf - the class for the CAPK as specified by the RID/Index.please see class CAKeyStruct for more inforamtion.
Returns:
success or error code.
See Also:
CAKeyStruct, BTPay_ErrorCode

emv_removeCAPK

public int emv_removeCAPK(java.lang.String rid,
                          java.lang.String index)
Removes Certificate Authority Public Key by the RID/Index.

Parameters:
rid - The RID of the key to remove, the format is hex string,example "A000000003".
index - The index of the key to remove, the format is hex string,example "57".
Returns:
success or error code.
See Also:
BTPay_ErrorCode

emv_setCAPK

public int emv_setCAPK(CAKeyStruct dataBuf)
Sets Certificate Authority Public Key .

Parameters:
dataBuf - the class for the CAPK containing the RID, Index, Exponent and key data to set.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

emv_retrieveCRLForRID

public int emv_retrieveCRLForRID(java.lang.String rid,
                                 ResDataStruct dataBuf)
Retrieve the Certificate Revocation List specific to RID,returns all the serial numbers for a specific RID on the CRL.

Parameters:
rid - the RID of the certificate to search for , the format is hex string,example "A000000003".
dataBuf - the class for all the serial numbers for a specific RID on the CRL, for each object: 5 bytes: AID 1 byte: Index 3 bytes: Serial Number.
the format:{CRL units in total(n)} {Index1} {Serial number 1}...{Index n} {Serial number n} .
Returns:
success or error code.
See Also:
BTPay_ErrorCode

emv_removeCRLUnit

public int emv_removeCRLUnit(CRLDataStruct dataBuf)
Removes a single CRL data as specified by the RID/Index/Serial Number passed as a parameter in the CRLDataStruct class.

Parameters:
dataBuf - The class for CRL containing the RID, Index and serial number.Please see class CRLDataStruct for more information.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

emv_setCRL

public int emv_setCRL(CRLDataStruct dataBuf)
Sets the CRL data as specified by the CRLDataStruct class.

Parameters:
dataBuf - The class for CRL containing the RID, Index and serial number.Please see class CRLDataStruct for more information.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

emv_retrieveCRLList

public int emv_retrieveCRLList(ResDataStruct dataBuf)
Retrieves all the RID in the CRL.

Parameters:
dataBuf - The class for all the RID in the CRL,5-byte objects for each RID,the format:{RID number (n)} {RID 1}...{RID n}.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

emv_removeCRL

public int emv_removeCRL(CRLDataStruct dataBuf)
Removes all CRL as specified by the RID and Index passed as a parameter in the CRLDataStruct class.

Parameters:
dataBuf - The class for CRL containing the RID, Index.please see class CRLDataStruct for more information.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

pin_getPINpadStatus

public int pin_getPINpadStatus(byte[] response)
Get PINPad status.

Parameters:
response - Pad status,one byte; response[0].
1. 0x01:PINPad is inactivate ;
2. 0x02:PINPad has been activated, but Public Key is not loaded;
3. 0x03:Public key has been loaded, but Firmware Key, Numeric Key and Check Value is not loaded;
4. 0x10:PINPad normal work status;
5. 0x30:PINPad suspend status if password input error;
6. 0x31:PINPad suspend status if get PIN(MKSK) 120 times in one hours.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

pin_cancelPin

public int pin_cancelPin()
Cancel enter from keypad,includes PIN,Numeric,Account,Encrypted data,Function Key and Amount.

Returns:
success or error code.
See Also:
BTPay_ErrorCode

pin_getFunctionKey

public int pin_getFunctionKey()
Get Function Key from keyboard, Returns value of pressed key in pinpadData of interface OnReceiverListener.

Returns:
success or error code.
See Also:
OnReceiverListener, BTPay_ErrorCode

pin_getEncryptedPIN

public int pin_getEncryptedPIN(byte kType,
                               java.lang.String account,
                               java.lang.String line1,
                               java.lang.String line2,
                               java.lang.String line3)
Get Encrypted PIN from keyboard,Returns pinblock/ksn of entered PIN value in pinpadData of interface OnReceiverListener.

Parameters:
kType - for the key type.
1. 0x00~0x01:External Account Keys,0x00:MKSK-TDES;0x01:DUKPT-TDES;
2. 0x20~0x21:Internal Account Keys,0x20:MKSK-TDES;0x21:DUKPT-TDES;
account - for external account,ASCII code(0x30~0x39),the account will not exist if the m_kType is 0x10~0x11. the length must be 13~20.
line1 - Display line 1, up to 12 characters.
line2 - Display line 2, up to 16 characters.
line3 - Display line 3, up to 16 characters.
Returns:
success or error code.
See Also:
OnReceiverListener, BTPay_ErrorCode

pin_getNumeric

public int pin_getNumeric(boolean m_eFlag,
                          byte m_iMax,
                          byte m_iMin,
                          int kID,
                          java.lang.String lang)
Get numeric key code from keypad,Returns value of entered numeric key in pinpadData of interface OnReceiverListener.
.

Parameters:
m_eFlag - Control whether the numeric key need to display in plain text,one byte.
1. false:display numeric for numeric key on LCD.
2. true:Display "*" for numeric key on LCD.
m_iMax - The max length for numeric,max length can not beyond 16.
m_iMin - The minimum length for numeric, minimum length can not less than 1.
kID - the RSA encrypted message ID.every ID for a encrypted data of characters and language.
lang - Language to use for message and encrypted file.Example,lang is "English",the name of encrypted file is "English_RSAData.xml".
Returns:
success or error code.
See Also:
OnReceiverListener, BTPay_ErrorCode

pin_getCardAccount

public int pin_getCardAccount(int iMax,
                              int iMin,
                              java.lang.String line1,
                              java.lang.String line2)
Get Card account number from keyboad,Returns value of entered account numbers in pinpadData of interface OnReceiverListener.

Parameters:
iMax - for max length of card account to be got from keypad, no more than 20.
iMin - for min length of card account to be got from keypad, no less than 12.
line1 - Display line 1, up to 12 characters.
line2 - Display line 2, up to 16 characters.
Returns:
success or error code.
See Also:
OnReceiverListener, BTPay_ErrorCode

pin_getEncryptedData

public int pin_getEncryptedData(boolean eFlag,
                                int iMax,
                                int iMin,
                                int kID,
                                java.lang.String lang)
Get encrypted data,Returns value of entered data in pinpadData of interface OnReceiverListener.

Parameters:
eFlag - 1. false:not the last package; 2. true:the last package.
iMax - The max length for numeric,max length can not beyond 16.
iMin - The minimum length for numeric, minimum length can not less than 1.
kID - the RSA encrypted message ID.every ID for a encrypted data of characters and language.
lang - Language to use for message and encrypted file.Example,lang is "English",the name of encrypted file is "English_RSAData.xml".
Returns:
success or error code.
See Also:
OnReceiverListener, BTPay_ErrorCode

pin_getAmount

public int pin_getAmount(byte iMax,
                         byte iMin,
                         int kID,
                         java.lang.String lang)
Get amount key code from keypad, Returns value of entered amount in pinpadData of interface OnReceiverListener.

Parameters:
iMax - The max length for amount,max length can not beyond 15.
iMin - The minimum length for amount, minimum length can not less than 0.
kID - the RSA encrypted message ID.every ID for a encrypted data of characters and language.
lang - Language to use for message and encrypted file.Example,lang is "English",the name of encrypted file is "English_RSAData.xml".
Returns:
success or error code.
See Also:
OnReceiverListener, BTPay_ErrorCode

pin_getPinLength

public int pin_getPinLength(byte[] lenBuf)
Get Encrypted PIN length.

Parameters:
lenBuf - lenBuf[0]is the minimum length for encrypted PIN and lenBuf[1] is the max length for encrypted PIN.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

pin_setPinLength

public int pin_setPinLength(int m_iMin,
                            int m_iMax)
Set Encrypted PIN length. * @param m_iMin The minimum length for encrypted PIN,minimum length can not less than 4.

Parameters:
m_iMax - The max length for encrypted PIN, max length can not beyond 12.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

msr_reviewAllSetting

public int msr_reviewAllSetting(MSRSettingStruct msrSetting)
Review all setting of Mask and Encryption.

Parameters:
msrSetting - for MSR setting. please see class MSRSettingStruct for more information.
Returns:
success or error code.
See Also:
MSRSettingStruct, BTPay_ErrorCode

msr_defaultAllSetting

public int msr_defaultAllSetting()
Default all setting of Mask and Encryption.

Returns:
success or error code.
See Also:
BTPay_ErrorCode

msr_getSingleSetting

public int msr_getSingleSetting(byte funcID,
                                byte[] response)
Get single setting of Mask and Encryption by Function ID.

Parameters:
funcID - function ID.
0x49:Leading PAN digits to display(0x00~0x06).
0x4A:Last PAN digits to display(0x00~0x04).
0x4B:Mask ASCII code track data(0x20~0x7E).
0x50:Mask or display expiration date(0x30 or 0x31);0x31:don’t mask expiration date.
0x3E:Key type(0x30 or 0x31);0x30:Data Key;0x31:PIN Key.
0x4C:Encryption type(0x31 or 0x32);0x31:TDES;0x32:AES.
response - response[0] for setting data.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

msr_setSingleSetting

public int msr_setSingleSetting(byte funcID,
                                byte setData)
Set single setting of Mask and Encryption by Function ID.

Parameters:
funcID - function ID.
0x49:Leading PAN digits to display(0x00~0x06).
0x4A:Last PAN digits to display(0x00~0x04).
0x4B:Mask ASCII code track data(0x20~0x7E).
0x50:Mask or display expiration date(0x30 or 0x31);0x31:don’t mask expiration date.
0x3E:Key type(0x30 or 0x31);0x30:Data Key;0x31:PIN Key.
0x4C:Encryption type(0x31 or 0x32);0x31:TDES;0x32:AES.
setData - for setting data.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

msr_startMSRSwipeWithDisplay

public int msr_startMSRSwipeWithDisplay(java.lang.String line1,
                                        java.lang.String line2,
                                        java.lang.String line3,
                                        java.lang.String line4)
Enable MSR swipe card. Returns encrypted MSR data or function key value by call back function.
The function swipeMSRData in interface OnReceiverListener will be called if swiping card data received.

Parameters:
line1 - Display line 1, up to 12 characters.
line2 - Display line 2, up to 16 characters.
line3 - Display line 3, up to 16 characters.
line4 - Display line 4, up to 16 characters.
Returns:
success or error code.
See Also:
OnReceiverListener, BTPay_ErrorCode

msr_cancelMSRSwipe

public int msr_cancelMSRSwipe()
Disable MSR swipe card.

Returns:
success or error code.
See Also:
BTPay_ErrorCode

StringToHex

public int StringToHex(java.lang.String str,
                       byte[] buff)

OnConnectBluetooth

public void OnConnectBluetooth()
Specified by:
OnConnectBluetooth in interface com.BTPaySDK.OnReceiverBluetooth