@rdlabo/capacitor-brotherprint 8.1.1 → 8.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +60 -249
- package/android/src/main/java/jp/rdlabo/capacitor/plugin/brotherprint/BluetoothPrinterFilter.kt +12 -0
- package/android/src/main/java/jp/rdlabo/capacitor/plugin/brotherprint/BrotherPrint.kt +120 -60
- package/dist/docs.json +3 -3
- package/dist/esm/definitions.d.ts +2 -2
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/interfaces.d.ts +6 -0
- package/dist/esm/interfaces.js.map +1 -1
- package/docs/events.md +58 -0
- package/docs/installation.md +133 -0
- package/docs/print.md +36 -0
- package/docs/search.md +106 -0
- package/docs/usage.md +76 -0
- package/ios/Sources/BrotherPrintPlugin/BrotherPrintPlugin.swift +34 -20
- package/ios/Sources/BrotherPrintPlugin/Info.plist +3 -1
- package/ios/Sources/BrotherPrintPlugin/PrintImageDecoder.swift +9 -0
- package/ios/Tests/BrotherPrintPluginTests/BrotherPrintPluginTests.swift +31 -10
- package/package.json +7 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020-present Masahiko Sakakibara
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,272 +1,55 @@
|
|
|
1
1
|
# @rdlabo/capacitor-brotherprint
|
|
2
2
|
|
|
3
|
-
Capacitor Brother Print
|
|
3
|
+
Capacitor Brother Print binds the native Brother Print SDK for iOS and Android so you can search supported Brother label printers and print images from a Capacitor app.
|
|
4
4
|
|
|
5
|
-
**This plugin is still in the RC (release candidate) phase.**
|
|
5
|
+
**This plugin is still in the RC (release candidate) phase.** iOS requires **Swift Package Manager** and a minimum of **iOS 15**. The Brother Print SDK is not compatible with CocoaPods for this plugin.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<!-- rdlabo-docs-omit -->
|
|
8
|
+
**Documentation:** [Read the full documentation](https://docs.rdlabo.dev/projects/capacitor-brotherprint)
|
|
9
|
+
<!-- /rdlabo-docs-omit -->
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
npm install @rdlabo/capacitor-brotherprint
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
For SDK placement, SPM layout, and permissions, see [Installation](https://docs.rdlabo.dev/projects/capacitor-brotherprint/docs/installation).
|
|
18
|
+
|
|
19
|
+
## Print your first label
|
|
20
|
+
|
|
21
|
+
1. [Installation](https://docs.rdlabo.dev/projects/capacitor-brotherprint/docs/installation) — npm install, place the Brother SDK, permissions, then `npx cap sync`.
|
|
22
|
+
2. [Search](https://docs.rdlabo.dev/projects/capacitor-brotherprint/docs/search) — register `onPrinterAvailable`, keep the discovered channel, run Wi-Fi (or other) search.
|
|
23
|
+
3. [Print](https://docs.rdlabo.dev/projects/capacitor-brotherprint/docs/print) — print with that channel, a supported model/label, and a real base64 image you prepare.
|
|
24
|
+
4. [Events](https://docs.rdlabo.dev/projects/capacitor-brotherprint/docs/events) — print success and error listeners in more detail.
|
|
8
25
|
|
|
9
26
|
## Supported models
|
|
10
27
|
|
|
11
|
-
Each product link is an Amazon affiliate link.
|
|
28
|
+
Each product link is an Amazon affiliate link. Purchases through these links help support development costs.
|
|
12
29
|
|
|
13
30
|
| Product | Model | iOS/WiFi | iOS/BT | iOS/BLE | Android/USB | Android/WiFi | Android/BT | Android/BLE |
|
|
14
31
|
| ------------------------------------- | ------------ | -------- | ------ | ------- | ----------- | ------------ | ---------- | ----------- |
|
|
15
|
-
| QL-810W | QL_810W |
|
|
16
|
-
| [QL-820NWB](https://amzn.to/3BXQ1aj) | QL_820NWB |
|
|
17
|
-
| [QL-820NWBc](https://amzn.to/4fjhUIe) | QL_820NWB |
|
|
18
|
-
| [TD-2320D](https://amzn.to/48EFCN3) | TD_2320D_203 |
|
|
19
|
-
| [TD-2350D](https://amzn.to/48ma6TK) | TD_2350D_300 |
|
|
32
|
+
| QL-810W | QL_810W | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ |
|
|
33
|
+
| [QL-820NWB](https://amzn.to/3BXQ1aj) | QL_820NWB | ✅ | ※1 | ❌ | △ | ✅ | △ | ❌ |
|
|
34
|
+
| [QL-820NWBc](https://amzn.to/4fjhUIe) | QL_820NWB | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ | ❌ |
|
|
35
|
+
| [TD-2320D](https://amzn.to/48EFCN3) | TD_2320D_203 | ❌ | ❌ | ❌ | △ | ❌ | ❌ | ❌ |
|
|
36
|
+
| [TD-2350D](https://amzn.to/48ma6TK) | TD_2350D_300 | ✅ | △ | △ | ✅ | ✅ | ✅ | △ |
|
|
20
37
|
|
|
21
|
-
Amazon Affiliate Links:
|
|
38
|
+
Amazon Affiliate Links: **https://amzn.to/3AiiOFT**
|
|
22
39
|
|
|
23
40
|
**Supplement**
|
|
24
41
|
|
|
25
42
|
| | description |
|
|
26
43
|
| --- | -------------------------- |
|
|
27
|
-
|
|
|
44
|
+
| ✅ | Supported and tested |
|
|
28
45
|
| △ | Implemented but not tested |
|
|
29
46
|
| - | Plugin is not supported |
|
|
30
|
-
|
|
|
47
|
+
| ❌ | Device is not supported |
|
|
31
48
|
| BT | Bluetooth |
|
|
32
49
|
| BLE | Bluetooth Low Energy |
|
|
33
50
|
|
|
34
51
|
※1 Due to low Bluetooth version, connection is not possible with iOS. Ref: https://okbizcs.okwave.jp/brother/qa/q9932082.html
|
|
35
52
|
|
|
36
|
-
※2 The iOS/BT implementation for the QL-820NWBc is in place, but it’s uncertain if it functions correctly. It’s unclear whether this is an implementation issue, as Brother’s official app also doesn’t work well.
|
|
37
|
-
|
|
38
|
-
## How to install
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
% npm install @rdlabo/capacitor-brotherprint
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Initialize the Brother SDK
|
|
45
|
-
|
|
46
|
-
### Android configuration
|
|
47
|
-
|
|
48
|
-
1. Place the following files in the android folder of your Capacitor project:
|
|
49
|
-
|
|
50
|
-
- `android/BrotherPrintLibrary/BrotherPrintLibrary.aar`
|
|
51
|
-
- `android/BrotherPrintLibrary/build.gradle`
|
|
52
|
-
|
|
53
|
-
The `BrotherPrintLibrary.aar` file is the Brother Print SDK library, which you can download from the Brother website: https://support.brother.co.jp/j/s/es/dev/ja/mobilesdk/android/index.html?c=jp&lang=ja&navi=offall&comple=on&redirect=on#ver4
|
|
54
|
-
|
|
55
|
-
2. In the `android/BrotherPrintLibrary/build.gradle file`, include the following content:
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
configurations.maybeCreate(“default”)
|
|
59
|
-
artifacts.add(“default”, file('BrotherPrintLibrary.aar'))
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
3. Open `android/settings.gradle` and add the following lines:
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
include ':BrotherPrintLibrary'
|
|
66
|
-
project(':BrotherPrintLibrary').projectDir = new File('./BrotherPrintLibrary/')
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
These steps will integrate the Brother Print SDK with your Capacitor Android project.
|
|
70
|
-
|
|
71
|
-
### iOS configuration
|
|
72
|
-
|
|
73
|
-
1. Place the following files in the ios folder of your Capacitor project:
|
|
74
|
-
|
|
75
|
-
- `ios/LocalPackages/BRLMPrinterKit/Sources/BRLMPrinterKit.xcframework`
|
|
76
|
-
- `ios/LocalPackages/BRLMPrinterKit/BRLMPrinterKit.podspec`
|
|
77
|
-
- `ios/LocalPackages/BRLMPrinterKit/Package.swift`
|
|
78
|
-
|
|
79
|
-
The `BRLMPrinterKit.xcframework` file is the Brother Print SDK library, which you can download from the Brother website: https://support.brother.co.jp/j/s/es/dev/ja/mobilesdk/android/index.html?c=jp&lang=ja&navi=offall&comple=on&redirect=on#ver4
|
|
80
|
-
|
|
81
|
-
`BRLMPrinterKit.podspec` content is here:
|
|
82
|
-
|
|
83
|
-
```podspec
|
|
84
|
-
Pod::Spec.new do |s|
|
|
85
|
-
s.name = 'BRLMPrinterKit'
|
|
86
|
-
s.version = '4.12.0'
|
|
87
|
-
s.homepage = 'https://support.brother.co.jp/j/s/support/html/mobilesdk/index.html'
|
|
88
|
-
s.source = { :path => './Sources' }
|
|
89
|
-
s.summary = "Pod for the BRLMPrinterKit / Brother's printers"
|
|
90
|
-
s.description = "This project is only a Pod for the Brother SDK v#{s.version}"
|
|
91
|
-
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
|
92
|
-
s.author = { 'Masahiko Sakakibara' => 'sakakibara@rdlabo.jp' }
|
|
93
|
-
s.ios.deployment_target = '11.0'
|
|
94
|
-
s.ios.vendored_frameworks = 'Sources/BRLMPrinterKit.xcframework'
|
|
95
|
-
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
|
|
96
|
-
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
|
|
97
|
-
end
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
`Package.swift` content is here:
|
|
101
|
-
|
|
102
|
-
```swift
|
|
103
|
-
// swift-tools-version: 5.9
|
|
104
|
-
import PackageDescription
|
|
105
|
-
|
|
106
|
-
let package = Package(
|
|
107
|
-
name: "BRLMPrinterKit",
|
|
108
|
-
platforms: [
|
|
109
|
-
.iOS(.v13)
|
|
110
|
-
],
|
|
111
|
-
products: [
|
|
112
|
-
.library(name: "BRLMPrinterKit", targets: ["BRLMPrinterKit"])
|
|
113
|
-
],
|
|
114
|
-
targets: [
|
|
115
|
-
.binaryTarget(
|
|
116
|
-
name: "BRLMPrinterKit",
|
|
117
|
-
path: "Sources/BRLMPrinterKit.xcframework"
|
|
118
|
-
)
|
|
119
|
-
]
|
|
120
|
-
)
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
2. Update the `ios/App/Podfile` file at your project.
|
|
124
|
-
|
|
125
|
-
```diff
|
|
126
|
-
target 'App' do
|
|
127
|
-
capacitor_pods
|
|
128
|
-
# Add your Pods here
|
|
129
|
-
+ pod 'BRLMPrinterKit', :path => '../LocalPackages/BRLMPrinterKit'
|
|
130
|
-
end
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
After set, run `pod update` in the `ios` directory.
|
|
134
|
-
|
|
135
|
-
## Permission configuration
|
|
136
|
-
|
|
137
|
-
### Android configuration
|
|
138
|
-
|
|
139
|
-
Update `AndroidManifest.xml` to include the following permissions:
|
|
140
|
-
|
|
141
|
-
```diff
|
|
142
|
-
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
143
|
-
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
144
|
-
+ xmlns:tools="http://schemas.android.com/tools">
|
|
145
|
-
...
|
|
146
|
-
+ <!-- For Bluetooth -->
|
|
147
|
-
+ <uses-permission android:name="android.permission.BLUETOOTH" />
|
|
148
|
-
+ <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
|
149
|
-
+ <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
|
150
|
-
|
|
151
|
-
+ <!-- For Bluetooth Low Energy, Android 11 and earlier-->
|
|
152
|
-
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
153
|
-
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
154
|
-
|
|
155
|
-
+ <!-- For Bluetooth Low Energy, Android 12 and later -->
|
|
156
|
-
+ <uses-permission android:name="android.permission.BLUETOOTH_SCAN"
|
|
157
|
-
+ android:usesPermissionFlags="neverForLocation"
|
|
158
|
-
+ tools:targetApi="s" />
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
More information is here: https://support.brother.co.jp/j/s/support/html/mobilesdk/guide/getting-started/getting-started-android.html
|
|
162
|
-
|
|
163
|
-
### iOS configuration
|
|
164
|
-
|
|
165
|
-
Update `Info.plist` to include the following permissions:
|
|
166
|
-
|
|
167
|
-
```diff
|
|
168
|
-
+ <key>NSBluetoothAlwaysUsageDescription</key>
|
|
169
|
-
+ <string>【Why use Bluetooth for your app.】</string>
|
|
170
|
-
+ <key>NSBluetoothPeripheralUsageDescription</key>
|
|
171
|
-
+ <string>【Why use Bluetooth for your app.】</string>
|
|
172
|
-
+ <key>NSBonjourServices</key>
|
|
173
|
-
+ <array>
|
|
174
|
-
+ <string>_pdl-datastream._tcp</string>
|
|
175
|
-
+ <string>_printer._tcp</string>
|
|
176
|
-
+ <string>_ipp._tcp</string>
|
|
177
|
-
+ </array>
|
|
178
|
-
+ <key>NSLocalNetworkUsageDescription</key>
|
|
179
|
-
+ <string>【Why use WiFi for your app.】</string>
|
|
180
|
-
+ <key>UISupportedExternalAccessoryProtocols</key>
|
|
181
|
-
+ <string>com.brother.ptcbp</string>
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
More information is here: https://support.brother.co.jp/j/s/support/html/mobilesdk/guide/getting-started/getting-started-ios.html
|
|
185
|
-
|
|
186
|
-
## How to use
|
|
187
|
-
|
|
188
|
-
```typescript
|
|
189
|
-
@Component({
|
|
190
|
-
selector: 'brother-print',
|
|
191
|
-
templateUrl: 'brother.component.html',
|
|
192
|
-
styleUrls: ['brother.component.scss'],
|
|
193
|
-
})
|
|
194
|
-
export class BrotherComponent implements OnInit, OnDestroy {
|
|
195
|
-
readonly #listenerHandlers: PluginListenerHandle[] = [];
|
|
196
|
-
readonly printers = signal<BRLMChannelResult[]>([]);
|
|
197
|
-
|
|
198
|
-
async ngOnInit() {
|
|
199
|
-
this.#listenerHandlers.push(
|
|
200
|
-
await BrotherPrint.addListener(BrotherPrintEventsEnum.onPrint, () => {
|
|
201
|
-
console.log('onPrint');
|
|
202
|
-
}),
|
|
203
|
-
);
|
|
204
|
-
this.#listenerHandlers.push(
|
|
205
|
-
await BrotherPrint.addListener(
|
|
206
|
-
BrotherPrintEventsEnum.onPrintError,
|
|
207
|
-
info => {
|
|
208
|
-
console.log('onPrintError');
|
|
209
|
-
},
|
|
210
|
-
),
|
|
211
|
-
);
|
|
212
|
-
this.#listenerHandlers.push(
|
|
213
|
-
await BrotherPrint.addListener(
|
|
214
|
-
BrotherPrintEventsEnum.onPrintFailedCommunication,
|
|
215
|
-
info => {
|
|
216
|
-
console.log('onPrintFailedCommunication');
|
|
217
|
-
},
|
|
218
|
-
),
|
|
219
|
-
);
|
|
220
|
-
this.#listenerHandlers.push(
|
|
221
|
-
await BrotherPrint.addListener(
|
|
222
|
-
BrotherPrintEventsEnum.onPrinterAvailable,
|
|
223
|
-
printer => {
|
|
224
|
-
this.printers.update(prev => [...prev, printer]);
|
|
225
|
-
},
|
|
226
|
-
),
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
async ngOnDestroy() {
|
|
231
|
-
this.#listenerHandlers.forEach(handler => handler.remove());
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
async searchPrinter(port: BRKMPrinterPort) {
|
|
235
|
-
// This method return void. Get the printer list by listening to the event.
|
|
236
|
-
await BrotherPrint.search({
|
|
237
|
-
port,
|
|
238
|
-
searchDuration: 15, // seconds
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
print() {
|
|
243
|
-
if (this.printers().length === 0) {
|
|
244
|
-
console.error('No printer found');
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
const defaultPrintSettings: BRLMPrintOptions = {
|
|
249
|
-
modelName: BRLMPrinterModelName.QL_820NWB,
|
|
250
|
-
labelName: BRLMPrinterLabelName.RollW62,
|
|
251
|
-
encodedImage: 'base64 removed mime-type', // base64
|
|
252
|
-
numberOfCopies: 1, // default 1
|
|
253
|
-
autoCut: true, // default true
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
BrotherPrint.printImage({
|
|
257
|
-
...defaultPrintSettings,
|
|
258
|
-
...{
|
|
259
|
-
port: this.printers()[0].port,
|
|
260
|
-
channelInfo: this.printers()[0].channelInfo,
|
|
261
|
-
},
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
See demo for complete code:
|
|
268
|
-
https://github.com/rdlabo-team/capacitor-brotherprint/blob/main/demo/src/app/home/home.page.ts
|
|
269
|
-
|
|
270
53
|
## API
|
|
271
54
|
|
|
272
55
|
<docgen-index>
|
|
@@ -341,7 +124,7 @@ you can use it to verify whether it is currently usable.
|
|
|
341
124
|
cancelSearchWiFiPrinter() => Promise<void>
|
|
342
125
|
```
|
|
343
126
|
|
|
344
|
-
|
|
127
|
+
Stop an active search before its timeout, including when leaving the screen.
|
|
345
128
|
|
|
346
129
|
--------------------
|
|
347
130
|
|
|
@@ -352,7 +135,7 @@ Basically, it times out, so there is no need to use it. Use it when you want to
|
|
|
352
135
|
cancelSearchBluetoothPrinter() => Promise<void>
|
|
353
136
|
```
|
|
354
137
|
|
|
355
|
-
|
|
138
|
+
Stop an active search before its timeout, including when leaving the screen.
|
|
356
139
|
|
|
357
140
|
--------------------
|
|
358
141
|
|
|
@@ -499,7 +282,7 @@ These are optional. If these are not set, default values are assigned by the pri
|
|
|
499
282
|
|
|
500
283
|
#### BRLMSearchOption
|
|
501
284
|
|
|
502
|
-
<code>{ /** * 'usb' is android only, and now developing. */ port: <a href="#brlmprinterport">BRLMPrinterPort</a>; /** * searchDuration is the time to end search for devices. * default is 15 seconds. * use only port is 'wifi' or 'bluetoothLowEnergy'. */ searchDuration: number; }</code>
|
|
285
|
+
<code>{ /** * 'usb' is android only, and now developing. */ port: <a href="#brlmprinterport">BRLMPrinterPort</a>; /** * searchDuration is the time to end search for devices. * default is 15 seconds. * use only port is 'wifi' or 'bluetoothLowEnergy'. */ searchDuration: number; /** * Android Bluetooth Classic only. Include only devices whose Bluetooth class * reports a printer. Defaults to false; ignored for other ports and on iOS. * This does not identify Brother devices. Devices with an unknown class are excluded when true. */ bluetoothPrintersOnly?: boolean; }</code>
|
|
503
286
|
|
|
504
287
|
|
|
505
288
|
#### isChannelAvailableResult
|
|
@@ -676,3 +459,31 @@ These are optional. If these are not set, default values are assigned by the pri
|
|
|
676
459
|
| **`onPrintError`** | <code>'onPrintError'</code> |
|
|
677
460
|
|
|
678
461
|
</docgen-api>
|
|
462
|
+
|
|
463
|
+
<!-- rdlabo-docs-omit -->
|
|
464
|
+
## Prerelease channels
|
|
465
|
+
|
|
466
|
+
An open, non-draft pull request can be published to the npm `beta` dist-tag after its `Validation` and `Package Candidate` workflows pass. A repository owner or maintainer must add a comment whose entire body is:
|
|
467
|
+
|
|
468
|
+
```text
|
|
469
|
+
/beta
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
The request authorizes only the pull request head SHA that existed when the comment was added. The workflow revalidates the owner or maintainer permission and head SHA immediately before publishing. Any new commit requires CI to pass again and a fresh owner or maintainer `/beta` comment. Fork pull requests are supported. Pull requests that change a release-gating workflow cannot be beta-published until those workflow changes land on `main`.
|
|
473
|
+
|
|
474
|
+
Beta versions use `<base>-beta.pr<PR number>.sha<12-character SHA>`. The candidate is built in a read-only workflow without npm publishing credentials. The privileged release workflow publishes only the validated immutable package artifact with lifecycle scripts disabled. A notification failure cannot invalidate a successful npm publish.
|
|
475
|
+
|
|
476
|
+
When a pull request is merged into `main`, it is automatically published to `beta` only after the required CI and `Package Candidate` succeed for that exact merge commit. Direct pushes to `main` do not publish a candidate.
|
|
477
|
+
|
|
478
|
+
Only `npm run release` creates a release tag. Stable `vX.Y.Z` tags publish to npm `latest`; revision/prerelease tags publish to `next`. Neither `beta` nor `next` publishing changes the npm `latest` dist-tag.
|
|
479
|
+
|
|
480
|
+
## Maintainers
|
|
481
|
+
|
|
482
|
+
- [rdlabo](https://rdlabo.dev/)
|
|
483
|
+
<!-- /rdlabo-docs-omit -->
|
|
484
|
+
|
|
485
|
+
<!-- rdlabo-docs-omit -->
|
|
486
|
+
## License
|
|
487
|
+
|
|
488
|
+
MIT
|
|
489
|
+
<!-- /rdlabo-docs-omit -->
|
package/android/src/main/java/jp/rdlabo/capacitor/plugin/brotherprint/BluetoothPrinterFilter.kt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package jp.rdlabo.capacitor.plugin.brotherprint
|
|
2
|
+
|
|
3
|
+
internal fun matchesBluetoothPrinterFilter(printersOnly: Boolean = false, deviceClass: () -> Int?): Boolean {
|
|
4
|
+
if (!printersOnly) return true
|
|
5
|
+
val value = deviceClass()
|
|
6
|
+
// Brother QL-820NWB / TD-2350D reported Bluetooth Class of Device 0x140680.
|
|
7
|
+
// Match its Imaging/Printer bits, not the entire value: Android's deviceClass
|
|
8
|
+
// omits service bits (0x140000), and other printers can report 0x000680.
|
|
9
|
+
// Class of Device: major Imaging (0x0600), minor Printer bit (0x0080).
|
|
10
|
+
// Other imaging capabilities (e.g. Scanner) may be set alongside Printer.
|
|
11
|
+
return value != null && (value and 0x1F80) == 0x0680
|
|
12
|
+
}
|