⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 registry.cpp

📁 HP喷墨打印机驱动代码 HP内部资料! 珍贵 珍贵 珍贵
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************\  registry.cpp : Implimentation for the DeviceRegistry class  Copyright (c) 1996 - 2001, Hewlett-Packard Co.  All rights reserved.  Redistribution and use in source and binary forms, with or without  modification, are permitted provided that the following conditions  are met:  1. Redistributions of source code must retain the above copyright     notice, this list of conditions and the following disclaimer.  2. Redistributions in binary form must reproduce the above copyright     notice, this list of conditions and the following disclaimer in the     documentation and/or other materials provided with the distribution.  3. Neither the name of Hewlett-Packard nor the names of its     contributors may be used to endorse or promote products derived     from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN  NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED  TO, PATENT INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\*****************************************************************************/// The purpose of this file is to facilitate addition and subtraction// of supported devices from the system.#include "header.h"#include "printerfactory.h"#include "printer.h"#include "apollo2xxx.h"#include "apollo21xx.h"#include "apollo2560.h"#include "apollo2xxx.h"#include "dj3320.h"#include "dj3600.h"#include "dj400.h"#include "dj6xx.h"#include "dj600.h"#include "dj630.h"#include "dj660.h"#include "dj690.h"#include "dj350.h"#include "dj540.h"#include "dj8xx.h"#include "dj850.h"#include "dj8x5.h"#include "dj890.h"#include "dj9xx.h"#include "dj9xxvip.h"#include "djgenericvip.h"#include "ljmono.h"#include "ljcolor.h"#include "psp100.h"#include "pscript.h"APDK_BEGIN_NAMESPACE#ifdef APDK_PSCRIPTPScriptProxy DeviceRegistry::s_PScriptProxy;#endif#ifdef APDK_LJMONOLJMonoProxy DeviceRegistry::s_LJMonoProxy;#endif#ifdef APDK_LJCOLORLJColorProxy DeviceRegistry::s_LJColorProxy;#endif#if defined(APDK_PSP100) && defined (APDK_DJ9xxVIP)PSP100Proxy DeviceRegistry::s_PSP100Proxy;#endif#if defined(APDK_DJGENERICVIP) && defined (APDK_DJ9xxVIP)DJGenericVIPProxy DeviceRegistry::s_DJGenericVIPProxy;#endif#ifdef APDK_DJ9xxDJ9xxProxy DeviceRegistry::s_DJ9xxProxy;#endif#ifdef APDK_DJ9xxVIPDJ9xxVIPProxy DeviceRegistry::s_DJ9xxVIPProxy;#endif#if defined(APDK_DJ8xx)|| defined(APDK_DJ9xx)DJ8xxProxy DeviceRegistry::s_DJ8xxProxy;#endif#if defined(APDK_DJ8xx)|| defined(APDK_DJ9xx)#ifdef APDK_DJ8x5DJ8x5Proxy DeviceRegistry::s_DJ8x5Proxy;#endif#endif#if defined(APDK_DJ890)DJ890Proxy DeviceRegistry::s_DJ890Proxy;#endif#if defined(APDK_DJ850)DJ850Proxy DeviceRegistry::s_DJ850Proxy;#endif#ifdef APDK_DJ6xxPhotoDJ6xxPhotoProxy DeviceRegistry::s_DJ6xxPhotoProxy;#endif#ifdef APDK_DJ6xxDJ660Proxy DeviceRegistry::s_DJ660Proxy;#endif#ifdef APDK_DJ630DJ630Proxy DeviceRegistry::s_DJ630Proxy;#endif#ifdef APDK_DJ600DJ600Proxy DeviceRegistry::s_DJ600Proxy;#endif#ifdef APDK_DJ540DJ540Proxy DeviceRegistry::s_DJ540Proxy;#endif#ifdef APDK_DJ400DJ400Proxy DeviceRegistry::s_DJ400Proxy;#endif#ifdef APDK_DJ350DJ350Proxy DeviceRegistry::s_DJ350Proxy;#endif#if defined(APDK_DJ3600) && defined (APDK_DJ3320)DJ3600Proxy DeviceRegistry::s_DJ3600Proxy;#endif#if defined (APDK_DJ3320)DJ3320Proxy DeviceRegistry::s_DJ3320Proxy;#endif#ifdef APDK_APOLLO2560Apollo2560Proxy DeviceRegistry::s_Apollo2560Proxy;#endif#ifdef APDK_APOLLO21XXApollo21xxProxy DeviceRegistry::s_Apollo21xxProxy;#endif#ifdef APDK_APOLLO2XXXApollo2xxxProxy DeviceRegistry::s_Apollo2xxxProxy;#endifDeviceRegistry::DeviceRegistry()    : device(UNSUPPORTED){}DeviceRegistry::~DeviceRegistry(){    DBG1("deleting DeviceRegistry\n");}DRIVER_ERROR DeviceRegistry::SelectDevice(const PRINTER_TYPE Model){    if (Model > MAX_PRINTER_TYPE)        return UNSUPPORTED_PRINTER;    device = Model;	return NO_ERROR;}DRIVER_ERROR DeviceRegistry::SelectDevice(char* model, int *pVIPVersion, char* pens, SystemServices* pSS)// used by PrintContext constructor// based on this 'model' string, we will search for the enum'd value// and set this enum'd value in 'device'{#if defined(DEBUG) && (DBG_MASK & DBG_LVL1)    printf("DR::SelectDevice: model= '%s'\n",model);    printf("DR::SelectDevice: VIPver= %d\n",*pVIPVersion);    printf("DR::SelectDevice: pens= '%s'\n",pens);#endif	int j = 0;    char pen1 = '\0';   // black/color(for CCM)/photo(for 690) pen    char pen2 = '\0';   // color/non-existent(for CCM) pen    BOOL match=FALSE;    DRIVER_ERROR err = NO_ERROR;    FAMILY_HANDLE familyHandle = pPFI->FindDevIdMatch(model);    if (familyHandle != NULL)    {		device = pPFI->GetFamilyType(familyHandle);		match = TRUE;	}    if (!match) // see if printer supports VIP, if so set compatible device    {        if (*pVIPVersion == 1)        {            match = TRUE;            device = eDJ9xxVIP;        }        else if (*pVIPVersion > 1)        {            match = TRUE;            device = eDJGenericVIP; // eDJ9xxVIP;        }    }/* *  See if this is a sleek (LIDIL) printer, or PostScript printer */    if (!match)    {        BYTE DevIDBuffer[DevIDBuffSize];        err = pSS->GetDeviceID(DevIDBuffer, DevIDBuffSize, FALSE);        ERRCHECK;   // should be either NO_ERROR or BAD_DEVICE_ID        if ((strstr((const char *) DevIDBuffer+2,"CMD:LDL")))        {            device = eDJ3320;            match = TRUE;        }		char	*cmdStr = strstr ((const char *) DevIDBuffer+2, "CMD:");		if (!cmdStr)		{			cmdStr = strstr ((const char *) DevIDBuffer+2, "COMMAND SET:");		}		if (!match && cmdStr && (strstr ((const char *) cmdStr+4, "POSTSCRIPT") || 			                     strstr ((const char *) cmdStr+4, "PostScript") || 					             strstr ((const char *) cmdStr+4, "Postscript") || 					             strstr ((const char *) cmdStr+4, "postscript") ))		{			device = ePScript;			match = TRUE;		}    }    if (!match)    {    // The devID model string did not have a match for a known printer    // and the printer doesn't support VIP so let's look at the pen info for clues        // if we don't have pen info (VSTATUS) it's presumably        //  either sleek, DJ4xx or non-HP		device = UNSUPPORTED;        if ( pens[0] != '\0' )        {            // Venice (and Broadway?) printers return penID $X0$X0            //  when powered off            if(pens[1] == 'X')            {                DBG1("DR:(Unknown Model) Need to do a POWER ON to get penIDs\n");                DWORD length=sizeof(Venice_Power_On);                err = pSS->ToDevice(Venice_Power_On, &length);                ERRCHECK;                err = pSS->FlushIO();                ERRCHECK;                // give the printer some time to power up                if (pSS->BusyWait((DWORD)1000) == JOB_CANCELED)                return JOB_CANCELED;                // we must re-query the devID                err=GetPrinterModel(model,pVIPVersion,pens,pSS);                ERRCHECK;            }            // Arggghh.  The pen(s) COULD be missing            do            {//				Is this binary-encoded format?				if (pens[0] != '$')				{					break;				}                // get pen1 - penID format is $HB0$FC0                pen1=pens[1];                // get pen2 - if it exists                j=2;                BOOL NO_PEN2 = FALSE;                while(pens[j] != '$')   // handles variable length penIDs                {                    j++;                    if ( pens[j] == '\0' )                    // never found a pen2                    {                        pen2 = '\0';                        NO_PEN2 = TRUE;                        break;                    }                }                if (NO_PEN2 == FALSE)                {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -