star-micronics / StarPRNT-SDK-iOS-Swift

StarPRNT SDK for iOS including libraries for supporting application development for Star printers.
https://www.star-m.jp/products/s_print/sdk/starprnt_sdk/manual/ios_swift/en/index.html
Other
41 stars 7 forks source link

SM-T300i Connection #26

Open 15mgm15 opened 6 months ago

15mgm15 commented 6 months ago

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

Your printer

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.

bandit-ibayashi commented 6 months ago

@15mgm15 We are afraid we have not tested it with Xamarin at this time and cannot guarantee that it will work.

But there are two points from your report that concern me. Could you please confirm these points first?

  1. Would your iOS device be paired with SM-T300i?

    The SM-T300i connects to the host device via Bluetooth, not BLE. Therefore, pairing is required in advance. SMPort.searchPrinter() method will return the connected printers. Please refer to the following for pairing information. https://www.star-m.jp/products/s_print/sdk/starprnt_sdk/manual/ios_swift/en/getting_start.html#bluetooth

  2. Could you please specify ("BT:") instead of ("BL:") for the searchPrinter argument?

Thank you in advance.