4.3. IDisplayCommandBuilder

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 .

  • Property

    Name

    Contents

    Commands

    Generated commands.

    PassThroughCommands

    Generated or added commands to which adds a pass-through command.

  • Method

    Name

    Contents

    Append

    Adds data (text or command) to the command buffer.

    AppendBackSpace

    Generates a backspace command, and then adds it to the command buffer.

    AppendHorizontalTab

    Generates a horizontal tab command, and then adds it to the command buffer.

    AppendLineFeed

    Generates a line feed command, and then adds it to the command buffer.

    AppendCarriageReturn

    Generates a carriage-return command, and then adds it to the command buffer.

    AppendBitmap

    Generates a graphic display command, and then adds it to the command buffer.

    AppendInternational

    Select command of the international character mode is generated and added to the command buffer.

    AppendCodePage

    Select command of the code page is generated and added to the command buffer.

    AppendDeleteToEndOfLine

    Generates a command to clear the screen until the end of the line, and then adds it to the command buffer.

    AppendClearScreen

    Generates a command to clear the screen, and then adds it to the command buffer.

    AppendHomePosition

    Generates a command to move the cursor to the home position, and then adds it to the command buffer.

    AppendTurnOn

    Generates a command to turn on/off the backlight, and then adds it to the command buffer.

    AppendSpecifiedPosition

    Generates a command to move the cursor to the specified position, and then adds it to the command buffer.

    AppendCursorMode

    Generates a command to change the cursor mode, and then adds it to the command buffer.

    AppendContrastMode

    Generates a command to change the contrast mode, and then adds it to the command buffer.

    AppendUserDefinedCharacter

    Generates a command to register user-defined characters (SBCS), and then adds it to the command buffer.

    AppendUserDefinedDbcsCharacter

    Generates a command to register user-defined characters (DBCS), and then adds it to the command buffer.

4.3.1. DisplayInternationalType

International character constants

  • Declaration

    public enum DisplayInternationalType {
        USA,
        France,
        Germany,
        UK,
        Denmark,
        Sweden,
        Italy,
        Spain,
        Japan,
        Norway,
        Denmark2,
        Spain2,
        LatinAmerica,
        Korea
    }
    
  • Constants

    Name

    Contents

    USA

    USA

    France

    France

    Germany

    Germany

    UK

    UK

    Denmark

    Denmark

    Sweden

    Sweden

    Italy

    Italy

    Spain

    Spain

    Japan

    Japan

    Norway

    Norway

    Denmark2

    Denmark ||

    Spain2

    Spain ||

    LatinAmerica

    Latin America

    Korea

    Korea

4.3.2. DisplayCodePageType

