1 /*****************************************************************************\
2 services.h : HP Inkjet Server
4 Copyright (c) 2001 - 2002, 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 the 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
20 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 NOT LIMITED TO, PATENT INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR
25 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 POSSIBILITY OF SUCH DAMAGE.
30 \*****************************************************************************/
32 #ifndef hpijs_services_INCLUDED
33 #define hpijs_services_INCLUDED
38 #define EVENT_PRINT_FAILED_MISSING_PLUGIN 502
40 #include "global_types.h"
44 #define BUFFER_CHUNK_SIZE 1024 * 1024 * 2
46 class UXServices:public SystemServices
50 virtual ~ UXServices ();
52 DRIVER_ERROR BusyWait (DWORD msec);
54 DRIVER_ERROR ToDevice (const BYTE* pBuffer, DWORD* wCount);
56 DRIVER_ERROR FromDevice (BYTE* pReadBuff, DWORD * wReadCount)
61 DRIVER_ERROR ReadDeviceID (BYTE * strID, int iSize);
62 BOOL GetStatusInfo (BYTE * bStatReg);
64 DWORD GetSystemTickCount (void)
69 /////////////////////////////////////////////////////////
70 BOOL YieldToSystem (void)
75 BYTE GetRandomNumber ()
80 void DisplayPrinterStatus (DISPLAY_STATUS ePrinterStatus);
87 DRIVER_ERROR GetDevID (BYTE * pDevIDString, int *iDevIDLength);
89 DRIVER_ERROR GetECPStatus (BYTE * pStatusString, int *pECPLength,
96 int GetPJLHeaderBuffer (char **szPJLBuffer);
99 BOOL GetVerticalAlignmentValue(BYTE* cVertAlignVal);
100 BOOL GetVertAlignFromDevice();
102 BYTE *AllocMem (int iMemSize)
104 return (BYTE *) malloc (iMemSize);
107 void FreeMem (BYTE * pMem)
112 float power (float x, float y)
117 int ProcessRaster(char *raster, char *k_raster);
118 int InitDuplexBuffer();
120 int MapPaperSize(float width, float height);
121 void MapModel(const char *nam);
122 const char * GetDriverMessage(DRIVER_ERROR err);
124 void ResetIOMode (BOOL bDevID, BOOL bStatus);
126 void InitSpeedMechBuffer ();
127 int CopyData (const BYTE *pBuffer, DWORD iCount);
128 int SendPreviousPage ();
129 void SendLastPage ();
130 BOOL IsSpeedMechEnabled ()
132 return m_bSpeedMechEnabled;
134 void EnableSpeedMech (BOOL bFlag)
136 m_bSpeedMechEnabled = bFlag;
141 BYTE **RastersOnPage;
142 BYTE **KRastersOnPage;
147 int Model; /* selected device: -1=no, 1=yes */
148 int OutputPath; /* open file descriptor */
149 QUALITY_MODE Quality;
154 float PaperWidth; /* physical width in inches */
155 float PaperHeight; /* physical height in inches */
160 int KRGB; /* 0=no, 1=yes */
161 int hpFD; /* CUPS hp backend file descriptor. */
162 DISPLAY_STATUS DisplayStatus; /* current DisplayPrinterStatus */
163 int VertAlign; /* for Crossbow/Spear */
173 virtual BYTE* AllocMem (int iMemSize, BOOL trackmemory)
174 { return AllocMem(iMemSize); }
176 virtual void FreeMem (BYTE* pMem, BOOL trackmemory)
182 BOOL m_bSpeedMechEnabled;
183 int m_iPclBufferSize;
184 int m_iCurPclBufferPos;
185 BYTE *m_pbyPclBuffer;
188 #endif /* hpijs_services_INCLUDED */