File tree Expand file tree Collapse file tree 5 files changed +20
-0
lines changed
escposprinter/src/main/java/com/dantsu/escposprinter/connection Expand file tree Collapse file tree 5 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 11package com .dantsu .escposprinter .connection .bluetooth ;
22
3+ import android .annotation .SuppressLint ;
34import android .bluetooth .BluetoothAdapter ;
45import android .bluetooth .BluetoothDevice ;
56
7+ import androidx .annotation .Nullable ;
8+
69import java .util .Set ;
710
811public class BluetoothConnections {
@@ -19,6 +22,8 @@ public BluetoothConnections() {
1922 * Get a list of bluetooth devices available.
2023 * @return Return an array of BluetoothConnection instance
2124 */
25+ @ SuppressLint ("MissingPermission" )
26+ @ Nullable
2227 public BluetoothConnection [] getList () {
2328 if (this .bluetoothAdapter == null ) {
2429 return null ;
Original file line number Diff line number Diff line change 44import android .bluetooth .BluetoothClass ;
55import android .bluetooth .BluetoothDevice ;
66
7+ import androidx .annotation .Nullable ;
8+
79import com .dantsu .escposprinter .exceptions .EscPosConnectionException ;
810
911public class BluetoothPrintersConnections extends BluetoothConnections {
@@ -13,6 +15,7 @@ public class BluetoothPrintersConnections extends BluetoothConnections {
1315 *
1416 * @return a EscPosPrinterCommands instance
1517 */
18+ @ Nullable
1619 public static BluetoothConnection selectFirstPaired () {
1720 BluetoothPrintersConnections printers = new BluetoothPrintersConnections ();
1821 BluetoothConnection [] bluetoothPrinters = printers .getList ();
@@ -36,6 +39,7 @@ public static BluetoothConnection selectFirstPaired() {
3639 * @return an array of EscPosPrinterCommands
3740 */
3841 @ SuppressLint ("MissingPermission" )
42+ @ Nullable
3943 public BluetoothConnection [] getList () {
4044 BluetoothConnection [] bluetoothDevicesList = super .getList ();
4145
Original file line number Diff line number Diff line change 44import android .hardware .usb .UsbDevice ;
55import android .hardware .usb .UsbManager ;
66
7+ import androidx .annotation .Nullable ;
8+
79import java .util .Collection ;
810
911public class UsbConnections {
@@ -22,6 +24,7 @@ public UsbConnections(Context context) {
2224 * Get a list of USB devices available.
2325 * @return Return an array of UsbConnection instance
2426 */
27+ @ Nullable
2528 public UsbConnection [] getList () {
2629 if (this .usbManager == null ) {
2730 return null ;
Original file line number Diff line number Diff line change 55import android .hardware .usb .UsbEndpoint ;
66import android .hardware .usb .UsbInterface ;
77
8+ import androidx .annotation .Nullable ;
9+
810public class UsbDeviceHelper {
911 /**
1012 * Find the correct USB interface for printing
1113 *
1214 * @param usbDevice USB device
1315 * @return correct USB interface for printing, null if not found
1416 */
17+ @ Nullable
1518 static public UsbInterface findPrinterInterface (UsbDevice usbDevice ) {
1619 if (usbDevice == null ) {
1720 return null ;
@@ -32,6 +35,7 @@ static public UsbInterface findPrinterInterface(UsbDevice usbDevice) {
3235 * @param usbInterface USB interface
3336 * @return Input endpoint or null if not found
3437 */
38+ @ Nullable
3539 static public UsbEndpoint findEndpointIn (UsbInterface usbInterface ) {
3640 if (usbInterface != null ) {
3741 int endpointsCount = usbInterface .getEndpointCount ();
Original file line number Diff line number Diff line change 44import android .hardware .usb .UsbConstants ;
55import android .hardware .usb .UsbDevice ;
66
7+ import androidx .annotation .Nullable ;
8+
79import com .dantsu .escposprinter .exceptions .EscPosConnectionException ;
810
911public class UsbPrintersConnections extends UsbConnections {
@@ -22,6 +24,7 @@ public UsbPrintersConnections(Context context) {
2224 *
2325 * @return a UsbConnection instance
2426 */
27+ @ Nullable
2528 public static UsbConnection selectFirstConnected (Context context ) {
2629 UsbPrintersConnections printers = new UsbPrintersConnections (context );
2730 UsbConnection [] bluetoothPrinters = printers .getList ();
@@ -39,6 +42,7 @@ public static UsbConnection selectFirstConnected(Context context) {
3942 *
4043 * @return an array of UsbConnection
4144 */
45+ @ Nullable
4246 public UsbConnection [] getList () {
4347 UsbConnection [] usbConnections = super .getList ();
4448
You can’t perform that action at this time.
0 commit comments