4.3. ISDCBBuilder
added in version 1.7.0
An interface to provide functions to generate commands for the customer display control.
This interface is only for models which support a customer display.For the supporting models, refer to Supported Peripherals .
Constant
Name
Contents
International character constants
Code Page constants
Cursor Mode constants
ContrastMode constants
Property
Name
Contents
Generated commands.
Generated or added commands to which adds a pass-through command.
Method
Name
Contents
Adds data (text or command) to the command buffer.
Generates a backspace command, and then adds it to the command buffer.
Generates a horizontal tab command, and then adds it to the command buffer.
Generates a line feed command, and then adds it to the command buffer.
Generates a carriage-return command, and then adds it to the command buffer.
Generates a graphic display command, and then adds it to the command buffer.
Select command of the international character mode is generated and added to the command buffer.
Select command of the code page is generated and added to the command buffer.
Generates a command to clear the screen until the end of the line, and then adds it to the command buffer.
Generates a command to clear the screen, and then adds it to the command buffer.
Generates a command to move the cursor to the home position, and then adds it to the command buffer.
Generates a command to turn on/off the backlight, and then adds it to the command buffer.
Generates a command to move the cursor to the specified position, and then adds it to the command buffer.
Generates a command to change the cursor mode, and then adds it to the command buffer.
Generates a command to change the contrast mode, and then adds it to the command buffer.
Generates a command to register user-defined characters (SBCS), and then adds it to the command buffer.
Generates a command to register user-defined characters (DBCS), and then adds it to the command buffer.
4.3.1. SDCBInternationalType
added in version 1.7.0
International character constants
Declaration
typedef NS_ENUM(NSInteger, SDCBInternationalType) { SDCBInternationalTypeUSA = 0x00, SDCBInternationalTypeFrance = 0x01, SDCBInternationalTypeGermany = 0x02, SDCBInternationalTypeUK = 0x03, SDCBInternationalTypeDenmark = 0x04, SDCBInternationalTypeSweden = 0x05, SDCBInternationalTypeItaly = 0x06, SDCBInternationalTypeSpain = 0x07, SDCBInternationalTypeJapan = 0x08, SDCBInternationalTypeNorway = 0x09, SDCBInternationalTypeDenmark2 = 0x0a, SDCBInternationalTypeSpain2 = 0x0b, SDCBInternationalTypeLatinAmerica = 0x0c, SDCBInternationalTypeKorea = 0x0d };
Constants
Name
Contents
SDCBInternationalTypeUSA
USA
SDCBInternationalTypeFrance
France
SDCBInternationalTypeGermany
Germany
SDCBInternationalTypeUK
UK
SDCBInternationalTypeDenmark
Denmark
SDCBInternationalTypeSweden
Sweden
SDCBInternationalTypeItaly
Italy
SDCBInternationalTypeSpain
Spain
SDCBInternationalTypeJapan
Japan
SDCBInternationalTypeNorway
Norway
SDCBInternationalTypeDenmark2
Denmark ||
SDCBInternationalTypeSpain2
Spain ||
SDCBInternationalTypeLatinAmerica
Latin America
SDCBInternationalTypeKorea
Korea
4.3.2. SDCBCodePageType
added in version 1.7.0
Code Page constants
Declaration
typedef NS_ENUM(NSInteger, SDCBCodePageType) { SDCBCodePageTypeCP437 = 0x00, SDCBCodePageTypeKatakana = 0x01, SDCBCodePageTypeCP850 = 0x02, SDCBCodePageTypeCP860 = 0x03, SDCBCodePageTypeCP863 = 0x04, SDCBCodePageTypeCP865 = 0x05, SDCBCodePageTypeCP1252 = 0x06, SDCBCodePageTypeCP866 = 0x07, SDCBCodePageTypeCP852 = 0x08, SDCBCodePageTypeCP858 = 0x09, SDCBCodePageTypeJapanese = 0x0a, SDCBCodePageTypeSimplifiedChinese = 0x0b, SDCBCodePageTypeTraditionalChinese = 0x0c, SDCBCodePageTypeHangul = 0x0d };
Constants
Name
Contents
SDCBCodePageTypeCP437
CodePage437 (USA, Std. Europe)
SDCBCodePageTypeKatakana
Katakana
SDCBCodePageTypeCP850
PC850 (Multilingual)
SDCBCodePageTypeCP860
PC860 (Portuguese)
SDCBCodePageTypeCP863
PC863 (Canadian-French)
SDCBCodePageTypeCP865
PC865 (Norwegian)
SDCBCodePageTypeCP1252
WPC1252
SDCBCodePageTypeCP866
PC866 [Cyrillic #2]
SDCBCodePageTypeCP852
PC852 [Latin 2]
SDCBCodePageTypeCP858
Page 19 [PC858]
SDCBCodePageTypeJapanese
Japanese font (shift JIS)
SDCBCodePageTypeSimplifiedChinese
Simplified Chinese (GB2312)
SDCBCodePageTypeTraditionalChinese
Traditional Chinese (Big5)
SDCBCodePageTypeHangul
Hangul (KSC5601)
4.3.3. SDCBCursorMode
added in version 1.7.0
Cursor Mode constants.
Declaration
typedef NS_ENUM(NSInteger, SDCBCursorMode) { SDCBCursorModeOff = 0x00, SDCBCursorModeBlink = 0x01, SDCBCursorModeOn = 0x02 };
Constants
Name
Contents
SDCBCursorModeOff
Cursor off
SDCBCursorModeBlink
Cursor blinking
SDCBCursorModeOn
Cursor lighting
4.3.4. SDCBContrastMode
added in version 1.7.0
Contrast mode constants.
Declaration
typedef NS_ENUM(NSInteger, SDCBContrastMode) { SDCBContrastModeMinus3 = 0x00, SDCBContrastModeMinus2 = 0x01, SDCBContrastModeMinus1 = 0x02, SDCBContrastModeDefault = 0x03, SDCBContrastModePlus1 = 0x04, SDCBContrastModePlus2 = 0x05, SDCBContrastModePlus3 = 0x06 };
Constants
Name
Contents
SDCBContrastModeMinus3
Contrast: -3
SDCBContrastModeMinus2
Contrast: -2
SDCBContrastModeMinus1
Contrast: -1
SDCBContrastModeDefault
Default
SDCBContrastModePlus1
Contrast: +1
SDCBContrastModePlus2
Contrast: +2
SDCBContrastModePlus3
Contrast: +3
4.3.5. commands
added in version 1.7.0
Gets the command buffer (generated command).
Declaration
@property (nonatomic, readonly) NSMutableData *commands;
Parameter
None
Value
Contents
Type
Command buffer (generated command)
NSMutableData *
4.3.6. passThroughCommands
added in version 1.7.0
Gets a command sequence with the pass-through command to the printer added at the beginning of the command buffer (generated command).
Declaration
@property (nonatomic, readonly) NSMutableData *passThroughCommands;
Parameter
None
Return value
Contents
Type
Command buffer (generated command)
NSMutableData *
Examples
ISDCBBuilder *builder = [StarIoExt createDisplayCommandBuilder:StarIoExtDisplayModelSCD222]; ... NSData *commands = [builder.passThroughCommands copy];
Refer to DisplayViewController.m / DisplayExtViewController.m.
4.3.7. appendData
added in version 1.7.0
Adds data (text or command) to the command buffer.
Declaration
- (void)appendByte:(unsigned char)data; - (void)appendData:(NSData *)otherData; - (void)appendBytes:(const void *)bytes length:(NSUInteger)length;
Parameter
Name
Contents
Type
dataotherDatabytesData (Text and Command)
unsigned charNSData *const void *length
Data length
NSUInteger
Return value
None
Examples
+ (void)appendTextPattern:(ISDCBBuilder *)builder number:(int)number { // [builder appendClearScreen]; [builder appendCursorMode:SDCBCursorModeOff]; [builder appendSpecifiedPosition:1 y:1]; unsigned char pattern1[] = "\x020\x021\x022\x023\x024\x025\x026\x027\x028\x029\x02a\x02b\x02c\x02d\x02e\x02f\x030\x031\x032\x033\x034\x035\x036\x037\x038\x039\x03a\x03b\x03c\x03d\x03e\x03f\x040\x041\x042\x043\x044\x045\x046\x047"; ... switch (number) { default : [builder appendBytes:pattern1 length:sizeof(pattern1)]; // 0 break; case 1 : [builder appendBytes:pattern2 length:sizeof(pattern2)]; break; case 2 : [builder appendBytes:pattern3 length:sizeof(pattern3)]; break; case 3 : [builder appendBytes:pattern4 length:sizeof(pattern4)]; break; case 4 : [builder appendBytes:pattern5 length:sizeof(pattern5)]; break; case 5 : [builder appendBytes:pattern6 length:sizeof(pattern6)]; break; } }
Refer to DisplayFunctions.m.
4.3.8. appendBackSpace
added in version 1.7.0
Generates a backspace command, and then adds it to the command buffer.
Declaration
void appendBackSpace();
Parameter
None
Return value
None
4.3.9. appendHorizontalTab
added in version 1.7.0
Generates a horizontal tab command, and then adds it to the command buffer.
Declaration
- (void)appendHorizontalTab;
Parameter
None
Return value
None
4.3.10. appendLineFeed
added in version 1.7.0
Generates a line feed command, and then adds it to the command buffer.
Declaration
- (void)appendLineFeed;
Parameter
None
Return value
None
4.3.11. appendCarriageReturn
added in version 1.7.0
Generates a carriage-return command, and then adds it to the command buffer.
Declaration
- (void)appendCarriageReturn;
Parameter
None
Return value
None
4.3.12. appendBitmap
added in version 1.7.0
Generates a graphic display command, and then adds it to the command buffer.
Declaration
- (void)appendBitmap:(UIImage *)image diffusion:(BOOL)diffusion;
Parameter
Name
Contents
Type
bitmap
Image you want to displaySpecify the instance of the 160 × 40 dots monochrome Bitmap class.If a different sized Bitmap is specified, it is resized to 160 × 40 dots.The Bitmap pixels are automatically converted to monochrome value.UIImage *
diffusion
Random ditherYES … ValidNO … InvalidBOOL
Return value
None
Examples
+ (void)appendGraphicPattern:(ISDCBBuilder *)builder number:(int)number { // [builder appendClearScreen]; [builder appendCursorMode:SDCBCursorModeOff]; // [builder appendSpecifiedPosition:1 y:1]; UIImage *image; switch (number) { default : // 0 image = [UIImage imageNamed:@"DisplayImage1.png"]; break; case 1 : image = [UIImage imageNamed:@"DisplayImage2.png"]; break; case 2 : image = [UIImage imageNamed:@"DisplayImage3.png"]; break; case 3 : image = [UIImage imageNamed:@"DisplayImage4.png"]; break; } [builder appendBitmap:image diffusion:YES]; }
Refer to DisplayFunctions.m.
4.3.13. appendInternational
added in version 1.7.0
Select command of the international character mode is generated and added to the command buffer.
Declaration
- (void)appendInternational:(SDCBInternationalType)type;
Parameter
Name
Contents
Type
internationalType
International character constants
Return value
None
Examples
+ (void)appendCharacterSet:(ISDCBBuilder *)builder internationalType:(SDCBInternationalType)internationalType codePageType:(SDCBCodePageType)codePageType { // [builder appendClearScreen]; [builder appendCursorMode:SDCBCursorModeOff]; [builder appendSpecifiedPosition:1 y:1]; [builder appendInternational:internationalType]; [builder appendCodePage :codePageType]; unsigned char pattern1[] = "\x02d\x020\x020\x020\x023\x024\x040\x05b\x05c\x05d\x05e\x060\x07b\x07c\x07d\x07e\x020\x020\x020\x02d\x0a0\x0a1\x0a2\x0a3\x0a4\x0a5\x0a6\x0a7\x0a8\x0a9\x0aa\x0ab\x0ac\x0ad\x0ae\x0af\x0b0\x0b1\x0b2\x0b3"; ... switch (codePageType) { default : [builder appendBytes:pattern1 length:sizeof(pattern1)]; break; //CP437,Katakana,CP850,CP860,CP863,CP865,CP1252,CP866,CP852,CP858 case SDCBCodePageTypeJapanese : [builder appendBytes:pattern2 length:sizeof(pattern2)]; break; case SDCBCodePageTypeSimplifiedChinese : [builder appendBytes:pattern3 length:sizeof(pattern3)]; break; case SDCBCodePageTypeTraditionalChinese : [builder appendBytes:pattern4 length:sizeof(pattern4)]; break; case SDCBCodePageTypeHangul : [builder appendBytes:pattern5 length:sizeof(pattern5)]; break; } }
Refer to DisplayFunctions.m.
4.3.14. appendCodePage
added in version 1.7.0
Select command of the code page is generated and added to the command buffer.
Declaration
- (void)appendCodePage:(SDCBCodePageType)type;
Parameter
Name
Contents
Type
codePageType
Code Page constants
Return value
None
Examples
+ (void)appendCharacterSet:(ISDCBBuilder *)builder internationalType:(SDCBInternationalType)internationalType codePageType:(SDCBCodePageType)codePageType { // [builder appendClearScreen]; [builder appendCursorMode:SDCBCursorModeOff]; [builder appendSpecifiedPosition:1 y:1]; [builder appendInternational:internationalType]; [builder appendCodePage :codePageType]; unsigned char pattern1[] = "\x02d\x020\x020\x020\x023\x024\x040\x05b\x05c\x05d\x05e\x060\x07b\x07c\x07d\x07e\x020\x020\x020\x02d\x0a0\x0a1\x0a2\x0a3\x0a4\x0a5\x0a6\x0a7\x0a8\x0a9\x0aa\x0ab\x0ac\x0ad\x0ae\x0af\x0b0\x0b1\x0b2\x0b3"; ... switch (codePageType) { default : [builder appendBytes:pattern1 length:sizeof(pattern1)]; break; //CP437,Katakana,CP850,CP860,CP863,CP865,CP1252,CP866,CP852,CP858 case SDCBCodePageTypeJapanese : [builder appendBytes:pattern2 length:sizeof(pattern2)]; break; case SDCBCodePageTypeSimplifiedChinese : [builder appendBytes:pattern3 length:sizeof(pattern3)]; break; case SDCBCodePageTypeTraditionalChinese : [builder appendBytes:pattern4 length:sizeof(pattern4)]; break; case SDCBCodePageTypeHangul : [builder appendBytes:pattern5 length:sizeof(pattern5)]; break; } }
Refer to DisplayFunctions.m.
4.3.15. appendDeleteToEndOfLine
added in version 1.7.0
Generates a command to clear the screen until the end of the line, and then adds it to the command buffer.
Declaration
- (void)appendDeleteToEndOfLine;
Parameter
None
Return value
None
4.3.16. appendClearScreen
added in version 1.7.0
Generates a command to clear the screen, and then adds it to the command buffer.
Declaration
- (void)appendClearScreen;
Parameter
None
Return value
None
Examples
+ (void)appendClearScreen:(ISDCBBuilder *)builder { [builder appendClearScreen]; }
Refer to DisplayFunctions.m.
4.3.17. appendHomePosition
added in version 1.7.0
Generates a command to move the cursor to the home position, and then adds it to the command buffer.
Declaration
- (void)appendHomePosition;
Parameter
None
Return value
None
4.3.18. appendTurnOn
added in version 1.7.0
Generates a command to turn on/off the backlight, and then adds it to the command buffer.
Declaration
- (void)appendTurnOn:(BOOL)turnOn;
Parameter
Name
Contents
Type
turnOn
Backlight ON/OFF
BOOL
Return value
None
Examples
+ (void)appendTurnOn:(ISDCBBuilder *)builder turnOn:(BOOL)turnOn { ... [builder appendTurnOn:turnOn]; }
Refer to DisplayFunctions.m.
4.3.19. appendSpecifiedPosition
added in version 1.7.0
Generates a command to move the cursor to the specified position, and then adds it to the command buffer.
Declaration
- (void)appendSpecifiedPosition:(int)x y:(int)y;
Parameter
Name
Contents
Type
x
Digit position (Leftmost digit is 1)
int
y
Line position (top line is 1)
int
Return value
None
Examples
+ (void)appendCursorMode:(ISDCBBuilder *)builder cursorMode:(SDCBCursorMode)cursorMode { // [builder appendClearScreen]; [builder appendCursorMode:SDCBCursorModeOff]; [builder appendSpecifiedPosition:1 y:1]; unsigned char pattern[] = "Star Micronics " "Total : 12345"; [builder appendBytes:pattern length:sizeof(pattern)]; [builder appendSpecifiedPosition:20 y:2]; [builder appendCursorMode:cursorMode]; }
Refer to DisplayFunctions.m.
4.3.20. appendCursorMode
added in version 1.7.0
Generates a command to change the cursor mode, and then adds it to the command buffer.
Declaration
- (void)appendCursorMode:(SDCBCursorMode)cursorMode;
Parameter
Name
Contents
Type
cursorMode
Cursor Mode constants
Return value
None
Examples
+ (void)appendCursorMode:(ISDCBBuilder *)builder cursorMode:(SDCBCursorMode)cursorMode { // [builder appendClearScreen]; [builder appendCursorMode:SDCBCursorModeOff]; [builder appendSpecifiedPosition:1 y:1]; unsigned char pattern[] = "Star Micronics " + "Total : 12345"; [builder appendBytes:pattern length:sizeof(pattern)]; [builder appendSpecifiedPosition:20 y:2]; [builder appendCursorMode:cursorMode]; }
Refer to DisplayFunctions.m.
4.3.21. appendContrastMode
added in version 1.7.0
Generates a command to change the contrast mode, and then adds it to the command buffer.
Declaration
- (void)appendContrastMode:(SDCBContrastMode)contrastMode;
Parameter
Name
Contents
Type
contrastMode
ContrastMode constants
Return value
None
Examples
+ (void)appendContrastMode:(ISDCBBuilder *)builder contrastMode:(SDCBContrastMode)contrastMode { ... [builder appendContrastMode:contrastMode]; }
Refer to DisplayFunctions.m.
4.3.22. appendUserDefinedCharacter
added in version 1.7.0
Generates a command to register user-defined characters (SBCS), and then adds it to the command buffer.
Declaration
- (void)appendUserDefinedCharacter:(int)index code:(int)code font:(unsigned char *)font;
Parameter
Name
Contents
Type
index
Japanese fontFont number00h ≦ index ≦ 1Fhint
code
Character code of user-defined character20h ≦ code ≦ 7FhIf SDCBCodePageTypeJapanese is specified with the appendCodePage method, the following range is also supported.A0h ≦ code ≦ DFhint
font
16-byte font dataRefer to the font data format of the user-defined characters.Specifying nil deletes the user-defined characters of the specified font No.unsigned char *
Return value
None
The font data format of the user-defined characters.
Examples
+ (void)appendUserDefinedCharacter:(ISDCBBuilder *)builder set:(BOOL)set { // [builder appendClearScreen]; [builder appendCursorMode:SDCBCursorModeOff]; [builder appendSpecifiedPosition:1 y:1]; [builder appendInternational:SDCBInternationalTypeUSA]; [builder appendCodePage :SDCBCodePageTypeJapanese]; if (set) { [builder appendUserDefinedCharacter:0 code:0x20 font:(unsigned char *) "\x000\x000\x032\x000\x049\x000\x049\x07f\x026\x048\x000\x048\x000\x030\x000\x000"]; [builder appendUserDefinedDbcsCharacter:0 code:0x8140 font:(unsigned char *) "\x000\x000\x000\x000\x000\x000\x000\x000\x003\x020\x004\x090\x004\x090\x002\x060\x000\x000\x007\x0f0\x004\x080\x004\x080\x003\x000\x000\x000\x000\x000\x000\x000"]; } else { [builder appendUserDefinedCharacter:0 code:0x00 font:nil]; [builder appendUserDefinedDbcsCharacter:0 code:0x0000 font:nil]; } unsigned char pattern[] = "\x05b\x020\x020\x053\x074\x061\x072\x020\x04d\x069\x063\x072\x06f\x06e\x069\x063\x073\x020\x020\x05d\x05b\x081\x040\x081\x040\x083\x058\x083\x05e\x081\x05b\x090\x0b8\x096\x0a7\x081\x040\x081\x040\x05d"; [builder appendBytes:pattern length:sizeof(pattern)]; }
Refer to DisplayFunctions.m.
4.3.23. appendUserDefinedDbcsCharacter
added in version 1.7.0
Generates a command to register user-defined characters (DBCS), and then adds it to the command buffer.
Declaration
- (void)appendUserDefinedDbcsCharacter:(int)index code:(int)code font:(unsigned char *)font;
Parameter
Name
Contents
Type
index
Japanese fontFont number00h ≦ index ≦ 0Fhint
code
Character code of user-defined character20h ≦ code ≦ 7FhIf SDCBCodePageTypeJapanese is specified with the appendCodePage method, the following range is also supported.80 00h ≦ code ≦ FF FFhint
font
32-byte font dataRefer to the font data format of the user-defined characters.Specifying nil deletes the user-defined characters of the specified font No.unsigned char *
Return value
None
The font data format of the user-defined characters.
Examples
+ (void)appendUserDefinedCharacter:(ISDCBBuilder *)builder set:(BOOL)set { // [builder appendClearScreen]; [builder appendCursorMode:SDCBCursorModeOff]; [builder appendSpecifiedPosition:1 y:1]; [builder appendInternational:SDCBInternationalTypeUSA]; [builder appendCodePage :SDCBCodePageTypeJapanese]; if (set) { [builder appendUserDefinedCharacter:0 code:0x20 font:(unsigned char *) "\x000\x000\x032\x000\x049\x000\x049\x07f\x026\x048\x000\x048\x000\x030\x000\x000"]; [builder appendUserDefinedDbcsCharacter:0 code:0x8140 font:(unsigned char *) "\x000\x000\x000\x000\x000\x000\x000\x000\x003\x020\x004\x090\x004\x090\x002\x060\x000\x000\x007\x0f0\x004\x080\x004\x080\x003\x000\x000\x000\x000\x000\x000\x000"]; } else { [builder appendUserDefinedCharacter:0 code:0x00 font:nil]; [builder appendUserDefinedDbcsCharacter:0 code:0x0000 font:nil]; } unsigned char pattern[] = "\x05b\x020\x020\x053\x074\x061\x072\x020\x04d\x069\x063\x072\x06f\x06e\x069\x063\x073\x020\x020\x05d\x05b\x081\x040\x081\x040\x083\x058\x083\x05e\x081\x05b\x090\x0b8\x096\x0a7\x081\x040\x081\x040\x05d"; [builder appendBytes:pattern length:sizeof(pattern)]; }
Refer to DisplayFunctions.m.