open cash drawer with TM-T81 epson iOS SDK

此生再无相见时 提交于 2020-02-03 10:21:09

问题


I want to open cash drawer which i have bought its printer driven cash drawer. And i have epson TM-T81 receipt printer.

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

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 solution from experts like you.


回答1:


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.



来源:https://stackoverflow.com/questions/31626722/open-cash-drawer-with-tm-t81-epson-ios-sdk

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!