4.11. IPeripheralConnectParser

added in version 1.6.0

An interface to provide functions to generate commands to get the connection/disconnection status of the peripheral.

This interface is only for models which support the peripheral. For the supporting models, refer to Supported Peripherals .

  • Member

    Name

    Contents

    isConnected

    Gets the connection/disconnection status of the peripheral.

4.11.1. isConnected

added in version 1.6.0

Gets the connection/disconnection status of the peripheral.

Executes after the parse returns Success .

  • Declaration

    boolean isConnected();
    
  • Parameter

    None

  • Return value

    Contents

    Type

    The connection/disconnection status of the peripheral.

    boolean

  • Examples

    Communication.parseDoNotCheckCondition(DisplayFragment.class, parser, setting.getPortName(), setting.getPortSettings(), 10000, getActivity(), new Communication.SendCallback() {
        @Override
        public void onStatus(boolean result, Communication.Result communicateResult) {
            if (!mIsForeground) {
            return;
            }
    
            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 / MelodySpeakerFragment.java.