Koala Preliminary Programming Guide BETA RELEASE

Koala Preliminary Programming Guide BETA RELEASE
Koala Preliminary Programming Guide
BETA RELEASE
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 1
TABLE OF CONTENTS
Koala Programming Guide – BETA............................................................................... 3
INTRODUCTION .............................................................................................................. 3
Port 0 – HotSync Port (on cradle connector) .................................................................. 3
Port 1 – Side Port (DB9)................................................................................................. 3
Port 2 – Printer / Card Reader......................................................................................... 3
Port 3 – Internal 33kbps Dial-up modem (optional)....................................................... 3
Port 4 – PCMCIA slot..................................................................................................... 3
SAMPLE METROWERKS C CODE ................................................................................ 6
SAMPLE APPFORGE CODE ......................................................................................... 10
APPENDIX A – CONNECTOR PINOUT....................................................................... 14
RJ-25 for Internal 33kbps Dial-up modem (optional) and pass-through on cradle. ..... 14
APPENDIX B – PRINTER ESCAPE CODES ................................................................ 15
Horizontal tab................................................................................................................ 15
Print and line feed ......................................................................................................... 15
Print and carriage return................................................................................................ 15
Set right-side character spacing .................................................................................... 16
Set absolute print position............................................................................................. 17
Select bit image mode................................................................................................... 18
Turn underline mode on /off ......................................................................................... 19
Select 1 /6-inch line spacing ......................................................................................... 20
Select line spacing......................................................................................................... 20
Initialize printer............................................................................................................. 20
Set horizontal tab positions........................................................................................... 21
Turn emphasized mode on /off ..................................................................................... 21
Turn on /off double-strike mode ................................................................................... 22
Print and feed paper ...................................................................................................... 22
Set relative print position .............................................................................................. 22
Select justification......................................................................................................... 23
Turn white /black reverse printing mode ...................................................................... 24
Set left margin............................................................................................................... 24
Set printing area width .................................................................................................. 25
Select the height of the bar code ................................................................................... 26
Print bar code ................................................................................................................ 26
Set bar code width......................................................................................................... 28
APPENDIX C MAGNETIC CARD READER................................................................ 29
Specifications:............................................................................................................... 29
Track encoding: ............................................................................................................ 29
Koala track read data: ................................................................................................... 30
APPENDIX D – PCMCIA CONFIGURATION.............................................................. 31
Sprint AirCard 510 by Sierra Wireless ......................................................................... 31
Motorola M1100 for Nextel.......................................................................................... 32
T-Mobile G-100 by Novatel Wireless .......................................................................... 33
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 2
Koala Programming Guide – BETA
INTRODUCTION
In order to maintain 100% Palm OS compatibility, while offering the advantages of builtin PCMCIA communications and multiple I/O devices, the Koala incorporates and
innovative, intelligent port multiplexer to select among the various ports. The application
program sees the standard Palm I/O structure, and talks to the Koala via the PalmOS
Serial Manager. The Koala switches the peripherals addressed with a standard “AT” style
serial command structure.
The user is provided with the Koala Utility, (documented elsewhere) for manual
switching of the I/O ports, testing, and setting operational preferences.
There are 5 internal ‘devices’ in the Koala, each one selectable through the Koala’s
intelligent software switch:
Port 0 – HotSync Port (on cradle connector)
This port, when the Koala is installed in it’s cradle, is wired to the cable attached to the cradle, and is
designed to plug into a Windows PC as the Primary method of HotSync.
Port 1 – Side Port (DB9)
This port is wired identically to the back of an IBM PC, and is designed for direct connection to bar code
readers, MICR check readers, PIN-pads, and biometric devices. It is capable of supplying up to 10 mA to a
port-powered device through the DTR line. When in its cradle, this connector is passed through to the DB9
mounted on the back of the cradle.
Port 2 – Printer / Card Reader
This port and device is functionally and completely code compatible with the AMSI / Verices Pocket
Merchant, with the exception that the Koala is capable of bidirectional card read. Developers can debug and
maintain printing code using the POSE emulator and Pocket Merchant combination.
Port 3 – Internal 33kbps Dial-up modem (optional)
This device, when present, is a completely self-contained 33kbps dial up modem. Specifications, and
features can be found at http://www.radi.com/modular21.htm. Programming commands can be found at
http://www.arcelect.com/IML56_modem_AT_commands.pdf. This option is intended primarily for the
terrain in the Japanese market, and will not be populated in US units unless custom ordered.
Port 4 – PCMCIA slot
Under normal circumstances, the PCMCIA will be automatically accessed and controlled by the Network and
communications facilities of the INET libraries. There should be no need to access this port directly.
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 3
When the Palm serial Port is opened, the Koala connects it to the last selected device. In
order to put the Koala into ‘Command Mode’, close the serial library to drop DTR for
approximately 100 mS, and then re-open it. This is shown in the example
“PChuteToggleDTR” later in this document. However you toggle DTR, once toggled,
the Koala is awaiting a valid Koala command. An abbreviated list of Koala commands is
shown here:
Koala Port Commands:
AT}P0
AT}P1
AT}P2
AT}P3
AT}PU
AT}PO
AT}PF
AT}PD
AT}PE
AT}PQ
- set port 0 (back HotSync port)
- set port 1 (side and cradle DB9)
- set port 2 (printer & credit-card swipe)
- set port 3 (internal modem)
- push current port setting on stack
- pop last-pushed port setting
- flush the port stack
- disable port selector but keep setting, allow wireless card to work
- enable port selector with last setting, disable card
- quit using the port-switching system (on app exit)
To switch to the credit-card reader / printer:
AT}P2
To switch back to wireless card:
AT}PD
To switch back to the credit-card swipe:
AT}PE
or
AT}P2
General rules:
----------After you send a port command (like AT}P2), the multiplexer turns on and switched to
the desired port and it is immediately passing data through directly to the port (printer in
this case).
However, if you drop DTR at any point, (close the serial library), the Koala goes back
into command mode. Even if the port is active (PC-card not taking priority), the Koala
will still eat TWO CHARACTERS on the next transmission. This is because it's looking
for a Koala AT command for baud-rate determination even though it's still in port-passthrough mode.
You can lock the baud rate by issuing "AT}b1", but this is not recommended because
INET might try to run the modem at a higher speed and you'd have a problem.
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 4
Bottom line:
--------------------------------("\r" means carriage-return ASCII 13)
1. If you select the printer ("AT}P2\r"), you can go ahead and use it.
2. If significant time has passed (but no interruption in the Palm operation -- see below),
you may want close the serial library, open it back up (to toggle DTR), and give another
"at}p2\r" port command just to make sure the printer's still on. Again, after giving this
command the printer should be ready to print.
3. If you have to turn off the serial library for some reason for a brief period and turn it
back on, you can give any of the following commands to prime it for printer output again:
at}p2\r
at}pe\r
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 5
SAMPLE METROWERKS C CODE
Here is the Metrowerks C Code used to toggle DTR and return the Koala to
AT-Command mode. We have found that 100ms delays between closing the
library, opening it, and resuming commands works reliably.
Close the port, delay 100ms, open the port, then delay another 100ms to avoid DTRdetection latency problems. There's a max 18ms sleep latency and a 1 or 2 ms main-loop
latency, so it shouldn't really need more than 20ms delay after reopening. We use 100ms
as a safe bracket for interactive use and it's never failed to go back to command mode.
Here is sample C code which performs the 100ms toggle using the PalmOS library. Take
care if you plan to try less than 100ms delay. At some point in decreasing the msdelay,
the "ticks" calculation returns zero, and SysTaskDelay will crash with a zero argument.
More robust code would calculate ticks first in a separate variable, test for zero, and force
at least a value of 1 for the SysTaskDelay argument
// for 100ms
msdelay = 100;
SerClose (RefNum);
SysTaskDelay (msdelay * SysTicksPerSecond () / 1000);
SerOpen (RefNum, 0, 9600)
SysTaskDelay (msdelay * SysTicksPerSecond () / 1000);
//
***********************************************************************
//
// FUNCTION:
PChuteOpen
//
// DESCRIPTION: Opens the Koala communications port and initializes
//
it with the settings from PChuteConfig.
//
// PARAMETERS: none.
//
// RETURNED:
0
= Success
//
< 0
= Failure
//
// REVISION HISTORY:
//
01/01/2000 JRH Creation
//
//
***********************************************************************
int PChuteOpen (UInt16 refNum)
{
int rc;
PChuteLibGlobalsType *gP;
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 6
if ((gP = PrvLockGlobals(refNum)) == NULL)
return (-1);
// still using old serial manager entry points.
// SerOpen returns serErrAlreadyOpen consistently, so ignore
if (gP->PChutePortOpen == 0 && (rc = SerOpen (gP>SerialRefNum, 0,
gP->PChuteSerialSettings.baudRate)) != 0) {
if (rc == serErrAlreadyOpen)
rc = 0;
else {
PrvUnlockGlobals(gP);
return (rc);
}
}
if ((rc = SerSetSettings(gP->SerialRefNum,
&gP->PChuteSerialSettings)) != 0) {
PrvUnlockGlobals(gP);
return (rc);
}
gP->PChutePortOpen = 1;
//
//
//
//
send out Koala AT Inquire command and check for response.
if no response, try it at different baud rates, from 1200
to 57600
it might have been locked at one of these.
PrvUnlockGlobals(gP);
return (0);
}
//
***********************************************************************
//
// FUNCTION:
PChuteClose
//
// DESCRIPTION: Shuts down the Koala communication port.
//
// PARAMETERS: none.
//
// RETURNED:
0
= Success
//
< 0
= Failure
//
// REVISION HISTORY:
//
01/01/2000 JRH Creation
//
//
***********************************************************************
int PChuteClose (UInt16 refNum)
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 7
{
Err error;
PChuteLibGlobalsType *gP;
if ((gP = PrvLockGlobals(refNum)) == NULL)
return (-1);
if (gP->PChutePortOpen == 0)
return (-1);
error = SerClose (gP->SerialRefNum);
gP->PChutePortOpen = 0;
PrvUnlockGlobals (gP);
return (error);
}
//
***********************************************************************
//
// FUNCTION:
PChuteToggleDTR
//
// DESCRIPTION: Toggles the DTR (GPO) line going out of the Palm to
//
the Koala. This resets the Koala serial port and
//
returns it to Koala Command Mode.
//
// PARAMETERS: int ms
Number of milliseconds to toggle
//
DTR. 1-5 ms should be sufficient
//
to reset the Koala Command
//
Mode.
//
// RETURNED:
0
= Success
//
< 0
= Failure
//
// REVISION HISTORY:
//
01Jan2000 JRH Creation
//
14Jul2001 JRH Fixed crash with 10ms ticks
//
//
***********************************************************************
int PChuteToggleDTR (UInt16 refNum, Int16 ms)
{
UInt16 wSysTicksPerSecond;
long lDelayTicks;
wSysTicksPerSecond = SysTicksPerSecond ();
lDelayTicks = wSysTicksPerSecond;
lDelayTicks = lDelayTicks * ms / 1000;
PChuteClose (refNum);
if (lDelayTicks > 0)
//
SysTaskDelay crashes with
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 8
//
an argument of "0"
SysTaskDelay (lDelayTicks);
PChuteOpen (refNum);
if (lDelayTicks > 0)
SysTaskDelay (lDelayTicks);
return (0);
}
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 9
APPFORGE CODE SAMPLE
Begin by creating a BAS Module and add the following:
Option Explicit
Public Enum KoalaPortControl
kcpHotsync = 0
kcpDB9 = 1
kcpPrinter = 2
kcpModemJack = 3
kcpReset = 4
kcpToCard = 5
kcpToBackPort = 6
End Enum
Create a Form and place one Timer and one Com control on the form.
In this example, Form frmPortControl contains the myTimer and myComControl
controls.
It also contains the following Public functions:
OpenPort, ClosePort, SetPort (PortType, LeaveOpen), Wait (MilliSeconds),
TurnOffPrinter
With public functions, you can access all port switching with a few calls. If you need
to send or receive information to the Port from inside your Form, call the SetPort
function with the LeaveOpen parameter set as False and immediately open the port
again with your form's Com control (i.e., to receive information from a reader and
parse into your routine). If you set LeaveOpen as True, you can use the
frmPortControl.myComControl methods, but you must call ClosePort after your are
fined (see Print example below). To receive data, set your threshold , then open
perform.
The Com Control should be set for the Palm COM port (32768). Since the Palm only
has one Comport, you must make sure that the Port is released from any previous
Com Object before calling these routines. Below, a generic PortOpen function is
called from inside the SetPort and TurnPrinterOff routines.
You should also wait for 200 milliseconds before issuing any commands to the Com
Port after it is opened. myTimer allows 100 millisecond pauses. Thus, the SetPort
and TurnPrinterOff routines also call the Wait function to "pause" between Port
Commands.
Public Sub Wait(Optional ByVal MilliSeconds As Long)
If MilliSeconds < 100 Then MilliSeconds = 100
myTimer.Interval = MilliSeconds
TimeUp = False
myTimer.Enabled = True
Do Until TimeUp = True
DoEvents
Loop
End Sub
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 10
If you are going to Print to the Printer after opening the Port, allow sufficient time for
the printer to power on. For example...
Dim R As Boolean
R = frmPortControl.SetPort(kcpPrinter, True)
frmPortControl.Wait 750
frmPortControl.myComControl.Output = "Print..." & vbCrLf
frmPortControl.ClosePort
You will need to experiment with the timing, or set up your program logic so that the
user can initiate a print once the printer is on. It is generally a good idea to set your
port settings when entering a form (screen) and close/reset the port when exiting
from the form. When terminating the program, you should also make sure that the
printer is powered down and that the back port control is set to the Hotsync port.
The TurnPrinterOff function provides for this.
Another Example:
'Save Current Port Setting (if needed)
LastPort = kcpDB9
'Open Form and set the Port
R = frmPortControl.SetPort(kcpPrinter, False)
'Open Port for Form's Com Control
'Do you processing on the form
'Close the Port for the Form's Com Control
'Reset the Port back to it's original state (if needed)
R = frmPortControl.SetPort(LastPort, False)
'Close the Form
Place into frmPortControl Form ========================
Option Explicit
Private
Private
Private
Private
Private
Private
Private
Private
TimeUp
Const sHotsync
Const sDB9
Const sPrinter
Const sModemJack
Const sReset
Const sToCard
Const sToBackPort
As
As
As
As
As
As
As
As
Integer
String =
String =
String =
String =
String =
String =
String =
"AT}P0"
"AT}P1"
"AT}P2"
"AT}P3"
"AT}PQ"
"AT}PD"
"AT}PE"
&
&
&
&
&
&
&
vbCr
vbCr
vbCr
vbCr
vbCr
vbCr
vbCr
Public Sub Wait(Optional ByVal MilliSeconds As Long)
If MilliSeconds < 100 Then MilliSeconds = 100
myTimer.Interval = MilliSeconds
TimeUp = False
myTimer.Enabled = True
Do Until TimeUp = True
DoEvents
Loop
End Sub
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 11
Public Function OpenPort() As Boolean
On Error GoTo errorHandler
If myComControl.PortOpen = False Then
#If APPFORGE Then
myComControl.CommPort = 32768
#Else
myComControl.CommPort = 1
#End If
myComControl.Settings = "9600,N,8,1"
myComControl.PortOpen = True
Wait 200
End If
OpenPort = True
Exit Function
errorHandler:
MsgBox Err.Description
End Function
Public Function SetPort(PortType As KoalaPortControl, LeaveOpen As
Boolean) As Boolean
Dim PortCommand As String
On Error GoTo errorHandler
If OpenPort Then
Select Case PortType
Case kcpHotsync:
PortCommand = sHotsync
Case kcpDB9:
PortCommand = sDB9
Case kcpPrinter:
PortCommand = sPrinter
Case kcpModemJack: PortCommand = sModemJack
Case kcpReset:
PortCommand = sReset
Case kcpToCard:
PortCommand = sToCard
Case kcpToBackPort: PortCommand = sToBackPort
End Select
myComControl.Output = PortCommand
If Not LeaveOpen Then myComControl.PortOpen = False
SetPort = True
End If
Exit Function
errorHandler:
MsgBox Err.Description
End Function
Public Function TurnOffPrinter() As Boolean
'Recommend that this function be called upon termination of your
'program
'To power off the printer, set the back port to the Hotsync Port
'Then set port back to PC Card (default) by calling the Reset
'command
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 12
On Error GoTo errorHandler
If OpenPort Then
myComControl.Output = sHotsync
Wait 200
myComControl.Output = sReset
ClosePort
TurnOffPrinter = True
End If
Exit Function
errorHandler:
MsgBox Err.Description
End Function
Public Sub ClosePort()
Wait 200
myComControl.PortOpen = False
End Sub
Private Sub myTimer_Timer()
myTimer.Enabled = False
TimeUp = True
End Sub
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 13
APPENDIX A – CONNECTOR PINOUT
Side Port DB9 and Side Port DB9 pass-through on cradle. Note: this connector is
wired exactly as the RS-232 connector on the back of a Windows PC. This is so that you
can plug PC peripherals such as bar code readers, MICR check readers, encrypted PIN
pads, and other RS-232 devices directly into it.
1 ------- N/C
2 ------- RxD
3 ------- TxD
4 ------- DTR
5 ------- GND
6 ------- N/C
7 ------- RTS
8 ------- CTS
9 ------- N/C
RJ-25 for Internal 33kbps Dial-up modem (optional) and pass-through on cradle.
1 ------- N/C
2 ------- N/C
3 ------- TIP
4 ------- RING
5 ------- N/C
6 ------- N/C
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 14
APPENDIX B – PRINTER ESCAPE CODES
HT
Horizontal tab
Hex 09
Decimal 9
[Description ] Moves the print position to the next horizontal tab position..
[Notes ]
This command is ignored unless the next horizontal tab position has been set. If the next
horizontal tab position exceeds the printing area, the printer sets the printing position to
[Printing area width +1 ]. Horizontal tab positions are set with ESC D. If this command is
received when the printing position is at [Printing area width +1 ],the printer executes
print buffer-full printing of the current line and horizontal tab processing from the
beginning of the next line.
LF
Print and line feed
Hex 0A
Decimal 10
[Description ] Prints the data in the print buffer and feed one line based on the current
line spacing..
[Notes ]
This command sets the print position to the beginning of the line.
[Reference ] ESC 2,ESC 3
FF
Print and return to standard mode (in page mode)
Hex 0C
Decimal 12
[Description ] Prints the data in the print buffer collectively and returns to standard
mode..
[Notes ]
The buffer data is deleted after being printed. . The printing area set by ESC W is reset to
the default setting. The printer does not execute paper cutting. This command sets the
print position to the beginning of the line. This command is enabled only in page mode.
[Reference ] ESC FF,ESC L,ESC S
CR
Print and carriage return
Hex 0D
Decimal 13
[Description ] When auto-line feed is enabled, this command functions in the same way
as LF. When auto-line feed is disabled, this command is ignored.
[Notes ]
This command sets the print position to the beginning of the line.
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 15
ESC SP n
Set right-side character spacing
Hex 1B 20 n
Decimal 27 32 n
[Range ] 0 = = n = [Description ] Sets the character spacing for the right side of the
character to [nx horizontal or vertical motion units ].
[Notes ]
The right-side character spacing for double-width mode is twice the normal value. When
characters are enlarged, the right-side character spacing is n times normal value. This
command sets values independently in each mode(standard and page modes). The
horizontal and vertical motion unit are specified by GS P.motion unit does not affect the
current right-side spacing. The horizontal and vertical motion unit are specified by GS
P.motion unit does not affect the current right-side spacing. The GS P command can
change the horizontal (and vertical) motion unit. However,the value cannot be less than
the minimum horizontal movement amount, and it must be in even units of the minimum
horizontal movement amount. In standard mode, the horizontal motion unit is used.
In page mode, the horizontal or vertical motion unit differs in page mode, depending on
starting position of the printable area as follows :
1. When the starting position is set to the upper left or lower right of the printable
area using ESC T,
2. the horizontal motion unit (x)is used.
3. When the starting position is set to the upper right or lower left of the printable
area using ESC T, the vertical motion unit (y)is used.
4. The maximum right-side spacing is 255/180 inches. Any setting exceeding the
maximum is converted to the maximum automatically.
[Default ] n==0
[Reference ] GS P
ESC!n
Select print mode(s)
Hex 1B 21 n
Decimal 27 33 n
[Range ] 0 = n = 255
[Description ] Selects print mode((s)using n as follows :
BIT Off/On Hex Decimal Function
Off
00
0
Character font A(12x24)selected.
0
On
01
1
Character font B(9x17)selected.
1
Undefined
2
Undefined
Off
00
0
Emphasized mode not selected
3
On
08
8
Emphasized mode selected
Off
00
0
Double-height mode not selected
4
On
10
16
Double-height mode selected
5
Off
00
0
Double-width mode not selected
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 16
6
7
On
Off
On
20
00
80
32
0
128
Double-width mode selected
Undefined
Underline mode not selected
Underline mode selected
Determine the values of n by adding the values of all the characteristics you want to
select.
[Notes ]
When both double-height and double-width modes are selected, quadruple size characters
are printed. The printer can underline all characters, but can not underline the space set
by HT,ESC $,or ESC\or 90 degree clockwise rotated characters. The thickness of the
underline is that selected by ESC -,regardless of the character size. When some
characters in a line are double or more height, all the characters on the line are aligned at
the baseline. ESC E can also turn on or off emphasized mode. However,the setting of the
last received command is effective. ESC -can also turn on or off underline mode.
However, the setting of the last received command is effective. GS !Can also select
character size. However, the setting of the last received command is effective.
[Default ] n=0
[Reference ]ESC -,ESC E,GS !
ESC $nL nH
Set absolute print position
Hex 1B 24 nL nH
Decimal 27 36 nL nH
[Range ] 0 = nL = 255 ; 0 = nH = 255
[Description ]
Sets the distance from the beginning of the line to the position at witch subsequent
characters are to be printed. The distance from the beginning of the line to the print
position is [(nL +nH ×256)× (vertical or horizontal motion unit)] inches..
[Notes ]
Settings outside the specified printable area are ignored. The horizontal and vertical
motion unit are specified by GS P. The GS P command can change the horizontal (and
vertical) motion unit. However, the value cannot be less than the minimum horizontal
movement amount, and it must be in even units of the minimum horizontal movement
amount. In standard mode, the horizontal motion unit (x)is used. In page mode,
horizontal or vertical motion unit differs depending on the starting position of the
printable area as follows :
1. When the starting position is set to the upper left or lower right of the printable
area using ESC T, the horizontal motion unit (x)is used.
2. When the starting position is set to the upper right or lower left of the printable
area using ESC T, the vertical motion unit (y)is used.
[Reference ] ESC \,GS $,GS \,GS P
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 17
ESC *m nL nH [d ]k
Select bit image mode
Hex 1B 2A m nL nH [d ]k
Decimal 27 42 m nL nH [d ]k
[Range ] m ==0,1,32,33 ; 0 = nL = 255 ; 0 = nH = 3 ; 0 = d = 255
[Description ]Selects a bit-image mode using m for the number of dots specified by nL
and nH,as follows :
M
0
1
32
33
Mode
8-dot single Density
8-dot double Density
24-dot single Density
24-dot double Density
Vertical Direction
Number of
Dot
dots
Density
Horizontal Direction (*1)
Dot
Number of Data
Density
(k)
8
60 DPI
90 DPI
nL+nHx256
8
60 DPI
180 DPI
nL+nHx256
24
180 DPI
90 DPI
(nL+nHx256)x3
24
180 DPI
180 DPI
(nL+nHx256)x3
The nL and nH indicate the number of dots of the bit image in the horizontal direction.
The number of dots is calculated by nL + nH × 256. If the bit-image data input exceeds
the number of dots to be printed on a line, the excess data is ignored. d indicates the bitimage data. Set a corresponding bit to 1 to print a dot or to 0 to not print a dot.
[Notes ]
If the value of m is out of the specified range, nL and data following are processed as
normal data. If the width of the printing area set by GS L and GS W less than the width
required by the data sent with the ESC * command, the following will be performed on
the line in question (but the printing cannot exceed the maximum printable area):
1. The width of the printing area is extended to the right to accommodate the amount
of data.
2. If step ? does not provide sufficient width for the data, the left margin is reduced
to accommodate the data. For each bit of data in single-density mode, the printer
prints two dots :for each bit of data in double-density mode, the printer prints one
dot. This must be considered in calculating the amount of data that can be printed
in one line.
After printing a bit image, the printer returns to normal data processing mode. This
command is not affected by print modes (emphasized, double-strike, and underline, etc.),
except upside-down mode. The relationship between the image data and the dots to be
printed is as follows :
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 18
ESC-n
Turn underline mode on /off
Hex 1B 2D n
Decimal 27 45 n
[Range ] 0 = = n = 2,48 = n = 50
[Description ] Turns underline mode on or off, based on the following value of n.
N
0.48
1.49
2.50
Function
Turns off underline mode
Turns on underline mode(1-dots thick)
Turns on underline mode (2-dots thick)
[Notes ]
The printer can underline all characters (including right-side character spacing),but
cannot underline the space set by HT. The printer cannot underline 90 .clockwise rotated
characters and white /black inverted characters. When underline mode id turned off by
setting the value of n to 0 or 48,the following data is not underlined, and the underline
thickness set before the mode is turned off does not change. The default underline
thickness is 1 dot. Changing the character size does not affect the current underline
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 19
thickness. Underline mode can also be turned on or off by using ESC !. Note, however,
that the last received command is effective.
[Default ] n =0
[Reference ] ESC !
ESC 2
Select 1 /6-inch line spacing
Hex 1B 32
Decimal 27 50
[Notes ]
The line spacing can be set independently in standard mode and in page mode.
[Reference ]ESC 3
ESC 3 n
Select line spacing
Hex 1B 33 n
Decimal 27 51 n
[Range ] 0 = = n = 255
[Description ] Sets the line spacing to [n × vertical or horizontal motion unit ] inches.
[Notes ]
The line spacing can be set independently in standard mode and in page mode. The
horizontal and vertical motion unit are specified by GS P. Changing the horizontal or
vertical
motion unit does not affect the current line spacing. The GS P command can change the
horizontal (and vertical)motion unit. However, the value cannot be less than the
minimum vertical movement amount, and it must be in even units of the minimum
vertical movement amount. In standard mode, the vertical motion unit (y) is used. In
page mode, this command functions as follows, depending on the starting position of the
printable area: ? When the starting position is set to the upper left or lower right of the
printable area using ESC T, the vertical motion unit (y)is used. ? When the starting
position is set to the upper right or lower left of the printable area using ESC T, the
horizontal motion unit (x) is used. . The maximum line spacing is 40 inches. When the
setting value exceeds the maximum, it is converted to the maximum automatically.
[Default ] n =60 (1 /6 inch)
[Reference ] ESC 2,,GS P
ESC @
Initialize printer
Hex 1B 40
Decimal 27 64
[Description ]
Clears the data in the print buffer and resets the printer mode to the mode that was in
effect when the power was turned on.
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 20
[Notes ]
The data in the receive buffer is not cleared.
ESC D [n ] k NUL
Set horizontal tab positions
Hex 1B 44 [n ]k 00
Decimal 27 68 [n ]k 0
[Range ] 1 = = n = 0 = k = 32
[Description ] Set horizontal tab positions..
n specifies the column number for setting a horizontal tab position from the beginning of
the line. k indicates the total number of horizontal tab positions to be set.
[Notes ]
The horizontal tab position is stored as a value of [character width × beginning of the
line. The character width includes the right-side character spacing, and double-width
characters are set with twice the width of normal characters. This command cancels the
previous horizontal tab settings. When setting n =8,the print position is moved to column
9 by sending HT. Up to 32 tab positions (k = 32) can be set. Data exceeding 32 tab
positions is processed as normal data. Transmit [n ]k in ascending order and place a
NUL code 0 at the end. When [n ]k is less than or equal to the preceding value [n ]k 1,tab setting is finished and the following data is processed as normal data. ESC D NUL
cancels all horizontal tab positions. When [n ]k exceeds the number of characters
printable on one line, the tab position set is equal to the maximum printable column plus
1. The previously specified horizontal tab positions do not change, even if the character
width
changes.
[Default ]
The default tab positions are at intervals of 8 characters (columns 9,17,25,…)for the font
A (12 ×24)
[Reference ]HT
ESC E n
Turn emphasized mode on /off
Hex 1B 45 n
Decimal 27 69 n
[Range ] 0 = = n = 255
[Description ]
Turns emphasized mode on or off. When the LSB of n is 0,emphasized mode is turned
off. When the LSB of n is 1,emphasized mode is turned on.
[Notes ]
Bit image and downloaded bit image, and bar code cannot be emphasized. ESC !also
turns on and off emphasized mode. However, the last received command is effective.
[Default ] n =0
[Reference ]ESC !
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 21
ESC G n
Turn on /off double-strike mode
Hex 1B 47 n
Decimal 27 71 n
[Range ] 0 = = n = 255
[Description ] Turns double--strike mode on or off.
When the LSB of n is 0,double-strike mode is turned off. When the LSB of n is
1,double-strike mode is turned on.
[Notes ]
Printer output is the same in double-strike mode and in emphasized mode. Double-strike
mode can not be used for the bit image.downloaded bit image, and bar code.
[Default ] n =0
[Reference ]ESC E
ESC J n
Print and feed paper
Hex 1B 4A n
Decimal 27 74 n
[Range ] 0 = = n = 255
[Description ]
Prints the data in the print buffer and feed the paper [n × vertical or horizontal motion
unit ] inches.
[Notes ]
After printing is completed, this command sets the print starting position to the beginning
of the line. The paper feed amount set by this command does not affect the values set by
ESC 2 or ESC 3. The horizontal and vertical motion unit are specified by GS P. The GS
P command can change the vertical (and horizontal)motion unit. However, the value
cannot be less than the minimum vertical movement amount, and it must be in even units
of the
minimum vertical movement amount. In standard mode, the printer uses the vertical
motion unit (y). When this command is used in page mode, the command functions as
follows, depending on the starting position of the printable area. ? When the starting
position is set to the upper left or lower right of the printable area using ESC T, the
vertical motion unit (y)is used.? When the starting position is set to the upper right or
lower left of the printable area using ESC T, the horizontal motion unit (x)is used. The
maximum paper feed amount is 40 inches. Even if a paper feed amount of more than 40
inches is set, the printer feeds the paper only 40 inches.
[Reference ] GS P
ESC /nL nH
Set relative print position
Hex 1B 5C nL nH
Decimal 27 92 nL nH
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 22
[Range ] 0 = = nL = 255 ; 0 = nH = 255
[Description ]
Sets the print starting position based on the current position by using the horizontal or
vertical motion unit. This command sets the distance from the current position to [(nL
+ nH ×256)× horizontal or vertical motion unit ]
[Notes ]
Any setting that exceeds the printable area is ignored. When pitch N is specified to the
right :nL + nH ×256 =N When pitch N is specified to the left (the negative direction),use
the complement of 65536.When pitch N is specified to the left : nL + nH ×256 =65536 –
N
The print starting position moves from the current position to [N × horizontal or vertical
motion unit ] The horizontal and vertical motion unit are specified by GS P. The GS P
command can change the horizontal (and vertical)motion unit. However, the value cannot
be less than the minimum horizontal movement amount, and it must be in even units of
the
minimum horizontal movement amount. In standard mode, the horizontal motion unit is
used. In page mode, the horizontal or vertical motion unit differs as follows, depending
on the starting point of the printing area :
1. When the starting position is set to the upper left or lower right of the printable
area using ESC T, the horizontal motion unit (x )is used.
2. When the starting position is set to the upper right or lower left of the printable
area using ESC T, the vertical motion unit (y )is used.
[Reference ] ESC $,GS P
ESC a n
Select justification
Hex 1B 61 n
Decimal 27 97 n
[Range ] 0 = = n = 2,48 = n = 50
[Description ]
Aligns all the data in one line to the specified position.n selects the type of justification as
follows :
[Notes ]
The command is enabled only when input at the beginning of the line. If this command is
input in page mode, the printer performs only internal flag operation. This command
does not affect printing in page mode. Lines are justified within the specified printing
area. Spaces set by HT,ESC $,and ESC \are all justified.
[Default ] n =0
N
Justification
1.49,31H Left justification
0.48,30H
Centering
2.50,32H Right justification
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 23
[Example ]
Left Justification
ABC
ABCD
ABCDE
Center Justification
ABC
ABCD
ABCDE
Right Justification
ABC
ABCD
ABCDE
GS B n
Turn white /black reverse printing mode
Hex 1D 42 n
Decimal 29 66 n
[Range ] 0 = = n = 255
[Description ] Turns on or off white / black reverse printing mode. When the LSB of n is
0, white / black reverse mode is turned off. When the LSB of n is 1, white / black reverse
mode is turned on.
[Notes ]
In white /black reverse printing mode, print dots and non-print dots are reversed.
(Characters are printed in white on a black background.) This command is available for
built-in characters and user-defined characters. When white /black reverse printing mode
is on, it also applied to character spacing set by ESC SP. This command does not affect
bit image, downloaded bit image, bar code, HRI characters, and spacing skipped by
HT,ESC $,and ESC \. This command does not affect the space between lines. White
/black reverse mode has a higher priority than underline mode. Even if underline mode is
on,
it is disabled (but not canceled) when white / black reverse mode is selected.
[Default ]n =0
GS L nL nH
Set left margin
Hex 1D 4C nL nH
Decimal 29 76 nL n H
[Range ]0 = nL = 255 ; 0 = nH = 255
[Description ]
Sets the left margin using nL and nH. The left margin is set to [(nL + nH × 256)×
horizontal motion unit ] inches.
[Notes ]
This command is effective only at the beginning of a line. If this command is input in
page mode, the printer performs only internal flag operations. This command does not
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 24
affect printing in page mode. If the setting exceeds the printable area, the maximum
value of the printable area is used. The horizontal and vertical motion unit are specified
by GS P. Changing the horizontal or vertical motion unit does not affect the current left
margin. The GS P command can change the horizontal (and vertical)motion unit.
However, the value cannot be less than the minimum horizontal movement amount, and
it must be in even units of the minimum horizontal movement amount.
[Default ] nL =0,nH =0
[Reference ] GS P,,GS W
GS W nL nH
Set printing area width
Hex 1D 57 nL nH
Decimal 29 87 nL n H
[Range ] 0 = nL = 255 ; 0 = nH = 255
[Description ]
Sets the printing area width to the area specified by nL and nH.
The printing area width is set to [(nL + nH × 256))× horizontal motion unit ] inches.
[Notes ]
This command is effective only at the beginning of a line. In page mode, the printer
performs only internal flag operations. This command does not affect the printing in
page mode. The maximum possible setting for the print range is the same as the
maximum printable area in the horizontal position. Settings exceeding the maximum
setting are rounded down to the maximum setting. The horizontal and vertical motion
unit are specified by GS P.motion unit does not affect the current printing area width.
The GS P command can change the horizontal (and vertical)cannot be less than the
minimum horizontal movement amount, and it must be in even units of the minimum
horizontal movement amount. one character, when the character data is developed, the
following processing is performed :
1. The set printing area width is extended to the right to accommodate one character.
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 25
2. If the printing area width cannot be extended sufficiently, the left margin is
reduced to accommodate one character.
When developing the bit image for a downloaded bit image, the following processes are
performed if the width of the printing area is less than the width required by the data sent
with the ESC *or GS / command :? The printing area width is extended to the right to
accommodate the data. ? If the printing area is still insufficient at ? ,the left margin is
reduced to accommodate the data. [Default ] Thermal paper mode :nL =128,nH =1
Thermal paper mode :nL =112,nH =2
[Reference ] GS L,GS P
GS h n
Select the height of the bar code
Hex 1D 68 n
Decimal 29 104 n
[Range ] 0 = = n = 255
[Description ]
Select the height of the bar code n specifies the number of dots in the vertical direction.
[Default ] n =162
[Reference ] GS K
? GS k m d1 …dk NUL ? GS k m n d1 …dn
Print bar code
[Range ] ? 0 = m = 6 (k and d depends on the bar code system used) ? 65 = m = 73 (n
and d depends on the bar code system used)
Format ? Hex 1D 6B m d1 …dk 00
Format ? Decimal 29 107 m d1 …dk 0
Format ? Hex 1D 6B m n d1 …dn
Format ? Decimal 29 107 m n
[Description ] Select a bar code system and prints the bar code; M select a bar code
system as follows;
M
1
0
1
2
3
Bar Code System
UPC-A
UPC-E
JAN13 (EAN)
JAN8 (EAN)
Number of Characters
11= k = 12
11= k = 12
12= k = 12
7= k = 8
Remark
48 = d = 57
48 = d = 57
48 = d = 57
48 = d = 57
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 26
4
CODE39
5
ITF
6
CODABAR
65
66
67
68
UPC-A
UPC-E
JAN13(EAN)
JAN8(EAN)
69
CODE39
70
ITF
71
CODABAR
72
73
CODE93
CODE128
2
48 = d = 57
65 = d = 90,
32,36,37,43,45,46,47
1= k (even number)
48 = d = 57
48 = d = 57
1= k
65 = d = 68,36,43
45,46,47,48
11= n = 12
48 = d = 57
11= n = 12
48 = d = 57
12= n = 13
48 = d = 57
7= n = 8
48 = d = 57
48 = d = 57
1= n = 255
65 = d = 90,32,36,
37,43,45,46,47
1= n = 255 (even number)
48 = d = 57
48 = d = 57
1= n = 255
65 = d = 68,36,43
45,46,47,58
1= n = 255
0= d = 127
2= n = 255
0= d = 127
1= k
[Description for ? ]
d indicates the character code to be printed and k indicates the number of characters to be
printed.
[Description for ? ]
n indicates the number of bar code data, and the printer processes n bytes from the next
character data as bar code data. d indicates the character code to be printed.
[Notes for ? ]
This command ends with a NUL code. When the bar code system used is UPC-A or
UPC-E, the printer prints the bar code data after receiving 12 bytes bar code data and
processing the following data as normal data. When the bar code system used is JAN
13,the printer prints the bar code after receiving 13 bytes bar code data and processes the
following data as normal data. When n the bar code system used is JAN 8,the printer
prints the bar code after receiving 8 bytes bar code data and processes the following data
as normal data. The number of data for ITF bar code must be even numbers. When an
odd number of data is input, the printer ignores the last received data.
[Notes for ? ]
If is outside of the specified range, the printer stops command processing and processes
the following data as normal data.
[Notes for standard mode ]
If d is outside of the specified range, the printer only feeds paper and processes the
following data as normal data. If the horizontal size exceeds printing area, the printer
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 27
only feeds the paper. This command feeds as much paper as is required to print the bar
code, regardless of the line spacing specified by ESC 2 or ESC 3. This command is
enabled only when no data exists in the print buffer. When data exists in the print buffer,
the printer processes the data following m as normal data. After printing bar code, this
command sets the print position to the beginning of the line. This command is not
affected by print modes (emphasized, double-strike, underline, or character size), except
for upside-down mode.
[Notes in page mode ]
This command develops bar code data in the print buffer, but does not print it. After
processing bar code data, this command moves the print position to the right side dot of
the bar code. If d is out of the specified range, the printer stops command processing and
processes the following data as normal data. In this case the data buffer position does not
change. If bar code width exceeds the printing area, the printer does not print the bar
code but moves the data buffer position to the left side out of the printing area.
[Reference ]GSH,GS f,GS h,GS w
GS w n
Set bar code width
Hex 1D 77 n
Decimal 29 119 n
[Range ] 2 = n = 6
[Description ]
Set the horizontal size of the bar code.
n specified the bar code width as follows : Multi-level bar codes are as follows :UPCA,UPC-E,JAN13,JAN8,CODE93,CODE128 Binary-level bar codes are as follows
:CODE39,ITF,CODABAR
[Default ] n =3
[Reference ] GS k
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 28
APPENDIX C MAGNETIC CARD READER
Specifications:
CARD STANDARD
READING METHOD
TRACK USED
READING DENSITY
READING CAPACITY
CARD THICKNESS
ISO-7811
F2F(FM)
TRACK1
TRACK2
ISO I (IATA)
ISO II (ABA)
210 BPI
75 BPI
79
40 CHARACTERS
CHARACTERS
(7-BIT CODE)
(5-BIT CODE)
0.76 +0.08mm
-Card Feeding Speed :20 to 120 cm/sec
-Head Life Time :Approximately 500,000 passes
-Card Jitter: Less than 18 %
Track encoding:
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 29
Koala track read data:
Here is an actual Koala track read output and breakdown (the card number has been
modified for obvious reasons):
Start Sentinel and
Format Character
Primary Account
Number (PAN)
Field
Separator
Cardholder
Name
Padded with
space(s)
ASCII 32
%B4012888888881881^IDEUE/DENNIS¤¤¤¤¤¤¤¤¤¤¤¤^
030710100000019302000000315000000?4012888888
881881=0307101193020315?
End of Track indicator
Track 2 Field
Separator
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 30
APPENDIX D – PCMCIA CONFIGURATION
Sprint AirCard 510 by Sierra Wireless
In order to use the Sierra Wireless
AirCard 510 in the Koala, you will
need to make the following settings in
your communications setup.
To set basic network preferences :
Setup is done in the Network
Preferences section off the phone. You
will only need to do this once for a
particular service.
A "service" is a record of information
that applies to your network
connection.
To create a new Connection:
1. Tap on the “Prefs” screen icon.
2. Select “Connection” in the upper right hand corner.
3. A list will appear. Tap “New” at the bottom of the screen.
4. Fill in the following information:
o Name: KoalaCard
o Connection Method: Serial to Modem
o Dialing: TouchTone.
o Volume: OFF
5. Tap “Details” at the bottom of the screen.
o Speed: 19,200 bps
o Flow Ctl: ON
o Init String: Leave this blank.
6. Tap “OK” to save these settings, and then “OK” again to save the connection
To create a new network service:
7. Select “Network” in the upper right hand corner.
8. At the Network Preferences screen:
o Service: Sprint PCS
o User Name: web
o Password: Tap on -Prompt- to assign a password. Your password, like your
username is: web
o Connection: Select KoalaCard.
o Phone: #2932 (include the “#” sign)
To set up advanced network preferences:
1. Make sure that you have performed the steps for Basic Network Setup first.
2. Tap on the Details button at the bottom of the screen.
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 31
3. For most connections, the default settings are adequate.
o Connection type: PPP
o Idle Timeout: Immediate (IMPORTANT)
o Query DNS: leave it checked.
o IP Address: Sprint does not require a static IP address, so this should remain
checked.
Motorola M1100 for Nextel
In order to use the Motorola M1100 wireless modem in the Koala, you will need to make
the following settings in your communications setup.
To set basic network preferences:
Setup is done in the Network Preferences section off the Koala.
You will only need to do this once for a particular service.
A "service" is a record of information that applies to
your network connection.
To create a new Connection:
1. Tap on the “Prefs” screen icon.
2. Select “Connection” in the upper right hand corner.
3. A list will appear. Tap the “New” button at the bottom of the screen.
4. Fill in the following information:
o Name: Motorola 1100
o Connection Method: Serial to Modem
o Dialing: TouchTone.
o Volume: OFF
5. Tap “Details” at the bottom of the screen.
o Speed: 19,200 bps
o Flow Ctl: ON (VERY IMPORTANT)
o Init String: Leave this blank.
6. Tap “OK” to save these settings, and then “OK” again to save the connection.
To create a new Network Service:
7. Select “Network” in the upper right hand corner.
8. Open the menu at the top left of the screen. Under the “Service” menu, select “New”.
9. At the new Network Preferences screen:
o Service: Nextel
o User Name: AMSI
o Password: Tap on -Prompt- to assign a password. Your password, like your
username is: AMSI
o Connection: Select Motorola 1100.
o Phone: S=2
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 32
To set up Advanced Network Preferences (Details):
10. First make sure that you have performed the steps for creating a Network Service
above.
11. Tap on the “Details” button at the bottom of the screen.
12. For most connections, the default settings are adequate.
o Connection type: PPP
o Idle Timeout: Immediate (IMPORTANT)
o Query DNS: leave it checked.
o IP Address: Nextel does not require a static IP address, so this should remain
checked.
T-Mobile G-100 by Novatel Wireless
Setup:
1. Prefs | Connection
- "New..." button
- Name:
VoiceStream
- Connection Method: Serial to PC
- (everything else should disappear)
2. Prefs | Connection | Details...
- Speed: 19200 bps
- Flow Ctl: On
(VERY IMPORTANT)
(do NOT leave flow ctl set to automatic)
3. Prefs | Network
- Menu:
"New"
- Service: T-Mobile VoiceStream
- User Name: AMSI
- Password: AMSI
- Connection VoiceStream
4. Prefs | Network | Details...
- Connection Type: PPP
- Idle timeout: Immediate << IMPORTANT!
- Query DNS
CHECKED
- IP Address
CHECKED Automatic
5. Prefs | Network | Details... | Script...
- Delay: 2
- Send: AT}S8=1
- Send CR:
- Wait For: OK
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 33
- Send: ATE1V1
- Send CR:
- Wait For: OK
- Send: AT+CGDCONT=1,"IP","internet3.voicestream.com"
- Send CR:
- Wait For: OK
- Send: ATD*99#
- Send CR:
- Wait For: CONNECT
- End:
Koala Programming Guide BETA RELEASE Copyright 2003, Advanced Merchant Solutions, Inc.
Page 34
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement