CustomAndroidAPI  1.30
it.custom.printer.api.android.CustomAndroidAPI Class Reference

Public Member Functions

Boolean SetVariable (String var, Object value) throws CustomException
 Set the value of an internal "parameter" More...
 
Object GetVariable (String var) throws CustomException
 Get the value of an internal "parameter" More...
 
CustomPrinter getPrinterDriverBT (BluetoothDevice printer) throws CustomException
 
CustomPrinter getPrinterDriverETH (String printerIpAddr) throws CustomException
 
CustomPrinter getPrinterDriverETH (String printerIpAddr, int printerIpPort) throws CustomException
 
CustomPrinter getPrinterDriverCOM (String devPort) throws CustomException
 
CustomPrinter getPrinterDriverUSB (UsbDevice device, Context cobj) throws CustomException
 
CustomPrinter getPrinterDriverBLE (BluetoothDevice printer, Context cobj) throws CustomException
 

Static Public Member Functions

static String getAPIVersion ()
 
static void EnableLogAPI (boolean enable)
 
static void ForceCheck2ndInterfaceAvailable (boolean enable)
 
static BluetoothDevice [] EnumBluetoothDevices () throws CustomException
 
static String [] EnumEthernetDevices (int searchTimeSpan, Context cobj) throws CustomException
 
static UsbDevice [] EnumUsbDevices (Context cobj) throws CustomException
 
static BluetoothDevice [] EnumBluetoothLeDevices (int searchTimeSpan) throws CustomException
 

Detailed Description

Factory class to get the printer driver class for supported model id

Member Function Documentation

◆ EnableLogAPI()

static void it.custom.printer.api.android.CustomAndroidAPI.EnableLogAPI ( boolean  enable)
inlinestatic

Enable / disable the API log (default disabled).

◆ EnumBluetoothDevices()

static BluetoothDevice [] it.custom.printer.api.android.CustomAndroidAPI.EnumBluetoothDevices ( ) throws CustomException
inlinestatic

Get the list of CUSTOM Bluetooth devices.

Returns
the list of CUSTOM Bluetooth devices
Exceptions
CustomExceptionif Bluetooth is not enable or is not supported

◆ EnumBluetoothLeDevices()

static BluetoothDevice [] it.custom.printer.api.android.CustomAndroidAPI.EnumBluetoothLeDevices ( int  searchTimeSpan) throws CustomException
inlinestatic

Get the list of CUSTOM Bluetooth Low Energy (BLE) devices.

Remarks
Note
This function is not available on the UI Thread(main thread). The enumeration of the Bluetooth Low Energy (BLE) devices must be done in a separate thread.
Parameters
searchTimeSpanBluetooth Low Energy (BLE) devices time span to search the BLE devices. Usually to find all the devices, this value must be 4000 (4sec) or higher.
Returns
the list of CUSTOM Bluetooth Low Energy (BLE) devices
Exceptions
CustomExceptionif Bluetooth Low Energy (BLE) is not enable or is not supported

◆ EnumEthernetDevices()

static String [] it.custom.printer.api.android.CustomAndroidAPI.EnumEthernetDevices ( int  searchTimeSpan,
Context  cobj 
) throws CustomException
inlinestatic

Get the list of CUSTOM WiFi/Ethernet devices.

Parameters
searchTimeSpantime span to search the WiFi/Ethernet devices
cobjContext object
Returns
the String list with IP ADDRESS of CUSTOM WiFi/Ethernet devices
Exceptions
CustomException

◆ EnumUsbDevices()

static UsbDevice [] it.custom.printer.api.android.CustomAndroidAPI.EnumUsbDevices ( Context  cobj) throws CustomException
inlinestatic

Get the list of CUSTOM USB Printer devices.

Parameters
cobjContext object
Returns
the String list CUSTOM USB devices
Exceptions
CustomException

◆ ForceCheck2ndInterfaceAvailable()

static void it.custom.printer.api.android.CustomAndroidAPI.ForceCheck2ndInterfaceAvailable ( boolean  enable)
inlinestatic

Enable / disable the check, at the open of the connection, if a 2nd communication interface is available (default enable).

