User Manual
User Manual
te nts
1. About
this
ios Printer SDK guide
..................................................................................................................................................4
V1.0.0
1
2-1-7 Select and print the bar code system...................................................................10
2-1-8 Set character size................................................................................................. 10
2-1-9 Real-time transmission printer ID........................................................................11
2-1-10 Real-time status transmit................................................................................... 11
2-1-11 Real-time printer request................................................................................... 11
2-1-12 Real-time pulse generator.................................................................................. 11
2-1-13 Select the bitmap mode..................................................................................... 12
2-1-14 Set / release underline mode.............................................................................12
2-1-15 Select the font................................................................................................... 12
2-1-16 Set / release 90 ° clockwise rotation..................................................................12
2-1-17 Set bitmap mode............................................................................................... 12
2-1-18 Select HRI character font...................................................................................13
2-1-19 Set / release inverse print mode........................................................................13
2-1-20 Barcode width.................................................................................................... 13
2-1-21 Select print direction in page mode...................................................................13
2-1-22 Set / release Bold............................................................................................... 14
2-1-23 Select paper cutting mode.................................................................................14
2-1-24 Set/Release invert printing mode.......................................................................14
2-1-25 Port selection..................................................................................................... 14
3.RTPrinter command control class definition (reference)............................................................15
3-1 Overview........................................................................................................................ 15
3-2 Porperties....................................................................................................................... 15
3-2-1 delegate............................................................................................................... 15
3-2-2 - (BOOL) InitPrinter.............................................................................................. 16
3-2-3 - (void) HT............................................................................................................ 16
3-2-4 - (void) LF............................................................................................................. 17
3-2-5 - (void) CR............................................................................................................ 17
3-2-6 - (void) Selftest Print............................................................................................ 18
3-2-7 - (void) SetRightSpace:(Byte)Distance..................................................................18
3-2-8 - (void) SetAbsoluteprintPosition:(Byte)nL highByte:(Byte)nH.............................18
3-2-9 - (void) SetRelativeprintPosition:(Byte)nL highByte:(Byte)nH..............................19
3-2-10 - (void) Set Default Line Spacing........................................................................20
3-2-11 - (void) Set Line Spacing:(Byte)Line Spacing.......................................................20
3-2-12 - (void) Set Left Start Spacing:(Byte)nL highByte:(Byte)nH.................................20
3-2-13 - (void) Set Area Width:(Byte)nL highByte:(Byte)nH..........................................21
3-2-14 - (void) Set Character Printmode:(Byte)Character Print mode...........................21
3-2-15 - (void) Set Underline:(Byte)UnderLine En........................................................22
3-2-16 - (void) Add Bold:(Byte)BoldEn..........................................................................22
3-2-17 - (void) SetCharacterFont:(Byte)Font.................................................................23
3-2-18 - (void) SetRotate:(Byte)RotateEN.....................................................................23
3-2-19 SetAlignMode................................................................................................... 24
3-2-20 - (void) SetInvert Print:(Byte)Invert ModeEn.....................................................24
3-2-21 - (void) Set Zoom:(Byte)Font Enlarge.................................................................25
3-2-22 - (void) Set BlackReverse Print:(Byte)BlackReverse En.......................................26
2
3-2-23 - (void) OpenDrawer:(Byte)DrawerNumber startTime:(Byte)pulseStartTime
endTime:(Byte)PulseEndTime....................................................................................... 26
3-2-24 - (void) Cut Paper.............................................................................................. 27
3-2-25 - (void) partial Cut Paper................................................................................... 27
3-2-26 ① - (void) Feed And Cut Paper:(Byte)Cut Mode.............................................28
②- (void) Feed And Cut Paper:(Byte)Cut Mode feed:(Byte)Feed Distance....................28
3-2-27 Add Bar Code Print............................................................................................ 28
3-2-28 Begin Print Image............................................................................................... 30
3-3 Instance Methods.......................................................................................................... 31
3-3-1 Begin................................................................................................................... 31
3-3-2 Excute.................................................................................................................. 32
3-3-3 Import Data......................................................................................................... 32
3-3-4 Clear Data........................................................................................................... 32
3-3-5 btn Connect........................................................................................................ 33
3-3-6 btnPrint............................................................................................................... 33
3-3-7 btn Preferences Click........................................................................................... 34
4.Agreement Involved.................................................................................................................. 36
4-1 Outline............................................................................................................................ 36
4-2 Instance Methods........................................................................................................... 36
4-2-1 connect Host........................................................................................................ 36
4-2-2 disconnect.......................................................................................................... 37
5.Appendix................................................................................................................................... 37
This guide describes the SDK library functions for IOS application development.
Platform
iOS 4.3 or higher
Development environment
XCode 4.2.6 or higher
3
1-2Models / interface list
3) Select "Link Binary With Libaries" project, click on the "+" pop up boxes as follow, select
4
1-3-2 Add a static library appropriate header files
AsynSocket.h
5
2. Contant
The following is a list of character set supported , the default character set is RT_CS_CP437.
6
RT_CS_MIK 8 MIK【Slavic / Bulgarian】
RT_CS_CP755 9 CP755【Eastern Europe, Latvia2】
RT_CS_CP862 15 CP862【Hebrew】
RT_CS_WCP1252 16 WCP1252【 Latin1】
RT_CS_WCP1253 17 WCP1253【Greece】
RT_CS_CP852 18 CP852【Latin2】
RT_CS_CP858 19 CP858【Latin characters1+European
languages】
RT_CS_IRANII 20 Iran II【Persian】
RT_CS_LATVIA 21 Latvia
RT_CS_CP864 22 CP864【Arabic】
RT_CS_ISO88591 23 ISO-8859-1【Western Europe】
RT_CS_CP737 24 CP737【Greece】
RT_CS_WCP1257 25 WCP1257【Baltic】
RT_CS_THAI 26 Thai
RT_CS_CP720 27 CP720【Arabic】
RT_CS_CP855 28 CP855
RT_CS_857 29 CP857【Turkish】
RT_CS_WCP1250 30 WCP1250【Central Europe】
RT_CS_CP775 31 CP775
RT_CS_WCP1254 32 WCP1254【Turkish】
RT_CS_WCP1255 33 WCP1255【Hebrew】
RT_CS_WCP1256 34 WCP1256【Arabic】
RT_CS_WCP1258 35 WCP1258【Vietnamese】
RT_CS_ISO88592 36 ISO-8859-2【Latin2】
RT_CS_ISO88593 37 ISO-8859-3【Latin3】
RT_CS_ISO88594 38 ISO-8859-4【Baltic】
RT_CS_ISO88595 39 ISO-8859-5【Cyrillic】
RT_CS_ISO88596 40 ISO-8859-6【Arabic】
RT_CS_ISO88597 41 ISO-8859-7【Greek】
RT_CS_ISO88598 42 ISO-8859-8【Hebrew】
RT_CS_ISO88599 43 ISO-8859-9【Turkish】
RT_CS_ISO885915 44 ISO-8859-15【9Latin 9】
RT_CS_THAI2 45 【Thai 2】
RT_CS_CP856 46 CP856
RT_CS_CP874 47 CP874
The following is a list of supported international character set, the default character set is
RT_ICS_CHINESE
7
Code Value Description
RT_ICS_USA 0 United States
RT_ICS_FRANCE 1 France
RT_ICS_GERMANY 2 Germany
RT_ICS_ENGLAND 3 British
RT_ICS_DENMARKI 4 Denmark I
RT_ICS_SWEDEN 5 Sweden
RT_ICS_ITALY 6 Italy
RT_ICS_SPAINI 7 Spanish I
RT_ICS_JAPAN 8 Japan
RT_ICS_NORWAY 9 Norway
RT_ICS_DENMARKII 10 Denmark II
RT_ICS_SPAINII 11 Spain II
RT_ICS_LATIN 12 Latin America
RT_ICS_KOREAN 13 Korea
RT_ICS_SLOVENIA 14 Slovenia
RT_ICS_CHINA 15 China
8
2-1-5 Select the print mode
9
RT_TS_1WIDTH 0x00 1(general)
RT_TS_2WIDTH 0x10 2 times the width
RT_TS_3WIDTH 0x20 3 times the width
RT_TS_4WIDTH 0x30 4 times the width
RT_TS_5WIDTH 0x40 5 times the width
RT_TS_6WIDTH 0x50 6 times the width
RT_TS_7WIDTH 0x60 7 times the width
RT_TS_8WIDTH 0x70 8 times the width
Character height settings
Code Value Description
RT_TS_1HEIGHT 0x00 1(general)
RT_TS_2HEIGHT 0x01 2 times the height
RT_TS_3HEIGHT 0x02 3times the height
RT_TS_4HEIGHT 0x03 4times the height
RT_TS_5HEIGHT 0x04 5times the height
RT_TS_6HEIGHT 0x05 6times the height
RT_TS_7HEIGHT 0x06 7times the height
RT_TS_8HEIGHT 0x07 8times the height
10
2-1-11 Real-time printer request
11
2-1-16 Set / release 90 ° clockwise rotation
12
RT_BARCODE_5 6 0.750 0.750 2.000
13
2-1-25 Port selection
(reference)
3-1 Overview
This section mainly describes our Company's printer control method class definition.
14
3-2 Porperties
3-2-1 delegate
【Description】
This part is for the control function initialization
【Applicable version】
SDK 1.0.0 or higher
【Example】
@interface delegateTestClass : NSObject
{ //Declaration
}
@end
@implementation TestClass
//process
-(id) initWithDelegate : (id) de
{ //Implementation
self = [super init];
if(self){
delegate = de;
if(mCmdBuffer == NULL)
mCmdBuffer = malloc(sizeof(Byte)*BUFFER_MAX_LEN);
mIndex = 0;
}
return self;
}
【Description】
This part is for the printer initialization
15
【Applicable version】
SDK 1.0.0 or higher
【Example】
Byte combyte[] = {0x1B, 0x40};
if(![asyncSocket isConnected])
retrurn false;
return true;
3-2-3 - (void) HT
【Description】
Moves the print position to the next level anchor position (horizontal orientation)
HT
【Applicable version】
SDK 1.0.0 or higher
【Example】
mCmdBuffer[mIndex++] = 0x09;
3-2-4 - (void) LF
【Description】
Print the data form the butter area,and forward the the paper one line in accordance with
the current line spacing
LF
【Note】
This command sets the print position to the beginning of the line
【Applicable version】
SDK 1.0.0 or higher
【Example】
mCmdBuffer[mIndex++] = 0x0A;
16
3-2-5 - (void) CR
【Description】
Print and carriage returnCR
CR
【Note】
This command function is the same as LF’s function when allowing automatic
document feed.
The command is ignored when not allow automatic document feed.
For serial interface mode, the command’s line paper feed function is ignored.
Set the printing start position to the starting point of the line.
【Applicable version】
SDK 1.0.0 or higher
【Example】
mCmdBuffer[mIndex++] = 0x0D;
【Description】
Print test test page
【Applicable version】
SDK 1.0.0 or higher
【Example】
mCmdBuffer[mIndex++] = 0x12;
mCmdBuffer[mIndex++] = 0x54;
17
Set value standard mode independently in every mode.
【Applicable version】
SDK 1.0.0 or higher
【Example】
mCmdBuffer[mIndex++] = 0x1B;
mCmdBuffer[mIndex++] = 0x20;
mCmdBuffer[mIndex++] = Distance;
@property(readwrite) Byte nL
@property(readwrite) Byte nH
【Description】
This command sets the print position to the beginning of the line.
The space from the print position to the beginning of the line is [(nL + nH *256)*0.125 mm].
【Note】
The set outside the specified print range is ignored.
Use the horizontal motion units in standard mode.
【Applicable version】
SDK 1.0.0 or higher
【Example】
mCmdBuffer[mIndex++] = 0x1B;
mCmdBuffer[mIndex++] = 0x24;
mCmdBuffer[mIndex++] = nL;
mCmdBuffer[mIndex++] = nH;
@property(readwrite) Byte nL
@property(readwrite) Byte nH
【Description】
Take the current position as basis point, use horizontal or vertical motion units, set the
beginning& ending print position.
The command set the print position from the current position to [(nL + nH *256)*0.125 mm].
【Note】
18
Any set is ignored if outside the specified print range.
If the space N is appointed to right : nL+ nH*256 = N
If N is appointed to left: (reverse), use the complement of 65536. nL+ nH*256 = 65536
– N.
【Applicable version】
SDK 1.0.0 or higher
【Example】
mCmdBuffer[mIndex++] = 0x1B;
mCmdBuffer[mIndex++] = 0x5C;
mCmdBuffer[mIndex++] = nL;
mCmdBuffer[mIndex++] = nH;
【Description】
Linespacing is selected to be 3.75 mm(30*0.125mm).
【Applicable version】
SDK 1.0.0 or higher.
【Example】
mCmdBuffer[mIndex++] = 0x1B;
mCmdBuffer[mIndex++] = 0x32;
【Description】
This part is to set line spacing, as param * 0.125mm.
ESC 3 n
【Note】
Line spacing can be set independently in standard mode and page mode.
Use vertical motion units in standard mode(y).
【Applicable version】
SDK 1.0.0 or higher.
19
【Example】
mCmd Buffer[mIndex++] = 0x1B
mCmd Buffer[mIndex++] = 0x33;
mCmd Buffer[mIndex++]= Set Line Spacing;
@property(readwrite) Byte nL
@property(readwrite) Byte nH
【Description】
Left blank is set as[(nL + nH *256)*0.125 mm].
【Applicable version】
SDK 1.0.0 or higher.
【Example】
mCmd Buffer[mIndex++] = 0x1D;
mCmd Buffer[mIndex++] = 0x4C;
mCmd Buffer[mIndex++] = nL;
mCmd Buffer[mIndex++] = nH;
@property(readwrite) Byte nL
@property(readwrite) Byte nH
【Description】
The width of print range is set as [(nL + nH *256)*0.125 mm].
【Applicable version】
SDK 1.0.0 or higher.
【Example】
mCmd Buffer[mIndex++] = 0x1D;
mCmd Buffer[mIndex++] = 0x57;
mCmd Buffer[mIndex++] = nL;
mCmd Buffer[mIndex++] = nH;
20
3-2-14 - (void) Set Character Printmode:(Byte)Character Print
mode
【Applicable version】
SDK 1.0.0 or higher.
【Example】
mCmd Buffer[mIndex++] = 0x1D;
mCmd Buffer[mIndex++] = 0x21;
mCmd Buffer[mIndex++] = RT_FT_DHEIGHT;
@property(readwrite)Byte UnderLineEn
【Description】
Parameter “UnderLineEn” determines underline parameter, which is defined as follows:
#define RT_UNDERLINE_DIS 0
#define RT_UNDERLINE_1 1
#define RT_UNDERLINE_2 2
【Applicable version】
SDK 1.0.0 or higher.
【Example】
mCmd Buffer[mIndex++] = 0x1B;
21
mCmd Buffer[mIndex++] = 0x2D;
// Set underline mode thickness is 2 point
mCmd Buffer[mIndex++] = RT_UNDERLINE_1;
@property(readwrite)Byte BoldEn
【Description】
This section is used to set / release bold print.
Parameter BoldEn is defined as follows:
#define RT_BOLD_DIS 0x00
#define RT_BOLD_EN 0x01
【Applicable version】
SDK 1.0.0 or higher.
【Example】
mCmdBuffer[mIndex++] = 0x1B;
mCmdBuffer[mIndex++] = 0x45;
// Set the bold print
mCmdBuffer[mIndex++] = RT_BOLD_EN;
@property(readwrite)Byte Font
【Description】
This section is used to select the character for font A or B.
Parameter Font is defined as follows:
#define RT_FONT_A 0x00
#define RT_FONT_B 0x01
【Applicable version】
SDK 1.0.0 or higher.
【Example】
mCmdBuffer[mIndex++] = 0x1B;
mCmdBuffer[mIndex++] = 0x4D;
22
// Font B(9x17)
mCmdBuffer[mIndex++] = RT_FONT_B;
@property(readwrite)Byte RotateEN
【Description】
Set/release 90 ° clockwise rotation.
Parameter RotateEN is defined as follows:
#define RT_CLOCKWISE_DIS 0
#define RT_CLOCKWISE_EN 1
【Applicable version】
SDK 1.0.0 or higher.
【Example】
mCmd Buffer[mIndex++] = 0x1B;
mCmd Buffer[mIndex++] = 0x56;
// Set the 90 ° clockwise rotation mode
mCmd Buffer[mIndex++] = RT_CLOCKWISE_EN;
3-2-19 SetAlignMode
@property(readwrite)Byte AlignMode
【Description】
This part is for selecting alignment.
Parameter AlignMode is defined as follows:
#define RT_ALIGNMENT_LEFT 0
#define RT_ALIGNMENT_CENTER 1
#define RT_ALIGNMENT_RIGHT 2
【Applicable version】
SDK 1.0.0 or higher.
【Example】
mCmdBuffer[mIndex++] = 0x1B;
mCmdBuffer[mIndex++] = 0x61;
//Align Left
23
mCmdBuffer[mIndex++] = RT_ALIGNMENT_LEFT;
@property(readwrite)Byte InvertModeEn
【Description】
This section is mainly used to set / release reverse print mode.
When the lowest valid position of n is 0, reverse print mode turn off.
When the lowest valid position of n is 1, reverse print mode turn on.
Parameter InvertModeEn is defined as follows:
#define RT_INVERT_DIS 0
#define RT_INVERT_EN 1
【Applicable version】
SDK 1.0.0 or higher.
【Example】
mCmdBuffer[mIndex++] = 0x1B;
mCmdBuffer[mIndex++] = 0x7b;
mCmdBuffer[mIndex++] = RT_INVERT_EN;
【Note】
The command set with 0-3 character height, 4-7 to set the character width.
The command is valid for all the characters(alphanumeric characters and Chinese
characters)except HRI characters.
When the characters in different sizes amplify in a row, all the characters in a row along
the baseline align.
In standard mode, the vertical direction is the paper feed direction. However, when the
characters rotate 90 ° clockwise, the relationship between the vertical and the
horizontal direction is reversed.
【Applicable version】
SDK 1.0.0 or higher.
24
【Example】
mCmd Buffer[mIndex++] = 0x1D;
mCmd Buffer[mIndex++] = 0x21;
mCmd Buffer[mIndex++] = FontEnlarge;
【Description】
The section is used to set/release black reverse print mode.
Parameter InvertModeEn is defined as follows:
#define RT_INVERSE_DIS 0x00
#define RT_INVERSE_EN 0x01
【Applicable version】
SDK 1.0.0 or higher.
【Example】
mCmdBuffer[mIndex++] = 0x1D;
mCmdBuffer[mIndex++] = 0x42;
// Set Black Reverse Print Mode
mCmdBuffer[mIndex++] = RT_INVERSE_EN;
// Release Black Reverse Print Mode
mCmdBuffer[mIndex++] = RT_INVERSE_DIS;
【Description】
DrawerNumber = 0, 1, 48, 49
0 <= pulseStartTime <= 255
0 <= PulseEndTime <= 255
【Description】
25
Send an impulse to specified connected pins.
On time= pulseStartTime x 2 millisecond
Off time= PulseEndTime x 2 millisecond
m =0/48 Impulse sent to cash drawer and then output pin 2;
m=1/49 Impulse sent to cash drawer and then output pin 5.
【Applicable version】
SDK 1.0.0 or higher.
【Example】
mCmdBuffer[mIndex++] = 0x1B;
mCmdBuffer[mIndex++] = 0x70;
mCmdBuffer[mIndex++] = DrawerNumber;
mCmdBuffer[mIndex++] = pulseStartTime;
mCmdBuffer[mIndex++] = PulseEndTime;
【Description】
Full cut paper
【Applicable version】
SDK 1.0.0 or higher.
【Example】
mCmdBuffer[mIndex++] = 0x1B;
mCmdBuffer[mIndex++] = 0x69;
【Description】
Partial cut paper
【Applicable version】
SDK 1.0.0 or higher.
【Example】
mCmdBuffer[mIndex++] = 0x1B;
mCmdBuffer[mIndex++] = 0x6D;
26
3-2-26 ① - (void) Feed And Cut Paper:(Byte)Cut Mode
(Byte)Feed Distance
【Range】
1 Cut Mode:RT_CUT_PARTIAL
2 Cut Mode:RT_CUT_WITHFEED
0 <= FeedDistance <= 255
【Description】
Select cut paper mode and cutting.
【Syntax】
- (void) FeedAndCutPaper:(Byte)CutMode
- (void) FeedAndCutPaper:(Byte)CutMode feed:(Byte)FeedDistance
【Example】
- (void) FeedAndCutPaper:(Byte)CutMode
Parameter: CutMode:is defined as follows:
#define RT_CUT_PARTIAL 0x31
Len :Data length
- (void) Feed And Cut Paper:(Byte)Cut Mode feed:(Byte)Feed Distance
Parameter: Cut Mode:is defined as follows:
#define RT_CUT_WITHFEED 0x42
Feed Distance:Feed points
@property(readwrite)int codeType
@property(readwrite)(NSData *) data
27
【Description】
This part is used to select barcode system and print barcode.
GS k m n d1 … dn
【Notice】
Parameter Code Type is used to select the barcode system, which is the parameter m in
command.
Data for input parameters d1…dn, parameter n is calculated based on the input
parameter’s number of d1…dn
n specifies the number of bytes of bar code data, and the printer will start from the
next n-byte character data as bar code data processing.
If n is outside the specified range, the printer stops processing the command, and
subsequent data as normal data.
If d is outside the specified range, the printer just feed and deal with the subsequent
data as normal data.
The command feeds according to the requirements of the bar code printing, regardless
of the line spacing set by ESC 2 or ESC 3.
Only when the print buffer is no data, the command is valid. Otherwise the printer
deals with the subsequent data as common ones.
After printing the bar code, this command will set print position at the beginning of the
line.
The command is not effected by print mode(bold overlap, underline, character size,
reverse print or characters 90 ° rotation, etc.),except upside-down printing mode.
The command is not effected by print mode(bold overlap, underline, character size,
reverse print or characters 90 ° rotation, etc.),except upside-down printing mode.
【Applicable Version】
SDK 1.0.0 or higher
【Example】
//******Print 1D Barcode**********//
- (void) Add BarCode Print: (int)code Type :(NS Data *)data
{
Switch (code Type){
case RT_BCS_UPCA:
[self UPCA: data];
break;
case RT_BCS_UPCE:
[self UPCE: data];
break;
case RT_BCS_EAN13:
[self EAN13:data];
28
break;
case RT_BCS_EAN8:
[self EAN8:data];
break;
case RT_BCS_CODE39:
[self CODE39:data];
break;
case RT_BCS_ITF:
[self ITF: data];
break;
case RT_BCS_CODABAR:
[self CODEBAR: data];
break;
case RT_BCS_CODE93:
[self CODE93:data];
break;
case RT_BCS_CODE128:
[self Code128_B:data];
break;
default :
break;
}
}
【Description】
This part is used to handle bitmap data.
【Applicable Version】
SDK 1.0.0 or higher
【Example】
CG Image Ref image ref = [image CG Image];
CG Color Space Ref color space = CG Color Space Create Device Gray();
CG Context Ref cg cnt = CG Bit map Context Create (image Data, width, height, …);
CG Rect there ct = CG Rect Make (0, 0, width, height);
CG Con text Draw Image (cg cnt, there ct, image ref);
CG Color Space Release(color space);
CG Context Release (cg cnt);
29
// Parse picture, get the bitmap data
…
//Bitmap data processing
…
// Send print pictures preamble command
Byte start[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x40, 0x1B, 0x33, 0x00};
NS Data *data Start = [NS Data data With Bytes : start length : 13];
[self Begin];
[self Import Data : data Start Len : [data Start length];
[self Excute];
[self Clear Data];
//Send picture data
[self Import Data : final Data Len : [final Data length]];
[self Excute];
[self Clear Data];
//Transmit complete demand
Byte end[] = {0x1d, 0x4c, 0x1f, 0x00};
NS Data *data End = [NS Datra data With Bytes : end length : 4];
[self Import Data : data End Len : [data End length]];
[self Excute];
[self Clear Data];
3-3-1 Begin
【Description】
This is used to initialize the printer and configure application environment.
【Syntax】
-(void) Begin
【Applicable Version】
SDK 1.0.0 or higher
【Example】
[self Wake Up Printer];
[self Init Printer];
//Clear the printer buffer
30
[self Clear Data];
3-3-2 Excute
【Description】
This part is for execution of processing data.
【Applicable Version】
SDK 1.0.0 or higher
【Example】
NS Data *data = [[NS Data alloc] init WithBytes : mCmd Buffer length : mIndex];
[self send Data : data]
M Index = 0;
【Description】
This part is for inputting printing data.
【Syntax】
-(void)Import Data : (NS Data *)data Len : (int) len
-(void)Import Data : (NS String *)data
【Example】
-(void)Import Data : (NS Data *)data Len : (int) len
Parameter: data :content of data
Len :length of data
-(void)Import Data : (NS String *)data
Parameter: data :print character string data
【Description】
Execute Clear Data() for data buffer area after execution of Execute printing.
【Syntax】
-(void)Clear Data
31
3-3-5 btn Connect
【Description】
This part is used for connect/disconnect printer connection.
【Syntax】
-(IB Action)btn Connect
-(void)on Connected
-(void)on Disconnected
【Example】
//on Connected
if(is Succeed)
{
[btn set Title : LANG(@”disconnect”) for State : UI Control State Normal];
Lab Status. text = LANG(@”connect”);
}
else {
MSGBOX(LANG(@”connection failed”));
}
//on DisConnected
if(is Succeed)
{
[btn set Title : LANG(@”connection”) for State : UI Control State Normal];
Lab Status. text = LANG(@”disconnected”);
}
else {
MSGBOX(LANG(@”disconnection failed”));
}
3-3-6 btnPrint
【Description】
This part is for testing simple printer functions.
【Syntax】
-(IB Action)btn Print
【Applicable Version】
SDK 1.0.0 or higher
【Example】
32
if(sw Double Width. Is On){
[printer Set Zoom : (Byte)0x10];
}
if(sw Double Height. isOn){
[printer Set Zoom : (Byte)0x01];
}
If (sw Under Line. is On){
[printer Set Underline : (Byte)0x02];
}
If (sw Bold. is On){
[printer Add Bold : (Byte)0x01];
}
If (sw Small Font. Is On){
[printer Set Character Font : (Byte)0x01];
}
If (sw To White. is On){
[printer Add Inverse : (Byte)0x01];
}
【Description】
This part is to select the test program print characters, pictures, bar codes, invoices or forms.
【Syntax】
-(IB Action)btn Preferences Click
-(IB Action)btn Print T ext
-(IB Action)btn Print Pic
-(IB Action)btn Print Barcode
-(IB Action)btn Print Invoice
-(IB Action)btn Print Table
【Applicable】
SDK 1.0.0 or higher
【Example】
//btn Preferences Click
Preferences *pref = [[Preferences alloc]init];
pref. printer = self. printer;
33
//btn Print Text
if(IS_LANG_EN)
{
[printer Import Data : @ “abcd!!!!\n”];
}
else
{
[printer Import Data : @”test!!!\n”];
}
//btn PrintPic
UI Image *img = [UI Image image Named : @”**.bmp”];
[printer Begin Print Image : img];
//btn Print Barcode
…
//btn Print Invoice
…
//btn Print Table
…
34
4.Agreement Involved
4-1 Outline
【Description】
This part is for Wifi connection.
【Syntax】
-(void)connect Host : (NS String *)host PORT : (UInt16)prot
- ( void ) on Socket : (Async Socket *)sock did Connect To Host : (NS String *)host port :
(UInt16)port
【Applicable Version】
SDK 1.0.0 or higher
【Example】
//connect Host
if(![async Socket connect To Host : host on Port : port with Timeout : TIMEOUT error : &err])
{
NSLog(@”Error: %@”, err);
}
[NS Thread detach New Thread Selector : @selector(thread Func:) to Target : self with Object :
@”CONN”];
35
//did Connect To Host
NS Log(@”connected.”);
if([delegate responds To Selector : @selector(on Connected:)])
{
[delegate on Connected : TRUE];
}
4-2-2 disconnect
【Description】
This part is for WiFi disconnection.
【Syntax】
-(void)disconnect
【Applicable Version】
SDK 1.0.0 or higher
【Example】
B DisconnOK = FALSE;
If ([async Socket is Connected])
{
…
}
Else
{
B DisconOK = TRUE;
if([delegate responds To Selector : @selector(on Disconnected:)])
{
[delegate on Disconnected : TRUE];
}
}
5.Appendix
36
RP58 USB/Serial/Parallel Thermal Receipt Printer
RP58E USB/Serial/Parallel Thermal Receipt Printer
RP80W WIFI WIFI printer
RPP-02 Original IR,VIR,IrDA(Ir Portable printer
COMM)RS232 interface,blue
tooth
RP203 Serial(RS-232C,TTL) Panel thermal printer
RP07 Serial(RS-232C,TTL) Panel thermal printer
RP76 Serial/Parallel/USB/cash port Impact printer
RP76II Serial/Parallel/USB/cash port Impact printer
PM628 Printer module
PM65C Printer module
PM532 Printer module
CT628 Paper cutter
CB628 Control board
CB1245 Control board
37