Open cash drawer with TM-T81 epson IOS SDK

I want to open a cash drawer that I bought for my printer cash drawer. And I have an epson TM-T81 print printer.

I get a delegate when opening and closing the printer manually, but I want to open it automatically when the receipt is the printer.

The code I wrote:

-(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.

+3


source to share


1 answer


Checkout the documentation.

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



You are looking for a addPulse

builder method .

The only need you need to know is what the cash drawer is connected to if you have multiple cash drawer slots.

+2


source







All Articles