com.BTPaySDK
Class BTPay_SDK.Common

java.lang.Object
  extended by com.BTPaySDK.BTPay_SDK.Common
Enclosing class:
BTPay_SDK

public class BTPay_SDK.Common
extends java.lang.Object

Class Common includes all methods for common function.


Constructor Summary
BTPay_SDK.Common()
           
 
Method Summary
 void close()
          Close and release the Bluetooth resource.
 int displayMessage(java.lang.String line1, java.lang.String line2, java.lang.String line3, java.lang.String line4)
          Display message.
 int getDateTime(java.lang.StringBuilder dateTime)
          Get the date and time of device.
 int getFirmwareVersion(java.lang.StringBuilder version)
          Get the firmware version of device.
 int getModelNumber(java.lang.StringBuilder modNumber)
          Get the model number of device.
 int getSDKVersion(java.lang.StringBuilder sdkVersion)
          Get the version of SDK.
 int GetSerialNumber(java.lang.StringBuilder serialNumber)
          Get the serial number of device.
 boolean open(java.lang.String address)
          Open device with the Bluetooth interface.
 int ploadJPEG(int pID, int pType, byte[] pData)
          Store picture in the device.
 int rebootDevice()
          Reboot device.
 int sendBeep(int frequency, int duration)
          Control the device's beeper.
 int setBluetoothAddress(java.lang.String strAddress)
          Set Bluetooth address.
 int setDateTime(java.lang.String dateTime)
          Set the date and time to device.
 int setIdleTimeForSleep(int idleTime)
          Set the time before the device into sleep mode.
 int setSerialNumber(java.lang.String serNumber)
          Set the serial number to device.
 int setSleepMode(boolean sleepMode)
          Change device the state of sleep mode.
 int showJPEG(int pID, int X0, int Y0, int X1, int Y1)
          Show stored picture on the LCD.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BTPay_SDK.Common

public BTPay_SDK.Common()
Method Detail

open

public boolean open(java.lang.String address)
Open device with the Bluetooth interface. It need "open" the device before calling any other API.

Parameters:
address - the valid Bluetooth MAC address.
Returns:
success(true) or fail(false).
Throws:
java.security.NoSuchAlgorithmException

close

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


getFirmwareVersion

public int 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

getSDKVersion

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

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

getModelNumber

public int 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

GetSerialNumber

public int 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

setSerialNumber

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

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

getDateTime

public int 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

setDateTime

public int 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

sendBeep

public int 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

setSleepMode

public int 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

setIdleTimeForSleep

public int 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

rebootDevice

public int rebootDevice()
Reboot device.

Returns:
success or error code.
See Also:
BTPay_ErrorCode

setBluetoothAddress

public int 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

ploadJPEG

public int ploadJPEG(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

showJPEG

public int 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"< 64, 0<="Y0" < "Y1" < 128.
Returns:
success or error code.
See Also:
BTPay_ErrorCode

displayMessage

public int 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