4.4. IDisplayCommandBuilder

added in version 1.3.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 .

  • Property

    Name

    Contents

    PassThroughCommands

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

  • Method

    Name

    Contents

    AppendData

    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.

    AppendBitmapAsync

    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.

    GetCommands

    Gets the command buffer (generated command).

4.4.1. DisplayInternationalType

added in version 1.3.0

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.4.2. DisplayCodePageType

added in version 1.3.0

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.4.3. DisplayCursorMode

added in version 1.3.0

Cursor Mode constants.

  • Declaration

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

    Name Contents
    Off Cursor off
    Blink Cursor blinking
    On Cursor lighting

4.4.4. DisplayContrastMode

added in version 1.3.0

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.4.5. PassThroughCommands

added in version 1.3.0

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

  • Declaration

    public IBuffer PassThroughCommands { get; }
    
  • Parameter

    None

  • Return value

    Contents Type
    Command buffer (generated command) IBuffer
  • Examples

    public static void AppendTextPattern(IDisplayCommandBuilder builder, int number)
    {
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendSpecifiedPosition(1, 1);
    
        byte[] pattern1 = { 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.AppendBytes(pattern1);
    
        builder.PassThroughCommands;
    }
    

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

4.4.6. AppendData

added in version 1.3.0

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

  • Declaration

    void AppendData(IBuffer otherData)
    void AppendByte(byte data)
    void AppendBytes(byte[] bytes)
    
  • Parameter

    Name Contents Type
    otherData
    data
    bytes
    Data (Text and Command)
    IBuffer
    byte
    byte[]
  • Return value

    None

  • Examples

    public static void AppendTextPattern(IDisplayCommandBuilder builder)
    {
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendSpecifiedPosition(1, 1);
    
        byte[] pattern1 = { 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.AppendBytes(pattern1);
    
        builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs

4.4.7. AppendBackSpace

added in version 1.3.0

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

  • Declaration

    void AppendBackSpace();
    
  • Parameter

    None

  • Return value

    None

4.4.8. AppendHorizontalTab

added in version 1.3.0

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

  • Declaration

    void AppendHorizontalTab();
    
  • Parameter

    None

  • Return value

    None

4.4.9. AppendLineFeed

added in version 1.3.0

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

  • Declaration

    void AppendLineFeed();
    
  • Parameter

    None

  • Return value

    None

4.4.10. AppendCarriageReturn

added in version 1.3.0

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

  • Declaration

    void AppendCarriageReturn();
    
  • Parameter

    None

  • Return value

    None

4.4.11. AppendBitmapAsync

added in version 1.3.0

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

  • Declaration

    IAsyncAction AppendBitmapAsync(Windows.Graphics.Imaging.BitmapDecoder bitmapDecoder)
    
  • 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.
    Windows.Graphics.Imaging.BitmapDecoder
  • Return value

    None

  • Examples

    public static async Task AppendGraphicPattern(IDisplayCommandBuilder builder)
    {
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendSpecifiedPosition(1, 1);
    
        BitmapDecoder bitmapDecoder = null;
        bitmapDecoder = await CreateDisplayImageAsync("DisplayImage1.png");
    
        await builder.AppendBitmapAsync(bitmapDecoder, true);
    
        builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs

4.4.12. AppendInternational

added in version 1.3.0

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 void AppendCharacterSet(IDisplayCommandBuilder builder)
    {
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendSpecifiedPosition(1, 1);
    
        builder.AppendInternational(DisplayInternationalType.USA);
        builder.AppendCodePage(DisplayCodePageType.Japanese);
    
        byte[] pattern1 = { 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.AppendBytes(pattern1);
    
        builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs

4.4.13. AppendCodePage

added in version 1.3.0

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 void AppendCharacterSet(IDisplayCommandBuilder builder)
    {
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendSpecifiedPosition(1, 1);
    
        builder.AppendInternational(DisplayInternationalType.USA);
        builder.AppendCodePage(DisplayCodePageType.Japanese);
    
        byte[] pattern1 = { 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.AppendBytes(pattern1);
    
        builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs

4.4.14. AppendDeleteToEndOfLine

added in version 1.3.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.4.15. AppendClearScreen

added in version 1.3.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

    public static void AppendClearScreen(IDisplayCommandBuilder builder)
    {
        builder.AppendClearScreen();
    
        builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs

4.4.16. AppendHomePosition

added in version 1.3.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

  • Examples

    public static void AppendHomePosition(IDisplayCommandBuilder builder)
    {
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendSpecifiedPosition(1, 1);
    
        IBuffer otherData1 = System.Text.Encoding.UTF8.GetBytes("Star Micronics    ").AsBuffer();
        IBuffer otherData2 = System.Text.Encoding.UTF8.GetBytes("Total       :12345").AsBuffer();
    
        builder.AppendData(otherData1);
        builder.AppendData(otherData2);
    
        builder.AppendSpecifiedPosition(20, 2);
    
        builder.AppendCursorMode(DisplayCursorMode.On);
    
        builder.AppendHomePosition();
    
        builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs

4.4.17. AppendTurnOn

added in version 1.3.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

    public static void AppendHomePosition(IDisplayCommandBuilder builder)
    {
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendSpecifiedPosition(1, 1);
    
        IBuffer otherData1 = System.Text.Encoding.UTF8.GetBytes("Star Micronics    ").AsBuffer();
        IBuffer otherData2 = System.Text.Encoding.UTF8.GetBytes("Total       :12345").AsBuffer();
    
        builder.AppendData(otherData1);
        builder.AppendData(otherData2);
    
        builder.AppendTurnOn(true);
    
        builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs

4.4.18. AppendSpecifiedPosition

added in version 1.3.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, 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 void AppendHomePosition(IDisplayCommandBuilder builder)
    {
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendSpecifiedPosition(1, 1);
    
        IBuffer otherData1 = System.Text.Encoding.UTF8.GetBytes("Star Micronics    ").AsBuffer();
        IBuffer otherData2 = System.Text.Encoding.UTF8.GetBytes("Total       :12345").AsBuffer();
    
        builder.AppendData(otherData1);
        builder.AppendData(otherData2);
    
        builder.AppendSpecifiedPosition(20, 2);
    
        builder.AppendCursorMode(DisplayCursorMode.On);
    
        builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs

4.4.19. AppendCursorMode

added in version 1.3.0

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 void AppendHomePosition(IDisplayCommandBuilder builder)
    {
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendSpecifiedPosition(1, 1);
    
        IBuffer otherData1 = System.Text.Encoding.UTF8.GetBytes("Star Micronics    ").AsBuffer();
        IBuffer otherData2 = System.Text.Encoding.UTF8.GetBytes("Total       :12345").AsBuffer();
    
        builder.AppendData(otherData1);
        builder.AppendData(otherData2);
    
        builder.AppendSpecifiedPosition(20, 2);
    
        builder.AppendCursorMode(DisplayCursorMode.On);
    
        builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs

4.4.20. AppendContrastMode

added in version 1.3.0

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 void AppendHomePosition(IDisplayCommandBuilder builder, DisplayContrastMode contrastMode)
    {
        builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendSpecifiedPosition(1, 1);
    
        IBuffer otherData1 = System.Text.Encoding.UTF8.GetBytes("Star Micronics    ").AsBuffer();
        IBuffer otherData2 = System.Text.Encoding.UTF8.GetBytes("Total       :12345").AsBuffer();
    
        builder.AppendData(otherData1);
        builder.AppendData(otherData2);
    
        builder.AppendSpecifiedPosition(20, 2);
    
        builder.AppendContrastMode(contrastMode);
    
        builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs

4.4.21. AppendUserDefinedCharacter

added in version 1.3.0

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 void AppendUserDefinedCharacter(IDisplayCommandBuilder builder, bool set)
    {
        //builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendSpecifiedPosition(1, 1);
    
        builder.AppendInternational(DisplayInternationalType.USA);
        builder.AppendCodePage(DisplayCodePageType.Japanese);
    
        if (set)
        {
            builder.AppendUserDefinedCharacter(0, 0x20, new byte[] { 0x00, 0x00, 0x32, 0x00, 0x49, 0x00, 0x49, 0x7f, 0x26, 0x48, 0x00, 0x48, 0x00, 0x30, 0x00, 0x00 });
    
            builder.AppendUserDefinedDbcsCharacter(0, 0x8140, new byte[] { 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 });
        }
        else
        {
            builder.AppendUserDefinedDbcsCharacter(0, 0x00, null);
    
            builder.AppendUserDefinedCharacter(0, 0x00, null);
        }
    
        byte[] pattern = { 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.AppendBytes(pattern);
    
        builder.PassThroughCommands;
    }
    

    Refer to DisplayFunction.cs

4.4.22. AppendUserDefinedDbcsCharacter

added in version 1.3.0

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 void AppendUserDefinedCharacter(IDisplayCommandBuilder builder, bool set)
    {
        //builder.AppendClearScreen();
        builder.AppendCursorMode(DisplayCursorMode.Off);
        builder.AppendSpecifiedPosition(1, 1);
    
        builder.AppendInternational(DisplayInternationalType.USA);
        builder.AppendCodePage(DisplayCodePageType.Japanese);
    
        if (set)
        {
            builder.AppendUserDefinedCharacter(0, 0x20, new byte[] { 0x00, 0x00, 0x32, 0x00, 0x49, 0x00, 0x49, 0x7f, 0x26, 0x48, 0x00, 0x48, 0x00, 0x30, 0x00, 0x00 });
    
            builder.AppendUserDefinedDbcsCharacter(0, 0x8140, new byte[] { 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 });
        }
        else
        {
            builder.AppendUserDefinedCharacter(0, 0x00, null);
    
            builder.AppendUserDefinedDbcsCharacter(0, 0x00, null);
        }
    
        byte[] pattern = { 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.AppendBytes(pattern);
    
        builder.PassThrouhCommands;
    }
    

    Refer to DisplayFunction.cs

4.4.23. GetCommands

added in version 1.3.0

Gets the command buffer (generated command).

  • Declaration

    IBuffer GetCommands()
    
  • Parameter

    None

  • Value

    Contents Type
    Command buffer (generated command) IBuffer