DJ890::DJ890(SystemServices* pSS, int numfonts, BOOL proto) : DJ8xx(pSS, numfonts, proto) { if ((!proto) && (IOMode.bDevID)) { constructor_error = VerifyPenInfo(); CERRCHECK; } else ePen=BOTH_PENS; // matches default mode #ifdef APDK_EXTENDED_MEDIASIZE pMode[GRAYMODE_INDEX] = new DJ895Mode5 (); // Normal Gray K #else pMode[GRAYMODE_INDEX] = new GrayMode (ulMapDJ600_CCM_K); // Normal Gray K #endif pMode[DEFAULTMODE_INDEX] = new DJ895Mode1 (); // Normal Color pMode[SPECIALMODE_INDEX] = new DJ895Mode3 (); // Draft Color pMode[SPECIALMODE_INDEX+1] = new DJ895Mode4 (); // Draft Gray K ModeCount = 4; CMYMap = ulMapDJ895_Binary_KCMY; DBG1("DJ890 created\n"); }
LJColor::LJColor (SystemServices* pSS, int numfonts, BOOL proto) : Printer(pSS, numfonts, proto) { if ((!proto) && (IOMode.bDevID)) { constructor_error = VerifyPenInfo(); CERRCHECK; } else ePen = BOTH_PENS; // matches default mode pMode[GRAYMODE_INDEX] = new LJColorGrayMode (); pMode[DEFAULTMODE_INDEX] = new LJColor300DPIMode (); pMode[SPECIALMODE_INDEX] = new LJColor600DPIMode (); pMode[SPECIALMODE_INDEX+1] = new LJColor150DPIMode (); pMode[SPECIALMODE_INDEX+2] = new LJColorKDraftMode (); ModeCount = 5; CMYMap = NULL; m_bJobStarted = FALSE; #ifdef APDK_AUTODUPLEX m_bRotateBackPage = FALSE; // Lasers don't require back side image to be rotated #endif #ifdef APDK_EXTENDED_MEDIASIZE pMode[SPECIALMODE_INDEX+3] = new LJColorPlainBestMode (); ModeCount = 6; #endif m_pCompressor = NULL; m_iYPos = 0; DBG1("LJColor created\n"); }
APDK_END_NAMESPACE #endif // defined(APDK_DJ400) || defined (APDK_DJ540) // DJ540 constructor needs Mode400 constructor but no other DJ400 things, // so let's only include this and none of the other DJ400 things #ifdef APDK_DJ400 APDK_BEGIN_NAMESPACE DJ400::DJ400(SystemServices* pSS, BOOL proto) : Printer(pSS, NUM_DJ400_FONTS,proto), last_C32_status(0) { if ((!proto) && (IOMode.bDevID)) { constructor_error = VerifyPenInfo(); CERRCHECK; } else { ePen=COLOR_PEN; // matches default mode } CMYMap = ulMapDJ400_CMY; pMode[DEFAULTMODE_INDEX] = new Mode400(); pMode[GRAYMODE_INDEX] = new GrayMode(ulMapDJ400_K); #if defined(APDK_FONTS_NEEDED) // create dummy font objects to be queried via EnumFont // but first delete standard fonts created by base constructor if (constructor_error == NO_ERROR) { #ifdef APDK_COURIER delete fontarray[COURIER_INDEX]; fontarray[COURIER_INDEX] = new Courier400(); CNEWCHECK(fontarray[COURIER_INDEX]); #endif #ifdef APDK_CGTIMES delete fontarray[CGTIMES_INDEX]; fontarray[CGTIMES_INDEX] = new CGTimes400(); CNEWCHECK(fontarray[CGTIMES_INDEX]); #endif #ifdef APDK_LTRGOTHIC delete fontarray[LETTERGOTHIC_INDEX]; fontarray[LETTERGOTHIC_INDEX] = new LetterGothic400(); CNEWCHECK(fontarray[LETTERGOTHIC_INDEX]); #endif } #endif // any fonts DBG1("DeskJet 400 created\n"); }
DJ850::DJ850(SystemServices* pSS, int numfonts, BOOL proto) : Printer(pSS, numfonts, proto) { if ((!proto) && (IOMode.bDevID)) { constructor_error = VerifyPenInfo(); CERRCHECK; } else ePen=BOTH_PENS; // matches default mode pMode[GRAYMODE_INDEX] = new DJ850Mode5 (); // Normal Gray K pMode[DEFAULTMODE_INDEX] = new DJ850Mode1 (); // Normal Color pMode[SPECIALMODE_INDEX] = new DJ850Mode3 (); // Draft Color pMode[SPECIALMODE_INDEX+1] = new DJ850Mode4 (); // Draft Gray K ModeCount = 4; CMYMap = ulMapDJ850_Normal_KCMY; DBG1("DJ850 created\n"); }
DRIVER_ERROR DJ400::VerifyPenInfo() { DRIVER_ERROR err = NO_ERROR; if(IOMode.bDevID == FALSE) return err; err = ParsePenInfo(ePen); ERRCHECK; if(ePen == BLACK_PEN || ePen == COLOR_PEN) // pen was recognized return NO_ERROR; // BLACK_PEN and COLOR_PEN are the only valid pens, so loop and // display error message until user cancels or a valid pen installed while(ePen != BLACK_PEN && ePen != COLOR_PEN) { pSS->DisplayPrinterStatus(DISPLAY_NO_PEN_DJ400); if(pSS->BusyWait(500) == JOB_CANCELED) { return JOB_CANCELED; } err = ParsePenInfo(ePen); ERRCHECK; } pSS->DisplayPrinterStatus(DISPLAY_PRINTING); // the 400 will lie about the pen that is installed // right after the pen is installed if (pSS->BusyWait(5000) == JOB_CANCELED) return JOB_CANCELED; return VerifyPenInfo(); }
APDK_BEGIN_NAMESPACE // PhotoSmart 100 - AtomAnt PSP100::PSP100 (SystemServices* pSS, BOOL proto) : DJ9xxVIP (pSS, proto) { for (unsigned int i = 0; i < ModeCount; i++) { if (pMode[i]) delete pMode[i]; pMode[i] = NULL; } ePen = COLOR_PEN; if (!proto && IOMode.bDevID) { bCheckForCancelButton = TRUE; constructor_error = VerifyPenInfo (); CERRCHECK; } pMode[GRAYMODE_INDEX] = new GrayModePSP100 (); pMode[DEFAULTMODE_INDEX] = new PSP100Mode (); pMode[SPECIALMODE_INDEX] = new PSP100NormalMode (); ModeCount = 3; #ifdef APDK_AUTODUPLEX bDuplexCapable = FALSE; #endif #ifdef APDK_EXTENDED_MEDIASIZE pMode[SPECIALMODE_INDEX+1] = new PSP1002400Mode (); ModeCount = 4; #endif } //PSP100
LJMono::LJMono (SystemServices* pSS, int numfonts, BOOL proto) : Printer(pSS, numfonts, proto) { if ((!proto) && (IOMode.bDevID)) { constructor_error = VerifyPenInfo (); CERRCHECK; } else ePen = BLACK_PEN; // matches default mode pMode[GRAYMODE_INDEX] = new LJMonoDraftMode (); pMode[DEFAULTMODE_INDEX] = new LJMonoNormalMode (); pMode[SPECIALMODE_INDEX] = new LJMonoBestMode (); ModeCount = 3; CMYMap = NULL; m_bJobStarted = FALSE; #ifdef APDK_AUTODUPLEX m_bRotateBackPage = FALSE; // Lasers don't require back side image to be rotated #endif DBG1("LJMono created\n"); }
DISPLAY_STATUS DJ850::ParseError(BYTE status_reg) { DBG1("DJ850: parsing error info\n"); DRIVER_ERROR err = NO_ERROR; BYTE DevIDBuffer[DevIDBuffSize]; if(IOMode.bDevID) { // If a bi-di cable was plugged in and everything was OK, let's see if it's still // plugged in and everything is OK err = pSS->GetDeviceID(DevIDBuffer, DevIDBuffSize, TRUE); if(err != NO_ERROR) // job was bi-di but now something's messed up, probably cable unplugged return DISPLAY_COMM_PROBLEM; if ( TopCoverOpen(status_reg) ) { DBG1("Top Cover Open\n"); return DISPLAY_TOP_COVER_OPEN; } // VerifyPenInfo will handle prompting the user // if this is a problem err = VerifyPenInfo(); if(err != NO_ERROR) // VerifyPenInfo returned an error, which can only happen when ToDevice // or GetDeviceID returns an error. Either way, it's BAD_DEVICE_ID or // IO_ERROR, both unrecoverable. This is probably due to the printer // being turned off during printing, resulting in us not being able to // power it back on in VerifyPenInfo, since the buffer still has a // partial raster in it and we can't send the power-on command. return DISPLAY_COMM_PROBLEM; } // check for errors we can detect from the status reg if (IOMode.bStatus) { if ( DEVICE_IS_OOP(status_reg) ) { DBG1("Out Of Paper\n"); return DISPLAY_OUT_OF_PAPER; } if (DEVICE_PAPER_JAMMED(status_reg)) { DBG1("Paper Jammed\n"); return DISPLAY_PAPER_JAMMED; } if (DEVICE_IO_TRAP(status_reg)) { DBG1("IO trap\n"); return DISPLAY_ERROR_TRAP; } } // don't know what the problem is- // Is the PrinterAlive? if (pSS->PrinterIsAlive()) { iTotal_SLOW_POLL_Count += iMax_SLOW_POLL_Count; #if defined(DEBUG) && (DBG_MASK & DBG_LVL1) printf("iTotal_SLOW_POLL_Count = %d\n",iTotal_SLOW_POLL_Count); #endif // -Note that iTotal_SLOW_POLL_Count is a multiple of // iMax_SLOW_POLL_Count allowing us to check this // on an absolute time limit - not relative to the number // of times we happen to have entered ParseError. // -Also note that we have different thresholds for uni-di & bi-di. if( ((IOMode.bDevID == FALSE) && (iTotal_SLOW_POLL_Count >= 60)) || ((IOMode.bDevID == TRUE) && (iTotal_SLOW_POLL_Count >= 120)) ) { return DISPLAY_BUSY; } else { return DISPLAY_PRINTING; } } else { return DISPLAY_COMM_PROBLEM; } }
DISPLAY_STATUS Printer::ParseError ( BYTE status_reg ) { DBG1("Printer: parsing error info\n"); DRIVER_ERROR err = NO_ERROR; BYTE DevIDBuffer[DevIDBuffSize]; if(IOMode.bDevID) { // If a bi-di cable was plugged in and everything was OK, let's see if it's still // plugged in and everything is OK err = pSS->GetDeviceID(DevIDBuffer, DevIDBuffSize, TRUE); if(err != NO_ERROR) { // job was bi-di but now something's messed up, probably cable unplugged // or printer turned off during print job return DISPLAY_COMM_PROBLEM; } } // check for errors we can detect from the status reg if (IOMode.bStatus) { if ( DEVICE_IS_OOP(status_reg) ) { DBG1("Out Of Paper\n"); return DISPLAY_OUT_OF_PAPER; } if (DEVICE_PAPER_JAMMED(status_reg)) { DBG1("Paper Jammed\n"); return DISPLAY_PAPER_JAMMED; } if (DEVICE_IO_TRAP(status_reg)) { DBG1("IO Trap\n"); return DISPLAY_ERROR_TRAP; } } if (IOMode.bDevID) { if ( TopCoverOpen(status_reg) ) { DBG1("Top Cover Open\n"); return DISPLAY_TOP_COVER_OPEN; } // VerifyPenInfo will handle prompting the user // if this is a problem VerifyPenInfo(); } // don't know what the problem is- // Is the PrinterAlive? if (pSS->PrinterIsAlive()) // <- This is only viable if bStatus is TRUE { iTotal_SLOW_POLL_Count += iMax_SLOW_POLL_Count; // -Note that iTotal_SLOW_POLL_Count is a multiple of // iMax_SLOW_POLL_Count allowing us to check this // on an absolute time limit - not relative to the number // of times we happen to have entered ParseError. // -Also note that we have different thresholds for uni-di & bi-di. // REVISIT these counts - they are relative to the speed through // the send loop aren't they? They may be too long! if( ((IOMode.bDevID == FALSE) && (iTotal_SLOW_POLL_Count >= 60)) || ((IOMode.bDevID == TRUE) && (iTotal_SLOW_POLL_Count >= 120)) ) { return DISPLAY_BUSY; } else { return DISPLAY_PRINTING; } } else { return DISPLAY_COMM_PROBLEM; } } //ParseError
DISPLAY_STATUS DJ400::ParseError(BYTE status_reg) { DBG1("DJ400: parsing error info\n"); DRIVER_ERROR err = NO_ERROR; BYTE DevIDBuffer[DevIDBuffSize]; if(IOMode.bDevID && IOMode.bStatus) { // If a bi-di cable was plugged in and everything was OK, let's see if it's still // plugged in and everything is OK err = pSS->GetDeviceID(DevIDBuffer, DevIDBuffSize, TRUE); if(err != NO_ERROR) { // The 400 can't get a DevID when there's a paper jam, so we have to check // for a paper jam here. If there's no jam then there really is a // communication problem. if (DEVICE_PAPER_JAMMED(status_reg)) { DBG1("Paper Jammed\n"); return DISPLAY_PAPER_JAMMED; } if (DEVICE_IO_TRAP(status_reg)) { DBG1("IO Trap\n"); return DISPLAY_ERROR_TRAP; } DBG1("DJ400, communication problem\n"); // job was bi-di but now something's messed up, probably cable unplugged // or printer turned off during print job return DISPLAY_COMM_PROBLEM; } } if (IOMode.bDevID) { if ( TopCoverOpen(status_reg) ) { DBG1("Top Cover Open\n"); return DISPLAY_TOP_COVER_OPEN; } // VerifyPenInfo will handle prompting the user // if this is a problem VerifyPenInfo(); } // check for errors we can detect from the status reg if(IOMode.bStatus) { if ( DEVICE_IS_OOP(status_reg) ) { DBG1("Out Of Paper\n"); // Printer::Send will only wait 1/2 second to try to GetStatusInfo after // we return DISPLAY_OUT_OF_PAPER. The DJ400 needs 2 seconds between // GetStatusInfo calls. Rather than inflict a 2 second delay on all of our // printers, let's just delay for 2 seconds here. pSS->BusyWait(2000); return DISPLAY_OUT_OF_PAPER; } if (DEVICE_PAPER_JAMMED(status_reg)) { DBG1("Paper Jammed\n"); return DISPLAY_PAPER_JAMMED; } if (DEVICE_IO_TRAP(status_reg)) { DBG1("IO trap\n"); return DISPLAY_ERROR_TRAP; } } // don't know what the problem is- // Is the PrinterAlive? if (pSS->PrinterIsAlive()) { iTotal_SLOW_POLL_Count += iMax_SLOW_POLL_Count; #if defined(DEBUG) && (DBG_MASK & DBG_LVL1) printf("iTotal_SLOW_POLL_Count = %d\n",iTotal_SLOW_POLL_Count); #endif // -Note that iTotal_SLOW_POLL_Count is a multiple of // iMax_SLOW_POLL_Count allowing us to check this // on an absolute time limit - not relative to the number // of times we happen to have entered ParseError. // -Also note that we have different thresholds for uni-di & bi-di. if( ((IOMode.bDevID == FALSE) && (iTotal_SLOW_POLL_Count >= 60)) || ((IOMode.bDevID == TRUE) && (iTotal_SLOW_POLL_Count >= 120)) ) return DISPLAY_BUSY; else return DISPLAY_PRINTING; } else { return DISPLAY_COMM_PROBLEM; } }