com.starmicronics.stario
Class StarProxiPRNTManager

java.lang.Object
  extended by com.starmicronics.stario.StarProxiPRNTManager

public final class StarProxiPRNTManager
extends java.lang.Object


Field Summary
static java.lang.String KEY_STAR_DEVICETYPE
           
static java.lang.String KEY_STAR_MACADDRESS
           
static java.lang.String KEY_STAR_NICKNAME
           
static java.lang.String KEY_STAR_PORTSETTIGS
           
static java.lang.String KEY_STAR_THRESHOLDRSSI
           
static java.lang.String KEY_STAR_WITHDRAWER
           
 
Method Summary
 void addSettingForDKAirCashPortName(java.lang.String portName, java.lang.String portSettings, java.lang.String macAddress, int threshold, java.lang.String nickName)
          Adds the settings of the DK-AirCash to be connected with the BLED10-U.
 void addSettingForPrinterPortName(java.lang.String portName, java.lang.String portSettings, boolean withDrawer, java.lang.String macAddress, int threshold, java.lang.String nickName)
           
 int calibrateActionArea(java.lang.String bleMacAddress)
          Calibrate RSSI to make action area.
 boolean deserializeSetting(byte[] settingsByteArray)
          Set deserialize settings by specified byte array settings
 java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.Object>> getAllSettings()
          Gets all setting information connected to the BLED10-U by the port name
 StarProxiPRNTManagerCallback getCallback()
          This method acquires the StarProxiPRNTManagerCallback object.
 java.lang.String getClosestCashDrawer()
          When the RSSI value exceeds the threshold, gets the port name of the POS Printer.
 java.lang.String getClosestPrinter()
          When the RSSI value exceeds the threshold, gets the port name of the DK-AirCash.
 int getRSSI(java.lang.String macAddress)
          Gets the RSSI value of the connected printer or DK-AirCash.
 java.util.HashMap<java.lang.String,java.lang.Object> getSettings(java.lang.String portName)
          Gets the setting information connected to the BLED10-U by the port name.
In getting device type (DK-AirCash or Printer), specify the "StarProxiPRNTManager.KEY_STAR_DEVICETYPE" to key
In getting presence/absence information (true/false), specify the "StarProxiPRNTManager.KEY_STAR_WITHDRAWER" to key
In getting NicName to connect the BLED10-U and the POSPrinter or DK-AirCash, specify the "StarProxiPRNTManager.KEY_STAR_NICKNAME" to key
In getting portSettings, specify the "StarProxiPRNTManager.KEY_STAR_PORTSETTINGS" to key
In getting threshold value, specify the "StarProxiPRNTManager.KEY_STAR_THRESHOLDRSSI" to key
In getting Mac address of BLED10-U, specify the "StarProxiPRNTManager.KEY_STAR_MACADDRESS" to key
static StarProxiPRNTManager getSharedManager()
          Gets an instance of StarProxiPRNTManager
 void removeSettingsWithPortName(java.lang.String portName)
          This method removes the setting information connected to the BLED10-U by the port name.
 byte[] serializedSettings()
          Get byte array value by serialized settings
 void setCallback(StarProxiPRNTManagerCallback callback)
          This method sets a callback.
See StarProxiPRNTManagerCallback interface for the callback function.
 boolean startScan()
          Start scanning Bluetooth Low Energy devices.
Do not execute this method when printing data or opening the drawer.
Execute stopScan method and stop scanning BLE device before printing data or opening the drawer.
 boolean startScan(int samplingNumber)
          Start scanning Bluetooth Low Energy devices.
Do not execute this method when printing data or opening the drawer.
Execute stopScan method and stop scanning BLE device before printing data or opening the drawer.
 void stopScan()
          Stop scanning Bluetooth Low Energy devices.
Execute stopScan method and stop scanning BLE device before printing data or opening the drawer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_STAR_MACADDRESS

public static final java.lang.String KEY_STAR_MACADDRESS
See Also:
Constant Field Values

KEY_STAR_PORTSETTIGS

public static final java.lang.String KEY_STAR_PORTSETTIGS
See Also:
Constant Field Values

KEY_STAR_DEVICETYPE

public static final java.lang.String KEY_STAR_DEVICETYPE
See Also:
Constant Field Values

KEY_STAR_WITHDRAWER

