4.1. StarIoExt

Provides human-readable command generation and peripheral device operation.

4.1.1. Emulation

Emulation type constants

  • Declaration

    public enum Emulation {
        None,
        StarPRNT,
        StarPRNTL,
        StarLine,
        StarGraphic,
        EscPos,
        EscPosMobile,
        StarDotImpact
    }
    
  • Constants

    Name Contents
    StarPRNT StarPRNT emulation
    StarPRNTL StarPRNTL emulation
    StarLine STAR Line Mode emulation
    StarGraphic STAR Graphic Mode emulation
    EscPos ESC/POS emulation
    EscPosMobile ESC/POS Mobile emulation
    StarDotImpact STAR Dot Impact emulation
  1. StarPRNTL emulation

    StarPRNTL emulation reduces the command size with the appendBitmap type method that generates a raster image printing command.The time it takes to send the raster image command is reduced.

    StarPRNTL emulation can only be selected on some supported models.For usable models, refer to the supported printers.

Constant of “Emulation” for each model.

Model

Emulation

Constants

mC-Print2 StarPRNT

StarPRNT

mC-Print3 StarPRNT

StarPRNT

mPOP StarPRNT

StarPRNT

FVP10 StarLine

StarLine

TSP100IIIW StarGraphic

StarGraphic

TSP100IIILAN StarGraphic

StarGraphic

TSP100IIIBI StarGraphic

StarGraphic

TSP100IIIU StarGraphic

StarGraphic

TSP100ECO StarGraphic

StarGraphic

TSP100U StarGraphic

StarGraphic

TSP100GT StarGraphic

StarGraphic

TSP100LAN StarGraphic

StarGraphic

TSP650II StarLine

StarLine

TSP650IISK StarLine

StarLine

TSP700II StarLine

StarLine

TSP800II StarLine

StarLine

TUP500 StarLine

StarLine

BSC10 StarLine

EscPos

SM-S210i StarPRNT

StarPRNT

EscPosMobile

EscPosMobile

SM-S220i StarPRNT

StarPRNT

EscPosMobile

EscPosMobile

SM-S230i StarPRNT

StarPRNT

EscPosMobile

EscPosMobile

SM-T300i/T300 StarPRNT

StarPRNT

EscPosMobile

EscPosMobile

SM-T400i StarPRNT

StarPRNT

EscPosMobile

EscPosMobile

SM-L200 StarPRNT

StarPRNT

StarPRNTL

SM-L300 StarPRNT

StarPRNT

StarPRNTL

SP700 StarDotImpact

StarDotImpact

SK1-211/221/V211/ StarPRNT

StarPRNT

SK1-211/221/V211 Presenter StarPRNT

StarPRNT

SK1-311/321/V311 StarPRNT

StarPRNT

SK1-311/V311 Presenter StarPRNT

StarPRNT

4.1.2. CharacterCode

Character code type constants.

  • Declaration

    public enum CharacterCode {
        None,
        Standard,
        Japanese,
        SimplifiedChinese,
        TraditionalChinese
    }
    
  • Constants

    Name Contents
    Standard Standard character code
    Japanese Japanese character code
    SimplifiedChinese Simplified chinese character code
    TraditionalChinese Traditional chinese character code

4.1.3. BcrModel

Barcode Reader Model constants

  • Declaration

    public enum BcrModel {
        None,
        POP1,
        DS9208
    }
    
  • Constants

    Name

    Contents

    Library version

    POP1

    Barcode reader : BCR-POP1

    USB HID Class (Keyboard mode)

    1.3.0+

    DS9208

    Barcode reader : DS9208

    1.10.0+

4.1.4. DisplayModel

added in version 1.6.0

Customer Display Model constants.

  • Declaration

    public enum DisplayModel {
        None,
        SCD222
    }
    
  • Constants

    Name Contents
    SCD222 Customer display: SCD222U

4.1.5. MelodySpeakerModel

added in version 1.10.0

Melody Speaker Model constants.

  • Declaration

    public enum MelodySpeakerModel {
        None,
        MCS10,
        FVP10
    }
    
  • Constants

    Name Contents
    MCS10 Melody speaker: MCS10
    FVP10 FVP10 internal speaker

4.1.6. LedModel

added in version 1.13.0

LED Model constants.

  • Declaration

    public enum LedModel {
        None,
        Star,
        SK
    }
    
  • Constants

    Name Contents
    Star LED indicator for Star
    SK LED indicator for SK series

4.1.7. createCommandBuilder

Creates the command builder object

  • Declaration

    public static ICommandBuilder createCommandBuilder(Emulation emulation);
    
  • Parameter

    Name Contents Type
    emulation Emulation type Emulation

    Constant of Emulation for each model, refer to Emulation .

  • Return value

    Contents Type
    ICommandBuilder object ICommandBuilder
  • Examples

    public static byte[] createCommandsImage(Emulation emulation, Bitmap bitmap) {
        ICommandBuilder builder = StarIoExt.createCommandBuilder(emulation);
    
        builder.beginDocument();
    
        builder.appendBitmap(bitmap, false);
    
        builder.appendCutPaper(CutPaperAction.PartialCutWithFeed);
    
        builder.endDocument();
    
        return builder.getCommands();
    }
    

    Refer to PrinterFunctions.java.

