📄 dj8xx.cpp
字号:
} ERRCHECK; // check for the normal case if (ePen == BOTH_PENS) { return NO_ERROR; } while ( ePen != BOTH_PENS ) { switch (ePen) { case BLACK_PEN: // black pen installed, need to install color pen pSS->DisplayPrinterStatus(DISPLAY_NO_COLOR_PEN); break; case COLOR_PEN: // color pen installed, need to install black pen pSS->DisplayPrinterStatus(DISPLAY_NO_BLACK_PEN); break; case NO_PEN: // neither pen installed default: pSS->DisplayPrinterStatus(DISPLAY_NO_PENS); break; } if (pSS->BusyWait(500) == JOB_CANCELED) { return JOB_CANCELED; } err = ParsePenInfo(ePen); ERRCHECK; } pSS->DisplayPrinterStatus(DISPLAY_PRINTING); return NO_ERROR;}DRIVER_ERROR DJ8xx::ParsePenInfo(PEN_TYPE& ePen, BOOL QueryPrinter){ char* str; DRIVER_ERROR err = SetPenInfo (str, QueryPrinter); ERRCHECK; if (*str != '$') { return BAD_DEVICE_ID; } // parse penID PEN_TYPE temp_pen1; // check pen1, assume it is black, pen2 is color switch (str[1]) { case 'H': // (H)obbes case 'L': // (L)inus case 'Z': // (Z)orro { temp_pen1 = BLACK_PEN; break; } case 'X': return UNSUPPORTED_PEN; default: temp_pen1 = NO_PEN; break; } // now check pen2 int i = 2; while ((i < DevIDBuffSize) && str[i] != '$') i++; // handles variable length penIDs if (i == DevIDBuffSize) { return BAD_DEVICE_ID; } i++; // need to be more forgiving of the color pen type because of // the unknown chinookID for broadway // we can't guarantee the (F)lash color pen, but we can make sure // the pen is not (X)Undefined, (A)Missing or (M)onet if(str[i] != 'X' && str[i] != 'A' && str[i] != 'M') // check what pen1 was { if (temp_pen1 == BLACK_PEN) { ePen = BOTH_PENS; } else { ePen = COLOR_PEN; } } else // no color pen, just set what pen1 was { ePen = temp_pen1; } return NO_ERROR;}Compressor* DJ8xx::CreateCompressor(unsigned int RasterSize){ DBG1("Compression = Mode2\n"); return new Mode2(pSS,RasterSize);}BOOL DJ8xx::UseGUIMode(PrintMode* pPrintMode){ return (!pPrintMode->bFontCapable);}DRIVER_ERROR DJ8xx::CleanPen(){ const BYTE Venice_Diag_Page[] = {ESC, '%','P','u','i','f','p','.', 'm','u','l','t','i','_','b','u','t','t','o','n','_','p','u','s','h',' ','4',';', 'u','d','w','.','q','u','i','t',';',ESC,'%','-','1','2','3','4','5','X' }; const BYTE PEN_CLEAN_PML[]={0x1B,0x45,0x1B,0x26,0x62,0x31,0x36,0x57, 0x50,0x4D,0x4C,0x20, // EscE Esc&b16WPML{space} 0x04,0x00,0x06,0x01,0x04,0x01,0x05,0x01, 0x01,0x04,0x01,0x64}; // PML Marking-Agent-Maintenance=100 DWORD length = sizeof(Venice_Power_On); DRIVER_ERROR Error = pSS->ToDevice(Venice_Power_On,&length); pSS->BusyWait((DWORD)1000); length = sizeof(PEN_CLEAN_PML); Error = pSS->ToDevice(PEN_CLEAN_PML,&length); length = sizeof(Venice_Diag_Page); return pSS->ToDevice(Venice_Diag_Page,&length);}/* * Function name: ParseError * * Owner: Darrell Walker * * Purpose: To determine what error state the printer is in. * * Called by: Send() * * Parameters on entry: status_reg is the contents of the centronics * status register (at the time the error was * detected) * * Parameters on exit: unchanged * * Return Values: The proper DISPLAY_STATUS to reflect the printer * error state. * *//* We have to override the base class's (Printer) ParseError function due to the fact that the 8XX series returns a status byte of F8 when it's out of paper. Unfortunately, the 600 series returns F8 when they're turned off. The way things are structured in Printer::ParseError, we used to check only for DEVICE_IS_OOP. This would return true even if we were connected to a 600 series printer that was turned off, causing the Out of paper status message to be displayed. This change also reflects a corresponding change in IO_defs.h, where I split DEVICE_IS_OOP into DEVICE_IS_OOP, DJ400_IS_OOP, and DJ8XX_IS_OOP and we now check for DJ8XX_IS_OOP in the DJ8xx class's ParseError function below. 05/11/99 DGC.*/DISPLAY_STATUS DJ8xx::ParseError(BYTE status_reg){ DBG1("DJ8xx: parsing error info\n"); DRIVER_ERROR err = NO_ERROR; BYTE DevIDBuffer[DevIDBuffSize]; char *pStr; 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; } if ( (pStr=(char *)strstr((const char*)DevIDBuffer+2,"VSTATUS:")) == NULL ) { return DISPLAY_COMM_PROBLEM; } pStr+=8; // skip "VSTATUS:" // Paper Jam or Paper Stall if (strstr((char*)pStr,"PAJM") || strstr((char*)pStr,"PAPS")) { return DISPLAY_PAPER_JAMMED; } // Power down or printing turning off if (strstr((char*)pStr,"PWDN") || strstr((char*)pStr,"OFFF")) { return DISPLAY_OFFLINE; } // 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; }}APDK_END_NAMESPACE#endif // defined APDK_DJ8xx or APDK_9xx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -