Skip to content

Commit

Permalink
V1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bandit-ibayashi committed Apr 17, 2023
1 parent e679d37 commit be6635f
Show file tree
Hide file tree
Showing 190 changed files with 139,056 additions and 3,944 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

# Change Log

## 1.3.0 (2023/03/31)

* Added mC-Label3 support.
* Added internal processing required for Bluetooth changes of SM-S210i, SM-S230i, SM-T300i and SM-T400i.
* Updated React Native version to 0.71.4.
* Added API for spooler function.
* Added API for Page Mode.
* Added API for setting/getting Star Configuration.
* Added API for getting detailed status.
* Added printing samples of the spooler function and several samples of printing patterns for labels to the example app.
* iOS: Supported for Xcode 14.
* Changed to not include Bitcode based on Apple policy.
* Windows: Supported for Visual Studio 2022.
* Windows: Added a specification that the model can be estimated and acquired for some printers with Bluetooth device name set to the initial value (TSP100IIIBI, mPOP, mC-Print2/3, mC-Label3 and SM-L200/300) when using the StarDeviceDiscoveryManager class.

* Bug Fix:
* Fixed an issue that command generation does not execute when adding a Builder immediately after instantiation. [#72](https://github.com/star-micronics/react-native-star-io10/issues/72)

* Android
* Fixed a rare crash while performing a discovery.
* Fixed an issue that printing may fail via USB in certain devices and will not recover after failure without the USB cable removal and insertion.

## 1.2.0 (2022/05/10)

* Added POP10CI support.
Expand Down
184 changes: 22 additions & 162 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@

This library is included in StarXpand SDK.

## Documentation

Please refer [here](https://www.star-m.jp/react-native-stario10-oml.html) for StarXpand SDK documentation.

Documentation includes an overview of the SDK, how to build a sample application, how to use the API, and a API reference.

## Requirements

| Platform | Version | Arch |
| --- | --- | --- |
| iOS | iOS 12.0 or later | Device: arm64<br> Simulator: x86_64, arm64 |
| Android | Android 6.0 or later | arm64-v8a, armeabi-v7a, x86, x86_64 |
| Windows | Windows 10 1909 or later | x86, x64 |
| Windows | Windows 11 / Windows 10 1909 or later | x86, x64 |

## Installation

Expand Down Expand Up @@ -79,25 +85,8 @@ https://star-m.jp/eng/products/s_print/apple_app_mfi.html
> :warning: In case of a Bluetooth Low Energy printer, you do not need to obtain this app approval.
### Android
#### In case of setting targetSdkVersion to 31 or later
Refer to [sample code](example/samples) and request BLUETOOTH_CONNECT permission before starting to communicate with or search for the printer.

#### In case of setting targetSdkVersion to 30 or earlier
The `react-native-star-io10` library contains the BLUETOOTH_CONNECT permission, which was added at API level 31. Please make the following two settings in AndroidManifest.xml to remove the BLUETOOTH_CONNECT permission.

* Add the `xmlns:tools="http://schemas.android.com/tools"` attribute to the `manifest` element.
* Add the `<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" tools:node="remove"/>` element.

```xml
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.starmicronics.starxpandsdk">

<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" tools:node="remove"/>
...
</manifest>
```
Refer to [sample code](example/samples) and request BLUETOOTH_CONNECT permission before starting to communicate with or search for the printer.

### Windows

Expand All @@ -107,11 +96,11 @@ The `react-native-star-io10` library contains the BLUETOOTH_CONNECT permission,
- Private Networks (Client & Server)
- Add "Visual C++ 2015-2019 UWP Desktop Runtime for native apps" to the project "References".

## Documentation
## Limitations

[Please refer here.](https://www.star-m.jp/react-native-stario10-oml.html)
### Cannot build for Windows x86

## Limitations
StarXpand SDK V1.3.0 using React Native for Windows V0.71.3 cannot be built for Windows x86 architecture, available only for x64 architecture.

### When using Android device, an image specified by URL is sometimes printed in a low resolution

Expand All @@ -124,153 +113,25 @@ This can be solved by either of the following methods:

## Examples

### Discover devices
StarXpand SDK includes an [example](example) application that can be used in combination with the printer to check its operation. Please use it in conjunction with the explanations of each function in the linked pages.

```typescript
manager: StarDeviceDiscoveryManager;
#### 1. [Discover printers](https://star-m.jp/products/s_print/sdk/react-native-star-io10/manual/en/searchPrinter.html)

async discover(): Promise<void> {
try {
// Specify your printer interface types.
manager = await StarDeviceDiscoveryManagerFactory.create([
InterfaceType.Lan,
InterfaceType.Bluetooth,
InterfaceType.BluetoothLE,
InterfaceType.Usb
]);

// Set discovery time. (option)
manager.discoveryTime = 10000;

// Callback for printer found.
manager.onPrinterFound = (printer: StarPrinter) => {
console.log(printer);
};

// Callback for discovery finished. (option)
manager.onDiscoveryFinished = () => {
console.log(`Discovery finished.`);
};

// Start discovery.
await manager.startDiscovery();

// Stop discovery.
// await manager.stopDiscovery()
}
catch(error) {
// Error.
console.log(error);
}
}
```
#### 2. [Create printing data](https://star-m.jp/products/s_print/sdk/react-native-star-io10/manual/en/basic-step1.html)

### Print
Printing samples of labels (sample code and print results) for each type of business that you can use for your print layouts are [also available](example/samples/printing_samples/PrintingSamples.md).

```typescript
async print(): Promise<void> {
// Specify your printer connection settings.
var settings = new StarConnectionSettings();
settings.interfaceType = InterfaceType.Lan;
settings.identifier = '00:11:62:00:00:00';
var printer = new StarPrinter(settings);
> :warning: Some printer models may not be able to print some samples. Please adjust the layout accordingly when using this samples.
try {
// Connect to the printer.
await printer.open();
#### 3. [Send printing data](https://star-m.jp/products/s_print/sdk/react-native-star-io10/manual/en/basic-step2.html)

// create printing data. (Please refer to 'Create Printing data')
var builder = new StarXpandCommand.StarXpandCommandBuilder();
// ...
var commands = await builder.getCommands();
#### 4. [Send printing data using spooler function](https://star-m.jp/products/s_print/sdk/react-native-star-io10/manual/en/spooler.html)

// Print.
await printer.print(commands);
}
catch(error) {
// Error.
console.log(error);
}
finally {
// Disconnect from the printer and dispose object.
await printer.close();
await printer.dispose();
}
}
```
#### 5. [Get printer status](#GetPrinterStatus)

### Create printing data

```typescript
// Create printing data using StarXpandCommandBuilder object.
var builder = new StarXpandCommand.StarXpandCommandBuilder();
builder.addDocument(new StarXpandCommand.DocumentBuilder()
.addPrinter(new StarXpandCommand.PrinterBuilder()
.actionPrintImage(new StarXpandCommand.Printer.ImageParameter("logo_01.png", 406))
.styleInternationalCharacter(StarXpandCommand.Printer.InternationalCharacterType.Usa)
.styleCharacterSpace(0)
.styleAlignment(StarXpandCommand.Printer.Alignment.Center)
.actionPrintText("Star Clothing Boutique\n" +
"123 Star Road\n" +
"City, State 12345\n" +
"\n")
.styleAlignment(StarXpandCommand.Printer.Alignment.Left)
.actionPrintText("Date:MM/DD/YYYY Time:HH:MM PM\n" +
"--------------------------------\n" +
"\n")
.actionPrintText("SKU Description Total\n" +
"300678566 PLAIN T-SHIRT 10.99\n" +
"300692003 BLACK DENIM 29.99\n" +
"300651148 BLUE DENIM 29.99\n" +
"300642980 STRIPED DRESS 49.99\n" +
"300638471 BLACK BOOTS 35.99\n" +
"\n" +
"Subtotal 156.95\n" +
"Tax 0.00\n" +
"--------------------------------\n")
.actionPrintText("Total ")
.add(new StarXpandCommand.PrinterBuilder()
.styleMagnification(new StarXpandCommand.MagnificationParameter(2, 2))
.actionPrintText(" $156.95\n")
)
.actionPrintText("--------------------------------\n" +
"\n" +
"Charge\n" +
"156.95\n" +
"Visa XXXX-XXXX-XXXX-0123\n" +
"\n")
.add(new StarXpandCommand.PrinterBuilder()
.styleInvert(true)
.actionPrintText("Refunds and Exchanges\n")
)
.actionPrintText("Within ")
.add(new StarXpandCommand.PrinterBuilder()
.styleUnderLine(true)
.actionPrintText("30 days")
)
.actionPrintText(" with receipt\n")
.actionPrintText("And tags attached\n" +
"\n")
.styleAlignment(StarXpandCommand.Printer.Alignment.Center)
.actionPrintBarcode(new StarXpandCommand.Printer.BarcodeParameter('0123456',
StarXpandCommand.Printer.BarcodeSymbology.Jan8)
.setBarDots(3)
.setBarRatioLevel(StarXpandCommand.Printer.BarcodeBarRatioLevel.Level0)
.setHeight(5)
.setPrintHri(true))
.actionFeedLine(1)
.actionPrintQRCode(new StarXpandCommand.Printer.QRCodeParameter('Hello World.\n')
.setModel(StarXpandCommand.Printer.QRCodeModel.Model2)
.setLevel(StarXpandCommand.Printer.QRCodeLevel.L)
.setCellSize(8))
.actionCut(StarXpandCommand.Printer.CutType.Partial)
)
);

// Get printing data from StarXpandCommandBuilder object.
var commands = await builder.getCommands();
```
#### 6. [Monitor printer](#MonitorPrinter)

<a id="GetPrinterStatus"></a>
### Get printer status

```typescript
Expand Down Expand Up @@ -301,6 +162,7 @@ async getStatus(): Promise<void> {
}
```

<a id="MonitorPrinter"></a>
### Monitor printer

```typescript
Expand Down Expand Up @@ -340,8 +202,6 @@ async monitor(): Promise<void> {
}
```

- [`example` project is located in this directory.](example)

## Copyright

Copyright 2021 Star Micronics Co., Ltd. All rights reserved.
10 changes: 5 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.facebook.react:react-native-gradle-plugin")
// noinspection DifferentKotlinGradleVersion
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Expand All @@ -32,8 +33,7 @@ android {
minSdkVersion 23
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
versionCode 1
versionName "0.1.0"

versionName "1.3.0"
}

buildTypes {
Expand Down Expand Up @@ -127,8 +127,8 @@ dependencies {
api 'com.facebook.react:react-native:+'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation files('src/lib/stario10.aar')
def coroutines_version = '1.3.7' //Kotlin coroutines用ライブラリ(async, await)のバージョン
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" //Kotlin coroutines用ライブラリ(async, await)
def coroutines_version = '1.3.7' // Version of the library for Kotlin coroutines (async, await)
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" // Library for Kotlin coroutines (async, await)
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
}
8 changes: 4 additions & 4 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
StarIO10Module_kotlinVersion=1.4.10
StarIO10Module_compileSdkVersion=31
StarIO10Module_buildToolsVersion=30.0.2
StarIO10Module_targetSdkVersion=31
StarIO10Module_kotlinVersion=1.6.10
StarIO10Module_compileSdkVersion=33
StarIO10Module_buildToolsVersion=33.0.0
StarIO10Module_targetSdkVersion=33

# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
Expand Down
Binary file modified android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
Loading

0 comments on commit be6635f

Please sign in to comment.