auctifera-josed / starprnt

Cordova plugin for the Star micronics printers
MIT License
40 stars 39 forks source link

[tsp100iiiBI] strange batching #34

Open daniellizik opened 5 years ago

daniellizik commented 5 years ago

version: 2.2.0 xcode version: 10.1 iOS version: 12

https://www.youtube.com/watch?v=sg8svJF8OZc

I see that the byte array size limit is around 500kB when I use .print. So for instance, this will cause some error in the objective-c code that causes an iOS crash:

starprnt.print('BT:TSP100', 'StarGraphic', [...501kB long]);

So I'm segmenting my data into 200kB chunks and calling .print iteratively

const print = (port, emulation, data, curr = 0) => {
  if (!data[curr]) return;
  starprnt.print(
    port,
    emulation,
    data[curr],
    () => print(port, emulation, data, curr + 1)
  );
}

However, Even if I have two chunks each with 200kB, my tsp100iiiBI seems to be printing in batches, though I am not sure how many bytes are being sent per request. Is there a recommended way to control batching? I'd like to figure this out as in the video for some inexplicable reason the tsp100iiiBI starts printing blank paper without stopping after a certain number of batches.