4.13. StarIoExtManager

Always connect to the printer. Provides a real-time status acquisition function.

Important

Please use SM-S and SM-T series in Auto Power Down function “NO USE” setting (Default setting).

4.13.1. Type

Manager type constants.

  • Declaration

    public enum Type {
        Standard,
        WithBarcodeReader,
        OnlyBarcodeReader
    }
    
  • Constants

    Name Contents
    Standard Management of the printer and the cash drawer.
    WithBarcodeReader Management of the printer, cash drawer and the barcode reader.
    OnlyBarcodeReader Management of the barcode reader.

4.13.2. PrinterStatus

Printer status constants.

  • Declaration

    public enum PrinterStatus {
        Invalid,
        Impossible,
        Online,
        Offline
    }
    
  • Constants

    Name Contents
    Invalid Invalid.
    Impossible Impossible to use printer.
    Online Detect Printer online.
    Offline Detect Printer offline.

4.13.3. PrinterPaperStatus

Printer paper status constants.

  • Declaration

    public enum PrinterPaperStatus {
        Invalid,
        Impossible,
        Ready,
        NearEmpty,
        Empty
    }
    
  • Constants

    Name Contents
    Invalid Invalid.
    Impossible Impossible to use printer.
    Ready Detect Printer paper ready.
    NearEmpty Detect Printer paper near end.
    Empty Detect Printer paper empty.

4.13.4. PrinterCoverStatus

Printer cover status constants.

  • Declaration

    public enum PrinterCoverStatus {
        Invalid,
        Impossible,
        Open,
        Close
    }
    
  • Constants

    Name Contents
    Invalid Invalid.
    Impossible Impossible to use printer.
    Open Detect Printer cover open.
    Close Detect Printer cover close.

4.13.5. CashDrawerStatus

Cash drawer status constants.

  • Declaration

    public enum CashDrawerStatus {
        Invalid,
        Impossible,
        Open,
        Close
    }
    
  • Constants

    Name Contents
    Invalid Invalid.
    Impossible Impossible to use Cash drawer.
    Open Detect Cash drawer open.
    Close Detect Cash drawer close.

4.13.6. BarcodeReaderStatus

Barcode reader status constants.

  • Declaration

    public enum BarcodeReaderStatus {
        Invalid,
        Impossible,
        Connect,
        Disconnect
    }
    
  • Constants

    Name Contents
    Invalid Invalid.
    Impossible Impossible to use Barcode reader.
    Connect Detect Barcode reader connection.
    Disconnect Detect Barcode reader disconnection.

4.13.7. StarIoExtManager

Initializes the StarIoExtManager .

  • Declaration

    StarIoExtManager(Type type, String portName, String portSetting, int ioTimeoutMillis, Context context);
    
  • Parameter

    Name Contents Type
    type Manager type Type
    portName
    Printer port name
    It is the same as the portName of the getPort method.
    String
    portSettings
    Port settings
    It is the same as the portSetting of the getPort method.
    String
    ioTimeoutMillis Acquires and specifies the timeout time for internal control and API (unit: millisecond) int
    context context android.context.Contex
  • Return value

    Contents Type
    StarIoExtManager object StarIoExtManager
  • Examples

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        PrinterSetting setting = new PrinterSetting(getContext());
    
        mStarIoExtManager = new StarIoExtManager(StarIoExtManager.Type.Standard, setting.getPortName(), setting.getPrinterType(), 10000, getContext()); // 10000mS!!!
    
        mStarIoExtManager.setListener(mStarIoExtManagerListener);
    }
    

    Refer to PrinterExtFragment.java, CashDrawerExtFragment.java, BarcodeReaderExtFragment.java and CombinationExtFragment.java.

4.13.8. connect

Management start.

  • Declaration

    public void connect(final ConnectionCallback callback);
    public void connect(final IConnectionCallback callback);
    
  • Parameter

    Name Contents Type Library version
    callback
    When the connect is completed, check connection result as onConnected method parameter.
    * result … Connection result
    * resultCode … Result code
    ConnectionCallback 1.10.0+
    callback
    When the connect is completed, check connection result as onConnected method parameter.
    * result … Connection result
    IConnectionCallback 1.3.0+
  • Return value

    None

  • Examples

    public void connect(final ConnectionCallback callback);

    public class PrinterExtFragment extends Fragment {
    
        ...
    
        @Override
        public void onStart() {
            super.onStart();
    
            ...
    
            mStarIoExtManager.connect(mConnectionCallback);
        }
    
        ...
    
        private final ConnectionCallback mConnectionCallback = new ConnectionCallback() {
            @Override
            public void onConnected(boolean result, int resultCode) {
            ...
            }
    
            @Override
            public void onDisconnected() {
            // do nothing
            }
        };
    }
    

    Refer to PrinterExtFragment.java, CashDrawerExtFragment.java, BarcodeReaderExtFragment.java and CombinationExtFragment.java.

    public void connect(final IConnectionCallback callback);

    public class PrinterExtFragment extends Fragment implements IConnectionCallback {
    
        ...
    
        @Override
        public void onStart() {
            super.onStart();
    
            ...
    
            mStarIoExtManager.connect(this);
        }
    
        ...
    
        @Override
        public void onConnected() {
            Log.d("PrinterExtFragment", "onConnected " + result);
    
            ...
        }
    
        ...
    }
    

