Skip to content

Commit

Permalink
1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bandit-ibayashi committed Nov 6, 2024
1 parent 50d9c1d commit 3bb6f37
Show file tree
Hide file tree
Showing 97 changed files with 108,885 additions and 125,551 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

# Change Log

## 1.8.0 (2024/11/01)

* Added TSP100IV-UEWB and TSP100IV-UEWB SK support.
* Added API to get detail information of printer.
* detail property of StarPrinterInformation
* StarPrinterInformationDetail
* StarPrinterInformationLan
* StarPrinterInformationBluetooth
* StarPrinterInformationBluetoothLE
* StarPrinterInformationUsb
* Added API to get detail information of error.
* errorDetail property of StarPrinter
* StarIO10ErrorDetail
* Bug Fix:
* Fixed an issue where `react-native-star-io10` failed to open and discover printer via LAN with the Xcode16 and iOS 18. [#124](https://github.com/star-micronics/react-native-star-io10/issues/124)

## 1.7.0 (2024/06/24)

* Added BSC10II support (Limited region model).
Expand Down
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<p align="center">
<div style="text-align: center;">
<img
src="docs/logo.png"
width="600"
style="margin-top: 20px; margin-bottom: 20px;"
/>
</p>
</div>

- [日本語](docs/README_JP.md)

Expand Down Expand Up @@ -52,18 +52,18 @@ Please check the table below and take action.
<a id="SupportedEAProtocols"></a>
##### 1. Set `Supported external accessory protocols`

1. Click on the information property list file (default : Info.plist).
1. Click on the information property list file (default : "Info.plist").
2. Add the `Supported external accessory protocols` Key.
3. Click the triangle of this key and set the value for the Item 0 to `jp.star-m.starpro`.
3. Click the triangle of this key and set the value for the "Item 0" to `jp.star-m.starpro`.

> :warning: If you do not use the printer concerned, do not configure this setting.
<a id="BluetoothAlwaysUsageDescription"></a>
##### 2. Set `Bluetooth Always Usage Description` and `Bluetooth Peripheral Usage Description`

1. Click on the information property list file (default : Info.plist).
2. Add the `Privacy Bluetooth Always Usage Description` Key.
3. If you set `Deployment Target` to iOS12, add the `Privacy Bluetooth Peripheral Usage Description` Key.
1. Click on the information property list file (default : "Info.plist").
2. Add the `Privacy - Bluetooth Always Usage Description` Key.
3. If you set `Deployment Target` to iOS12, add the `Privacy - Bluetooth Peripheral Usage Description` Key.
4. Set the reason for using Bluetooth in Value (e.g. `Use Bluetooth for communication with the printer.`)
5. When communicating with the Bluetooth printer on iOS 13 or later, an alert requesting permission to access Bluetooth is displayed. The string set in Value is displayed in the alert as the reason for using Bluetooth.

Expand All @@ -74,7 +74,7 @@ https://developer.apple.com/documentation/bundleresources/information_property_l
<a id="LocalNetworkUsageDescription"></a>
##### 3. Set `Local Network Usage Description`

1. Click on the information property list file (default : Info.plist).
1. Click on the information property list file (default : "Info.plist").
2. Add the `Privacy - Local Network Usage Description` Key.
3. Set the reason for using Local Network in Value (e.g. `Use Local Network for communication with the printer or discovery the printers.`)
4. When communicating with the Ethernet printer on iOS 14 or later, an alert requesting permission to access Local Network is displayed. The string set in Value is displayed in the alert as the reason for using Local Network.
Expand Down Expand Up @@ -113,7 +113,7 @@ When communicating with a USB printer, a dialog box will appear asking for conne

If you do not want to display the connection permission dialog every time the USB cable is plugged in or unplugged, configure the following settings. This setting will also allow the application to start automatically when the USB cable is plugged.

##### 2.1. Add settings to AndroidManifest.xml
##### 3.1. Add settings to AndroidManifest.xml
Add the following `<intent-filter>` and `<meta-data>` elements to AndroidManifest.xml.

```xml
Expand All @@ -126,7 +126,7 @@ Add the following `<intent-filter>` and `<meta-data>` elements to AndroidManifes
<meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" android:resource="@xml/accessory_filter" />
```

##### 2.2. Add a resource file
##### 3.2. Add a resource file
Store the following resource files under `res/xml` with the names `device_filter.xml` and `accessory_filter.xml`.

- device_filter.xml
Expand Down Expand Up @@ -160,6 +160,8 @@ Store the following resource files under `res/xml` with the names `device_filter
<resources>
<usb-accessory model="Star TSP143IV-UE" manufacturer="STAR"/>
<usb-accessory model="Star TSP143IV-UE SK" manufacturer="STAR"/>
<usb-accessory model="Star TSP143IV-UEWB" manufacturer="STAR"/>
<usb-accessory model="Star TSP143IV-UEWB SK" manufacturer="STAR"/>
<usb-accessory model="mC-Print3" manufacturer="Star Micronics"/>
<usb-accessory model="mC-Label3" manufacturer="Star Micronics"/>
<usb-accessory model="mPOP" manufacturer="Star Micronics"/>
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ android {
minSdkVersion 28
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
versionCode 1
versionName "1.7.0"
versionName "1.8.0"
}

buildTypes {
Expand Down
Binary file modified android/src/lib/stario10.aar
Binary file not shown.
7 changes: 7 additions & 0 deletions android/src/main/java/com/stario10module/EventParameter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ class EventParameter {
const val KEY_RESERVED = "reserved"
const val KEY_CONNECTION_IDENTIFIER = "connectionIdentifier"

const val KEY_LAN_MAC_ADDRESS = "macAddress"
const val KEY_LAN_IP_ADDRESS = "ipAddress"
const val KEY_BT_ADDRESS = "bluetoothAddress"
const val KEY_BT_DEVICE_NAME = "bluetoothDeviceName"
const val KEY_USB_PORT_NAME = "usbPortName"
const val KEY_USB_USB_SN = "usbSerialNumber"

const val NAME_PRINTER_DELEGATE_READY = "PrinterReady"
const val NAME_PRINTER_DELEGATE_ERROR = "PrinterError"
const val NAME_PRINTER_DELEGATE_PAPER_READY = "PrinterPaperReady"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,36 @@ class StarDeviceDiscoveryManagerWrapper internal constructor(context: ReactAppli
)
)

params.putString(
EventParameter.KEY_LAN_MAC_ADDRESS,
printer.information?.detail?.lan?.macAddress ?: null
)

params.putString(
EventParameter.KEY_LAN_IP_ADDRESS,
printer.information?.detail?.lan?.ipAddress ?: null
)

params.putString(
EventParameter.KEY_BT_ADDRESS,
printer.information?.detail?.bluetooth?.address ?: null
)

params.putString(
EventParameter.KEY_BT_DEVICE_NAME,
printer.information?.detail?.bluetooth?.deviceName ?: null
)

params.putString(
EventParameter.KEY_USB_PORT_NAME,
printer.information?.detail?.usb?.portName ?: null
)

params.putString(
EventParameter.KEY_USB_USB_SN,
printer.information?.detail?.usb?.usbSerialNumber ?: null
)

sendEvent(EventParameter.NAME_PRINTER_FOUND, params)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.stario10module

import com.facebook.react.bridge.*
import com.starmicronics.stario10.*

class StarIO10ErrorDetailWrapper internal constructor(context: ReactApplicationContext) :
ReactContextBaseJavaModule(context) {
override fun getName(): String {
return "StarIO10ErrorDetailWrapper"
}

@ReactMethod
fun getAutoSwitchInterfaceLanErrorIdentifier(identifier: String, promise: Promise) {
getAutoSwitchInterfaceErrorIdentifier(identifier, promise, InterfaceType.Lan)
}

@ReactMethod
fun getAutoSwitchInterfaceBluetoothErrorIdentifier(identifier: String, promise: Promise) {
getAutoSwitchInterfaceErrorIdentifier(identifier, promise, InterfaceType.Bluetooth)
}

@ReactMethod
fun getAutoSwitchInterfaceUsbErrorIdentifier(identifier: String, promise: Promise) {
getAutoSwitchInterfaceErrorIdentifier(identifier, promise, InterfaceType.Usb)
}

@ReactMethod
fun getAutoSwitchInterfaceBluetoothLEErrorIdentifier(identifier: String, promise: Promise) {
getAutoSwitchInterfaceErrorIdentifier(identifier, promise, InterfaceType.BluetoothLE)
}

private fun getAutoSwitchInterfaceErrorIdentifier(identifier: String, promise: Promise, interfaceType: InterfaceType) {
val errorDetail = InstanceManager.get(identifier)

if (errorDetail is StarIO10ErrorDetail) {
val error = errorDetail.autoSwitchInterfaceOpenErrors?.get(interfaceType)

if (error != null) {
val errorIdentifier = InstanceManager.set(error)
promise.resolve(errorIdentifier)
} else {
promise.reject(ReactNoCrashSoftException("Not found Error of $identifier identifier"))
}
} else {
promise.reject(ReactNoCrashSoftException("Not found $identifier identifier"))
}
}

@ReactMethod
fun dispose(identifier: String, promise: Promise) {
InstanceManager.remove(identifier)

promise.resolve(0)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class StarIO10Package : ReactPackage {
modules.add(PageModeBuilderWrapper(reactContext))
modules.add(StarDeviceDiscoveryManagerWrapper(reactContext))
modules.add(StarIO10ErrorWrapper(reactContext))
modules.add(StarIO10ErrorDetailWrapper(reactContext))
modules.add(StarPrinterStatusWrapper(reactContext))
modules.add(StarSpoolJobStatusWrapper(reactContext))
modules.add(StarSpoolJobStatusListWrapper(reactContext))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,10 @@ class StarIO10ValueConverter {
value.javaClass.isArray -> {
writableMap.putArray(key, this.toWritableArray(value as Array<Any?>))
}

value is DrawerOpenedMethod ->{
writableMap.putString(key, this.toString(value))
}
}
}

Expand Down
14 changes: 14 additions & 0 deletions android/src/main/java/com/stario10module/StarPrinterWrapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,20 @@ class StarPrinterWrapper internal constructor(context: ReactApplicationContext)
promise.resolve(0)
}

@ReactMethod
fun getErrorDetail(identifier: String, promise: Promise) {
val printer = InstanceManager.get(identifier)

if (printer is StarPrinter) {
val errorDetail = printer.errorDetail
val errorDetailIdentifier = InstanceManager.set(errorDetail)

promise.resolve(errorDetailIdentifier)
} else {
promise.reject(StarIO10Exception("Identifier error"))
}
}

private fun sendEvent(eventName: String, @Nullable params: WritableMap) {
reactApplicationContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
Expand Down
17 changes: 17 additions & 0 deletions docs/CHANGELOG_JP.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
- [English](../CHANGELOG.md)


# 変更点

## 1.8.0 (2024/11/01)

* TSP100IV-UEWB およびTSP100IV-UEWB SK に対応
* プリンターの詳細情報を取得するAPIを追加
* StarPrinterInformationのdetailプロパティ
* StarPrinterInformationDetail
* StarPrinterInformationLan
* StarPrinterInformationBluetooth
* StarPrinterInformationBluetoothLE
* StarPrinterInformationUsb
* エラーの詳細情報を取得するAPIを追加
* StarPrinterのerrorDetailプロパティ
* StarIO10ErrorDetail
* 不具合修正
* Xcode16とiOS18の組み合わせで、LAN経由でプリンターの検索・通信に失敗する問題を修正 [#124](https://github.com/star-micronics/react-native-star-io10/issues/124)

## 1.7.0 (2024/06/24)

* BSC10II に対応
Expand Down
10 changes: 6 additions & 4 deletions docs/README_JP.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<p align="center">
<div style="text-align: center;">
<img
src="logo.png"
width="600"
style="margin-top: 20px; margin-bottom: 20px;"
/>
</p>
</div>


- [English](../README.md)
Expand Down Expand Up @@ -115,7 +115,7 @@ USBプリンターと通信を行うとき、接続許可を求めるダイ

USBケーブル挿抜の度に接続許可ダイアログを表示させないようにしたい場合、次の設定を行ってください。また、この設定を行うことで、USBケーブルを挿入したときにアプリケーションが自動で起動するようになります。

##### 2.2. AndroidManifest.xmlに設定を追加する
##### 3.1. AndroidManifest.xmlに設定を追加する
AndroidManifest.xmlに下記の `<intent-filter>` 要素と `<meta-data>` 要素を追加してください。

```xml
Expand All @@ -128,7 +128,7 @@ AndroidManifest.xmlに下記の `<intent-filter>` 要素と `<meta-data>` 要素
<meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" android:resource="@xml/accessory_filter" />
```

##### 2.2. リソースファイルを追加する
##### 3.2. リソースファイルを追加する
下記のリソースファイルを `res/xml` 以下に `device_filter.xml``accessory_filter.xml` という名前で保存してください。

- device_filter.xml
Expand Down Expand Up @@ -161,6 +161,8 @@ AndroidManifest.xmlに下記の `<intent-filter>` 要素と `<meta-data>` 要素
<resources>
<usb-accessory model="Star TSP143IV-UE" manufacturer="STAR"/>
<usb-accessory model="Star TSP143IV-UE SK" manufacturer="STAR"/>
<usb-accessory model="Star TSP143IV-UEWB" manufacturer="STAR"/>
<usb-accessory model="Star TSP143IV-UEWB SK" manufacturer="STAR"/>
<usb-accessory model="mC-Print3" manufacturer="Star Micronics"/>
<usb-accessory model="mC-Label3" manufacturer="Star Micronics"/>
<usb-accessory model="mPOP" manufacturer="Star Micronics"/>
Expand Down
29 changes: 23 additions & 6 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
**/.xcode.env.local

# Android/IntelliJ
#
Expand All @@ -33,6 +34,9 @@ local.properties
# Visual Studio Code
#
.vscode/
.cxx/
*.keystore
!debug.keystore

# node.js
#
Expand All @@ -53,15 +57,28 @@ buck-out/
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots
**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots
**/fastlane/test_output

# Bundle artifact
*.jsbundle

# CocoaPods
/ios/Pods/
# Ruby / CocoaPods
**/Pods/
/vendor/bundle/

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

# testing
/coverage
/coverage

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
Loading

0 comments on commit 3bb6f37

Please sign in to comment.