public static final java.lang.String KEY_STAR_WITHDRAWER
See Also:
Constant Field Values

KEY_STAR_THRESHOLDRSSI

public static final java.lang.String KEY_STAR_THRESHOLDRSSI
See Also:
Constant Field Values

KEY_STAR_NICKNAME

public static final java.lang.String KEY_STAR_NICKNAME
See Also:
Constant Field Values
Method Detail

getSharedManager

public static StarProxiPRNTManager getSharedManager()
                                             throws StarIOPortException
Gets an instance of StarProxiPRNTManager

Returns:
Gets an instance of StarProxiPRNTManager
Throws:
StarIOPortException - If Android OS Version is earlier than API Level:18.

startScan

public boolean startScan()
                  throws StarIOPortException
Start scanning Bluetooth Low Energy devices.
Do not execute this method when printing data or opening the drawer.
Execute stopScan method and stop scanning BLE device before printing data or opening the drawer.

Returns:
false if calibrateActionArea is alive or startLeScan returned false.
Throws:
StarIOPortException - If Android OS Version is earlier than API Level:18.

startScan

public boolean startScan(int samplingNumber)
                  throws StarIOPortException
Start scanning Bluetooth Low Energy devices.
Do not execute this method when printing data or opening the drawer.
Execute stopScan method and stop scanning BLE device before printing data or opening the drawer.

Parameters:
samplingNumber - 3 or 7 or 10 can specified.
Returns:
false if calibrateActionArea is alive or startLeScan returned false.
Throws:
StarIOPortException - If Android OS Version is earlier than API Level:18. Or sampling Number is not match.

stopScan

public void stopScan()
              throws StarIOPortException
Stop scanning Bluetooth Low Energy devices.
Execute stopScan method and stop scanning BLE device before printing data or opening the drawer.

Throws:
StarIOPortException - If Android OS Version is earlier than API Level:18.

getRSSI

public int getRSSI(java.lang.String macAddress)
            throws StarIOPortException
Gets the RSSI value of the connected printer or DK-AirCash.

Parameters:
macAddress - macAddress of BLED10-U to use
Returns:
RSSI value of selected port
Throws:
StarIOPortException - If Android OS Version is earlier than API Level:18.

addSettingForPrinterPortName

public void addSettingForPrinterPortName(java.lang.String portName,
                                         java.lang.String portSettings,
                                         boolean withDrawer,
                                         java.lang.String macAddress,
                                         int threshold,
                                         java.lang.String nickName)
                                  throws StarIOPortException
Parameters:
portName - Identifies the POSprinter to use
Ethernet and WiFi: Usage - TCP:IPAddress (eg, TCP:192.168.1.23)
BlueTooth: Usage - BT: (finds and uses the first star BlueTooth printer paired with your device)
BT:DeviceName (eg, BT:StarMicronics)
BT:<MacAddress> (eg, BT:00:15:0E:45:00:12)

PortSettings - The settings for the port
Ethernet Settings:
Examples: ""
BlueTooth Settings: "" - Using a POSprinter (No portSettings are required when using other Interface and "SSP" by Bluetooth Interface.)
;p - Using a POSprinter(If use the "PIN Code" by Bluetooth Interface)
Examples: "", ";p"
withDrawer - Presence/absence of a cash drawer.
macAddress - Mac address of the BLED10-U.
threshold - Threshold
nickName - Nick name to connect the BLED-10U and the POS Printer.
Throws:
StarIOPortException
- If portName or macAddress is null
- If the same portName has been specified
- If the same macAddress has been specified
StarIOPortException

addSettingForDKAirCashPortName

public void addSettingForDKAirCashPortName(java.lang.String portName,
                                           java.lang.String portSettings,
                                           java.lang.String macAddress,
                                           int threshold,
                                           java.lang.String nickName)
                                    throws StarIOPortException
Adds the settings of the DK-AirCash to be connected with the BLED10-U.

Parameters:
portName - Identifies the DK-AirCash to use
Ethernet and WiFi: Usage - TCP:IPAddress (eg, TCP:192.168.1.23)
BlueTooth: Usage - BT: (finds and uses the first star BlueTooth printer paired with your device)
BT:DeviceName (eg, BT:StarMicronics)
BT:<MacAddress> (eg, BT:00:15:0E:45:00:12)

