|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.starmicronics.stario.StarIOPort
public abstract class StarIOPort
| Constructor Summary | |
|---|---|
StarIOPort()
|
|
| Method Summary | |
|---|---|
abstract StarPrinterStatus |
beginCheckedBlock()
Starts a checked block to ensure that the printer successfully finished its job. |
protected abstract void |
closeNative()
|
static byte[] |
compressRasterData(int width,
int height,
byte[] imageData,
java.lang.String portSettings)
|
abstract StarPrinterStatus |
endCheckedBlock()
Only call this after a call to This function blocks until either the printer goes off line or the print job finished |
static byte[] |
generateBitImageCommand(int width,
int height,
byte[] imageData,
java.lang.String portSettings)
Deprecated. compressRasterData(int width, int height, byte[] imageData, String portSettings) |
abstract java.util.Map<java.lang.String,java.lang.Boolean> |
getDipSwitchInformation()
Get DIP switch settings of DK-AirCash In getting DIP switch settings of DK-AirCash, specify the "DIPSW11" or "DIPSW12" or "DIPSW13" or "DIPSW14" or "DIPSW15" or "DIPSW16" or "DIPSW17" or "DIPSW18" or "DIPSW21" or "DIPSW22" or "DIPSW23" or "DIPSW24" or "DIPSW25" or "DIPSW26" or "DIPSW27" or "DIPSW28" to key |
abstract java.util.Map<java.lang.String,java.lang.String> |
getFirmwareInformation()
Get printer model name and printer firmware version In getting printer firmware version, specify the "FirmwareVersion" to key In getting printer model name, specify the "ModelName" to key |
static StarIOPort |
getPort(java.lang.String portName,
java.lang.String portSettings,
int ioTimeoutMillis)
Opens a connection to either a TCP or BlueTooth StarMicronics printer for printing |
static StarIOPort |
getPort(java.lang.String portName,
java.lang.String portSettings,
int ioTimeoutMillis,
android.content.Context currentContext)
Opens a connection to either a TCP, BlueTooth, or USB StarMicronics printer for printing . |
java.lang.String |
getPortName()
Retrieves the port name that were used to open the port |
java.lang.String |
getPortSettings()
Retrieves the port settings that were use to open the port |
static java.lang.String |
getStarIOVersion()
Get StarIO Version |
static void |
InterruptOpen()
Interrupts the opening of any bluetooth printer an immediately throws an StarIOPortException on all threads opening a bluetooth connection. |
abstract int |
readPort(byte[] readBuffer,
int offSet,
int size)
Read data from the printer into a byte array |
static void |
releasePort(StarIOPort port)
Closes a connection to an open printer |
abstract StarPrinterStatus |
retreiveStatus()
Gets the current status of the printer |
static java.util.ArrayList<PortInfo> |
searchPrinter(java.lang.String target)
Search printer on LAN or paired bluetooth device. |
static java.util.ArrayList<PortInfo> |
searchPrinter(java.lang.String target,
android.content.Context Context)
Search printer on LAN, paired bluetooth device or USB device. |
abstract void |
setEndCheckedBlockTimeoutMillis(int endCheckedBlockTimeoutMillis)
Sets the timeout time in milliseconds of endCheckedBlock method. |
abstract void |
writePort(byte[] writeBuffer,
int offset,
int size)
Writes a byte array out to the printer |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StarIOPort()
| Method Detail |
|---|
public static java.util.ArrayList<PortInfo> searchPrinter(java.lang.String target)
throws StarIOPortException
target - Identifies the interface type to search (ex. "TCP:", "BT:", "BT:xxx")
StarIOPortException
public static java.util.ArrayList<PortInfo> searchPrinter(java.lang.String target,
android.content.Context Context)
throws StarIOPortException
target - Identifies the interface type to search (ex. "TCP:", "BT:", "USB:")Context - The context of the android application. Only necessary for USB connections. The context is used to autoask the use for permission to use the usb port. Only asked if permission is necessary.
StarIOPortException
public static StarIOPort getPort(java.lang.String portName,
java.lang.String portSettings,
int ioTimeoutMillis)
throws StarIOPortException
PortName - Identifies the printer 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:SMS200) | ||
| BT:<MacAddress> | (eg, BT:00:15:0E:45:00:12) |
PortSettings - The settings for the port
| Ethernet Settings: | portable;escpos - | Using for a ESC/POS mode portable printer | ||
| a - | Set socket to keep alive | |||
| n - | Use TCP no delay | |||
| Examples: | "portable;escpos;a;n", "portable;escpos;a", ";a", ";n", "" | |||
| BlueTooth Settings: | portable - | Using for a portable printer | ||
| l - | Automatically retry connection process until timeout occurs | |||
| f - | Automatically flush after data is written to stream | |||
| u - | use SPP (unsecure) for Bluetooth connection. (Only for android api level 10 or later) | |||
| p - | use Pin code security for Bluetooth connection. (Only for android api level 10 or later) | |||
| d[timeout value] - | Perform data cancel function. When the printer during the specified time does not receive data. Using for POSPrinter TSP650II Bluetooth model and Frimware Version 1.3 or later The timeout range is 0-255.[unit: second] If you specify 0, this setting is disabled. Example: ";d127" - Perform data cancel function when it does not receive data 127 seconds during printing. |
|||
| Examples: | "portable;l", "portable", ";p;l", ";f", ";d127" |
ioTimeoutMillis - The time out in milliseconds used when writing or reading from the port
StarIOPort The port that is used to write and read data to the printer
StarIOPortException - If for some reason communication with the printer can't be established, if the error "device discovery failed" repeatedly shows up try pairing again with the priner
public static StarIOPort getPort(java.lang.String portName,
java.lang.String portSettings,
int ioTimeoutMillis,
android.content.Context currentContext)
throws StarIOPortException
PortName - Identifies the printer 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:SMS200) | ||||||
| BT:<MacAddress> | (eg, BT:00:15:0E:45:00:12) | ||||||
| By using StarIOPort3.1.jar instead of the standard StarIOPort.jar usb connections become available. USB connection should also only be opened on a thread or else it will prevent the user from using the usb permission request screen | |||||||
| USB Connections: Usage - | USB:<Printer Number> | (eg, USB:1) - Use the first USB star printer (currently StarIO only supports one usb printer at a time) | |||||
| USB: | (eg, USB:) - Find and use the first USB star printer | ||||||
| USBVEN: | (eg, USBVEN:) - Find and use the first USB vendor class star printer | ||||||
| USBVEN: | (eg, USBVEN:) - Find and use the first USB printer class star printer | ||||||
PortSettings - The settings for the port
| Ethernet Settings: | portable;escpos - | Using for a ESC/POS mode portable printer | |
| a - | Set socket to keep alive | ||
| n - | Use TCP no delay | ||
| Examples: | "portable;escpos;a;n", "portable;escpos;a", "a", "n", "" | BlueTooth Settings: | portable - | Using a portable printer (this is required for all BlueTooth printers) |
| f - | Automatically flush after data is written to stream | ||
| u - | use unsecure bluetooth connection. (Only for android api level 10 and up) | ||
| Examples: | "portable;u;f", "portable" |
ioTimeoutMillis - The time out in milliseconds used when writing or reading from the portContext - The context of the android aplication. Only nessesary for USB connections. The context is used to autoask the use for permission to use the usb port. Only asked if permission is nessasary.
StarIOPort The port that is used to write and read data to the printer
StarIOPortException - If for some reason communication with the printer can't be established, if the error "device discovery failed" repeatedly shows up try repairing with the printer
public static void InterruptOpen()
throws StarIOPortException
StarIOPortException
public static void releasePort(StarIOPort port)
throws StarIOPortException
port - Opened StarIOPort that will be closed
StarIOPortException - should never happen
@Deprecated
public static byte[] generateBitImageCommand(int width,
int height,
byte[] imageData,
java.lang.String portSettings)
throws StarIOPortException
compressRasterData(int width, int height, byte[] imageData, String portSettings)
width - The width of the bitmap data. - width > 0height - The height of the bitmap data. - height > 0imageData - The bitmap data of array binaryPortSettings - The settings for the port
| Ethernet Settings: | portable - | Using a portable printer | |
| a - | Set socket to keep alive | ||
| n - | Use TCP no delay | ||
| Examples: | "portable;a;n", "portable;a", "a", "n", "" | BlueTooth Settings: | portable - | Using a portable printer (this is required for all BlueTooth printers) |
| f - | Automatically flush after data is written to stream | ||
| u - | use unsecure bluetooth connection. (Only for android api level 10 and up) | ||
| Examples: | "portable;u;f", "portable" |
StarIOPortException - If specified width, height, imageData is invalid, show error message.
public static byte[] compressRasterData(int width,
int height,
byte[] imageData,
java.lang.String portSettings)
throws StarIOPortException
StarIOPortExceptionpublic java.lang.String getPortName()
public java.lang.String getPortSettings()
public abstract void writePort(byte[] writeBuffer,
int offset,
int size)
throws StarIOPortException
writeBuffer - The array containing the data to be writtenoffset - The start offset for writing datasize - The amount of data that should be written to the printer
StarIOPortException - Thrown if the data can reach the printer
public abstract int readPort(byte[] readBuffer,
int offSet,
int size)
throws StarIOPortException
readBuffer - The byte array to store the data read from the printeroffSet - The offset in the readbuffer at which the data is writtensize - The maximum number of bytes to read
StarIOPortException - Thrown if data cannot be read from the printer
protected abstract void closeNative()
throws StarIOPortException
StarIOPortException
public abstract StarPrinterStatus retreiveStatus()
throws StarIOPortException
StarIOPortException - Thown if the connection to the printer is lost
public abstract StarPrinterStatus beginCheckedBlock()
throws StarIOPortException
StarIOPortException - Thrown if connection to the printer is lost
public abstract StarPrinterStatus endCheckedBlock()
throws StarIOPortException
StarIOPortException - Thrown if connection to the printer is lost
public abstract java.util.Map<java.lang.String,java.lang.String> getFirmwareInformation()
throws StarIOPortException
StarIOPortException
public abstract java.util.Map<java.lang.String,java.lang.Boolean> getDipSwitchInformation()
throws StarIOPortException
StarIOPortExceptionpublic static java.lang.String getStarIOVersion()
public abstract void setEndCheckedBlockTimeoutMillis(int endCheckedBlockTimeoutMillis)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||