Code Page constants

  • Declaration

    public enum DisplayCodePageType {
        CP437,
        Katakana,
        CP850,
        CP860,
        CP863,
        CP865,
        CP1252,
        CP866,
        CP852,
        CP858,
        Japanese,
        SimplifiedChinese,
        TraditionalChinese,
        Hangul
    }
    
  • Constants

    Name

    Contents

    CP437

    CodePage437 (USA, Std. Europe)

    Katakana

    Katakana

    CP850

    PC850 (Multilingual)

    CP860

    PC860 (Portuguese)

    CP863

    PC863 (Canadian-French)

    CP865

    PC865 (Norwegian)

    CP1252

    WPC1252

    CP866

    PC866 [Cyrillic #2]

    CP852

    PC852 [Latin 2]

    CP858

    Page 19 [PC858]

    Japanese

    Japanese font (shift JIS)

    SimplifiedChinese

    Simplified Chinese (GB2312)

    TraditionalChinese

    Traditional Chinese (Big5)

    Hangul

    Hangul (KSC5601)

4.3.3. DisplayCursorMode

Cursor Mode constants.

  • Declaration

    public enum DisplayCursorMode {
        Off,
        Blink,
        On
    }
    
  • Constants

    Name

    Contents

    Off

    Cursor off

    Blink

    Cursor blinking

    On

    Cursor lighting

4.3.4. DisplayContrastMode

Contrast mode constants.

  • Declaration

    public enum DisplayContrastMode {
        Minus3,
        Minus2,
        Minus1,
        Default,
        Plus1,
        Plus2,
        Plus3
    }
    
  • Constants

    Name

    Contents

    Minus3

    Contrast: -3

    Minus2

    Contrast: -2

    Minus1

    Contrast: -1

    Default

    Default

    Plus1

    Contrast: +1

    Plus2

    Contrast: +2

    Plus3

    Contrast: +3

4.3.5. Commands

Gets the command buffer (generated command).

  • Declaration

    byte[] Commands { get; };
    
  • Parameter

    None

  • Value

    Contents

    Type

    Command buffer (generated command)

    byte[]

4.3.6. PassThroughCommands

Gets a command sequence with the pass-through command to the printer added at the beginning of the command buffer (generated command).

  • Declaration

    byte[] PassThroughCommands { get; };
    
  • Parameter

    None

  • Return value

    Contents

    Type

    Command buffer (generated command)

    byte[]

  • Examples

    public static byte[] CreateTextPattern()
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
    
        builder.AppendCursorMode(DisplayCursorMode.Off);
    
        builder.AppendHomePosition();
    
        byte[] textPattern = new byte[]{
            0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
            0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
            0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47
        };
    
        builder.Append(textPattern);
    
        return builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs/DisplaySamplePage.xaml.cs/DisplayExtSamplePage.xaml.cs.

4.3.7. Append

Adds data (text or command) to the command buffer.

  • Declaration

    void Append(byte data);
    void Append(byte[] data);
    
  • Parameter

    Name

    Contents

    Type

    data

    Data (Text and Command)

    byte
    byte[]
  • Return value

    None

  • Examples

    public static byte[] CreateTextPattern()
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
    
        builder.AppendCursorMode(DisplayCursorMode.Off);
    
        builder.AppendHomePosition();
    
        byte[] textPattern = new byte[]{
            0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
            0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
            0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47
        };
    
        builder.Append(textPattern);
    
        return builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs.

4.3.8. AppendBackSpace

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.6.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

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

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

Generates a graphic display command, and then adds it to the command buffer.

  • Declaration

    void AppendBitmap(Bitmap bitmap, bool diffusion);
    
  • Parameter

    Name

    Contents

    Type

    bitmap

    Image you want to display
    Specify 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.

    System.Drawing.Bitmap

    diffusion

    Random dither
    true … Valid
    false … Invalid

    bool

  • Return value

    None

  • Examples

    public static byte[] CreateGraphicPattern()
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
    
        Bitmap bitmap;
        using (var stream = Properties.Resources.display_image_1)
        {
            bitmap = new Bitmap(stream);
        }
    
        builder.AppendBitmap(bitmap, false);
    
        return builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs.

4.3.13. AppendInternational

Select command of the international character mode is generated and added to the command buffer.

  • Declaration

    void AppendInternational(DisplayInternationalType internationalType);
    
  • Parameter

    Name

    Contents

    Type

    internationalType

    International character constants

    DisplayInternationalType

  • Return value

    None

  • Examples

    public static byte[] CreateCharacterSet(DisplayCodePageType codePageType)
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendHomePosition();
    
        builder.AppendInternational(DisplayInternationalType.USA);
        builder.AppendCodePage(codePageType);
    
        byte[] pattern = {
            0x2d, 0x20, 0x20, 0x20, 0x23, 0x24, 0x40, 0x5b, 0x5c, 0x5d, 0x5e, 0x60, 0x7b, 0x7c, 0x7d, 0x7e, 0x20, 0x20, 0x20, 0x2d,
            0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3
        };
    
        builder.Append(textPattern);
    
        return builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs.

4.3.14. AppendCodePage

Select command of the code page is generated and added to the command buffer.

  • Declaration

    void AppendCodePage(DisplayCodePageType codePageType);
    
  • Parameter

    Name

    Contents

    Type

    codePageType

    Code Page constants

    DisplayCodePageType

  • Return value

    None

  • Examples

    public static byte[] CreateCharacterSet(DisplayCodePageType codePageType)
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendHomePosition();
    
        builder.AppendInternational(DisplayInternationalType.USA);
        builder.AppendCodePage(codePageType);
    
        byte[] pattern = {
            0x2d, 0x20, 0x20, 0x20, 0x23, 0x24, 0x40, 0x5b, 0x5c, 0x5d, 0x5e, 0x60, 0x7b, 0x7c, 0x7d, 0x7e, 0x20, 0x20, 0x20, 0x2d,
            0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3
        };
    
        builder.Append(textPattern);
    
        return builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs.

4.3.15. AppendDeleteToEndOfLine

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

Generates a command to clear the screen, and then adds it to the command buffer.

  • Declaration

    void AppendClearScreen();
    
  • Parameter

    None

  • Return value

    None

  • Examples

    public static byte[] CreateClearScreen()
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
    
        return builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs.

4.3.17. AppendHomePosition

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

  • Examples

    public static byte[] CreateCursorMode(DisplayCursorMode mode)
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendHomePosition();
    
        byte[] textPattern = Encoding.UTF8.GetBytes("Star Micronics     Total :    12345");
    
        builder.Append(textPattern);
    
        builder.AppendSpecifiedPosition(20, 2);
    
        builder.AppendCursorMode(mode);
    
        builder.AppendHomePosition();
    
        return builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs.

4.3.18. AppendTurnOn

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

    public static byte[] CreateTurnOn()
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendTurnOn(true);
    
        return builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs.

4.3.19. AppendSpecifiedPosition

Generates a command to move the cursor to the specified position, and then adds it to the command buffer.

  • Declaration

    void AppendSpecifiedPosition(int x, 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

    public static byte[] CreateCursorMode(DisplayCursorMode mode)
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendHomePosition();
    
        byte[] textPattern = Encoding.UTF8.GetBytes("Star Micronics     Total :    12345");
    
        builder.Append(textPattern);
    
        builder.AppendSpecifiedPosition(20, 2);
    
        builder.AppendCursorMode(mode);
    
        return builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs.

4.3.20. AppendCursorMode

Generates a command to change the cursor mode, and then adds it to the command buffer.

  • Declaration

    void AppendCursorMode(DisplayCursorMode cursorMode);
    
  • Parameter

    Name

    Contents

    Type

    cursorMode

    Cursor Mode constants

    DisplayCursorMode

  • Return value

    None

  • Examples

    public static byte[] CreateCursorMode(DisplayCursorMode mode)
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendHomePosition();
    
        byte[] textPattern = Encoding.UTF8.GetBytes("Star Micronics     Total :    12345");
    
        builder.Append(textPattern);
    
        builder.AppendSpecifiedPosition(20, 2);
    
        builder.AppendCursorMode(DisplayCursorMode.On);
    
        return builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs.

4.3.21. AppendContrastMode

Generates a command to change the contrast mode, and then adds it to the command buffer.

  • Declaration

    void AppendContrastMode(DisplayContrastMode contrastMode);
    
  • Parameter

    Name

    Contents

    Type

    contrastMode

    ContrastMode constants

    DisplayContrastMode

  • Return value

    None

  • Examples

    public static byte[] CreateContrastMode()
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendContrastMode(DisplayContrastMode.Default);
    
        return builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs.

4.3.22. AppendUserDefinedCharacter

Generates a command to register user-defined characters (SBCS), and then adds it to the command buffer.

  • Declaration

    void AppendUserDefinedCharacter(int index, int code, byte[] font);
    
  • Parameter

    Name

    Contents

    Type

    index

    Japanese fontFont number
    00h ≦ index ≦ 1Fh

    int

    code

    Character code of user-defined character
    20h ≦ code ≦ 7Fh
    If Japanese is specified with the AppendCodePage method, the following range is also supported.
    A0h ≦ code ≦ DFh

    int

    font

    16-byte font data
    Refer to the font data format of the user-defined characters.
    Specifying null deletes the user-defined characters of the specified font No.

    byte[]

  • Return value

    None

  • The font data format of the user-defined characters.

    ../_images/display_user_defined_sbcs_data.png
  • Examples

    public static byte[] CreateUserDefinedCharacter(bool set)
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendHomePosition();
    
        builder.AppendInternational(DisplayInternationalType.USA);
        builder.AppendCodePage(DisplayCodePageType.Japanese);
    
        if (set)
        {
            byte[] font = { 0x00, 0x00, 0x32, 0x00, 0x49, 0x00, 0x49, 0x7f, 0x26, 0x48, 0x00, 0x48, 0x00, 0x30, 0x00, 0x00 };
            byte[] dbcsFont = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x20, 0x04, 0x90, 0x04, 0x90, 0x02, 0x60, 0x00, 0x00, 0x07, 0xf0, 0x04, 0x80, 0x04, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    
            builder.AppendUserDefinedCharacter(0, 0x20, font);
            builder.AppendUserDefinedDbcsCharacter(0, 0x8140, dbcsFont);
        }
        else
        {
            builder.AppendUserDefinedDbcsCharacter(0, 0x8140, null);
        }
    
        byte[] textPattern = {0x5b, 0x20, 0x20, 0x53, 0x74, 0x61, 0x72, 0x20, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x73, 0x20, 0x20, 0x5d, 0x5b, 0x81, 0x40, 0x81, 0x40, 0x83, 0x58, 0x83, 0x5e, 0x81, 0x5b, 0x90, 0xb8, 0x96, 0xa7, 0x81, 0x40, 0x81, 0x40, 0x5d };
    
        builder.Append(textPattern);
    
        return builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs.

4.3.23. AppendUserDefinedDbcsCharacter

Generates a command to register user-defined characters (DBCS), and then adds it to the command buffer.

  • Declaration

    void AppendUserDefinedDbcsCharacter(int index, int code, byte[] font);
    
  • Parameter

    Name

    Contents

    Type

    index

    Japanese fontFont number
    00h ≦ index ≦ 0Fh

    int

    code

    Character code of user-defined character
    20h ≦ code ≦ 7Fh
    If Japanese is specified with the AppendCodePage method, the following range is also supported.
    80 00h ≦ code ≦ FF FFh

    int

    font

    32-byte font data
    Refer to the font data format of the user-defined characters.
    Specifying null deletes the user-defined characters of the specified font No.

    byte[]

  • Return value

None

  • The font data format of the user-defined characters.

    ../_images/display_user_defined_dbcs_data.png
  • Examples

    public static byte[] CreateUserDefinedCharacter(bool set)
    {
        IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendHomePosition();
    
        builder.AppendInternational(DisplayInternationalType.USA);
        builder.AppendCodePage(DisplayCodePageType.Japanese);
    
        if (set)
        {
            byte[] font = { 0x00, 0x00, 0x32, 0x00, 0x49, 0x00, 0x49, 0x7f, 0x26, 0x48, 0x00, 0x48, 0x00, 0x30, 0x00, 0x00 };
            byte[] dbcsFont = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x20, 0x04, 0x90, 0x04, 0x90, 0x02, 0x60, 0x00, 0x00, 0x07, 0xf0, 0x04, 0x80, 0x04, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    
            builder.AppendUserDefinedCharacter(0, 0x20, font);
            builder.AppendUserDefinedDbcsCharacter(0, 0x8140, dbcsFont);
        }
        else
        {
            builder.AppendUserDefinedDbcsCharacter(0, 0x8140, null);
        }
    
        byte[] textPattern = {0x5b, 0x20, 0x20, 0x53, 0x74, 0x61, 0x72, 0x20, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x73, 0x20, 0x20, 0x5d, 0x5b, 0x81, 0x40, 0x81, 0x40, 0x83, 0x58, 0x83, 0x5e, 0x81, 0x5b, 0x90, 0xb8, 0x96, 0xa7, 0x81, 0x40, 0x81, 0x40, 0x5d };
    
        builder.Append(textPattern);
    
        return builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs.