Select your printer model
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 |
|
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]
- Introduction
- help
- Printer class
- Printer
- connect
- disconnect
- startMonitor
- stopMonitor
- getStatus
- sendData
- beginTransaction
- endTransaction
- requestPrintJobStatus
- clearCommandBuffer
- addTextAlign
- addLineSpace
- addTextRotate
- addText
- addTextLang
- addTextFont
- addTextSmooth
- addTextSize
- addTextStyle
- addHPosition
- addFeedUnit
- addFeedLine
- addImage
- addLogo
- addBarcode
- addSymbol
- addHLine
- addVLineBegin
- addVLineEnd
- addPageBegin
- addPageEnd
- addPageArea
- addPageDirection
- addPagePosition
- addPageLine
- addPageRectangle
- addRotateBegin
- addRotateEnd
- addCut
- addPulse
- addSound
- addFeedPosition
- addLayout
- addCommand
- getMaintenanceCounter
- resetMaintenanceCounter
- getPrinterSetting
- setPrinterSetting
- getPrinterSettingEx
- setPrinterSettingEx
- setPrinterSettingEx[Obsolete]
- verifyPassword
- getPrinterInformation
- downloadFirmwareList
- getPrinterFirmwareInfo
- verifyUpdate
- updateFirmware
- forceRecover
- forcePulse
- forceStopSound
- forceCommand
- forceReset
- setStatusChangeEventListener
- setReceiveEventListener
- setGetPrinterSettingExListener
- setSetPrinterSettingExListener
- setVerifyPasswordListener
- interval
- LFCPrinter class
- HybridPrinter class
- HybridPrinter
- connect
- disconnect
- startMonitor
- stopMonitor
- getStatus
- sendData
- beginTransaction
- endTransaction
- clearCommandBuffer
- selectPaperType
- waitInsertion
- cancelInsertion
- ejectPaper
- readMicrData
- cleanMicrReader
- forceRecover
- forcePulse
- forceCommand
- forceReset
- paperType
- interval
- waitTime
- mode40Cpl
- setStatusChangeEventListener
- setReceiveEventListener
- LineDisplay class
- LineDisplay
- connect
- disconnect
- getStatus
- sendData
- clearCommandBuffer
- addInitialize
- addCreateWindow
- addDestroyWindow
- addSetCurrentWindow
- addClearCurrentWindow
- addCreateScreen
- addCreateScreenCustom
- addCreateTextArea
- addDestroyTextArea
- addSetCurrentTextArea
- addClearCurrentTextArea
- addSetCursorPosition
- addMoveCursorPosition
- addSetCursorType
- addText
- addReverseText
- addMarqueeText
- addSetBlink
- addSetBrightness
- addBackgroundColor
- addStartSlideShow
- addStopSlideShow
- addDownloadImage
- addRegisterDownloadImage
- addNVImage
- addClearImage
- addSymbol
- addClearSymbol
- addShowClock
- addCommand
- setReceiveEventListener
- Keyboard class
- POSKeyboard class
- BarcodeScanner class
- MSR class
- SimpleSerial class
- GermanyFiscalElement class
- OtherPeripheral class
- CommBox class
- Common to all classes
- Discovery class
- Epos2Exception class
- Log class
- EasySelect class
- EasySelectInfo class
- Appendix
- Status list
- Key code list
- List of Supported Classes
- List of Supported APIs
- Printer-specific Support Information
- TM-m10
- TM-m30
- TM-m30II
- TM-m30II-H
- TM-m30II-NT
- TM-m30II-S
- TM-m30II-SL
- TM-m30III
- TM-m30III-H
- TM-m50
- TM-m50II
- TM-m50II-H
- TM-T20
- TM-T20II
- TM-T20III
- TM-T20IIIL
- TM-T20IV-L
- TM-T20X
- TM-T20X-II
- TM-T60
- TM-T70
- TM-T70II
- TM-T81II
- TM-T81III
- TM-T82
- TM-T82II
- TM-T82III
- TM-T82IIIL
- TM-T82IV-L
- TM-T82X
- TM-T82X-II
- TM-T83II
- TM-T83III
- TM-T83IV
- TM-T88V
- TM-T88VI
- TM-T88VII
- TM-T100
- TM-L90 Liner-Free Label Printer Model
- TM-L100
- TM-U220
- TM-U330
- EU-m30
- TM-P20
- TM-P20II
- TM-P60 (Receipt)
- TM-P60 (Peeler)
- TM-P60II (Receipt)
- TM-P60II (Peeler)
- TM-P80
- TM-P80II
- TM-H6000V
- TM-T20II-i
- TM-T70-i
- TM-T82II-i
- TM-T83II-i
- TM-T88V-i
- TM-T88VI-iHUB
- TM-U220-i
- TM-T70II-DT
- TM-T70II-DT2
- TM-T88V-DT
- TM-T88VI-DT2
- TM-H6000IV-DT
- TM-T88IV
- TM-T90
- TM-L90
- TM-H6000IV