Apple II
Technical Notes
_____________________________________________________________________________
                                                  Developer Technical Support


AppleTalk
#9:    The PAP Status Buffer

Written by:    Jim Luther                                       November 1990

This Technical Note shows the format of the status data returned into the
application-supplied status buffer by the PAPStatus and PAPOpen Printer Access
Protocol (PAP) AppleTalk commands.  The status buffer format is shown for both
LaserWriter and ImageWriter (with the ImageWriter II/LQ LocalTalk Option card
installed) printers.
_____________________________________________________________________________

The PAPStatus and PAPOpen AppleTalk commands must supply a pointer to a 260-byte
status buffer.  When the PAPStatus or PAPOpen commands complete, the status
buffer contains the ATP data portion of a Status (TResp) packet.  The first four
bytes of that data are unused, so the actual status data starts at offset $04 in
the status buffer.

The LaserWriter printer returns its status data in the form of a Pascal string.
That string is usually something suitable to display on the screen (e.g.,
"status: idle" or "job: Fred; document: My LaserWriter is on fire; status: busy;
source: AppleTalk").  In fact, the status text displayed in the Print Manager
LaserWriter dialog boxes is usually the statusString returned by PAPStatus or
PAPOpen.  Figure 1 shows the contents of the status buffer returned by a
LaserWriter.

          +-------------------+
     $00  |_                 _|    Longword       Unused
          |_      unused     _|
          |_                 _|
          |                   |
          +-------------------+
     $04  |_ (string length) _|
          |_                 _|
          |_                 _|
          .                   .
          .   status string   .    String         The PAP status string
          .                   .                   (Pascal string, ASCII,
          |_                 _|                   high-bit clear)
          |_                 _|
          |                   |
     $103 +-------------------+         
          

                 Figure 1-PAP Status Buffer from a LaserWriter

The ImageWriter II/LQ LocalTalk Option card does not return a status string for
display.  Instead, it returns a statusBits word where each bit within that word
has a specific meaning.  Your application can interpret the statusBits word and
generate an appropriate message to display.  Figure 2 shows the contents of the
status buffer returned by the ImageWriter II/LQ LocalTalk Option card and the
individual bit definitions of the statusBits word.

          +------------------+
     $00  |_                _|     Longword       Unused
          |_      unused    _|
          |_                _|
          |                  |
          +------------------+
     $04  |string data length|     Byte           Always = 2
          +------------------+
     $05  |_    statusBits  _|     Word           Status bits returned by
          |                  |                    LocalTalk ImageWriter
          +------------------+                    Option card (see following
     $07  |_                _|                    definition)
          |_                _|
          |_                _|
          .                  .     253 Bytes      Unused
          .                  .
          .                  .
          |_                _|                    
          |_                _|
          |                  |
     $103 +------------------+          
     
                            +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                            |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
                            +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                              |  |<-- Reserved --->|  |  |  |  |  |  |  |  |
1 = Printer is busy ----------+  |_________________|  |  |  |  |  |  |  |  |
                                                      |  |  |  |  |  |  |  |
1 = Color ribbon installed ---------------------------+  |  |  |  |  |  |  |
1 = Sheet feeder installed ------------------------------+  |  |  |  |  |  |
1 = Paper out error ----------------------------------------+  |  |  |  |  |
1 = Cover open error ------------------------------------------+  |  |  |  |
1 = Printer off line ---------------------------------------------+  |  |  |
1 = Paper jam error -------------------------------------------------+  |  |
1 = Printer fault ------------------------------------------------------+  |
1 = Printer active (head is moving) ---------------------------------------+


   Figure 2-PAP Status Buffer from an ImageWriter II/LQ LocalTalk Option Card

There are two additional things to note when interpreting the statusBits word
returned by a ImageWriter II/LQ LocalTalk Option card:

  o   If a sheet feeder is installed (bit 6 = 1), running out of paper results
      in a "Paper jam error" (bit 2 = 1) instead of a "Paper out error" (bit 5).
  o   The ImageWriter  II/LQ LocalTalk Option card has been known to randomly
      return all ones in the low byte (bits 0-7) of the statusBits word.  When
      this happens, the statusBits word is invalid and an application should
      repeat the PAPStatus call to get valid information.


Further Reference
_____________________________________________________________________________
  o     Inside AppleTalk, Second Edition
  o     AppleShare Programmer's Guide for the Apple II Family

