Select your printer model

Parameters are refined by the selected printer.

start


Starts searching for the specified device type.

An event is generated for each device detected.

Syntax

 
public static synchronized void start(Context context, FilterOption filterOption,DiscoveryListener listener) throws Epos2Exception

Parameter

context

Sets an instance of the Context class for the caller.
Example) Sets Context acquired by getBaseContext() within Activity.

filterOption

In order to filter the search result, set the filter option in the FilterOption type and specify it in the parameter. When null is specified, search is run with the default settings.

The following information is stored in the FilterOption type.

  • portType
    Selects the port to search.
  • Value

    Description

    Discovery.PORTTYPE_ALL (default)

    Search for all devices which can be connected via TCP, Bluetooth or USB.

    Discovery.PORTTYPE_TCP

    Search for devices connected to the network.

    Discovery.PORTTYPE_BLUETOOTH

    Search for devices which can be connected via Bluetooth.

    Discovery.PORTTYPE_USB

    Search for devices which can be connected via USB.

  • broadcast
    Specify a Broadcast Address for TCP search as a string.
  • Value

    Description

    "255.255.255.255" (default)

    -

  • deviceModel
    Specifies the device model to search for.
  • Value

    Description

    Discovery.MODEL_ALL

    Search for all models.

  • epsonFilter
    Filters the search result by the Epson printers.
    Search can be performed for printers connected via Bluetooth or USB.
  • Value

    Description

    Discovery.FILTER_NAME(default)

    Filters the search result by the Epson printers.

    Discovery.FILTER_NONE

    Does not filter the search result.

  • deviceType
    Specifies the device type to search for.
    The device type settings other than "Discovery.TYPE_ALL" can be used for the following systems connected using Wi-Fi or Ethernet.
    • Customer Display Models (SSL/TLS communication only)
    • TM Printer + DM-D + barcode scanner model
    • TM Printer + barcode scanner model
    • POS Terminal Model
  • Value

    Description

    Discovery.TYPE_ALL (default)

    Search for all devices.

    Discovery.TYPE_PRINTER

    Search for printers.

    Discovery.TYPE_HYBRID_PRINTER

    Searches for hybrid model printers.

    Discovery.TYPE_DISPLAY

    Search for customer displays.

    Discovery.TYPE_KEYBOARD

    Search for keyboards.

    Discovery.TYPE_SCANNER

    Search for barcode scanners.

    Discovery.TYPE_SERIAL

    Search for serial communication devices.

    Discovery.TYPE_POS_KEYBOARD

    Search for the POS keyboard.

    Discovery.TYPE_MSR

    Search for the MSR.

    Discovery.TYPE_GFE

    Search for German fiscal element (TSE).

    Discovery.TYPE_OTHER_PERIPHERAL

    Search for other peripheral devices.

  • bondedDevices
    Specifies the search target when searching for a device that can be connected via Bluetooth.
  • Value

    Description

    Discovery.TRUE

    Search for devices that can be connected, and devices that were previously connected.

    Discovery.FALSE (default)

    Search for devices that can be connected.

  • usbDeviceName
    Specifies whether to search USB devices by their names or not.
  • Value

    Description

    Discovery.TRUE

    Search for USB compatible devices by their name.

    Discovery.FALSE (default)

    Does not search for USB compatible devices by their name.

listener

Specifies an object which has a notification target method.

Exception

When the process fails, Epos2Exception with one of the following error status occurs.

Error status

Description

ERR_PARAM

An invalid parameter was passed.

ERR_ILLEGAL

  • Tried to start search when search had been already done.
  • Bluetooth is OFF.
  • There is no permission for the position information.

ERR_MEMORY

Memory necessary for processing could not be allocated.

ERR_FAILURE

An unknown error occurred.

ERR_PROCESSING

Could not run the process.

Listener interface

public interface DiscoveryListener extends EventListener

Listener method

void onDiscovery(DeviceInfo deviceInfo);

Parameter

deviceInfo

The device information of the detected device is stored in the DeviceInfo type.

The following device information is stored.

  • deviceType
    The device type is stored.
  • Device type

    Status

    For a printer

    Discovery.TYPE_PRINTER

    For hybrid model printers

    Discovery.TYPE_HYBRID_PRINTER

    For a customer display

    Discovery.TYPE_DISPLAY

    For a keyboard

    Discovery.TYPE_KEYBOARD

    For a barcode scanner

    Discovery.TYPE_SCANNER

    For a serial communication device

    Discovery.TYPE_SERIAL

    For POS keyboard

    Discovery.TYPE_POS_KEYBOARD

    For MSR

    Discovery.TYPE_MSR

    For German fiscal element (TSE)

    Discovery.TYPE_GFE

    For other peripheral devices

    Discovery.TYPE_OTHER_PERIPHERAL

  • target
    The connection target of a device which can be specified by connectAPI is stored as a string.
    Example)
    "TCP:192.168.192.168"
    "BT:00:22:15:7D:70:9C"
    "USB:/dev/udev/*"
    "USB:000000000000000000"
    "TCP:192.168.192.168[local_printer]"
    "TCP:192.168.192.168[local_display]"
    "TCP:12:34:56:78:56:78"
  • deviceName
    The name set to the device is stored.
    If it could not be acquired, "" (blank character) or "TM Printer" is stored.
    Example)
    For a printer: "TM-T88V"
  • ipAddress
    The IP address is stored.
    If it could not be acquired, "" (blank character) is stored.
    Example)
    TCP: "192.168.192.168"
    BT: ""(blank character)
  • macAddress
    The MAC address is stored.
    If it could not be acquired, "" (blank character) is stored.
    Example)
    TCP: "12:34:56:78:56:78"
    BT: ""(blank character)
  • bdAddress
    The BD address is stored.
    If it could not be acquired, "" (blank character) is stored.
    Example)
    TCP: ""(blank character)
    BT: "12:34:56:78:56:78"

Supplementary explanation

  • The search result of this API is reported to the callback function for each device detected.
    An already opened device is also reported. However, a USB device and a Bluetooth device are not reported if they have been already opened.
  • In search for TCP devices, if multiple devices with the same IP address exist, the device information is treated as a single device. Consistency for such device information is not guaranteed.
  • If the printer has its TCP address and TCPS address, and the both are detected, only the TCPS address is reported to the callback function.
  • Hybrid model printers can be detected as deviceType of Discovery.TYPE_PRINTER and Discovery.TYPE_HYBRID_PRINTER.
  • To search for a hybrid model printer connected via USB, specify Discovery.TYPE_ALL in deviceType.
  • After the search begins and the process ends, make sure to end the search.
  • This search function is not available in Android Studio simulator.
  • When searching for a device running on Android 10 or later as a Bluetooth-capable device, enable access to location information of the device.
  • When searching for a device connected to the USB-A - Device Charging connector by using API Level 29 or higher application software, a dialogue box that tells you to acquire access permissions may pop up if USB permission has not been acquired.
  • If a USB device is connected while searching the device, the device may not be found.
    In that case, terminate and restart the search.
  • When searching for a Bluetooth-capable device, depending on API Level, the following permissions are necessary.
    API Level 28 or lower application software: ACCESS_COARSE_LOCATION
    API Level 29 to 30 application software: ACCESS_FINE_LOCATION
    API Level 31 or higher application software: ACCESS_FINE_LOCATION (when acquiring physical location information)
 

Quick Access

  • [Name]
  • [Format]
  • [Range]
  • [Description]
  • [Notes]

Epson ePOS SDK includes patented or patent pending functions. The contents must not be disclosed to third parties.


Epson ePOS SDK for Android

Jump to the top