-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed unit tests folders as I won't create unit tests on this wrapper
- Loading branch information
Showing
5 changed files
with
45 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
PrintWrapper/src/androidTest/java/com/zebra/printwrapper/ExampleInstrumentedTest.java
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
PrintWrapper/src/main/java/com/zebra/printwrapper/GetPrinterStatusTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.zebra.printwrapper; | ||
|
||
import com.zebra.sdk.comm.Connection; | ||
import com.zebra.sdk.comm.ConnectionException; | ||
import com.zebra.sdk.printer.PrinterStatus; | ||
import com.zebra.sdk.printer.ZebraPrinter; | ||
import com.zebra.sdk.printer.ZebraPrinterFactory; | ||
import com.zebra.sdk.printer.ZebraPrinterLanguageUnknownException; | ||
import com.zebra.sdk.printer.discovery.DiscoveredPrinter; | ||
|
||
public class GetPrinterStatusTask extends ExecutorTask<DiscoveredPrinter, Boolean, PrinterStatus>{ | ||
@Override | ||
protected PrinterStatus doInBackground(DiscoveredPrinter... printerParams) { | ||
DiscoveredPrinter selectedPrinter = printerParams[0]; | ||
PrinterStatus printerStatus = null; | ||
if(selectedPrinter != null) | ||
{ | ||
if(selectedPrinter.getConnection() != null ) { | ||
Connection connection = selectedPrinter.getConnection(); | ||
if(connection.isConnected() == false) { | ||
try { | ||
connection.open(); | ||
ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection); | ||
if(printer != null) | ||
{ | ||
printerStatus = printer.getCurrentStatus(); | ||
} | ||
} catch (ConnectionException e) { | ||
throw new RuntimeException(e); | ||
} catch (ZebraPrinterLanguageUnknownException e) { | ||
throw new RuntimeException(e); | ||
} | ||
finally { | ||
try { | ||
connection.close(); | ||
} catch (ConnectionException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return printerStatus; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
PrintWrapper/src/test/java/com/zebra/printwrapper/ExampleUnitTest.java
This file was deleted.
Oops, something went wrong.