Waiting time Epson T88V - ios

PROBLEM:
How to print (multiple) receipts without any delay?
As far as I know, there are at least 3 options to print with a T88V on OSX or iOS device. Unfortunately, all 3 of those options has a flaw.
OPTION 1:
I've been playing around with the official OSX driver (latest version 1.2a) and have no problems printing with it. However, between every print command, there's 1 sec delay.
- (IBAction)button1:(id)sender
{
[self TMAppPrint];
}
- (OSStatus)TMAppPrint
{
TMTextView *textWindow = [[TMTextView alloc] init];
NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
OSStatus err = noErr;
err = [TMPrintSupport TMSetJobTicket:printInfo printerName:#"TM-T88V" documentSize:NSMakeSize(204.0, 841.8) resolution:#"180x180dpi" speed:#"1" blank:#"Off" paperCut:#"DocFeedCut" chashDrwr1:#"Off" chashDrwr2:#"Off" buzzerControl:#"Off" buzzerPattern:#"Internal" buzzerRepeat:#"1"];
NSPrintOperation *printOperation = [NSPrintOperation printOperationWithView:textWindow printInfo:printInfo];
[printOperation setCanSpawnSeparateThread:YES];
[printOperation setShowsPrintPanel:NO];
[printOperation runOperation];
return err;
}
OPTION 2:
Using the iOS SDK (latest version 1.3.0) I can also print without problems but it's even worse. After sending the print command, there will be 1 sec delay till it prints.
- (IBAction)button2:(id)sender
{
if (printer != nil)
{
errorStatus = EPOS_OC_SUCCESS;
if (builder != nil)
{
int printStatus = EPOS_OC_SUCCESS;
// create a print document
printStatus = [builder addTextLang: EPOS_OC_LANG_EN];
printStatus = [builder addTextSmooth: EPOS_OC_TRUE];
printStatus = [builder addTextFont: EPOS_OC_FONT_A];
printStatus = [builder addTextSize: 1 Height: 1];
printStatus = [builder addTextStyle: EPOS_OC_FALSE Ul: EPOS_OC_FALSE Em: EPOS_OC_TRUE Color: EPOS_OC_PARAM_UNSPECIFIED];
// specify the print data>
printStatus = [builder addText: #"hello!\n"];
printStatus = [builder addCut: EPOS_OC_CUT_FEED];
// send data>
errorStatus = [printer sendData:builder Timeout:1000 Status: &status];
// end communication with the printer>
errorStatus = [printer closePrinter];
}
}
}
OPTION 3:
The last option is using the ESC/POS commands. I managed to get it to print some basic lines but I still don't understand most of it. There's no delay in printing though.
- (IBAction)button3:(id)sender
{
printer = [[EposPrint alloc] init];
errorStatus = [printer openPrinter:EPOS_OC_DEVTYPE_TCP DeviceName:#"192.168.1.168"];
builder = [[EposBuilder alloc] initWithPrinterModel:#"TM-T88V" Lang:EPOS_OC_MODEL_ANK];
}
I already directly asked Epson about this, but they couldn't give me any answer except it's working as intended... Which means I have to dive into the ESC/POS commands and learn it or are there still other options?

Related

determining throughput speed Cordova bridge. Any insights?

I'm trying to get an idea about the throughput speed of Cordova's WebView-Native bridge. For this I will send a Uint8Array of a determined size. However, I would have expected the throughput speed of this bridge to be higher.
Testing on a iPhone 4s and Cordova 5.4.1 the throughput speed is ~0.8mb/s. This feels low to me (based on some experience with Cordva apps, but this is of course subjective).
Question: is this realistic?
I think that without posting my code this questions show no enough info, therefore I've attached my code:
My JavaScript code:
var success = function(endTime) {
//endTime is unix epoch time (ms)
var time_df = endTime - beginTime
results.push(time_df)
numTests += 1;
sendMessage()
}
var sendMessage = function() {
// execute test 30 times
if (numTests < 30) {
beginTime = +new Date()
bench.send(payload, success, fail)
} else {
console.log('results', results)
}
}
var createPayload = function(size) {
size = size * 1000;
var bufView = new Uint8Array(size);
for (var i = 0; i < size; ++i) {
bufView[i] = i % 20;
}
return bufView.buffer;
}
var startTest = function() {
// create payload of 500kb
payload = createPayload(500)
sendMessage()
}
My Objective-C code.
Code does basicly one thing: return unix epoch time after payload is received.
(void)send:(CDVInvokedUrlCommand*)command
{
NSTimeInterval time = ([[NSDate date] timeIntervalSince1970]); // returned as a double
long digits = (long)time; // this is the first 10 digits
int decimalDigits = (int)(fmod(time, 1) * 1000); // this will get the 3 missing digits
long timestamp = (digits * 1000) + decimalDigits;
NSString *timestampString = [NSString stringWithFormat:#"%ld%d",digits ,decimalDigits];
NSString* callbackId = [command callbackId];
CDVPluginResult* result = [CDVPluginResult
resultWithStatus:CDVCommandStatus_OK
messageAsString:timestampString];
[self success:result callbackId:callbackId];
}

How to add new call as conference PJSIP with siphon

Whats my project .
voice calling .
Whats library in my project .
Asterisk server (version 11.0)
pjsip 2.5.1
siphon for UI
My achievement
One-to-One call working fine
My issues :-
I need to implement add new buddy feature so that we can do conference .
Whats My problems
I am unable to get conference Voice call . scenarios is A called to B voice working fine ,but when B add new buddy C then B and C communicate but A and C Unable to communicate .
This my code which i am using for calling One-toOne
if (([[_label text] length] > 0) &&
([phoneCallDelegate respondsToSelector:#selector(dialup:number:)]))
{
_lastNumber = [[NSString alloc] initWithString: [_label text]];
[_label setText:#""];
}
else
{
_lcd.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"lcd_top_simple.png"]];
[_label setText:_lastNumber];
[_lastNumber release];
}
}
Call.m file calling this below method .
status = pjsua_call_make_call(acc_id, &pj_uri, 0, NULL, NULL, call_id);
if (status != PJ_SUCCESS)
{
pjsua_perror(THIS_FILE, "Error making call", status);
}
There are missing some files Which is from "PJSIP" library. Please include the "PJSIP" library after compilation, or you may download the project from this link, this project have compiled "PJSIP" included.
static void on_call_media_state(pjsua_call_id call_id)
{
pjsua_call_info ci;
SiphonApplication *app = (SiphonApplication *)[SiphonApplication sharedApplication];
pjsua_call_get_info(call_id, &ci);
// PJ_LOG(3,(THIS_FILE,"on_call_media_state status %d count %d",
// ci.media_status
// pjmedia_conf_get_connect_count()));
/* FIXME: Stop ringback */
sip_ring_stop([app pjsipConfig]);
/* Connect ports appropriately when media status is ACTIVE or REMOTE HOLD,
* otherwise we should NOT connect the ports.
*/
if (ci.media_status == PJSUA_CALL_MEDIA_ACTIVE ||
ci.media_status == PJSUA_CALL_MEDIA_REMOTE_HOLD)
{
// When media is active, connect call to sound device.
pjsua_conf_connect(ci.conf_slot, 0);
pjsua_conf_connect(0, ci.conf_slot);
//pjsua_conf_adjust_rx_level(0, 3.0);
//pjsua_conf_adjust_tx_level(0, 5.0);
}
if (ci.media_status == PJSUA_CALL_MEDIA_ACTIVE) { // When media is active, connect call to sound device.
pjsua_conf_port_id slotOne = ci.conf_slot;
// pjsua_conf_connect(slotOne, 0);
// pjsua_conf_connect(0, slotOne);
//mergeCalls=true;
int max=pjsua_call_get_count();
if (max==2) {
mergeCalls=true;
}
if (mergeCalls == true) {
pjsua_conf_port_id slotTwo = pjsua_call_get_conf_port(activeCallID);
pjsua_conf_connect(slotOne, slotTwo);
pjsua_conf_connect(slotTwo, slotOne);
// since the "activeCallID" is already talking, its conf_port is already connected to "0" (and vice versa) ...
} else {
activeCallID = call_id;
}
} else if (ci.media_status == PJSUA_CALL_MEDIA_LOCAL_HOLD) {
// … callSuspended(callID);
}
}

IOMobileFramebufferGetLayerDefaultSurface function failed on iOS 9

I created a app to capture screenshot in background. It works well on iOS 7.x & 8.x, but failed to execute on iOS 9 beta. Here's my code:
CFMutableDictionaryRef sm = IOServiceMatching("AppleH1CLCD");
io_service_t ioService = IOServiceGetMatchingService(kIOMasterPortDefault, sm);
if (!ioService)
{
sm = IOServiceMatching("AppleM2CLCD");
ioService = IOServiceGetMatchingService(kIOMasterPortDefault, sm);
}
if (!ioService)
{
sm = IOServiceMatching("AppleCLCD");
ioService = IOServiceGetMatchingService(kIOMasterPortDefault, sm);
}
IOMobileFramebufferConnection connection = 0;
IOSurfaceRef ptr = nil;
IOMobileFramebufferReturn openMobileFrameBufferResult = IOMobileFramebufferOpen(ioService, mach_task_self(), 0, &connection);
if (openMobileFrameBufferResult)
{
return;
}
IOMobileFramebufferReturn getLayerDefaultSurfaceResult = IOMobileFramebufferGetLayerDefaultSurface(connection, 0, (CoreSurfaceBufferRef*)&ptr);
if (getLayerDefaultSurfaceResult)
{
return; // Here, the getLayerDefaultSurfaceResult is -536870201, not 0!
}
.......
When debugging it step by step, I found that the function IOMobileFramebufferGetLayerDefaultSurface failed to execute with a returning value -536870201 and the value expected was 0.
Who can tell me why this happened and how to resolve it ? thhhhhhhhhhhhhhhx!!
Another user asked a similar question. I did some digging into IOMobileFramebufferGetLayerDefaultSurface on iOS8 vs iOS9 (GM). And the results of what I found are summarized in this answer.
Given these results, I believe it is no longer possible, as of iOS9, to use IOMFB to capture the screen.

AVAnimator Assertion failure in -[AVMvidFrameDecoder advanceToFrame:] 'framebuffer num bytes'

I have dolwoaded the latest code from Github for AVAnimator library. I added the folders AVAnimator and LZMASDK in addition to AutoPropertyRelease.h and AutoPropertyRelease.m.
I am using the following code to play a video with alpha channel (adopted form another AVAnimator app examples):
CGRect iPhoneExplosionRect = CGRectMake(0, -2, 640/2, 480/2);
CGRect iPadExplosionRect = CGRectMake(0, -5, 840, 630);
NSString *rgbResourceName = #"ExplosionAdjusted_rgb_CRF_30_24BPP.m4v";
NSString *alphaResourceName = #"ExplosionAdjusted_alpha_CRF_30_24BPP.m4v";
// Output filename
NSString *tmpFilename;
NSString *tmpPath;
tmpFilename = #"Explosion.mvid";
tmpPath = [AVFileUtil getTmpDirPath:tmpFilename];
// Set to TRUE to always decode from H.264
BOOL alwaysDecode = FALSE;
if (alwaysDecode && [AVFileUtil fileExists:tmpPath]) {
BOOL worked = [[NSFileManager defaultManager] removeItemAtPath:tmpPath error:nil];
NSAssert(worked, #"could not remove file %#", tmpPath);
}
// This loader will join 2 H.264 videos together into a single 32BPP .mvid
AVAssetJoinAlphaResourceLoader *resLoader = [AVAssetJoinAlphaResourceLoader aVAssetJoinAlphaResourceLoader];
resLoader.movieRGBFilename = rgbResourceName;
resLoader.movieAlphaFilename = alphaResourceName;
resLoader.outPath = tmpPath;
//resLoader.alwaysGenerateAdler = TRUE;
AVAnimatorMedia *media = [AVAnimatorMedia aVAnimatorMedia];
media.resourceLoader = resLoader;
self.expMedia = media;
// Frame decoder will read from generated .mvid file
AVMvidFrameDecoder *aVMvidFrameDecoder = [AVMvidFrameDecoder aVMvidFrameDecoder];
media.frameDecoder = aVMvidFrameDecoder;
// Create layer that video data will be directed into
CGRect expFrame;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
expFrame = iPhoneExplosionRect;
} else {
expFrame = iPadExplosionRect;
}
CALayer *layer = [CALayer layer];
layer.frame = expFrame;
}
if (FALSE) {
layer.backgroundColor = [UIColor orangeColor].CGColor;
}
[self.view.layer addSublayer:layer];
AVAnimatorLayer *animatorLayer = [AVAnimatorLayer aVAnimatorLayer:layer];
self.expAnimatorLayer = animatorLayer;
// Finally connect the media object to the layer so that rendering will be
// sent to the layer.
[animatorLayer attachMedia:media];
//media.animatorRepeatCount = 3;
//media.animatorRepeatCount = 30;
//media.animatorRepeatCount = INT_MAX;
[media prepareToAnimate];
Once prepareToAnimate is hit the application fails at an assertion as described below
** Assertion failure in -[AVMvidFrameDecoder advanceToFrame:], /Users/user/Documents/.../AVAnimator/AVMvidFrameDecoder.m:844
...*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'framebuffer num bytes'
Is it the architecture I am using (both 32 and 64 bit) causing it or something else?
I hope someone can put me on the right track
AF
I looked into this assert and different ways it might be reproduced. I tried improperly setting the arch flags to include only 32 bit or only 64 bit code in the executable and tested on a 64 bit device and the simulator. I was not able to reproduce the problem and it is not clear how it could happen. To gather more information, I added an extra check that is compiled in either DEBUG or OPT mode when the framebuffer is allocated, could you pull the most recent version of AVAnimator from the github or grab the patch from patch here. Please make sure that none of the defines were modified in your version of the code and that you are using the most recent version of Xcode.

open cash drawer with TM-T81 epson iOS SDK

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.
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.
I added below the line of code and got working for the TM-T20 series.
[printer_ addPulse:EPOS2_DRAWER_HIGH time:EPOS2_PULSE_100];

Resources