PortSettings - The settings for the port
Ethernet Settings:
Examples: ""
BlueTooth Settings: "" - Using a DK-AirCash (No portSettings are required when using other Interface and "SSP" by Bluetooth Interface.)
;p - Using a DK-AirCash(If use the "PIN Code" by Bluetooth Interface)
Examples: "", ";p"
macAddress - Mac address of the BLED10-U.
threshold - Threshold
nickName - Nick name to connect the BLED-10U and the DK-AirCash.
Throws:
StarIOPortException
- If portName or macAddress is null
- If the same portName has been specified
- If the same macAddress has been specified
StarIOPortException

removeSettingsWithPortName

public void removeSettingsWithPortName(java.lang.String portName)
                                throws StarIOPortException
This method removes the setting information connected to the BLED10-U by the port name.

Parameters:
portName - A port name to delete settings
Throws:
StarIOPortException
- If the specified portName is null
- If the settings of specified portName is not exists
StarIOPortException

serializedSettings

public byte[] serializedSettings()
Get byte array value by serialized settings

Returns:
A byte value of serialized settings

deserializeSetting

public boolean deserializeSetting(byte[] settingsByteArray)
                           throws StarIOPortException
Set deserialize settings by specified byte array settings

Parameters:
settingsByteArray - Value obtained from serializedSettings method
Returns:
False if the restoration is failed.
Throws:
StarIOPortException - If settingsByteArray is null

getSettings

public java.util.HashMap<java.lang.String,java.lang.Object> getSettings(java.lang.String portName)
                                                                 throws StarIOPortException
Gets the setting information connected to the BLED10-U by the port name.
In getting device type (DK-AirCash or Printer), specify the "StarProxiPRNTManager.KEY_STAR_DEVICETYPE" to key
In getting presence/absence information (true/false), specify the "StarProxiPRNTManager.KEY_STAR_WITHDRAWER" to key
In getting NicName to connect the BLED10-U and the POSPrinter or DK-AirCash, specify the "StarProxiPRNTManager.KEY_STAR_NICKNAME" to key
In getting portSettings, specify the "StarProxiPRNTManager.KEY_STAR_PORTSETTINGS" to key
In getting threshold value, specify the "StarProxiPRNTManager.KEY_STAR_THRESHOLDRSSI" to key
In getting Mac address of BLED10-U, specify the "StarProxiPRNTManager.KEY_STAR_MACADDRESS" to key

Parameters:
portName - portName of POS Printer or DK-AirCash connected to the BLED10-U.
Returns:
A HashMap object containing POS Printer or DK-AirCash settings.
Throws:
StarIOPortException
- If Android OS Version is earlier than API Level:18. - If the specified portName is null
StarIOPortException

getAllSettings

public java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.Object>> getAllSettings()
                                                                                                        throws StarIOPortException
Gets all setting information connected to the BLED10-U by the port name

Returns:
A HashMap object of all device settings
Throws:
StarIOPortException

setCallback

public void setCallback(StarProxiPRNTManagerCallback callback)
This method sets a callback.
See StarProxiPRNTManagerCallback interface for the callback function.

Parameters:
callback - specifies the object (StarProxiPRNTManagerCallback interface).

getCallback

public StarProxiPRNTManagerCallback getCallback()
This method acquires the StarProxiPRNTManagerCallback object. Use it after calling the setCallback method.

Returns:
StarProxiPRNTManagerCallback object

getClosestPrinter

public java.lang.String getClosestPrinter()
When the RSSI value exceeds the threshold, gets the port name of the DK-AirCash. When RSSI value is lower than the threshold, the port name is an empty string.

Returns:
A portName of DK-AirCash.

getClosestCashDrawer

public java.lang.String getClosestCashDrawer()
When the RSSI value exceeds the threshold, gets the port name of the POS Printer. When RSSI value is lower than the threshold, the port name is an empty string.

Returns:
A portName of POS Printer.

calibrateActionArea

public int calibrateActionArea(java.lang.String bleMacAddress)
                        throws StarIOPortException
Calibrate RSSI to make action area.

Parameters:
bleMacAddress - of BLED10-10
Returns:
the maximum RSSI value approximately five seconds later.
Throws:
StarIOPortException - If Android OS Version is earlier than API Level:18. - If StartScan has been executed already
- If BLED10-U is not found
- If the bleMacAddress value is not the following format
(eg, 00:07:80:A2:70:ab)