POS Printer Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Geeshan
    New Member
    • Oct 2008
    • 2

    POS Printer Problem

    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.
    Code:
    [HardwareId(@"USB\Vid_0525&Pid_a700",@"USB\Vid_0525&Pid_a700")]
        [ServiceObject(DeviceType.PosPrinter,"PrinterTemplate","Printer Class",1,9)]
        public class MyPrinter : PosPrinterBase
        {   private string MyHealthText;
            
            public MyPrinter()
            {        
                // Initialize device capability properties.          
                MyHealthText = "";
            }
    
            ~MyPrinter()
            {
                Dispose(false);
            }
    
            // Release any resources managed by this object.
            protected override void Dispose(bool disposing)
            {
                try
                {
                    // Your code here.
                }
                finally
                {
                    // Must call base class Dispose.
                    base.Dispose(disposing);
                }
            }         
            #region PosCommon overrides
            // Returns the result of the last call to CheckHealth().
            public override string CheckHealthText
            {
                get
                {
                    // MsrBasic.VerifyState(mustBeClaimed,
                    // mustBeEnabled). This may throw an exception.
                    VerifyState(false, false);
    
                    return MyHealthText;
                }
            }
    
            public override string CheckHealth(
                        HealthCheckLevel level)
            {
                // Verify that device is open, claimed, and enabled.
                VerifyState(true, true);
    
                // Your code here:
                // check the health of the device and return a 
                // descriptive string.
    
                // Cache result in the CheckHealthText property.
                MyHealthText = "Ok";
                return MyHealthText;
            }
    
            public override DirectIOData DirectIO(
                            int command, 
                            int data, 
                            object obj)
            {
                // Verify that device is open.
                VerifyState(false, false);
    
                return new DirectIOData(data, obj);
            }
            #endregion // PosCommon overrides
            protected override PrintResults PrintNormalImpl(PrinterStation station, PrinterState printerState, string data)
            {
                throw new Exception("The method or operation is not implemented.");
            }
            protected override void ValidateDataImpl(PrinterStation station, string data)
            {
                throw new Exception("The method or operation is not implemented.");
            }
           
        }
    I register this with posdm in the name "Printer"

    This is my application.
    Code:
    PosExplorer ex = new PosExplorer();
                DeviceInfo d = ex.GetDevice(DeviceType.PosPrinter, "Printer");
                PosPrinter printer = (PosPrinter)ex.CreateInstance(d);
                printer.Open();
                printer.Claim(1000);
                printer.DeviceEnabled = true;
                //printer.PrintNormal(PrinterStation.Receipt, "SSSSSS");
                
                printer.Release();
                printer.Close();
    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.PrintN ormal(PrinterSt ation.Receipt, "ESC /27,112,0,25,250 ");"

    I'm really confused.
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    I fixed your code tags. They end with [/CODE]

    Comment

    • Geeshan
      New Member
      • Oct 2008
      • 2

      #3
      Hi I overcome the problem with setting

      Properties.CapR ecPresent = true;

      But now it give me another error.
      Code:
      System.Exception: The method or operation is not implemented.
         at IndexPrinter.IndexPrinter.PrintNormalImpl(PrinterStation station, PrinterState printerState, String data)
         at Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.OutputRequestHandler(OutputRequest Request)
         at Microsoft.PointOfService.Internal.PosCommonInternal.ProcessOutputRequest(OutputRequest request, Boolean asyncOperation)
         at Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.ProcessRequest(PrintOperation operation)
         at Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.PrintNormal(PrinterStation station, String data)
         at IndexPrinter.IndexPrinter.PrintNormal(PrinterStation station, String data)
         at TestApplication.PosPrinterScreen.PrintButton_Click(Object sender, EventArgs e)
      I include this code in the class

      public override void PrintNormal(Pri nterStation station, string data)
      {
      base.PrintNorma l(station, data);
      }

      But it give me the same error. please help

      Comment

      • Robskew
        New Member
        • Jun 2009
        • 1

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

        Comment

        Working...