4.1.8. createDisplayCommandBuilder

added in version 1.6.0

Creates the customer display command builder object

  • Declaration

    public static IDisplayCommandBuilder createDisplayCommandBuilder(DisplayModel model);
    
  • Parameter

    Name Contents Type
    model Customer Display Model constants DisplayModel
  • Return value

    Contents Type
    IDisplayCommandBuilder object IDisplayCommandBuilder
  • Examples

    public static byte[] createTextPattern(int number) {
        IDisplayCommandBuilder builder = StarIoExt.createDisplayCommandBuilder(DisplayModel.SCD222);
    
        builder.appendClearScreen();
        builder.appendCursorMode(CursorMode.Off);
        builder.appendHomePosition();
    
        byte[] pattern;
    
        builder.append(pattern);
    
        return builder.getPassThroughCommands();
    }
    

    Refer to DisplayFunctions.java.

4.1.9. createMelodySpeakerCommandBuilder

added in version 1.10.0

Creates the melody speaker command builder object

  • Declaration

    public static IMelodySpeakerCommandBuilder createMelodySpeakerCommandBuilder(MelodySpeakerModel model);
    
  • Parameter

    Name Contents Type
    model Melody Speaker Model constants MelodySpeakerModel
  • Return value

    Contents Type
    IMelodySpeakerCommandBuilder object IMelodySpeakerCommandBuilder
  • Examples

    public static byte[] createPlayingRegisteredSound(MelodySpeakerModel model, SoundStorageArea soundStorageArea, boolean specifySound, int soundNumber, boolean specifyVolume, int volume) {
        IMelodySpeakerCommandBuilder builder = StarIoExt.createMelodySpeakerCommandBuilder(model);
    
        SoundSetting setting = new SoundSetting();
    
        if (specifySound) {
            setting.setSoundStorageArea(soundStorageArea);
            setting.setSoundNumber(soundNumber);
        }
    
        if (specifyVolume) {
            setting.setVolume(volume);
        }
    
        builder.appendSound(setting);
    
        return builder.getCommands();
    }
    

    Refer to MelodySpeakerFunctions.java.

4.1.10. createPresenterCommandBuilder

added in version 1.13.0

Creates the presenter command builder object

  • Declaration

    public static IPresenterCommandBuilder createPresenterCommandBuilder(Emulation emulation);
    
  • Parameter

    Name Contents Type
    emulation Emulation type Emulation
  • Return value

    Contents Type
    IPresenterCommandBuilder object IPresenterCommandBuilder
  • Examples

    public static byte[] createSetPresenterOperation(Emulation emulation, Mode mode, PaperRetractFunction retractFunction, int holdTime) {
        IPresenterCommandBuilder builder = StarIoExt.createPresenterCommandBuilder(emulation);
    
        PresenterSetting setting = new PresenterSetting();
    
        setting.setMode(mode);
    
        setting.setPaperRetractFunction(retractFunction);
    
        if (retractFunction == PaperRetractFunction.Retract || retractFunction == PaperRetractFunction.Eject) {
            setting.setPaperHoldTime(holdTime);
        }
    
        builder.appendOperation(setting);
    
        return builder.getCommands();
    }
    

    Refer to PresenterFunctions.java.

4.1.11. createLedCommandBuilder

added in version 1.13.0

Creates the LED command builder object

  • Declaration

    public static ILedCommandBuilder createLedCommandBuilder(LedModel model);
    
  • Parameter

    Name Contents Type
    model LED Model constants LedModel
  • Return value

    Contents Type
    ILedCommandBuilder object ILedCommandBuilder
  • Examples

    private void print() {
        ...
    
        LedModel model = ModelCapability.getLedModel(mPrinterSettings.getModelIndex());
        ILedCommandBuilder ledBuilder = StarIoExt.createLedCommandBuilder(model);
    
        try {
            ledBuilder.appendAutomaticBlinkMode(leds);
    
            List ledList = Arrays.asList(leds);
    
            if (ledList.contains(Led.Printing)) {
            ledBuilder.appendAutomaticBlinkInterval(Led.Printing, printingLedOnTime, printingLedOffTime);
            }
    
            if (ledList.contains(Led.Error)) {
            ledBuilder.appendAutomaticBlinkInterval(Led.Error, errorLedOnTime, errorLedOffTime);
            }
    
            if (ledList.contains(Led.Idle)) {
            ledBuilder.appendAutomaticBlinkInterval(Led.Idle, idleLedOnTime, idleLedOffTime);
            }
        }
        catch (IllegalArgumentException e) {
            ...
        }
    
        ...
    }
    

    Refer to LedFragment.java.

4.1.12. createBezelCommandBuilder

added in version 1.14.0