4.13.9. disconnect

Management stop.

  • Declaration

    public void disconnect(ConnectionCallback callback);
    public void disconnect(IConnectionCallback callback);
    
  • Parameter

    Name Contents Type Library version
    callback When the disconnect is completed, check disconnected result as onDisconnected method. ConnectionCallback 1.10.0+
    callback When the disconnect is completed, check disconnected result as onDisconnected method. IConnectionCallback 1.3.0+
  • Return value

    None

  • Examples

    public void disconnect(ConnectionCallback callback);

    public class PrinterExtFragment extends Fragment {
    
        ...
    
        @Override
        public void onStop() {
            super.onStop();
    
            ...
    
            mStarIoExtManager.disconnect(mConnectionCallback);
        }
        ...
        private final ConnectionCallback mConnectionCallback = new ConnectionCallback() {
            @Override
            public void onConnected(boolean result, int resultCode) {
            ...
            }
    
            @Override
            public void onDisconnected() {
            // do nothing
            }
        };
    }
    

    Refer to PrinterExtFragment.java, CashDrawerExtFragment.java, BarcodeReaderExtFragment.java and CombinationExtFragment.java.

    public void disconnect(IConnectionCallback callback);

    public class PrinterExtFragment extends Fragment implements IConnectionCallback {
    
        ...
    
        @Override
        public void onStop() {
            super.onStop();
    
            ...
    
            mStarIoExtManager.disconnect(this);
        }
    
        ...
    
        @Override
        public void onDisconnected() {
            Log.d("PrinterExtFragment", "onDisconnected");
    
            ...
        }
    
        ...
    }
    

4.13.10. getPort

StarIOPort object.

  • Declaration

    StarIOPort getPort();
    
  • Parameter

    None

  • Return value

    Contents Type
    StarIOPort object StarIOPort

4.13.11. getPrinterStatus

Printer Online status.

  • Declaration

    PrinterStatus getPrinterStatus();
    
  • Parameter

    None

4.13.12. getPrinterPaperStatus

Printer paper status.

  • Declaration

    PrinterPaperStatus getPrinterPaperStatus();
    
  • Parameter

    None

4.13.13. getPrinterCoverStatus

Printer cover status.

  • Declaration

    PrinterCoverStatus getPrinterCoverStatus();
    
  • Parameter

    None

4.13.14. getCashDrawerStatus

Gets the cash drawer status.

  • Declaration

    CashDrawerStatus getCashDrawerStatus();
    
  • Parameter

    None

4.13.15. getBarcodeReaderStatus

Barcode reader status.

  • Declaration

    BarcodeReaderStatus getBarcodeReaderStatus();
    
  • Parameter

    None

4.13.16. getCashDrawerOpenActiveHigh

Mode of cash drawer open sensor active.

  • Declaration

    boolean getCashDrawerOpenActiveHigh();
    
  • Parameter

    None

  • Return value

    Contents Type
    Mode of a cash drawer open sensor active
    true … Active high
    false … Active low
    boolean

4.13.17. setCashDrawerOpenActiveHigh

Sets the mode of cash drawer open sensor active.

  • Declaration

    void setCashDrawerOpenActiveHigh(boolean isActiveHigh);
    
  • Parameter

    Name Contents Type
    isActiveHigh
    Mode of a cash drawer open sensor active
    true … Active high
    false … Active low
    boolean

    Warning

    Be the default value (true) for mPOP.

  • Return value

    None

4.13.18. setListener

Sets the listener object of the StarIoExtManager .

  • Declaration

    void setListener(StarIoExtManagerListener listener);
    
  • Return value

    None

  • Examples

    public class PrinterExtFragment extends Fragment implements IConnectionCallback {
    
        ...
    
        public void onStart() {
            super.onStart();
    
            ...
    
            mStarIoExtManager.setListener(mStarIoExtManagerListener);
    
            ...
        }
    
        private final StarIoExtManagerListener mStarIoExtManagerListener = new StarIoExtManagerListener() {
    
            ...
    
        };
    }
    

    Refer to PrinterExtFragment.java, CashDrawerExtFragment.java, BarcodeReaderExtFragment.java and CombinationExtFragment.java.