org.hcilab.btprinter
Class Status

java.lang.Object
  extended by org.hcilab.btprinter.Status

public class Status
extends java.lang.Object

This class contains the status data sent back by the printer and provides methods to access them

Version:
1.0.0
Author:
Dominik Schmidt

Field Summary
static int STATUS_LENGTH
           
 
Constructor Summary
Status(byte[] status)
          Initializes a new status message.
 
Method Summary
 java.lang.String getErrorMsg()
          Provides a human readible message of the error status.
 java.lang.String getReadyToPrintMsg()
          Provides a human readible message of the ready status.
 boolean hasEmptyBattery()
          Check in case of error status.
 boolean hasHighTemperature()
          Check in case of error status.
 boolean hasHighVoltageAdapter()
          Check in case of error status.
 boolean hasNoPaper()
          Check in case of error status.
 boolean hasNoPaperCassette()
          Check in case of error status.
 boolean hasPaperCassetteChange()
          Check in case of error status.
 boolean hasPaperJam()
          Check in case of error status.
 boolean hasProgramError()
          Check in case of error status.
 boolean hasSystemError()
          Check in case of error status.
 boolean isErrorStatus()
          Checks if the status is an error status.
 boolean isReadyToPrint()
          Checks if the printer is ready to start printing.
 boolean isReplyStatus()
          Checks if the status is a reply to a status request.
 boolean isValidStatus()
          Checks if the status is valid for the supported printer model.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS_LENGTH

public static final int STATUS_LENGTH
See Also:
Constant Field Values
Constructor Detail

Status

public Status(byte[] status)
       throws java.lang.IllegalArgumentException
Initializes a new status message.

Parameters:
status - Status bytes received by printer
Throws:
java.lang.IllegalArgumentException - If bytes have the wrong format
Method Detail

getErrorMsg

public java.lang.String getErrorMsg()
Provides a human readible message of the error status.

Returns:
Message

getReadyToPrintMsg

public java.lang.String getReadyToPrintMsg()
Provides a human readible message of the ready status.

Returns:
Message

hasEmptyBattery

public boolean hasEmptyBattery()
Check in case of error status.

Returns:
True, if the battery is empty

hasHighTemperature

public boolean hasHighTemperature()
Check in case of error status.

Returns:
True, if the printer is too warm

hasHighVoltageAdapter

public boolean hasHighVoltageAdapter()
Check in case of error status.

Returns:
True, if the wrong voltage adapter is connected

hasNoPaper

public boolean hasNoPaper()
Check in case of error status.

Returns:
True, if the printer has no more paper

hasNoPaperCassette

public boolean hasNoPaperCassette()
Check in case of error status.

Returns:
True, if there is no paper cassette inserted

hasPaperCassetteChange

public boolean hasPaperCassetteChange()
Check in case of error status.

Returns:
True, if the paper cassette has changed

hasPaperJam

public boolean hasPaperJam()
Check in case of error status.

Returns:
True, if there has a paper jam occured

hasProgramError

public boolean hasProgramError()
Check in case of error status.

Returns:
True, if a programm error occured

hasSystemError

public boolean hasSystemError()
Check in case of error status.

Returns:
True, if a system error occured

isErrorStatus

public boolean isErrorStatus()
Checks if the status is an error status.

Returns:
True, if status is a error status

isReadyToPrint

public boolean isReadyToPrint()
Checks if the printer is ready to start printing. Use after having checked if status is reply status.

Returns:
True, if printer is ready

isReplyStatus

public boolean isReplyStatus()
Checks if the status is a reply to a status request.

Returns:
True, if status is a reply status

isValidStatus

public boolean isValidStatus()
Checks if the status is valid for the supported printer model.

Returns:
True, if status is valid