Giter Club home page Giter Club logo

starprnt-sdk-ios-swift's Introduction

StarPRNT SDK iOS Swift

This package contains StarPRNT SDK for supporting to develop applications for Star printers.

In accordance with Apple's guidelines, StarIO V2.11.1 or later, StarIO_Extension V1.17.1 or later, StarIODeviceSetting V1.0.2 or later include a privacy manifest file. Please see here for the Manifest file. StarIO, StarIO_Extension, uses User defaults APIs. StarIODeviceSetting does not use the Required Reason API. (As of January 29, 2024)

Scope

Please refer to the StarPRNT SDK document for supported OS, development environment, and supported printers.

Limitation

  1. Notification in case of SM-L Series

    It could take some time when an iOS device tries to connect to a printer via "Bluetooth Low Energy". Refer to the "getPort API" section on the StarPRNT SDK document for details.

  2. When using printer with Bluetooth Interface, please do not change the memory switch setting of "ASB Status" from default value(invalid). (Bank 7/Bit C)

  3. In iOS 10.0 - 10.2.1 and 11.0 - 11.2.2, when using a Bluetooth printer, in rare cases, an error occurs when getPort, begin / endCheckedBlock is called, and thereafter the printer can not be discovered by the searchPrinter API. At this time, "Connected" is displayed in "Settings" - "Bluetooth", but the printer will not be displayed in "General" - "Information".

    [Restoration Method] Power off the printer once, or disconnect and reconnect Bluetooth from "Setting" app.

  4. It has been reported that the following models go out of service after getting unable to be recognized by applications when "releasePort" is executed before all of a large volume data using "writePort" is completely sent to the printer:

    • SM-S210i (Firmware 3.1 or higher)
    • SM-S230i (Firmware 1.3)
    • SM-T300i (Firmware 3.1 or higher)
    • SM-T400i (Firmware 3.1 or higher)

    The following product also may lose Bluetooth connection in the same condition.

    • mPOP

    (the issue is already reported to Apple)

    StarPRNT SDK loops writePort until the data is completely sent in sendCommands method included in the Communication class but it is designed to make releasePort in case that it fails to send all the data within the designated time and in the result the above issue can happen.

    In order to eliminate the issue, please designate a proper length of time enough to complete the print data sending, if you prefer your application to make the above procedure.

    For your information, if the printer goes out of service, you can shut down the connection on the "Bluetooth" window of the setting screen and connect again, then the printer will come back.

    Even if Bluetooth loses connection, with the Auto Connection function enabled, the connection will be recovered automatically. Otherwise you will have to re-connect manually on the iOS "setting" window.

  5. In iOS 11, set sleep to avoid a problem which sometimes cannot communicate with Bluetooth. Under our test environment, 0.2 sec sleep time is enough to avoid this problem. The appropriate sleep time is different depending on the environment.

    Please check under your own environment and set appropriate time for each environment.

  6. Precaution related to compatibility

    Beginning from StarPRNT SDK v5.6.0, the readPort behavior when a LAN printer is used has been changed as shown below. When the data that should be received when readPort is executed does not exist

    • v5.5.0 and before: Throws a PortException.
    • v5.6.0 and later: Returns 0.

    If your application uses “Throws a PortException”, change it to “Returns 0”.

  7. If mC-Sound was connected after the printer power was turned ON, melody speaker API does not work properly. Please turn on the printer after connecting mC-Sound to it.

  8. For users of Ethernet/Wireless LAN interface with mC-Print2/3, TSP100LAN, and TSP100IIILAN/W:

    • To avoid a problem which sometimes fail getPort with Ethernet interface, the appropriate portSettings argument of getPort method is required.
    • Under our test environment, the setting of argument to ;l1000 can avoid this problem.
    • The appropriate argument is different depending on the environment.
    • Please check under your own environment and set the appropriate argument.

Copyright

Copyright 2016-2024 Star Micronics Co., Ltd. All rights reserved.

starprnt-sdk-ios-swift's People

Contributors

bandit-ibayashi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

starprnt-sdk-ios-swift's Issues

Pod install failure for StarIO 2.8.1, 403 server failed to authenticate the request

Description

When I run the command pod install it fails with the following output in the terminal:

Installing StarIO (2.8.1)

[!] Error installing StarIO
[!] /usr/bin/curl -f -L -o /var/folders/sl/jfdrtpvj5ls7w127r92xqrmw0000gn/T/d20230106-52611-ytbmtj/file.zip https://libraryfilesstorage.blob.core.windows.net/ios/StarIO/2.8.1/StarIO.zip?sv=2019-02-02&si=TechSalesSupp&sr=c&sig=kkD24MYypOKNgnika6m1dHueNNbGz%2Bk0WQ8%2BuYO%2B0TM%3D --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.11.2 cocoapods-downloader/1.5.1'

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

