Connecting Tech Pros Worldwide Forums | Help | Site Map

POS Printer Problem

Newbie
 
Join Date: Oct 2008
Posts: 2
#1: Oct 22 '08
Hi All,

I'm a newbie to the POS system. so please mind if my questions are stupid.

I have an epson TM-U200 printer with USB connection and cash drawer connected to printer with RJ 11 cable.

I tried to create a service object for my printer and suceeds.(It shows on test app as a POS Printer)

this is my code for that.
Expand|Select|Wrap|Line Numbers
  1. [HardwareId(@"USB\Vid_0525&Pid_a700",@"USB\Vid_0525&Pid_a700")]
  2.     [ServiceObject(DeviceType.PosPrinter,"PrinterTemplate","Printer Class",1,9)]
  3.     public class MyPrinter : PosPrinterBase
  4.     {   private string MyHealthText;
  5.  
  6.         public MyPrinter()
  7.         {        
  8.             // Initialize device capability properties.          
  9.             MyHealthText = "";
  10.         }
  11.  
  12.         ~MyPrinter()
  13.         {
  14.             Dispose(false);
  15.         }
  16.  
  17.         // Release any resources managed by this object.
  18.         protected override void Dispose(bool disposing)
  19.         {
  20.             try
  21.             {
  22.                 // Your code here.
  23.             }
  24.             finally
  25.             {
  26.                 // Must call base class Dispose.
  27.                 base.Dispose(disposing);
  28.             }
  29.         }         
  30.         #region PosCommon overrides
  31.         // Returns the result of the last call to CheckHealth().
  32.         public override string CheckHealthText
  33.         {
  34.             get
  35.             {
  36.                 // MsrBasic.VerifyState(mustBeClaimed,
  37.                 // mustBeEnabled). This may throw an exception.
  38.                 VerifyState(false, false);
  39.  
  40.                 return MyHealthText;
  41.             }
  42.         }
  43.  
  44.         public override string CheckHealth(
  45.                     HealthCheckLevel level)
  46.         {
  47.             // Verify that device is open, claimed, and enabled.
  48.             VerifyState(true, true);
  49.  
  50.             // Your code here:
  51.             // check the health of the device and return a 
  52.             // descriptive string.
  53.  
  54.             // Cache result in the CheckHealthText property.
  55.             MyHealthText = "Ok";
  56.             return MyHealthText;
  57.         }
  58.  
  59.         public override DirectIOData DirectIO(
  60.                         int command, 
  61.                         int data, 
  62.                         object obj)
  63.         {
  64.             // Verify that device is open.
  65.             VerifyState(false, false);
  66.  
  67.             return new DirectIOData(data, obj);
  68.         }
  69.         #endregion // PosCommon overrides
  70.         protected override PrintResults PrintNormalImpl(PrinterStation station, PrinterState printerState, string data)
  71.         {
  72.             throw new Exception("The method or operation is not implemented.");
  73.         }
  74.         protected override void ValidateDataImpl(PrinterStation station, string data)
  75.         {
  76.             throw new Exception("The method or operation is not implemented.");
  77.         }
  78.  
  79.     }
  80.  
I register this with posdm in the name "Printer"

This is my application.
Expand|Select|Wrap|Line Numbers
  1. PosExplorer ex = new PosExplorer();
  2.             DeviceInfo d = ex.GetDevice(DeviceType.PosPrinter, "Printer");
  3.             PosPrinter printer = (PosPrinter)ex.CreateInstance(d);
  4.             printer.Open();
  5.             printer.Claim(1000);
  6.             printer.DeviceEnabled = true;
  7.             //printer.PrintNormal(PrinterStation.Receipt, "SSSSSS");
  8.  
  9.             printer.Release();
  10.             printer.Close();
  11.  
this PrintNormal method giving me an error saying "The receipt station is not present". I cannot figure it out. Please help me on this.

and if I want to open the cash drawer, can I use the printnormal method for that. something like "printer.PrintNormal(PrinterStation.Receipt, "ESC /27,112,0,25,250");"

I'm really confused.

insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,608
#2: Oct 22 '08

re: POS Printer Problem


I fixed your code tags. They end with [/code]
Newbie
 
Join Date: Oct 2008
Posts: 2
#3: Oct 26 '08

re: POS Printer Problem


Hi I overcome the problem with setting

Properties.CapRecPresent = true;

But now it give me another error.
Expand|Select|Wrap|Line Numbers
  1. System.Exception: The method or operation is not implemented.
  2.    at IndexPrinter.IndexPrinter.PrintNormalImpl(PrinterStation station, PrinterState printerState, String data)
  3.    at Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.OutputRequestHandler(OutputRequest Request)
  4.    at Microsoft.PointOfService.Internal.PosCommonInternal.ProcessOutputRequest(OutputRequest request, Boolean asyncOperation)
  5.    at Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.ProcessRequest(PrintOperation operation)
  6.    at Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.PrintNormal(PrinterStation station, String data)
  7.    at IndexPrinter.IndexPrinter.PrintNormal(PrinterStation station, String data)
  8.    at TestApplication.PosPrinterScreen.PrintButton_Click(Object sender, EventArgs e)
  9.  
  10.  
I include this code in the class

public override void PrintNormal(PrinterStation station, string data)
{
base.PrintNormal(station, data);
}

But it give me the same error. please help
Newbie
 
Join Date: Jun 2009
Posts: 1
#4: Jun 8 '09

re: POS Printer Problem


Geeshan, did you ever solve this problem??, because I run into the same errors...
Reply