ZebraPrinterSdk
A factory interface used to acquire a cross platform instance of ZebraImageI.
Creates an instance of from the image specified in fullPath.
The full path of the image.
An image formatted for Zebra Printers
If the file could not be found, open, or is an unsupported graphic.
If fullPath is null.
Creates an instance of from the image data specified in imageData.
A byte[] containing the image data.
An image formatted for Zebra Printers.
If the file could not be found, open, or is an unsupported graphic.
If imageData is null.
Creates an instance of from the image data specified in imageData.
A stream containing the image data.
An image formatted for Zebra Printers.
If the file could not be found, open, or is an unsupported graphic.
If imageData is null.
A factory used to acquire an instance of ZebraImageI.
Current IZebraPrinterFactory to use
For internal use of the Zebra Printer API only.
For internal use of the Zebra Printer API only.
For internal use of the Zebra Printer API only.
A factory used to acquire an instance of a ZebraImageI.
Creates an instance of from the image specified in image.
The bitmap image
An image formatted for Zebra Printers
If the file could not be found, open, or is an unsupported graphic.
If image is null
Creates an instance of from the image specified in fullPath.
The full path of the image.
An image formatted for Zebra Printers
If the file could not be found, open, or is an unsupported graphic.
If fullPath is null
Creates an instance of from the image data specified in imageData
A stream containing the image data.
An image formatted for Zebra Printers.
If the file could not be found, open, or is an unsupported graphic.
If imageData is null
35 seconds was chosen for a Max Timeout so that if the pairing request is
ignored it will close and deny the pair before we hit the Max Timeout and close.
Establishes a Bluetooth® connection to a printer
In order to connect to a device with Bluetooth®, the device must be discoverable, authentication must be enabled,
and the authentication pin must be set(1-16 alphanumeric characters).
The encryption type and whether or not it is used is determined by the device initiating the connection and not
device being connected to.
Desktop
Android™
iOS
For internal use of the Zebra Printer API only.
For internal use of the Zebra Printer API only.
Gets/sets the time to wait before closing the connection (milliseconds).
For internal use of the Zebra Printer API only.
For internal use of the Zebra Printer API only.
For internal use of the Zebra Printer API only.
Constructs a new Bluetooth® connection with the given macAddress.
The MAC address is a hexadecimal string with or without separators between the octets. (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF).
This constructor will use the default timeouts for . The default timeout is a maximum of 10
seconds for any data to be received. If no more data is available after 500 milliseconds the read operation is
assumed to be complete.
To specify timeouts other than the defaults, use:
the device's MAC address.
Constructs a new Bluetooth® connection with the givenmacAddress and timeout values.
The MAC address is a hexadecimal string with or without separators between the octets. (e.g. 00:11:BB:DD:55:FF or
0011BBDD55FF). This constructor will use the specified timeouts for .The timeout is a
maximum of maxTimeoutForRead milliseconds for any data to be received.If no more data is available
after timeToWaitForMoreData milliseconds the read operation is assumed to be complete.
the device's MAC address.
the maximum time, in milliseconds, to wait for any data to be received.
the maximum time, in milliseconds, to wait in-between reads after the initial read.
Exposed this protected constructor for testing. We can pass in a mock Connector rather than the BT specific one.
The MAC address is a hexadecimal string with no separators between the octets. (e.g. 0011BBDD55FF).
Opens a Bluetooth® connection as specified in the constructor.
For internal use of the Zebra Printer API only.
Closes the Bluetooth® connection.
The friendly name is obtained from the device when this connection is opened. If the friendly name changes on the
device, it will not be refreshed until the connection is closed and reopened.
Bluetooth:[MAC Address]:[Friendly Name].
Gets the MAC address and the friendly name as the description.
[MAC Address]:[Friendly Name]
Gets the MAC address which was passed into the constructor. The MAC address is a hexadecimal string with
separators between the octets. (e.g. 00:11:BB:DD:55:FF).
Gets the friendly name of the Bluetooth® connection. The friendly name is obtained from the device when
this connection is opened.If the friendly name changes on the device, it will not be refreshed until the
connection is closed and reopened.
Establishes an insecure Bluetooth® connection to a printer.
Insecure Bluetooth® connections do not require the device and the printer to be paired.
Desktop
Android™
For internal use of the Zebra Printer API only.
Constructs a new insecure Bluetooth® connection with the given macAddress.
The MAC address is a hexadecimal string with or without separators between the octets. (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF).
This constructor will use the default timeouts for . The default timeout is a maximum of 5
seconds for any data to be received. If no more data is available after 500 milliseconds the read operation is assumed to be complete.
To specify timeouts other than the defaults, use:
.
The device's MAC address.
Constructs a new insecure Bluetooth® connection with the given macAddress and timeout values.
The MAC address is a hexadecimal string with or without separators between the octets. (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF).
This constructor will use the specified timeouts for . The timeout is a
maximum of maxTimeoutForRead milliseconds for any data to be received. If no more data is available
after timeToWaitForMoreData milliseconds the read operation is assumed to be complete.
The device's MAC address.
The maximum time, in milliseconds, to wait for any data to be received.
The maximum time, in milliseconds, to wait in-between reads after the initial read.
Establishes a Bluetooth® status only connection to a Link-OS printer.
This connection requires Link-OS firmware 2.5 or higher. This channel will not block the printing channel,
nor can it print. If you wish to print, see .
In order to connect to a device with Bluetooth®, the device must be discoverable, authentication must be enabled,
and the authentication pin must be set(1-16 alphanumeric characters).
The encryption type and whether or not it is used is determined by the device initiating the connection and not device being connected to.
Desktop
Android™
For internal use of the Zebra Printer API only.
For internal use of the Zebra Printer API only.
For internal use of the Zebra Printer API only.
For internal use of the Zebra Printer API only.
For internal use of the Zebra Printer API only.
Constructs a new Bluetooth® connection with the given macAddress.
The MAC address is a hexadecimal string with or without separators between the octets. (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF).
This constructor will use the default timeouts for . The default timeout is a maximum of 5
seconds for any data to be received.If no more data is available after 500 milliseconds the read operation is
assumed to be complete.
To specify timeouts other than the defaults, use:
the device's MAC address.
Constructs a new Bluetooth® connection with the givenmacAddress and timeout values.
The MAC address is a hexadecimal string with or without separators between the octets. (e.g. 00:11:BB:DD:55:FF or
0011BBDD55FF). This constructor will use the specified timeouts for .The timeout is a
maximum of maxTimeoutForRead milliseconds for any data to be received.If no more data is available
after timeToWaitForMoreData milliseconds the read operation is assumed to be complete.
the device's MAC address.
the maximum time, in milliseconds, to wait for any data to be received.
the maximum time, in milliseconds, to wait in-between reads after the initial read.
Exposed this protected constructor for testing. We can pass in a mock Connector rather than the BT specific one.
The MAC address is a hexadecimal string with no separators between the octets. (e.g. 0011BBDD55FF).
Opens a Bluetooth® connection as specified in the constructor.
Closes the Bluetooth® connection.
The friendly name is obtained from the device when this connection is opened. If the friendly name changes on the
device, it will not be refreshed until the connection is closed and reopened.
Bluetooth_STATUS:[MAC Address]:[Friendly Name].
Gets the MAC address and the friendly name as the description.
[MAC Address]:[Friendly Name]
Gets the MAC address which was passed into the constructor. The MAC address is a hexadecimal string with
separators between the octets. (e.g. 00:11:BB:DD:55:FF).
Gets the friendly name of the Bluetooth® connection. The friendly name is obtained from the device when
this connection is opened.If the friendly name changes on the device, it will not be refreshed until the
connection is closed and reopened.
Establishes a status only insecure Bluetooth® connection to a Link-OS printer.
This connection requires Link-OS firmware 2.5 or higher. This channel will not block the printing channel, nor can it print.
If you wish to print, see . Insecure Bluetooth® connections do not require the device and
the printer to be paired.
Desktop
Android™
For internal use of the Zebra Printer API only.
Constructs a new status only insecure Bluetooth® connection with the given macAddress.
The MAC address is a hexadecimal string with or without separators between the octets. (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF).
This constructor will use the default timeouts for . The default timeout
is a maximum of 5 seconds for any data to be received. If no more data is available after 500 milliseconds the
read operation is assumed to be complete.
To specify timeouts other than the defaults, use:
The device's MAC address.
Constructs a new status only insecure Bluetooth® connection with the given macAddress and timeout values.
The MAC address is a hexadecimal string with or without separators between the octets. (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF).
This constructor will use the specified timeouts for . The timeout is a maximum of
maxTimeoutForRead milliseconds for any data to be received. If no more data is available after
timeToWaitForMoreData milliseconds the read operation is assumed to be complete.
The device's MAC address.
The maximum time, in milliseconds, to wait for any data to be received.
The maximum time, in milliseconds, to wait in-between reads after the initial read.
Establishes a Bluetooth® Low Energy connection to a printer.
In order to connect to a device with Bluetooth®, the device must the device must have Bluetooth® Low Energy capabilies.
The encryption type and whether or not it is used is determined by the device being connected to and the bluetooth.le settings.
Constructs a new Bluetooth® connection with the given macAddress and timeout values. The MAC address is a hexadecimal
string with or without separators between the octets. (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF). This constructor will use the specified
timeouts for com.zebra.sdk.comm.Connection.The timeout is a maximum of maxTimeoutForRead milliseconds for any data to be received.
If no more data is available after timeToWaitForMoreData milliseconds the read operation is assumed to be complete.
You will need to set in order to connect to a Printer.
The device's MAC address.
Constructs a new Bluetooth® connection with the given macAddress and timeout values. The MAC address is a hexadecimal
string with or without separators between the octets. (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF). This constructor will use the specified
timeouts for com.zebra.sdk.comm.Connection.The timeout is a maximum of maxTimeoutForRead milliseconds for any data to be received.
If no more data is available after timeToWaitForMoreData milliseconds the read operation is assumed to be complete.
The device's MAC address.
Android™ application context.
Constructs a new Bluetooth® connection with the given macAddress and timeout values. The MAC address is a hexadecimal
string with or without separators between the octets. (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF). This constructor will use the specified
timeouts for com.zebra.sdk.comm.Connection.The timeout is a maximum of maxTimeoutForRead milliseconds for any data to be received.
If no more data is available after timeToWaitForMoreData milliseconds the read operation is assumed to be complete.
The device's MAC address.
The maximum time, in milliseconds, to wait for any data to be received.
The maximum time, in milliseconds, to wait in-between reads after the initial read.
Android™ application context.
Opens a Bluetooth® Low Energy connection as specified in the constructor.
Closes the Bluetooth® Low Energy connection.
The friendly name is obtained from the device when this connection is opened. If the friendly name changes on the
device, it will not be refreshed until the connection is closed and reopened.
BluetoothLe:[MAC Address]:[Friendly Name].
Gets the MAC address and the friendly name as the description.
[MAC Address]:[Friendly Name]
Gets the MAC address which was passed into the constructor. The MAC address is a hexadecimal string with
separators between the octets. (e.g. 00:11:BB:DD:55:FF).
Gets the friendly name of the Bluetooth® connection. The friendly name is obtained from the device when
this connection is opened.If the friendly name changes on the device, it will not be refreshed until the
connection is closed and reopened.
Returns a ConnectionReestablisher which allows for easy recreation of a connection which may have been closed.
The time to wait for the device to come back online.
Get/Set the application context.
The Android™ application context used for the Bluetooth® Low Energy connection or null if not specified.
Builds a Connection from a description string. The description string is used to specify a connection to a specific
device over TCP or Bluetooth®.
The description string may be of the explicit forms:
"TCP:192.168.1.4:6101" -- creates a TCP connection to the device with IP address 192.168.1.4 on port 6101.
"TCP:192.168.1.4" -- creates a TCP connection to the device with IP address 192.168.1.4 on default port 9100.
"TCP:dnsName:6101" -- creates a TCP connection to the device with 'dnsName' on port 6101.
"TCP:dnsName" -- creates a TCP connection to the device with 'dnsName' on default port 9100.
"TCP_MULTI:192.168.1.4" -- creates a Multichannel TCP connection to the device with '192.168.1.4' using the default ports for both the printing channel(9100) and the status channel(9200).
"TCP_MULTI:192.168.1.4:1234" -- creates a Multichannel TCP connection to the device with '192.168.1.4' using the given port for the printing channel(1234) and the default port for the status channel(9200).
"TCP_MULTI:192.168.1.4:1234:5678" -- creates a Multichannel TCP connection to the device with '192.168.1.4' using the given ports for the printing channel(1234) and the status channel(5678).
"TCP_MULTI:dnsName:1234:5678" -- creates a Multichannel TCP connection to the device with 'dnsName' using the given ports for the printing channel(1234) and the status channel(5678).
"TCP_STATUS:192.168.1.4:1234" -- creates a TCP status only connection to the device with IP address 192.168.1.4 on port 1234.
"TCP_STATUS:192.168.1.4" -- creates a TCP status only connection to the device with IP address 192.168.1.4 on the default status port 9200.
"BT:11:22:33:44:55:66" -- creates a Bluetooth® connection to the device using '11:22:33:44:55:66' as the MAC address.
"BT_MULTI:11:22:33:44:55:66" -- creates a multichannel Bluetooth® connection to the device using '11:22:33:44:55:66' as the MAC address. (Link-OS 2.5 or higher for the status channel)
"BT_STATUS:11:22:33:44:55:66" -- creates a status only Bluetooth® connection to the device using '11:22:33:44:55:66' as the MAC address. (Link-OS 2.5 or higher)
Generic text may also be used to attempt to specify a device. For example a description string of "genericText" will
attempt to connect to a device using the following priority:
-
TCP_MULTI
-
TCP
-
TCP_STATUS
-
BT_MULTI
-
BT
-
BT_STATUS
If you supply the string '1FE533AA7B90'. This could be interpreted to be either a DNS name or a Bluetooth® MAC
address. ConnectionBuilder will attempt to connect to this string given the above priority order. If you supply a
more specific string, such as '192.168.2.3', ConnectionBuilder will more efficiently interpret this string as being
an IP address and, therefore, only attempt the TCP connections.
The Bluetooth® Connection Building process will first attempt an insecure connection (no pairing required). This
requires the printer's 'bluetooth.minimum_security_mode' must be set to 1. If an insecure connection could not be
esablished, it will attempt to pair and connect securely. This will trigger the Android pairing request prompt.
Note: Colon (':') characters are not supported in dnsName, friendlyName, uniqueId, deviceName, or genericText fields.
The following is an example of building a connection from a string.
Desktop
Android™
iOS
For internal use of the Zebra Printer API only.
For internal use of the Zebra Printer API only.
Add a connection type to the ConnectionBuilder.
Connection class.
Creates a Connection type based on the contents of descriptionString.
"TCP:192.168.1.2:9100"
The format of the input string is: [prefix:] address [: port_number(s)].
-
Prefix is either TCP_MULTI, TCP, TCP_STATUS, BT_MULTI, BT, or BT_STATUS.
-
The format of address depends on the prefix
- TCP : address is either a DNS name or an IPv4 address.
- BT : address is the MAC address.
- port_number(s) is optional, and only applicable for TCP connections.
-
Examples:
- TCP:ZBR3054027:9100
- TCP_MULTI:ZBR3054027:9100:9200
- BT:11:22:33:44:55:66
- BT_MULTI:11:22:33:44:55:66
- BT_STATUS:11:22:33:44:55:66
- 10.1.2.3
Connection derived from the contents of descriptionString.If a connection could not be established for the given descriptionString.
Establishes a Bluetooth® label and status connection to a printer.
In order to connect to a device with Bluetooth®, the device must be discoverable,
authentication must be enabled, and the authentication pin must be set(1-16 alphanumeric characters).
The encryption type and whether or not it is used is determined by the device initiating the connection and not
device being connected to.
Desktop
Android™
Initializes a new instance of the MultichannelBluetoothConnection class.
This constructor will use the default timeouts for . The default timeout is
a maximum of 5 seconds for any data to be received.If no more data is available after 500 milliseconds
the read operation is assumed to be complete.
The MAC Address of the Printer.
Initializes a new instance of the MultichannelBluetoothConnection class.
This constructor will use the specified timeouts for for both channels. The timeout is a maximum of
maxTimeoutForRead milliseconds for any data to be received. If no more data is available after
timeToWaitForMoreData milliseconds the read operation is assumed to be complete. If you wish to
specify different timeouts for each channel, use .
The MAC Address of the Printer.
The maximum time, in milliseconds, to wait for any data to be received.
The maximum time, in milliseconds, to wait in-between reads after the initial read.
Initializes a new instance of the MultichannelBluetoothConnection class.
This constructor will use the specified timeouts for for the channels. The timeout is a maximum of
printingChannelMaxTimeoutForRead/statusChannelMaxTimeoutForRead milliseconds for any data to be
received on the printing/status channels respectively. If no more data is available after
printingChannelTimeToWaitForMoreData/statusChannelTimeToWaitForMoreData milliseconds on the
printing/status channels respectively the read operation is assumed to be complete.
The MAC Address of the Printer.
The maximum time, in milliseconds, to wait for any data to be received on the printing channel.
The maximum time, in milliseconds, to wait in-between reads after the initial read on the printing channel.
The maximum time, in milliseconds, to wait for any data to be received on the status channel.
The maximum time, in milliseconds, to wait in-between reads after the initial read on the status channel.
For internal use of the Zebra Printer API only.
For internal use of the Zebra Printer API only.
Opens both the printing and status channel of this Multichannel connection.
When this Multichannel connection is no longer needed, you must call to free up system resources.
If neither channel can be opened
Closes both the printing and status Bluetooth® channels.
If an error occurs while trying to close either channel
The friendly name is obtained from the device when this connection is opened. If the friendly name changes on the
device, it will not be refreshed until the connection is closed and reopened.
Bluetooth_MULTI:[MAC Address]:[Friendly Name].
Gets the MAC address and the friendly name as the description.
[MAC Address]:[Friendly Name]
Establishes an Android™ USB connection to an attached Zebra USB printer.
Returns the UsbManager object.
Returns the USB device name.
Return the device name as the description.
Returns the serial number of the printer.
Gets/sets the instance.
Creates a new UsbConnection.
The UsbManager object used to create this UsbConnection.
The UsbDevice object.
Creates a new UsbConnection.
The UsbManager object used to create this UsbConnection.
The UsbDevice object.
Maximum time to wait for read data.
Maximum time to wait for more data after initial data is sent from printer.
The USB device name is obtained from the device when this connection is opened.
Returns USB:[Device path].
Interface defining a UsbPermissionRequestor.
Intended to be implemented by an Activity that knows how to request permission for USB communications from the Android USB manager.
It will be used/accessed by the SDK when attempting to reestablish USB communications after a firmware download and printer reset.
The UsbDevice object.
A class that discovers Bluetooth® devices.
Desktop
Android
iOS
Find Bluetooth® devices that are discoverable.
This method will return all devices found, not just Zebra printers
This method should not be called from the application main thread.
Android 6 and higher (API 23+) requires user permission ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION in your application manifest.
Android™ application context.
a instance that is used to handle discovery events (e.g. found a printer, errors, discovery finished).
for communication or discovery errors
Find Bluetooth® devices that are discoverable.
This method will return all devices found, not just Zebra printers.
This method should not be called from the application main thread.
Android™ application context
a instance that is used to handle discovery events (e.g. found a printer, errors, discovery finished)
for communication or discovery errors
Find services(ConnectionChannels) that are supported by the device at macAddress.
Android™ application context
MAC address of the device
a instance that is used to handle service discovery events.
The Bluetooth MAC address is invalid
DeviceFilter is an interface to allow the user to write custom code to determine whether or not the
BluetoothDiscoverer should include a particular BluetoothDevice in it's result set.
Method called by a BluetoothDiscoverer to determine whether or not a Bluetooth® device should be added to
it's list of discovered devices.
BluetoothDevice to potentially be added to the list of of discovered Bluetooth® devices.
a bool indicating whether or not a particular BluetoothDevice should be added.
Instance of DiscoveredPrinter that is returned when performing a Bluetooth® discovery.
Returns an instance of a DiscoveredPrinterBluetooth with macAddress.
MAC address of the printer.
Friendly name of the printer.
The friendly name of the Bluetooth® device.
Instance of DiscoveredPrinter that is returned when performing a USB discovery.
Creates a new DiscoveredPrinterUsb.
Identifier to associate with the created DiscoveredPrinterUsb instance.
Android™ UsbManager to use for the created DiscoveredPrinterUsb instance.
Android™ UsbDevice to use for the created DiscoveredPrinterUsb instance.
The Android™ UsbDevice used by this DiscoveredPrinterUsb instance.
The Android™ UsbManager used by this DiscoveredPrinterUsb instance.
Interface definition for a callback to be invoked for service discovery events
This method is invoked when a service has been discovered. This method will be invoked for each service that is found.
a discovered channel
This method is invoked when discovery is finished
A class used to discover a printer described by a URL. (Windows 10 only)
This method will search using a combination of discovery methods to find the printer described by the specified URL. (Windows 10 only)
This method will invoke the method for each interface that
the specified printer is found. will be invoked when the discovery is
finished and will be invoked when any errors are encountered during
discovery. When is invoked, the discovery will be canceled and
will not be invoked.
This method will typically be used when reading an NFC tag attached to a Zebra printer. To launch your app when a
Zebra NFC tag is read:
- Register to listen for Zebra NFC Tag scans in your application
- Handle the NFC scan in your application
The URL describing the targeted printer (Typically, this information is encoded on an NFC tag attached
to the printer)
Example:
"http://www.zebra.com/apps/r/nfc?mBL=00225832C75F&mW=000000000000&mE=000000000000&c=QN3-AUBA0E01-00&s=XXQLJ112600422&v=0"
A instance that is used to handle discovery events (e.g. found a
printer, errors, discovery finished).
Android™ application context.
If an error occurs while starting the discovery (errors during discovery will be sent
via ).
Discovers Zebra printers connected to an Android™ device via USB Host.
Desktop
Android
Enumerate all currently connected Zebra USB printers.
Android™ application context.
A instance that is used to handle discovery events (e.g. found a printer, errors, discovery finished).
Enumerate all currently connected Zebra USB printers.
Android™ UsbManager.
A instance that is used to handle discovery events (e.g. found a printer, errors, discovery finished).
Determines if the UsbDevice is a Zebra printer.
The UsbDevice.
True if the USB device is a Zebra device.