Cannot find TSP100GT printer that's shared through network

We are working on building a CRM application for iPhone and iPad through Swift and Xcode. All our customers receive a StarPRNT device along with our product to manage their purchases and receipts. The StarPRNT device is model TSP100GT and at the moment of testing, it is paired through USB with a host Mac that shares the printer along the network. We're able to find and print with the TSP100GT from other Macs throughout the network but not on the iPhones and iPads. Not even the StarPRNT SDK application is able to find our printer. Other mobile applications like Printer Pro Lite however, are able to find and print with the TSP100GT. We also have experimented with the StarPRNT SDK but no luck locating our printer. We're really questioning ourselves what we're doing wrong in this case. Any help is appreciated!

CPU usage above 90%!!!

SDK Version: 5.14.2
iOS Version: 13.3.1

When searching for printers, the CPU usage will exceed 90%.

Is there a function to align left and right on a single line or column? or how to print like this design?

I am using the mc-print3 model
I want to display the menu on the left and the price on the right

cloudPRNT seems to have a column function.
(https://www.star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/articles/markup/command_column.html?tabs=tabid-2)

But in the SDK's documentation:
I was only able to find the sort function for an entire line.

I tried using "horizontalTab", but this function could not place the price on the far right.

I have attached a photo of the printed receipt as an example. (Pictures downloaded from the Internet)
As in the attached photo, I would like to know if there is a function that can be printed out right-aligned even if the number of prices increases
image 8

Printer Connection Failed!!![BUG]

Description

  • Restaurants continue to see Star Printer disconnection issues from time to time.
  • We have provided an interim protocol to our local team: restart the iPad, forget Wi-Fi SSID and reconnect, and reset the iPad network setting.
  • We still don't know what it means by PortName: TCP:10.1.10.122 code: -1 message: Connection failed.
  • We suspect that IPv6 might cause the issue. But the printer was still disconnected after disabling the router's IPv6.

Your device where the bug occurs

  • Device:
    iPad pro 1 & iPad mini 2
  • OS:
    iOS 12+
  • SDK:
    StarIO (Ver. 2.9.0)
    StarIO_Extension (Ver. 1.16.0)
  • Version
    V5.15.0

Your printer

  • Model Names:
    mC-Print3、TSP100
  • Firmware Version:
    3.4~3.6
  • Interface:
    Ethernet、USB

Your development environment

Xcode 13.4

To Reproduce

We can't determine what caused this error. And when such an error occurs, we must restart the iPad or reset the iPad network to connect to the printer normally.
This happens by accident and we can't reproduce it with a specific scene or demo.

[BUG] Inconsistency in printed receipts

Description

We have tested our code across a range of star printers and it all looks exactly the same. We are printing receipts by generating an in-memory bitmap of the whole receipt file and printing it using appendBitmap

We've tested 3-4 different printers, on starGraphic and escPosMobile emulation modes (not sure if helpful), on Bluetooth, ethernet, wifi, and USB interfaces, and the printed image receipts look exactly the same (picture 1).

However, we're having issues with MCP31LB. The same iPad, connected to a TSP100, SM-T300 and an mC-Print3, printed the same receipt on all three. The first two, printed it exactly as picture 1, while the second consistently adds glitches to the image. Sometimes, just some sections of the image, appear centered. Other times, garbage is printed instead of the word (see the Restaurant word in the header).

Not sure how to investigate this issue or what tests to perform to debug it. We are on the latest SDK version and latest iOS version.

Your printer

  • Model Names:
    mC-Print3 MCP31LB

Screenshots

correct_image

bad_image

Pods Issue StarIO for 2.8.2 - Signature not valid in the specified time frame

As per Cocoapods spec,
for StarIO for 2.8.2
CocoaPods/Specs@801136a

path is mentioned as "https://libraryfilesstorage.blob.core.windows.net/ios/StarIO/2.8.2/StarIO.zip?sv=2019-02-02&si=TechSalesSupp&sr=c&sig=kkD24MYypOKNgnika6m1dHueNNbGz%2Bk0WQ8%2BuYO%2B0TM%3D"

This server is not working

We are getting the error as

Signature not valid in the specified time frame: Start [Sun, 31 May 2020 15:00:00 GMT] - Expiry [Thu, 30 Dec 2021 15:00:00 GMT] - Current [Tue, 04 Jan 2022 05:35:05 GMT]

For StarIO for 2.9.0

CocoaPods/Specs@742a9a5#diff-874fd2b761d9e117e081b137d1499e5ac15b69ca8b47496becec687760132117

it is using new server

https://library.starmicronicscloud.com/ios/StarIO/2.9.0/StarIO.zip

Could you please update for 2.8.2 also ?

Suggestion: Add StarPRNT emulation for Stargraphic printers

Currently, Stargraphic-only models such as the TSP100 series can only accept raster printing commands.

It would be amazing if Star could support an emulation driver in iOS/Android that supports StarPRNT commands such as append, appendAlignment, enableEmphasis, etc., renders/rasterizes the text into an image in iOS memory, and outputs the raster image bytes to the device.

Bothscale for StarDotImpact

Hello, I'm using Star SP700 (Star Dot Impact) for my kitchen order and TSP800II for Receipt.

Because our order has multiple languages, so, for easy we convert to image and using appendBitmap command for printing.
In the TSP800 device, it works perfectly. But in the SP700, the image not scale, it's so big.
Image

My pager: 3'', and I set in appendBitmap command with is 576dots.

Please help.

Search returns an empty array

SMPort.searchPrinter(target: "ALL:") as? [PortInfo]

This returns an empty array, though the sample app works.
What can be the issue?

SM-T300i Connection

Description

I am creating a Xamarin.iOS binding of your library, but, while calling:

SearchPrinter("BLE:") I am getting an empty array.

SearchPrinter("BL:") / SearchPrinter("ALL:") Doesn't return any port.

Using your StarPRNT SDK iOS app I am able to connect the printer and print an example ticket.

I have these permissions already on my info.plist:

NSBluetoothPeripheralUsageDescription
Please allow access to Bluetooth to connect to 3rd party devices.
NSBluetoothAlwaysUsageDescription
Please allow access to Bluetooth to connect to 3rd party devices.
UISupportedExternalAccessoryProtocols

jp.star-m.starpro

Your device where the bug occurs

  • Device:
    iPhone 13 Pro Max
  • OS:
    iOS 17.2

Your printer

  • Model Names:
    SM-T300i
  • Interface:
    Bluetooth

Your development environment

Mac OS, Xamarin.iOS, Visual Studio for Mac

Using the deprecated Xamarin library, I am also not able to connect, but I am able to connect to the old SM-T300 model.

I have also tried to bind the StarXpand library to Xamarin, but there is a Factory method that returns an instance of an abstract class which doesn't translate well from Swift to C#

Please let me know your comments.

Create receipt by commands vs. pdf

Hi,

I'm developing a POS iOS application and have created a pdf receipt. I haven't yet added the Star SDK, but about to now. Can someone with experience give some advice between creating the receipt by commands vs just export a pdf receipt to the printer for printout?

SPM Support [BUG]

Description

The included XCFramework does not work with Swift package manager. When integrating as a binary target in a swift package, SPM throws the error.

Cannot open file handle for file at path: Path(str: "/Sources/Frameworks/StarIO_Extension.xcframework/ios-arm64_i386_x86_64-simulator/StarIO_Extension.framework")

This is due to no top-level info plist on for the .framework files. Also, the info.plist in the fat framework resources folder is not processed.

Your device where the bug occurs

N/A

Your printer

N/A

Your development environment

ProductName:	macOS
ProductVersion:	12.4
BuildVersion:	21F79

To Reproduce

I have attached a sample project to reproduce quickly. Open the "App" Xcode project in the attached zip
and build to replicate.

Expected behaviour

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the bug here.

SPM-import-issue.zip

Cash Drawer on Mpop

Description

The cash drawer opens on the different model except the mPop . What am I missing for this specific model ? I have searched the entire sdk doc but found no specific instruction for it.

Your device where the bug occurs

  • Device:
    iPads
  • OS:
    iOS 15.0*
  • Version
    'StarIO', '2.9.0'
    'StarIO_Extension', '1.16.0'

Your printer

  • Model Names:
    mPop

  • Interface:
    bluetooth

Your development environment

xcode

Additional context

here is the snippet of code
func sendDataForCashDrawer (fullReconnect:Bool = false) -> Bool {
`if !initializePrinterObject() {
return false
}

    if !self.cashDrawerOpenActiveHigh {
        return false
    }

    builder!.appendPeripheral(**SCBPeripheralChannel.no1**)
    
    builder!.endDocument()
    
    let commands = builder!.commands.copy() as! Data

    GlobalQueueManager.shared.serialQueue.async {
        _ = Communication.sendCommandsDoNotCheckCondition(commands,
                                       portName: self.portName,
                                       portSettings: self.portSettings,
                                       timeout: 10000, 
            completionHandler: { (result: Bool, title: String, message: String) in
                let formatter = DateFormatter()
                formatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSS "
                DispatchQueue.main.async {
                    if result {
                        //PrintMessageView.show(message: "Tiroir caisse ouvert !!!", theme: .success)
                    }else if !fullReconnect{
                        PrintMessageView.cashDrawerFailedToOpen(message: "\(title) : \(message)" , theme: .warning)
                    } else {
                        PrimaryPrinterService.shared.devicesDelegate =  self
                        PrimaryPrinterService.shared.startConnectionRoutine()
                        return 
                    }
                    self.initializePrinterObject()
                }
        })
    }
    return true
}`

iPadOS 16.5

Hi there

In the recently launched iPadOS 16.5, there were some changes to the Bluetooth management for iPadOS apps.

As a result, if a user tries to run two or more scanning apps then the bluetooth connection stops working and devices such as star devices refuse to re-connect.

Most SDKs have been updated to reflect the change in iPadOS 16.5, however this appears to not be the case on this SDK. Can you advise if and when you intend to deal with this iPadOS 16.5 bluetooth management issue?

Note that this issue only happens on iPadOS and does not affect iOS.

Missing privacy manifest?

Description

According Apple docs:

From Fall 2023 you’ll receive an email from Apple if you upload an app to App Store Connect that uses required reason API without describing the reason in its privacy manifest file. From Spring 2024, apps that don’t describe their use of required reason API in their privacy manifest file won’t be accepted by App Store Connect.

Does StarPRNT-SDK use any APIs mentioned here? If so, are there plans to include a privacy manifest? I'm not 100% sure what that'd even look like, but this thread maybe has a little insight.

Your device where the bug occurs

  • Device:
    Any
  • OS:
    Any
  • Browser:
    N/A
  • Version
    N/A

Your printer

  • Model Names:
    Any
  • Firmware Version:
    Any
  • Interface:
    Any

Your development environment

N/A

To Reproduce

N/A

Expected behavior

N/A

Screenshots

N/A

Additional context

N/A

Print cash receipt from PDF

Hi again,

We followed your advice of getting a LAN printer and it worked, so thanks! But now we have the problem that our cash receipts are way too (approx 16) long. It kinda makes sense since the PDF has a lot of whitespace at the bottom but we would like to cut this if possible. We apply the PDF as an image through the appendBitmap function and this works, besides the receipts being too long. Even if we crop the cash receipts's PDF to delete the whitespace at the bottom it's still the same. I hope you can help us!

In the attachment we have an example how it's currently printed. We disrupted the printing process to waste more paper so it's not at its full length but I think the idea is clear.

Thanks in advance!
IMG_4531

Rotate ticket failed after enable "180 Rotation"

Printer Mode: MCP31 (STR-001)
Firmware Version: 3.4

I set up my ticket using ISCBBuilder, and I want to rotate my ticket to 180, so I enable the "180 Rotation" by mc_Print Utility.
But the ticket is not displayed correctly if it is very long.
441629858538_ pic_hd

[StarPRNTBuilderImpl setPageMode:] + 49 Fatal Exception

Description

[StarPRNTBuilderImpl setPageMode:] + 49 is crashing with fatal exception

*** -[NSConcreteMutableData subdataWithRange:]: range {3, 18446744073709551613} causes integer overflow

Trace from crash log:

Fatal Exception: NSRangeException
0  CoreFoundation                 0x9e48 __exceptionPreprocess
1  libobjc.A.dylib                0x178d8 objc_exception_throw
2  Foundation                     0x5051c -[NSConcreteData copyWithZone:]
3  Rezku-POS                      0x96b310 -[StarPRNTBuilderImpl setPageMode:] + 49 (StarPRNTBuilderImpl.m:49)
4  CoreBluetooth                  0x38d40 -[CBPeripheral handleAttributeEvent:args:attributeSelector:delegateSelector:delegateFlag:]
5  CoreBluetooth                  0x38e70 -[CBPeripheral handleCharacteristicEvent:characteristicSelector:delegateSelector:delegateFlag:]
6  CoreBluetooth                  0x35ae8 -[CBPeripheral handleMsg:args:]
7  CoreBluetooth                  0x2570 -[CBCentralManager handleMsg:args:]
8  CoreBluetooth                  0x20f0 -[CBManager xpcConnectionDidReceiveMsg:args:]
9  CoreBluetooth                  0x1fc8 __30-[CBXpcConnection _handleMsg:]_block_invoke
10 libdispatch.dylib              0x24b4 _dispatch_call_block_and_release
11 libdispatch.dylib              0x3fdc _dispatch_client_callout
12 libdispatch.dylib              0xb694 _dispatch_lane_serial_drain
13 libdispatch.dylib              0xc214 _dispatch_lane_invoke
14 libdispatch.dylib              0xb56c _dispatch_lane_serial_drain
15 libdispatch.dylib              0xc1e0 _dispatch_lane_invoke
16 libdispatch.dylib              0x16e10 _dispatch_workloop_worker_thread
17 libsystem_pthread.dylib        0xdf8 _pthread_wqthread
18 libsystem_pthread.dylib        0xb98 start_wqthread

Your device where the bug occurs

  • Device:
    Any iPad
  • OS:
    iOS 13, 14, 15, 16
  • Browser:
    N/A
  • Version
    StarPRNT SDK to V5.15.1

Your printer

We are seeing this crash with a mixture of users who are using STAR Printers and users who are not. So printer model is not relevant.

Your development environment

ProductName: macOS
ProductVersion: 12.5
BuildVersion: 21G72

To Reproduce

Unsure. Please see stack trace. Looks like there's a missing check on an NSRange somewhere in your SDK.

Expected behavior

SDK should not crash

Screenshots

N/A

Additional context

This seemed to start happening when we started building our app against the iOS 16 SDK.

SM-T300i not properly handles ISCBBuilder commands.

Hi, I'm trying to configure printing on SM-T300i and faced the fact that some of the commands are working out incorrectly and someone correctly (this behavior both reproduces on my application and on your StarPRNT SDK)

  1. appendFontStyle: does not work
  2. appendEmphasis:
    when I call "func appendData(withInvert otherData: Data!)" I will apply emphasis to the rest of the whole content (not only for provided data)
  3. appendLineSpace:
    does not work
  4. appendCutPaper:
    when I add any of these modes printer feeds out too much paper after content (about 10 sm), as a workaround I have to add 4 empty lines after adding content
  5. appendQrCodeData:
    it unable to print QR code, instead of this it prints: ###yS0yS1yS2yD1Hello World.yp*Cell: 8,
    while expected QR code for "Hello world"
  6. appendBitmap:
    instead of images it prints a long long list of symbols

Some other simple commands like appendData, appendCharacterSpace, appendLineFeed works fine

[BUG] App built with Xcode 14 causes crash when calling disconnect

Description

A clear and concise description of what a bug is. disconnect

Your device where the bug occurs

  • Device:
    Any iPad
  • OS:
    iOS 14, 15, 16

Your printer

  • Model Names:
    mPOP
  • Firmware Version:
    4.0
  • Interface:
    bluetooth

Your development environment

The result of executing the command ver on Windows, sw_vers on macOS, uname –a on Linux, or these equivalent commands.
ProductName: macOS
ProductVersion: 12.5.1
BuildVersion: 21G83

To Reproduce

Steps to reproduce the behavior:

  1. Call disconnect on StarIoExtManager

Expected behavior

A clear and concise description of what you expected to happen.
not crash

Screenshots

If applicable, add screenshots to help explain your problem.
N/A

Additional context

Add any other context about the bug here.
Crash Title on Firebase

-[StarIoExtManager .cxx_destruct]
EXC_BREAKPOINT
StarIoExtManager.m:71

Crash Log

3
POS
StarIoExtManager.m - 行 53
-[StarIoExtManager .cxx_destruct] + 53
4
libobjc.A.dylib
object_cxxDestructFromClass(objc_object*, objc_class*) + 116
6
libobjc.A.dylib
_objc_rootDealloc + 80
7
POS
StarIoExtManager.m - 行 121
-[StarIoExtManager dealloc] + 121

Crash Key Log

BUG IN CLIENT OF LIBDISPATCH: Semaphore object deallocated while in use

Happens about 44% while the app is in the background (with background operations on)
Edit: now happens around 76% in the BG

Add support for TUP* models (open frame kiosk printers)

I understand it might not be a typical scenario to connect an iOS device to a printer meant to be mounted inside a kiosk but they share the same interface boards with their standalone siblings and it would be nice to also have these models (TUP900, TUP500, TUP400) supported by the official iOS apps

The "endCheckedBlock" is neccessary?

Version

StarPRNT 5.13.0
iOS 14.x

Description

When I call the endCheckedBlock of port, sometimes it throws an error EndCheckedBlock : PortException. But actually, the tickets have been printed out.

Question

Should we need to filter this error? Because it looks like the printer successfully prints the ticket.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.