| 1 |
// -*- C++ -*- |
| 2 |
// $Id: LabelWriterDriver.h 15964 2011-09-02 14:47:00Z pineichen $ |
| 3 |
|
| 4 |
// DYMO LabelWriter Drivers |
| 5 |
// Copyright (C) 2008 Sanford L.P. |
| 6 |
|
| 7 |
// This program is free software; you can redistribute it and/or |
| 8 |
// modify it under the terms of the GNU General Public License |
| 9 |
// as published by the Free Software Foundation; either version 2 |
| 10 |
// of the License, or (at your option) any later version. |
| 11 |
|
| 12 |
// This program is distributed in the hope that it will be useful, |
| 13 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
// GNU General Public License for more details. |
| 16 |
|
| 17 |
// You should have received a copy of the GNU General Public License |
| 18 |
// along with this program; if not, write to the Free Software |
| 19 |
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 20 |
|
| 21 |
#ifndef h53a93353_4968_443a_a5aa_1167526295fc |
| 22 |
#define h53a93353_4968_443a_a5aa_1167526295fc |
| 23 |
|
| 24 |
#include <stdlib.h> |
| 25 |
#include "PrinterDriver.h" |
| 26 |
|
| 27 |
namespace DymoPrinterDriver |
| 28 |
{ |
| 29 |
|
| 30 |
|
| 31 |
/** |
| 32 |
Driver for the printers supported LabelWriter command set |
| 33 |
*/ |
| 34 |
class CLabelWriterDriver: public IPrinterDriver |
| 35 |
{ |
| 36 |
public: |
| 37 |
typedef enum |
| 38 |
{ |
| 39 |
pdLow = 0, |
| 40 |
pdMedium, |
| 41 |
pdNormal, |
| 42 |
pdHigh |
| 43 |
} density_t; |
| 44 |
|
| 45 |
typedef enum |
| 46 |
{ |
| 47 |
pqText = 0, |
| 48 |
pqBarcodeAndGraphics |
| 49 |
} quality_t; |
| 50 |
|
| 51 |
typedef enum |
| 52 |
{ |
| 53 |
ptRegular = 0, |
| 54 |
ptContinuous |
| 55 |
} paper_type_t; |
| 56 |
|
| 57 |
typedef enum |
| 58 |
{ |
| 59 |
resUnknown = 0, // unknown or irrelevant resolution |
| 60 |
res136, // 136x204 dpi (SE450) |
| 61 |
res204 // 204x204 dpi (SE450) |
| 62 |
} resolution_t; |
| 63 |
|
| 64 |
struct point_t |
| 65 |
{ |
| 66 |
int x; |
| 67 |
int y; |
| 68 |
|
| 69 |
point_t(int xx, int yy) |
| 70 |
{ |
| 71 |
x = xx; |
| 72 |
y = yy; |
| 73 |
} |
| 74 |
}; |
| 75 |
|
| 76 |
CLabelWriterDriver(IPrintEnvironment& Environment); |
| 77 |
virtual ~CLabelWriterDriver(); |
| 78 |
|
| 79 |
virtual void StartDoc(); |
| 80 |
virtual void EndDoc(); |
| 81 |
|
| 82 |
virtual void StartPage(); |
| 83 |
virtual void EndPage(); |
| 84 |
|
| 85 |
virtual void ProcessRasterLine(const buffer_t& LineBuffer); |
| 86 |
|
| 87 |
resolution_t GetResolution(); |
| 88 |
density_t GetDensity(); |
| 89 |
quality_t GetQuality(); |
| 90 |
size_t GetPageHeight(); |
| 91 |
paper_type_t GetPaperType(); |
| 92 |
|
| 93 |
void SetResolution (resolution_t Value); |
| 94 |
void SetDensity (density_t Value); |
| 95 |
void SetQuality (quality_t Value); |
| 96 |
void SetPageHeight (size_t Value); |
| 97 |
void SetPaperType (paper_type_t Value); |
| 98 |
void SetMaxPrintWidth(size_t Value); |
| 99 |
void SetPageOffset (point_t Value); |
| 100 |
|
| 101 |
static buffer_t GetResetCommand(); |
| 102 |
static buffer_t GetRequestStatusCommand(); |
| 103 |
protected: |
| 104 |
// helper function to send printer commands |
| 105 |
void SendCommand(const byte* Buf, size_t BufSize); |
| 106 |
void SendCommand(const buffer_t& Buf); |
| 107 |
void SendLineTab(size_t Value); |
| 108 |
void SendDotTab(size_t Value); |
| 109 |
void SendFormFeed(); |
| 110 |
void SendBytesPerLine(size_t Value); |
| 111 |
void SendSkipLines(size_t Value); |
| 112 |
void SendLabelLength(size_t Value); |
| 113 |
void SendPrintQuality(quality_t Value); |
| 114 |
void SendPrintDensity(density_t Value); |
| 115 |
void SendResolution(resolution_t Value); |
| 116 |
|
| 117 |
void GetBlanks(const buffer_t& Buf, size_t& LeaderBlanks, size_t& TrailerBlanks); |
| 118 |
void SendNotCompressedData(const buffer_t& Buf, size_t LeaderBlanks, size_t TrailerBlanks); |
| 119 |
void SendCompressedData(const buffer_t& CompressedBuf, size_t NotCompressedSize); |
| 120 |
|
| 121 |
size_t GetEmptyLinesCount(); |
| 122 |
void SetEmptyLinesCount(size_t Value); |
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
private: |
| 127 |
IPrintEnvironment& Environment_; |
| 128 |
|
| 129 |
resolution_t Resolution_; |
| 130 |
density_t Density_; |
| 131 |
quality_t Quality_; |
| 132 |
size_t PageHeight_; |
| 133 |
paper_type_t PaperType_; |
| 134 |
size_t MaxPrintWidth_; |
| 135 |
point_t PageOffset_; |
| 136 |
|
| 137 |
size_t LastDotTab_; |
| 138 |
size_t LastBytesPerLine_; |
| 139 |
size_t EmptyLinesCount_; |
| 140 |
|
| 141 |
|
| 142 |
}; |
| 143 |
|
| 144 |
class CLabelWriterDriver400: public CLabelWriterDriver |
| 145 |
{ |
| 146 |
public: |
| 147 |
CLabelWriterDriver400(IPrintEnvironment& Environment); |
| 148 |
virtual ~CLabelWriterDriver400(); |
| 149 |
|
| 150 |
virtual void StartDoc(); |
| 151 |
virtual void EndDoc(); |
| 152 |
virtual void EndPage(); |
| 153 |
|
| 154 |
static buffer_t GetShortFormFeedCommand(); |
| 155 |
protected: |
| 156 |
void SendShortFormFeed(); |
| 157 |
}; |
| 158 |
|
| 159 |
class CLabelWriterDriverTwinTurbo: public CLabelWriterDriver400 |
| 160 |
{ |
| 161 |
public: |
| 162 |
typedef enum |
| 163 |
{ |
| 164 |
rtAuto = 0, |
| 165 |
rtLeft, |
| 166 |
rtRight |
| 167 |
} roll_t; |
| 168 |
|
| 169 |
CLabelWriterDriverTwinTurbo(IPrintEnvironment& Environment); |
| 170 |
virtual ~CLabelWriterDriverTwinTurbo(); |
| 171 |
|
| 172 |
virtual void StartDoc(); |
| 173 |
|
| 174 |
roll_t GetRoll(); |
| 175 |
void SetRoll(roll_t Value); |
| 176 |
|
| 177 |
static buffer_t GetRollSelectCommand(roll_t Value); |
| 178 |
protected: |
| 179 |
void SendRollSelect(roll_t Value); |
| 180 |
|
| 181 |
private: |
| 182 |
roll_t Roll_; |
| 183 |
}; |
| 184 |
|
| 185 |
}; //namespace |
| 186 |
|
| 187 |
#endif |
| 188 |
|
| 189 |
/* |
| 190 |
* End of "$Id: LabelWriterDriver.h 15964 2011-09-02 14:47:00Z pineichen $". |
| 191 |
*/ |