advertisement
Star Micronics Copyright 2011 - 2014 Version 2.1.0
Java Software Development
How to Use StarIO in Java
Thermal Line Mode Printing
This SDK contains a Java NetBeans 6.9.1 Project that shows how to code StarIO commands to print to one of many Star Micronics Thermal POS Printers.
Compatible Star Printer Models: Supported Interfaces:
• FVP10 (Ver.1.0 or later)
• HSP7000 (Ver.1.0 or later)
• TSP650 (Ver.2.0 or later)
• TSP650II (Ver.1.0 or later)
• TSP700II (Ver.2.0 or later)
• TSP800II (Ver.1.0 or later)
• TUP500 (Ver.1.0 or later)
• TUP900 (Ver.1.2 or later)
• SP700 (Ver.1.0 or later)
Works with these DK-AirCash Model Series:
• SAC10 (Ver.1.0 or later)
• Serial
• Parallel
• Ethernet
• USB (Printer Class & Vendor Class)
• Bluetooth
Functions include:
• Sample Receipt
• Read Printer/Drawer Status
• Code Pages
• 1D Barcodes
• 2D Barcodes
• Drawer Kick
• Check Block (ETB)
• Text Formatting
• Set Printer Font
• Line Feed & Cutting
• Text Formatting
Requirements: NetBeans 6.9.1 or later and the latest Java JDK/JRE
NOTE:
• This sample project contains StarIO components from StarIO Version 2.0.0.0.
Details of StarIO(Restrictions, Precautions) are found in the manuals located here:
English : <..\StarIO_help\en\StarIO\index.htm>
Japanese : <..\StarIO_help\ja\StarIO\index.htm>
• This sample project provides source code which tells how to use StarIO components.
Executable for 32/64-bit can be built by this project.
• Executable files for 64-bit cannot be executed in a 32-bit environment but 32-bit programs can run on 64-bit operating systems. This is set as 32-bit by default.
• This is not a JavaPOS sample and will not work with printers that do not support StarIO
Line Mode commands.
1
Star Micronics Copyright 2011 - 2014
Table of Contents
Star Printer Compatibility Chart
How to compile and run the Java SDK
Using the SDK with a Star Micronics Printer
o
Port Name and Interface Relation
Overview of how this Java SDK is designed
o
How to include StarIO into your project
o
Configuring your project for 32- or 64-bit
o
•
•
•
GetPort – Opening the port to the printer
ReleasePort – Closing the port to the printer
WritePort – Writing data (print job) to the printer
ETB (Verifying the data transmission)
•
•
o
• Code 39
•
Interleaved 2 of 5
• Code 93
• Code 128
•
•
•
•
2
Version 2.1.0
Star Micronics Copyright 2011 - 2014
•
•
•
•
•
•
•
o
o
•
•
•
o
o
o
•
Getting Online Status of the Printer
Getting Parsed Status of the Printer
Tips for software application development when using StarIO
o
o
o
o
o
o
o Star Micronics Developers Network
Updated versions of this manual and source code
Star Micronics Printer Drivers
Technical Questions/Support o
3
Version 2.1.0
Star Micronics Copyright 2011 - 2014
About this Manual
Version 2.1.0
This manual is designed to help you understand StarIO and how to build a Java application to interact with Star Micronics Thermal Line Mode Printers. It is important to understand the basics of the Java language and have the Java JDK/JRE installed. The SDK was built in the IDE
NetBeans, but can be used with other IDEs. The Java syntax used in this SDK is all within the code base Main.java which is in the “src” folder. Check the Developers section of our site for the latest updated SDKs, technical documentation, FAQs, and more.
This is not a JavaPOS example but a more robust SDK built for Star Thermal POS Printers.
Key Legend:
Warning
Avoid Doing This
Note
These will explain some potential issues.
Explains things to avoid.
Provides important information and tips.
CAUTION:
• The information in this manual is subject to change without notice.
• STAR MICRONICS CO., LTD. has taken every measure to provide accurate information, but assumes no liability for errors or omissions.
• STAR MICRONICS CO., LTD. is not liable for any damages resulting from the use of information contained in this manual.
• Reproduction in whole or in part is prohibited.
4
Star Micronics Copyright 2011 - 2014
Star Printer Compatibility Chart
Version 2.1.0
Star
Printer
FVP10
TSP650
TSP650II
TSP700II
TSP800II
TUP500
TUP900
SP700
HSP7000
SAC10
*1
*2
*1 QR Code is not supported. PDF417 is available from F/W ver.3.1 or later.
*2 Sample code of this SDK is for Thermal Printer command.
When use SP700, please refer "Star Impact Printer Command Specifications".
5
Star Micronics Copyright 2011 - 2014 Version 2.1.0
How to compile and run the Java SDK
This section will explain:
1.
How to open the
Java NetBeans 6.9.1 Project.
2.
Compiling the project.
3.
Running the project.
How to open the Java SDK project:
You must have NetBeans and Java JDK installed.
Open the NetBeans IDE and click File > Open Project…
Navigate to where you exported the StarIO_Java_SDK package, highlight the project folder, and click “Open Project”.
6
Star Micronics Copyright 2011 - 2014 Version 2.1.0
To view the code, expand source packages/StarIO_Java_SDK and open up Main.Java
You can then use the code view or GUI view to find blocks of function code to include in your
Java projects. You can double click buttons within the GUI designer to jump to a code block.
7
Star Micronics Copyright 2011 - 2014
Compiling the project:
Click on the menu item “Run” and then click “Run Project” or hit F6.
Version 2.1.0
You may want to do a clean build which can also be done from the menu item “Run”.
This project was built using a Windows 7 32-bit machine and although Java doesn’t need to know what operating system you’re running on, you will need to determine whether your target machine will be a 32-bit or 64-bit operating system. Once you know, you can then include the dependencies for that OS. You can find these under the folder called “dependencies” where you find respective StarIO builds for 32- and
64-bit environments.
8
Star Micronics Copyright 2011 - 2014 Version 2.1.0
Using the SDK with Star Micronics Printers
Please make sure you have a compatible Star Micronics Thermal Line Mode Printer model.
Port Name and Interface Relation:
StarIO uses specific port names to identify what port will be used. These are very important to understand because not following the naming convention correctly will fail to communicate with the printer.
Interface
Serial
Parallel
USB (Vendor Class)
USB (Printer Class)
Ethernet (TCP/IP)
Bluetooth
Port Name
COMn
Port Settings
9600,n,8,1,h
LPTn usbven:COMn
N/A
N/A usbprn:”Queue Name” N/A tcp:”IP Address”
BT: COMn
N/A
N/A
NOTE: If using a USB interface and the printer is in printer class mode, after successfully installing the printer driver, you will have a Printer Queue Name to use in the Port Name. Put "usbprn:Star TSP700II (TSP743II)" as the Port.
Printer Class Mode Vendor Class Mode
9
If using a USB interface and the printer is in vendor class mode, a port number is not required. Just put “usbven:” as the Port Name.
"LPTn" n = your port number (1, 2, 3, 4 etc)
"COMn" n = your port number (1, 2, 3, 4 etc)
"tcp:192.168.222.244" Enter TCP IP Address of the Ethernet printer.
"BT:COMn" n = your Bluetooth virtual serial port number (1, 2, 3, 4 etc)
Star Micronics Copyright 2011 - 2014 Version 2.1.0
Overview of how this Java SDK is designed
This overview will touch briefly on key components of the SDK and how to find them.
Focus on the file “Main.java” which contains all the business logic and StarIO commands.
To navigate to a specific command is easy; simply right click on the file called
“Main.java” in the solution explorer. Then click on the option “Open” which will open the designer view.
So let us say for example you wanted to find out what code block is executed for the
“Print Sample Receipt” button.
Double click on the button in the designer view. This will switch to code view and show the code block handling the mouse click event for the “Print Sample Receipt” code.
Click “Open” to view the code in the designer.
Right Click Button, then click “View Code”
With this tip known, you can now fully explore all of the advanced StarIO commands with ease.
Please note that there is a stopping point in the code where everything below the line
“
CODE BELOW THIS POINT IS NOT USEFUL AS SDK
EXAMPLES
” is not really useful as code samples because they are related specifically to this
SDK program. This code is mostly for the UI so please do not get confused into including this code into your business application.
You can double click on a button in design mode to
move to that block of code instantly.
This SDK contains a folder named “Documentation” with helper RTF documents for the program to load into the right help window. If these files / folder are moved and/or renamed from this folder, the RTF files will not get loaded correctly and the SDK will not display this helpful info.
10
Star Micronics Copyright 2011 - 2014 Version 2.1.0
StarIO – (StarIOPort.dll/StarIOJ.dll & StarIO.Jar)
How to include StarIO into your project:
The file StarIO.jar is a library that you can include into your Java projects to expose StarIO methods. The file StarIOJ.dll is also needed to point to StarIOPort.dll.
To include this library into your project:
1.
Create a new NetBeans Java project
2.
Choose Add JAR/Folder
3.
Navigate to the Java StarIO SDK folder
4.
Click the “Dependencies” folder attached with this SDK and select the folder “32” or
“64” based on your target platform.
5.
Click add existing item, then “StarIO.Jar”
6.
To expose StarIO, add
“ import com.starmicronics.stario.*;” at the top of your main code.
7.
Now you can access all of StarIO’s methods!
Please note that if you want to make your code portable, copy and paste the libraries into your project first. This will avoid and issues once opened on another computer.
StarIO being used as a Reference
Step 2 click Add Jar
Step 3 find stario.jar
WARNING: Make sure StarIOJ.dll and StarIOPort.dll are in the same directory as
StarIO.jar. This file will link itself to StarIOJ.dll which then links to
StarIOPort.dll by looking in the same folder that the StarIO.jar is located in.
11
Star Micronics Copyright 2011 - 2014
Configuring your project to x64 or x86 with StarIO:
Version 2.1.0
Compiling your project with the correct StarIO is very important to get the maximum speed from your CPU. Your main two choices are 32-bit (x86) and 64-bit (x64) operating systems.
1.
To switch this project to a 64-bit project, remove the StarIO library from the Library folder and then right click again and select -Add Jar/Folder…
2.
Navigate to the folder where the 64-bit StarIO is stored
“Java_StarIO_SDK/dependencies/64/”
3.
Select the file “stario.jar”
4.
You now have connected the 64-bit compiled JAR StarIO into your project.
WARNING: Please make sure to include the correctly compiled binary for the
Java project. If you select the wrong one (64-bit even thought the project will run on 32-bit computers) and try to execute function, it may seem like a communication issue but rather it’s a bad library issue.
StarIO Methods Overview:
Class Variables include portName (string), portSettings (string), and Timeout (int).
These 3 variables will be “read only” if accessed directly. To assign them use
GetPort(portName,portSettings,Timeout); which will allow you to pass in
variables to this methods which then assigns the 3 class variables with values.
portName is what you will be using to specify the port of communication to the printer.
Ex. “usbven:” “usbprn:TSP650” “tcp:192.168.1.2” “COM4” “LPT1” “BT:COM3”
portSettings is what you will use for configuring Serial connections correctly.
Ex. “9600,n,8,1,h”
The following are the acceptable inputs from left to right:
baud: 38400, 19200, 9600, 4800, 2400 parity: n, e, o data-bits: 8, 7 stop-bits: 1 flow-ctrl: n, h
Timeout is a
millisecond timeout controlled internally and is used for communication in the APIs (this parameter guarantees that all of the below APIs will complete in a bounded amount of time, but does NOT guarantee the exact timeout length)
12
Star Micronics Copyright 2011 - 2014
GetPort
Version 2.1.0 public static StarIOPort
getPort(
String portName, String portSettings, Int TimeoutMillis)
throws StarIOPortException
GetPort is what you will be using to “open” the port to the device. Using one of the valid inputs for portName and portSettings as mentioned previously before this, you can pass your connection string into the StarIO class so that it will correctly set its private variables.
The following would be an actual usage of getPort in Java:
StarIOPort port = null;
String portName = txtPortName.getText();
String portSettings = txtPortSettings.getText();
String status = ""; try {
port = StarIOPort.getPort(portName, portSettings, TIMEOUT);
} catch (StarIOPortException e) {
status += "Failure to print sample\nCheck printer connection.";
// e .printStackTrace();
} finally {
if (port != null) {
StarIOPort.releasePort(port);
}
}
StarIOPort is a part of StarIO and this will allow you to create a “port” handle. The above example shows the port being created and set to null then being assigned the actual port hook on the following line that contains GetPort.
Always use a Try , Catch when using getPort. If the port cannot be opened because of connection problems, your program will crash unless you use a
Try , Catch like the above example.
ReadPort
public int
ReadPort(
Byte[] readBuffer, Int offset, Int size)
throws StarIOPortException
This method reads data from the device. Only use this if you really need to read raw bytes from the
device
.
Do not use this method to try and read raw status.
Use GetOnlineStatus or GetParsedStatus for getting status.
13
Star Micronics Copyright 2011 - 2014
Parameters: readbuffer
– A Byte Array buffer into which data is read.
offset
- specifies where to begin writing data into the readBuffer[]
size
– Total number of bytes to read.
Returns:
Version 2.1.0
The number of bytes that were actually read. Under some interface types, this function will succeed even when no data was read in. Your application should call this function a limited number of times until the expected data has been read in or until an application determined retry threshold has been reached.
Throws:
StarIOPortException
- when a communication failure occurs
ReleasePort
public static void
ReleasePort(
StarIOPort port)
This function closes a connection to the port specified.
Parameters: port – StarIOPort type representing a previously initialized port.
Always release (close) ports that you get (open).
Leaving a port open will cause future calls to open the port to fail.
14
Star Micronics Copyright 2011 - 2014
WritePort
Version 2.1.0 public int
WritePort(
Byte[] writeBuffer, Int offset, Int size)
throws StarIOPortException
This method writes data to the device. Use this to print to the
device
, send commands, etc. The following is an example of how to use this method:
Please keep in mind this is the simplest way to send data to the printer. private static int WritePortHelper( StarIOPort port, byte [] writeBuffer) throws StarIOPortException { int zeroProgressOccurances = 0; int totalSizeCommunicated = 0; while ((totalSizeCommunicated < writeBuffer.length) && (zeroProgressOccurances < 2))
{ int sizeCommunicated = port.writePort(writeBuffer, totalSizeCommunicated, writeBuffer.length - totalSizeCommunicated); if (sizeCommunicated == 0) {
zeroProgressOccurances++;
} else {
totalSizeCommunicated += sizeCommunicated;
zeroProgressOccurances = 0;
}
} return totalSizeCommunicated;
}
Remember to use a Try , Catch for safe programming practices.
Parameters: writeBuffer
- Contains the output data in a byte array.
offset
- Specifies where to begin pulling data from writeBuffer .
size
- Number of bytes to write.
Returns:
The number of bytes that were actually written. Under some interface types, this function will succeed even when no data was written out. Your application should call this function a limited number of times until all the data has been written out or until an application determined retry threshold has been reached.
Throws:
StarIOPortException
- when a communication failure occurs
15
Star Micronics Copyright 2011 - 2014
ETB
BeginCheckedBlock
Version 2.1.0 public StarPrinterStatus
BeginCheckedBlock()
throws StarIOPortException
This method initiates a checked block printing operation and returns the device's detailed status.
Returns:
StarPrinterStatus structure giving the current device status - don't bother printing if the printer is offline
Throws:
StarIOPortException
- when a communication failure occurs
EndCheckedBlock
public StarPrinterStatus EndCheckedBlock()
throws StarIOPortException
This method ends a checked block printing operation and returns the device's detailed status. This function does not return until either the printer has successfully printed all data or has gone offline in error. If the
StarPrinterStatus structure indicates that the printer is online upon return than all data was successfully printed.
Returns:
StarPrinterStatus structure giving the current device status - if it's offline then printing failed
Throws:
StarIOPortException
- when a communication failure occurs
Here is an example usage of BeginCheckedBlock and EndCheckedBlock methods: try { //Open the port
port = StarIOPort.getPort(portName, portSettings, TIMEOUT);
16
Star Micronics Copyright 2011 - 2014 Version 2.1.0
StarPrinterStatus starPrinterStatus; //Get status
starPrinterStatus = port.beginCheckedBlock(); //Begin checked block if (starPrinterStatus.offline == true) {
status += "Printer is Offline"; return ;
} byte [] data = "Hello World!\n".getBytes();
//For loop to print 50 Hello world lines and end the check block after to make sure all the data has been received for ( int count = 0; count < 50; count++) { int totalSizeCommunicated = WritePortHelper(port, data); // see below if (totalSizeCommunicated != data.length) {
status += "Error! Could not write all data to the printer”; return ;
}
}
//END CHECK BLOCK
starPrinterStatus = port.endCheckedBlock(); if (starPrinterStatus.offline == true) {
status += "The printing failed to send all bytes";
}
status += "Successfully sent all data to printer!”;
} catch (StarIOPortException e) {
status += "Failure to Check Block";
}
ResetDevice
public void
ResetDevice()
throws StarIOPortException
This method resets the device at the hardware level.
Throws:
StarIOPortException
- when a communication failure occurs
GetOnlineStatus
public boolean
GetOnlineStatus()
throws StarIOPortException
17
Star Micronics Copyright 2011 - 2014
This method returns a Boolean value if the device is online or offline.
Returns:
Version 2.1.0
Boolean value: true =
device
is online false =
device
is offline
Throws:
StarIOPortException
- when a communication failure occurs
GetParsedStatus
public StarPrinterStatus
GetParsedStatus ()
throws StarIOPortException
This method retrieves detailed status form the device with StarIO.
Returns:
StarPrinterStatus structure giving the current device status
Throws:
StarIOPortException
- when a communication failure occurs
This method uses a class structure that is included with StarIO called StarPrinterStatus
This structure gives the printer's status in both boolean and binary form.
Create the
StarPrinterStatus
object in your project by doing the following:
StarPrinterStatus printerStatus = port.GetParsedStatus();
If (printerStatus.Offline == false )
{
If (printerStatus.CompulsionSwitch == true ){
//Cash drawer is open
}
Else {
//Cash drawer is closed
}
}
Else {
//If True, then the printer is offline.
}
There are different statuses that are pulled when you initialize
StarPrinterStatus
.
18
Star Micronics Copyright 2011 - 2014
This is a list of statuses that are in the class structure StarPrinterStatus :
CoverOpen returns a Boolean .
Offline returns a Boolean .
CompulsionSwitch returns a Boolean .
OverTemp returns a Boolean .
UnrecoverableError returns a Boolean .
CutterError returns a Boolean .
MechanicalError returns a Boolean .
HeadThermistorError returns a Boolean .
ReceiveBufferOverflow returns a Boolean .
PageModeCommadError returns a Boolean .
BlackMarkError returns a Boolean .
PresenterPaperJamError returns a Boolean .
HeadUpError returns a Boolean .
VoltageError returns a Boolean .
ReceiptBlackMarkDetection returns a Boolean .
ReceiptPaperEmpty returns a Boolean .
ReceiptPaperNearEmptyInner returns a Boolean .
ReceiptPaperNearEmptyOuter returns a Boolean .
PresenterPaperPresent returns a Boolean .
PeelerPaperPresent returns a Boolean .
StackerFull returns a Boolean . slipTOF returns a Boolean . slipCOF returns a Boolean . slipBOF returns a Boolean . validationPaperPresent returns a Boolean . slipPaperPresent returns a Boolean .
ETBAvailable returns a Boolean .
ETBCounter returns a Byte .
PresenterState returns a Byte .
RawStatus returns a Byte[] array.
Version 2.1.0
19
Star Micronics Copyright 2011 - 2014
Functionality
Version 2.1.0
StarIO Printer Commands
All of these commands can be found in the Star Thermal Line Mode Command Manual and
Star Impact Printer Command Manual .
The Java SDK also has page and section references to this document for more information so please download that manual and study it if you need more detail on a specific command.
1D Barcodes
ESC b n1 n2 n3 n4 d1 ... dk RS n1 = Barcode Type
0 = UPC-E 1 = UPC-A 2 = JAN/EAN8 3 = JAN/EAN13
4 = Code39 5 = ITF 6 = Code128 7 = Code93 8 = NW-7 n2 = Under-bar character selection and added line feed selection
1 = No added under-bar characters & Executes line feed after printing barcode
2 = Adds under-bar characters & Executes line feed after printing barcode
3 = No added under-bar characters & doesn’t line feed after printing barcode
4 = Adds under-bar characters & doesn’t line feed after printing barcode n3 = Barcode mode selection specifies the size of the narrow and wide barcode lines n4 = Barcode height (dot count)
20
Star Micronics Copyright 2011 - 2014
2D Barcodes
QR Code
Version 2.1.0
21
There are 5 commands below that are very important to printing a good QR Code.
(1)
Set QR Code Model #
(2)
Set QR Code Correction Level
(3)
Set QR Code Cell Size
(4)
Set QR Code Data
(5)
Print the QR Code
ESC GS y S 0 n
ESC GS y S 1 n
ESC GS y S 2 n
ESC GS y D 1 NUL nL nH d1…dk
ESC GS y P
Here is the order in which commands need to be sent to the printer for it to print the QR code.
QR Model + QR Correction Level + QR Cell Size + QR Data + Print QR Code
Star Micronics Copyright 2011 - 2014
PDF417
Version 2.1.0
Please visit page 3-120 in the Line Mode Spec Manual for more details on PDF417
(1)
Set PDF417 barcode size
(2)
Set PDF417 ECC (Security Level)
(3)
Set PDF417 module X direction size
(4)
Set PDF417 module aspect ratio
(5)
Set PDF417 barcode data
(6)
Print PDF417 barcode
ESC GS x S 0 n p1 p2
ESC GS x S 1 n
ESC GS x S 2 n
ESC GS x S 3 n
ESC GS x D nL nH d1 d2 … dk
ESC GS x P
Here is the order in which commands need to be sent to the printer for it to print the PDF417.
PDF417 Size + PDF417 ECC + PDF417 X-dim + PDF417 Ratio + PDF417 Data + Print PDF417
22
Star Micronics Copyright 2011 - 2014
Cash Drawer
There are 2 examples that involve the cash drawer.
First is the real-time monitoring function located on the bottom right.
Second is the Open Cash Drawer function located on the bottom left.
Check Drawer Status
Version 2.1.0
Click the “Start Monitoring Status” button to start the real-time status monitoring.
Review the code in this timer block for more on getting StarIO status from printer.
Kick (Open) Drawer
The second cash drawer test that can be done is the “Open Cash Drawer” function.
To open the cash drawer, your program just needs to send 0x07 to the printer.
ETB (Check Block)
The ETB will return 0 from the printer once the print job has been completed.
23
Star Micronics Copyright 2011 - 2014
Change Font
Version 2.1.0
Changing the font on the printer can be done with the following commands.
ESC RS F n n = 0 for A, 1 for B, 10 for OCR-B
24
Feed
The feed commands are very straight forward. Use LF for best results.
Star Micronics Copyright 2011 - 2014
Cut
Version 2.1.0
Partial Cut
Full Cut
ESC d 1 or 3
ESC d 0 or 2
Text Formatting
The following are all Text Decoration or formatting related.
25
Star Micronics Copyright 2011 - 2014
Slashed Zero
ESC / n
Underline
Upperline
ESC – n
ESC _ n
Invert Color (B/W)
Emphasized (Bold)
ESC 4
ESC E = on ESC F = off
Upside-Down
Character Expansion
0F = Start DC2 = off
Version 2.1.0
Width
Height
Set Left Margin
ESC l n
Set Right Margin
ESC Q n
Alignment
Left
ESC W n
ESC h n
0 ≤ n ≤ 255
0 ≤ n ≤ 255
ESC GS a 0
0 ≤ n ≤ 255
0 ≤ n ≤ 255
Center
Right
ESC GS a 1
ESC GS a 2
Horizontal Tabbing
This is covered in the sample receipt that can be printed, please review that code block or page 3-29 of the Thermal Line Mode Manual.
Set Horizontal Tab
Clear Horizontal Tab
ESC D n1 n2 ... nk NUL
ESC D NUL
Move Horizontal Tab
HT
26
Star Micronics Copyright 2011 - 2014
SBCS Code Pages
Version 2.1.0
Currently this SDK only supports fonts that are built into the Java virtual machine.
There is a list of fonts that the JVM supports but luckily for you we have already done the hard work by comparing Star supported character sets to the Java sets.
If you hit the drop down box you will see certain code pages that show that the JVM do not support, so in those cases you will not be able to copy and paste these code page character sets into any Java program.
To set a code page on the printer:
ESC GS 74 n n = The Code Page Selection Index
Stored Logo Printing
Stored logo printing is done in the sample receipt. Please review that and the Thermal
Line Mode Manual for more information.
ESC FS p 1 0
Getting Online Status of the Printer
Visit the function code block called
printToPrinter and there you will see the StarIO method GetOnlineStatus being used to retrive a boolean value for online status.
True = Online
False = Offline
Getting Parsed Status of the Printer
Review the function code block called
timerGetStatus_Tick and there you will see the
StarIO method
GetParsedStatus being used to pull a struct down of all the potential
status flags the printer can throw. Click here for the full list of statuses.
27
Star Micronics Copyright 2011 - 2014 Version 2.1.0
Tips for App Development when using StarIO
Star Micronics prides itself as the industry leader in great POS products and with great power comes great responsibility. Below is a tips section just to help you get on the fast track to software development with StarIO.
TIP #1: If you are going to be coding a large project, create a class to abstract all the printing methods into class(s) instead of having the code reside in the main code block. This will help with code reusability and will also save you time in the long run from having to find one line of code in the main code. By having StarIO only reside in the class(s), you will be fully taking advantage of object oriented programming.
TIP #2: Know what the differences and definitions of (ASCII & Unicode), (Hex & Decimal), and
(Byte & Char) are. A byte is normally 8-bits long which would be 8 digits of binary (1s and 0s).
These bytes are just 8 bits of binary data but bytes can also be int or char. The three different variable types basically hold the data in the same way but there are slight differences. Try to code with Bytes instead of Chars, ints, or strings when choosing a variable to contain your print job data. ASCII to Unicode and vice versa conversions are sometimes unsecure so make sure you know what and how the encoding class works with these. Big mistakes made in Unicode are culture-sensitive search and casing, surrogate pairs, combining characters, and normalization.
TIP #3: HEX DUMP MODE! If you are debugging and your application seems to have a bug in it use hex dump mode on the printer. This is the best way to verify what is being sent out of the computer is being received correctly. To put the printer in hex dump mode, turn the printer off, open the cover to the paper, hold the feed button down, turn the printer back on, close the cover, let go of the feed button. Hex dump mode is a sure fire way to verify hex data is sent correctly. When in hex dump mode, printer functions will not work.
TIP #4: Do not waste time trying to reverse engineer StarIO command codes. All the available
StarIO commands are available in the Thermal Line Mode Spec Manual and that is the best resource to use when researching a specific StarIO command. This SDK & Manual was built to help you (The Developer) have a very easy job ahead of you to program for Star Printers.
TIP #5: If there is a command that is not covered in this SDK but you wish to see a code snippet of that command in use then visit our Developers’ section for a possible code block that matches your needs.
TIP #6: StarIO, ESC/POS, UPOS: JavaPOS, POS for .NET, & OPOS are all different ways to communicate with the printer. Visit our Developers’ section for more info on these. This SDK covers StarIO only.
28
Star Micronics Copyright 2011 - 2014
Additional Resources
Version 2.1.0
This section will share resources that will help you develop good software with StarIO.
Star Micronics Developers Network
Browse Star Micronics’ FAQs, ask a question, look up information, etc.
The Developers Network gets you access to:
Updated Versions of this Manual and Source Code
Code Snippets
Star Micronics Printer Drivers
Technical Questions/Support
Download the Star Thermal Line Mode Command Spec Manual
Download the Star Impact Printer Command Spec Manual
Use it as your reference for all StarIO Line Mode commands!
Character Encoding in Java
If you don’t know what ASCII and Unicode is, this is a good place to start.
Oracle Java Internationalization
Good resource for more detail on internationalization.
New to Java Developer Center
Great place to learn more about the Java language.
Unicode.org
The Unicode Consortium – Good place to learn more about Unicode.
1D Barcodes
Barcode Island is a great resource for specs on 1D barcodes.
2D Barcodes
Great place for information on 2D Barcodes, QR Codes , and PDF417
Code Pages
Learn about Code Pages here.
29
Star Micronics Copyright 2011 - 2014
ASCII Table Resource
ASCII Hex Symbol
12
13
14
15
8
9
10
11
4
5
6
7
0
1
2
3
C
D
E
F
8
9
A
B
4
5
6
7
0
1
2
3
BS
TAB
LF
VT
FF
CR
SO
SI
NUL
SOH
STX
ETX
EOT
ENQ
ACK
BEL
ASCII Hex Symbol
76
77
78
79
72
73
74
75
68
69
70
71
64
65
66
67
48
49
4A
4B
4C
4D
4E
4F
44
45
46
47
40
41
42
43
L
M
N
O
H
I
J
K
D
E
F
G
@
A
B
C
ASCII Hex Symbol
28
29
30
31
24
25
26
27
20
21
22
23
16
17
18
19
18
19
1A
1B
1C
1D
1E
1F
14
15
16
17
10
11
12
13
CAN
EM
SUB
ESC
FS
GS
RS
US
DLE
DC1
DC2
DC3
DC4
NAK
SYN
ETB
ASCII Hex Symbol
92
93
94
95
88
89
90
91
84
85
86
87
80
81
82
83
58
59
5A
5B
5C
5D
5E
5F
54
55
56
57
50
51
52
53
^
_
\
]
X
Y
Z
[
T
U
V
W
P
Q
R
S
ASCII Hex Symbol
44
45
46
47
40
41
42
43
36
37
38
39
32
33
34
35
28
29
2A
2B
2C
2D
2E
2F
24
25
26
27
20
21
22
23
.
/
,
-
*
+
(
)
(space)
!
"
#
$
%
&
'
ASCII Hex Symbol
104
105
106
107
108
109
110
111
96
97
98
99
100
101
102
103
68
69
6A
6B
6C
6D
6E
6F
64
65
66
67
60
61
62
63 l m n o h i j k d e f g b c
` a
Use this to compare hex values to symbol (ASCII) values.
30
Version 2.1.0
ASCII Hex Symbol
60
61
62
63
56
57
58
59
52
53
54
55
48
49
50
51
38
39
3A
3B
3C
3D
3E
3F
34
35
36
37
30
31
32
33
<
=
>
?
:
;
8
9
4
5
6
7
0
1
2
3
ASCII Hex Symbol
120
121
122
123
124
125
126
127
112
113
114
115
116
117
118
119
78
79
7A
7B
7C
7D
7E
7F
74
75
76
77
70
71
72
73
|
}
~
z
{ x y t u v w r s p q
Star Micronics is a global leader in the manufacturing of small printers. We apply over 50 years of knowhow and innovation to provide elite printing solutions that are rich in stellar reliability and industry-respected features. Offering a diverse line of Thermal, Hybrid, Mobile, Kiosk and Impact Dot Matrix printers, we are obsessed with exceeding the demands of our valued customers every day.
We have a long history of implementations into Retail, Point of Sale, Hospitality, Restaurants and Kitchens, Kiosks and
Digital Signage, Gaming and Lottery, ATMs, Ticketing,
Labeling, Salons and Spas, Banking and Credit Unions,
Medical, Law Enforcement, Payment Processing, and more!
High Quality POS Receipts, Interactive Coupons with Triggers,
Logo Printing for Branding, Advanced Drivers for Windows,
Mac and Linux, Complete SDK Packages, Android, iOS,
Blackberry Printing Support, OPOS, JavaPOS, POS for .NET,
Eco-Friendly Paper and Power Savings with Reporting Utility,
ENERGY STAR, MSR Reading, futurePRNT, StarPRNT… How can Star help you fulfill the needs of your application?
Don’t just settle on hardware that won’t work as hard as you do. Demand everything from your printer. Demand a Star!
Version
1.0.0
2.0.0
2.1.0
Release Date
July 2011
Mar. 2014
July 2014
Star Micronics Worldwide
Star Micronics Co., Ltd.
536 Nanatsushinya
Shimizu-ku, Shizuoka 424-0066
Japan
+81-54-347-2163 http://www.star-m.jp/eng/index.htm
Star Micronics America, Inc.
1150 King Georges Post Road
Edison, NJ 08837
USA
1-800-782-7636
+1-732-623-5500 http://www.starmicronics.com
Star Micronics EMEA
Star House
Peregrine Business Park, Gomm Road
High Wycombe, Buckinghamshire HP13 7DL
UK
+44-(0)-1494-471111 http://www.star-emea.com
Star Micronics (Thailand) Co., Ltd.
26/59 1st & 3rd Floor, M7 Soi Kingkaew 62/2,
Kingkaew Road, T. Rachathewa,
A. Bangplee, Samutprakarn 10540
Thailand
+66-2-175-1923 http://www.starmicronics.co.th/
advertisement
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Related manuals
advertisement