Note
The check for a 2nd communication interface is available is performed only with the Ethernet/Wifi and USB communciation ports.

◆ getAPIVersion()

static String it.custom.printer.api.android.CustomAndroidAPI.getAPIVersion ( )
inlinestatic

Current API version

Returns
current API version eg 1.00
Exceptions
CustomException

◆ getPrinterDriverBLE()

CustomPrinter it.custom.printer.api.android.CustomAndroidAPI.getPrinterDriverBLE ( BluetoothDevice  printer,
Context  cobj 
) throws CustomException
inline

Connects to Bluetooth Low Energy (BLE) Printer device.

Parameters
printerdevice to connect
cobjContext object
Returns
printer driver class according to its model/printer id
Exceptions
CustomExceptionif Bluetooth Low Energy (BLE) device is not printer or printer model is not supported

◆ getPrinterDriverBT()

CustomPrinter it.custom.printer.api.android.CustomAndroidAPI.getPrinterDriverBT ( BluetoothDevice  printer) throws CustomException
inline

Connects to Bluetooth Printer device.

Parameters
printerdevice to connect
Returns
printer driver class according to its model/printer id
Exceptions
CustomExceptionif Bluetooth device is not printer or printer model is not supported

◆ getPrinterDriverCOM()

CustomPrinter it.custom.printer.api.android.CustomAndroidAPI.getPrinterDriverCOM ( String  devPort) throws CustomException
inline

Connects to Com/Serial Printer device.

Parameters
devPortString value with dev address of device to connect (the dev must be set with "666" permissions. Example: "chmod 666 /dev/ttyS0")
Returns
printer driver class according to its model/printer id
Exceptions
CustomExceptionif open port port error, device is not printer or printer model is not supported

◆ getPrinterDriverETH() [1/2]

CustomPrinter it.custom.printer.api.android.CustomAndroidAPI.getPrinterDriverETH ( String  printerIpAddr) throws CustomException
inline

Connects to WiFi/Ethernet Printer device.

Remarks
Note
From Android 3.0 Network operations are not allowed on the UI Thread(main thread). You have to do the network communication in a separate thread. Google Android developer link about it.
Parameters
printerIpAddrString value with IP ADDRESS of device to connect (connect of prn port 9100)
Returns
printer driver class according to its model/printer id
Exceptions
CustomExceptionif WiFi/Ethernet device is not printer or printer model is not supported

◆ getPrinterDriverETH() [2/2]

CustomPrinter it.custom.printer.api.android.CustomAndroidAPI.getPrinterDriverETH ( String  printerIpAddr,
int  printerIpPort 
) throws CustomException
inline

Connects to WiFi/Ethernet Printer device.

Remarks
Note
From Android 3.0 Network operations are not allowed on the UI Thread(main thread). You have to do the network communication in a separate thread. Google Android developer link about it.
Parameters
printerIpAddrString value with IP ADDRESS of device to connect
printerIpPortinteger value with IP PORT of device to connect
Returns
printer driver class according to its model/printer id
Exceptions
CustomExceptionif WiFi/Ethernet device is not printer or printer model is not supported

◆ getPrinterDriverUSB()

CustomPrinter it.custom.printer.api.android.CustomAndroidAPI.getPrinterDriverUSB ( UsbDevice  device,
Context  cobj 
) throws CustomException
inline

Connects to Usb Printer device.

Parameters
deviceUSB object of device to connect
cobjContext object
Returns
printer driver class according to its model/printer id
Exceptions
CustomExceptionif USB device is not printer or printer model is not supported

◆ GetVariable()

Object it.custom.printer.api.android.CustomAndroidAPI.GetVariable ( String  var) throws CustomException
inline

Get the value of an internal "parameter"

Parameters
varVariable ID
Returns
Variable value
Exceptions
CustomException

◆ SetVariable()

Boolean it.custom.printer.api.android.CustomAndroidAPI.SetVariable ( String  var,
Object  value 
) throws CustomException
inline

Set the value of an internal "parameter"

Parameters
varVariable ID
valueVariable value
Returns
false if the name lookup failed
Exceptions
CustomException