4

I want to open a cash drawer which I have bought its printer driven cash drawer. And I have an Epson TM-T81 receipt printer.

I get a delegate called when I open and close the printer manually but I want to open it automatically when receipt is printed.

The code I have written is :

-(void)openDrawer{
    EposBuilder *builder = [[EposBuilder alloc] initWithPrinterModel:@"TM-P20" Lang:0];
    if(builder == nil){
        return ;
    }

//add command
int result;
result  = [builder addPulse:EPOS_OC_DRAWER_1 Time:EPOS_OC_PULSE_100];
NSLog(@"%d command result",result);
NSString *str = @"27 112 48 55 121";
NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding];
result = [builder addCommand:data];

NSLog(@"%d pulse",result);

if(result != EPOS_OC_SUCCESS){
    NSLog(@"cut failed");
    return ;
}

//send builder data
unsigned long status = 0;
unsigned long battery = 0;
result = [printer sendData:builder Timeout:10000 Status:&status Battery:&battery];

//remove builder
[builder clearCommandBuffer];

}

Looking for a solution from experts like you.

Pete Ythong
  • 305
  • 5
  • 13
Aamir'ss
  • 61
  • 5

2 Answers2

3

Checkout the documentation.

http://spsrprofessionals.com/ClientSite/readers/ePOS-Print_SDK_141020E/iOS/ePOS-Print_SDK_iOS_en_revN.pdf#page98

You're looking for the addPulse method of the builder.

The only need you need to know is what jack the cash drawer is connected to if you printer has more than one cash drawer jack.

Saul Martínez
  • 920
  • 13
  • 28
2

I added below the line of code and got working for the TM-T20 series.

[printer_ addPulse:EPOS2_DRAWER_HIGH time:EPOS2_PULSE_100];
Vikram Chaudhary
  • 580
  • 4
  • 14