1 /*****************************************************************************\
2 dj8x5.cpp : Implimentation for the DJ8x5 class
4 Copyright (c) 1996 - 2001, Hewlett-Packard Co.
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions
10 1. Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15 3. Neither the name of Hewlett-Packard nor the names of its
16 contributors may be used to endorse or promote products derived
17 from this software without specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
20 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
22 NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24 TO, PATENT INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
25 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 \*****************************************************************************/
32 #if defined(APDK_DJ8xx)|| defined(APDK_DJ9xx)
38 #include "printerproxy.h"
40 APDK_BEGIN_NAMESPACE // must be here for non-test harness case
41 extern BYTE* GetHT3x3_4();
42 extern BYTE* GetHT6x6_4();
43 APDK_END_NAMESPACE // must be here for non-test harness case
47 extern uint32_t ulMapDJ8x5PlainNormal[ 9 * 9 * 9 ];
48 extern uint32_t ulMapDJ895_HB_KCMY[ 9 * 9 * 9 ];
49 extern uint32_t ulMapDJ8x5Draft[ 9 * 9 * 9 ];
52 DJ8x5Mode1::DJ8x5Mode1()
53 : PrintMode(ulMapDJ8x5PlainNormal)
58 ColorDepth[K]=1; // 600x600x1 K
60 for (int i=1; i < 4; i++)
61 ColorDepth[i]=2; // 300x300x2 CMY
68 ColorFEDTable = GetHT3x3_4();
70 bFontCapable = FALSE; // DJ8xx can't do fonts and hifipe at same time
72 CompatiblePens[0] = COLOR_PEN;
75 DJ8x5Mode2::DJ8x5Mode2()
76 : PrintMode(ulMapDJ895_HB_KCMY)
80 ColorDepth[K]=1; // 600x600x1 K
83 ColorDepth[i]=2; // 600x600x2 CMY
86 ResolutionX[i]=ResolutionY[i]=600;
88 BaseResX = BaseResY = 600;
92 theQuality = qualityPresentation;
94 ColorFEDTable = GetHT6x6_4();
96 bFontCapable = FALSE; // DJ8xx can't do fonts and hifipe at same time
99 CompatiblePens[0] = COLOR_PEN;
101 pmQuality = QUALITY_BEST;
102 pmMediaType = MEDIA_PHOTO;
105 DJ8x5Mode3::DJ8x5Mode3()
106 : PrintMode(ulMapDJ8x5Draft)
111 CompatiblePens[0] = COLOR_PEN;
112 theQuality = qualityDraft;
113 pmQuality = QUALITY_DRAFT;
116 DJ8x5::DJ8x5 (SystemServices* pSS, int numfonts, BOOL proto)
117 : DJ8xx (pSS, numfonts, TRUE)
119 CMYMap = ulMapDJ8x5Draft;
122 * If we don't have device id, we won't know about the pens installed.
123 * But since both 825 and 845 ship with atleast a colorpen, we will
124 * default to COLOR_PEN, so it will work okay out of the box.
127 if ((!proto) && (IOMode.bDevID))
129 constructor_error = VerifyPenInfo();
137 // DJ8xx modes based on BOTH_PENS are already installed (i.e. pModes 0-4)
139 pMode[5] = new DJ8x5Mode1 (); // Normal Color CMY
140 pMode[6] = new DJ8x5Mode2 (); // Photo CMY
141 pMode[7] = new DJ8x5Mode3 (); // Draft Color CMY
144 DBG1("DJ8x5 created\n");
147 PEN_TYPE DJ8x5::DefaultPenSet()
152 DRIVER_ERROR DJ8x5::VerifyPenInfo ()
155 DRIVER_ERROR err=NO_ERROR;
157 if(IOMode.bDevID == FALSE)
160 err = ParsePenInfo (ePen);
162 if(err == UNSUPPORTED_PEN) // probably Power Off - pens couldn't be read
164 DBG1("DJ8x5::Need to do a POWER ON to get penIDs\n");
166 if (pSS->BusyWait((DWORD)2000) == JOB_CANCELED)
169 DWORD length=sizeof (DJ895_Power_On);
170 err = pSS->ToDevice (DJ895_Power_On, &length);
173 err = pSS->FlushIO ();
176 // give the printer some time to power up
177 if (pSS->BusyWait ((DWORD) 2500) == JOB_CANCELED)
180 err = ParsePenInfo(ePen);
185 // check for the normal case
186 if (ePen == BOTH_PENS)
189 while (ePen == NO_PEN)
191 pSS->DisplayPrinterStatus(DISPLAY_NO_PENS);
193 if (pSS->BusyWait(500) == JOB_CANCELED)
196 err = ParsePenInfo(ePen);
200 pSS->DisplayPrinterStatus(DISPLAY_PRINTING);