SmartPos SDK for Android 1.4.1

Public Member Functions
com.paydevice.smartpos.sdk.printer.UsbPrinter Class Reference

Class of UsbPrinter implement. More...

Inheritance diagram for com.paydevice.smartpos.sdk.printer.UsbPrinter:

## Public Member Functions
| UsbPrinter (Context context)
void | selectPrinter (UsbDevice device)
| Select external usb printer. More...
void | selectBuiltInPrinter ()
| Select built-in printer. More...
void | open () throws SmartPosException
| Open printer and request permission. More...
void | close () throws SmartPosException
| Close printer. More...
int | read (byte[] buf, int len) throws SmartPosException
| Read data from printer(timeout 1s) More...
void | write (byte[] buf, int len) throws SmartPosException
| Write data to printer(timeout 1s) More...
int | getType ()
| Get the printer type. More...
int | read (byte[] buf, int len, int timeout) throws SmartPosException
| Read data from printer. More...
void | write (byte[] buf, int len, int timeout) throws SmartPosException
| Write data to printer. More...
List< UsbDevice > | getPrinterList ()
| Get all usb printer. More...

## Detailed Description

Class of UsbPrinter implement.

## Member Function Documentation

## ◆ close()

void com.paydevice.smartpos.sdk.printer.UsbPrinter.close | ( |  | ) | throws SmartPosException

Close printer.

Returns

Implements com.paydevice.smartpos.sdk.printer.Printer.

## ◆ getPrinterList()

List<UsbDevice> com.paydevice.smartpos.sdk.printer.UsbPrinter.getPrinterList | ( |  | ) |

Get all usb printer.

Returns
  UsbDevice list of all usb printer

## ◆ getType()

int com.paydevice.smartpos.sdk.printer.UsbPrinter.getType | ( |  | ) |

Get the printer type.

Returns

Implements com.paydevice.smartpos.sdk.printer.Printer.

## ◆ open()

void com.paydevice.smartpos.sdk.printer.UsbPrinter.open | ( |  | ) | throws SmartPosException

Open printer and request permission.

Returns

Implements com.paydevice.smartpos.sdk.printer.Printer.

## ◆ read() [1/2]

int com.paydevice.smartpos.sdk.printer.UsbPrinter.read | ( | byte[] | buf,
|  | int | len
| ) |  | throws SmartPosException

Read data from printer(timeout 1s)

Parameters

  buf | data buffer
  len | data len

Returns

Implements com.paydevice.smartpos.sdk.printer.Printer.

## ◆ read() [2/2]

int com.paydevice.smartpos.sdk.printer.UsbPrinter.read | ( | byte[] | buf,
|  | int | len,
|  | int | timeout
| ) |  | throws SmartPosException

Read data from printer.

Parameters

  buf | data buffer
  len | data len
  timeout | timeout in ms

Returns

## ◆ selectBuiltInPrinter()

void com.paydevice.smartpos.sdk.printer.UsbPrinter.selectBuiltInPrinter | ( |  | ) |

Select built-in printer.

Returns

Implements com.paydevice.smartpos.sdk.printer.Printer.

## ◆ selectPrinter()

void com.paydevice.smartpos.sdk.printer.UsbPrinter.selectPrinter | ( | UsbDevice | device | ) |

Select external usb printer.

Parameters

  device | UsbDevice

Returns

## ◆ write() [1/2]

void com.paydevice.smartpos.sdk.printer.UsbPrinter.write | ( | byte[] | buf,
|  | int | len
| ) |  | throws SmartPosException

Write data to printer(timeout 1s)

Parameters

  buf | data buffer
  len | data len

Returns

Implements com.paydevice.smartpos.sdk.printer.Printer.

## ◆ write() [2/2]

void com.paydevice.smartpos.sdk.printer.UsbPrinter.write | ( | byte[] | buf,
|  | int | len,
|  | int | timeout
| ) |  | throws SmartPosException

Write data to printer.

Parameters

  buf | data buffer
  len | data len
  timeout | timeout in ms

Returns

The documentation for this class was generated from the following file:

- src/com/paydevice/smartpos/sdk/printer/UsbPrinter.java