|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hcilab.btprinter.Driver
public class Driver
This is the core class of the printing package. It handles the platform specific driver loading and the sequence of control codes being sent to the printer.
This driver has been tested with a Brother MW-140BT bluetooth printer. The printing is done in a parallel thread so it is not blocking.
ToDo
| Field Summary | |
|---|---|
static byte |
STATUS_ERROR
There was an error during printing. |
static byte |
STATUS_PRINTING
Driver is currently printing. |
static byte |
STATUS_READY
Driver is ready and waiting. |
| Constructor Summary | |
|---|---|
Driver(java.lang.String platformPackage)
Initializes driver with the given platform specific driver package which has to provide at least the classes ImageHandlerImpl, IOHandlerImpl and LogHandlerImpl. |
|
Driver(java.lang.String platformPackage,
LogHandler logHandler)
Initializes driver with the given platform specific driver package which has to provide at least the classes ImageHandlerImpl, IOHandlerImpl and LogHandlerImpl. |
|
| Method Summary | |
|---|---|
void |
addObserver(Observer observer)
Adds a observer to this driver. |
int |
getProgress()
Gives information about the printing progress. |
byte |
getStatus()
Provides information about the driver's status. |
java.lang.String |
getStatusMessage()
Provides a human readable description of the driver's status. |
void |
print(java.lang.Object imgObject,
java.lang.String connection)
Prints the given image using the connection specified in the driver package and the identifier given here. |
void |
removeObserver(Observer observer)
Removes a registered observer. |
void |
run()
The actual printing is done here. |
void |
setLogHandler(LogHandler logHandler)
Sets the log handler for this and associated objects. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final byte STATUS_ERROR
public static final byte STATUS_PRINTING
public static final byte STATUS_READY
| Constructor Detail |
|---|
public Driver(java.lang.String platformPackage)
throws PlatformNotSupportedException
platformPackage - Name of platform package (e.g.
org.hcilbab.btprinter.platform.j2me)
PlatformNotSupportedException - If the necessary classes cannot be found in the given package
public Driver(java.lang.String platformPackage,
LogHandler logHandler)
throws PlatformNotSupportedException
platformPackage - Name of platform package (e.g.
org.hcilbab.btprinter.platform.j2me)logHandler - Log handler
PlatformNotSupportedException - If the necessary classes cannot be found in the given package| Method Detail |
|---|
public void addObserver(Observer observer)
observer - Observer to addpublic int getProgress()
public byte getStatus()
public java.lang.String getStatusMessage()
public void print(java.lang.Object imgObject,
java.lang.String connection)
throws java.io.IOException,
java.lang.IllegalArgumentException,
java.lang.IllegalStateException
imgObject - Object representing an image (depending on the selected driver
package)connection - Connection identifier (meaning depends on the selected driver
package)
java.io.IOException - If any io error occurs
java.lang.IllegalArgumentException - If printer status is not recognized
java.lang.IllegalStateException - If there is already a print job going onpublic void removeObserver(Observer observer)
observer - Observer to removepublic void run()
run in interface java.lang.RunnableRunnable.run()public void setLogHandler(LogHandler logHandler)
logHandler - Log handler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||