Creates the Bezel command builder object

  • Declaration

    public static IBezelCommandBuilder createBezelCommandBuilder(Emulation emulation)
    
  • Parameter

    Name Contents Type
    emulation Emulation type Emulation
  • Return value

    Contents Type
    IBezelCommandBuilder object IBezelCommandBuilder
  • Examples

    public static List<byte[]> createHoldPrintData(Emulation emulation, boolean[] isHoldArray) {
        List<byte[]> commandList = new ArrayList<>();
    
        for (int i = 0; i < isHoldArray.length; i++) {
            ICommandBuilder builder = StarIoExt.createCommandBuilder(emulation);
    
            builder.beginDocument();
    
            IBezelCommandBuilder bezelBuilder = StarIoExt.createBezelCommandBuilder(emulation);
    
            // Enable bezel.
            bezelBuilder.appendBezelMode(Mode.Valid);
    
            builder.append(bezelBuilder.getCommands());
    
            // Disable hold print controlled by printer firmware.
            builder.appendHoldPrint(HoldPrintType.Invalid);
    
            ...
        }
    
        return commandList;
    }
    

    Refer to PrinterFunctions.java.

4.1.13. createBcrConnectParser

Creates a barcode reader connection status command response analysis object

  • Declaration

    public static IPeripheralConnectParser createBcrConnectParser(BcrModel model);
    
  • Parameter

    Name Contents Type
    model Barcode Reader Model constants BcrModel
  • Return value

    Contents Type
    IPeripheralConnectParser object IPeripheralConnectParser

4.1.14. createDisplayConnectParser

added in version 1.6.0

Creates a customer display connection status command response analysis object

  • Declaration

    public static IPeripheralConnectParser createDisplayConnectParser(DisplayModel model);
    
  • Parameter

    Name Contents Type
    model Customer Display Model constants DisplayModel
  • Return value

    Contents Type
    IPeripheralConnectParser object IPeripheralConnectParser
  • Examples

    public void onItemClick(final AdapterView<?> parent, View view, final int position, long id) {
        super.onItemClick(parent, view, position, id);
    
        CommonAlertDialogFragment dialog = null;
    
        if (position == 1) {
            mProgressDialog.show();
    
            PrinterSetting setting = new PrinterSetting(getActivity());
    
            final IPeripheralConnectParser parser = StarIoExt.createDisplayConnectParser(DisplayModel.SCD222);
    
            Communication.parseDoNotCheckCondition(DisplayFragment.class, parser, setting.getPortName(), setting.getPortSettings(), 10000, getActivity(), new Communication.SendCallback() {
            @Override
            public void onStatus(boolean result, Communication.Result communicateResult) {
                ...
    
                String msg;
                String title;
    
                if (result) {
                    title = "Check Status";
                    if (parser.isConnected()) {
                        msg = "Display Connect";
                    }
                    else {
                        msg = "Display Disconnect";
                    }
                }
                else {
                    title = "Communication Result";
                    msg = "Printer Impossible";
                }
    
                ...
            }
            });
        }
    
        ...
    }
    

    Refer to DisplayFragment.java/DisplayExtFragment.java.

4.1.15. createMelodySpeakerConnectParser

added in version 1.10.0

Creates a melody speaker connection status command response analysis object

  • Declaration

    public static IPeripheralConnectParser createMelodySpeakerConnectParser(MelodySpeakerModel model);
    
  • Parameter

    Name Contents Type
    model Melody Speaker Model constants MelodySpeakerModel
  • Return value

    Contents Type
    IPeripheralConnectParser object IPeripheralConnectParser
  • Exception

    Class Contents
    UnsupportedOperationException FVP10 is specified
  • Examples

    private void playRegisteredSound() {
        mProgressDialog.show();
    
        PrinterSettingManager settingManager = new PrinterSettingManager(getActivity());
        PrinterSettings settings = settingManager.getPrinterSettings();
    
        if (mMelodySpeakerModel == MelodySpeakerModel.MCS10) {
            final IPeripheralConnectParser parser = StarIoExt.createMelodySpeakerConnectParser(MelodySpeakerModel.MCS10);
    
            Communication.parseDoNotCheckCondition(MelodySpeakerFragment.class, parser, settings.getPortName(), settings.getPortSettings(), 10000, getActivity(), new Communication.SendCallback() {
            @Override
            public void onStatus(boolean result, Communication.Result communicateResult) {
                if (!mIsForeground) {
                    return;
                }
    
                String msg;
                String title;
    
                if (result) {
                    if (parser.isConnected()) {
                        sendRegisteredSoundCommand();
                        return;
                    }
                    else {
                        title = "Check Status";
                        msg = "MelodySpeaker Disconnect";
                    }
                }
                else {
                        title = "Communication Result";
                        msg = "Printer Impossible";
                }
            }
    
            ...
            });
        }
    
        ...
    }
    

    Refer to MelodySpeakerFragment.java.

4.1.16. createPresenterPaperCounterParser

added in version 1.13.0

Creates a response analysis object of the command which gets the presenter paper counter

  • Declaration

    public static IPresenterPaperCounterParser createPresenterPaparCounterParser(Emulation emulation);
    
  • Parameter

    Name Contents Type
    emulation Emulation type Emulation
  • Return value

    Contents Type
    IPresenterPaperCounterParser object IPresenterPaperCounterParser