@rdlabo/capacitor-brotherprint 6.0.2 → 6.0.3
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/README.md +42 -38
- package/ios/Podfile +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# @rdlabo/capacitor-brotherprint
|
|
2
|
+
|
|
2
3
|
Capacitor Brother Print is a native Brother Print SDK implementation for iOS & Android. This plugin can use in `QL-820NW` and `QL-800`.
|
|
3
4
|
|
|
4
5
|
## How to install
|
|
6
|
+
|
|
5
7
|
```
|
|
6
8
|
% npm install @rdlabo/capacitor-brotherprint@git@github.com:rdlabo-team/capacitor-brotherprint.git
|
|
7
9
|
```
|
|
@@ -16,82 +18,84 @@ import { BrotherPrintOptions } from '@rdlabo/capacitor-brotherprint';
|
|
|
16
18
|
@Component({
|
|
17
19
|
selector: 'brother-print',
|
|
18
20
|
templateUrl: 'brother.component.html',
|
|
19
|
-
styleUrls: ['brother.component.scss']
|
|
21
|
+
styleUrls: ['brother.component.scss'],
|
|
20
22
|
})
|
|
21
23
|
export class BrotherComponent {
|
|
22
24
|
constructor() {
|
|
23
25
|
// Success to print
|
|
24
|
-
BrotherPrint.addListener('onPrint',
|
|
25
|
-
console.log(
|
|
26
|
+
BrotherPrint.addListener('onPrint', info => {
|
|
27
|
+
console.log('onPrint');
|
|
26
28
|
});
|
|
27
29
|
// Failed to communication with printer
|
|
28
|
-
BrotherPrint.addListener('onPrintError',
|
|
29
|
-
console.log(
|
|
30
|
+
BrotherPrint.addListener('onPrintError', info => {
|
|
31
|
+
console.log('onPrintError');
|
|
30
32
|
});
|
|
31
33
|
// Failed to communication with printer
|
|
32
|
-
BrotherPrint.addListener('onPrintFailedCommunication',
|
|
33
|
-
console.log(
|
|
34
|
+
BrotherPrint.addListener('onPrintFailedCommunication', info => {
|
|
35
|
+
console.log('onPrintFailedCommunication');
|
|
34
36
|
});
|
|
35
37
|
}
|
|
36
38
|
print() {
|
|
37
39
|
BrotherPrint.printImage({
|
|
38
40
|
printerType: 'QL-820NW',
|
|
39
41
|
encodedImage: 'base64 removed mime-type', // base64
|
|
40
|
-
} as BrotherPrintOptions)
|
|
42
|
+
} as BrotherPrintOptions);
|
|
41
43
|
}
|
|
42
44
|
printWithNetWork() {
|
|
43
|
-
const wifi = () =>
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
const wifi = () =>
|
|
46
|
+
new Promise(resolve => {
|
|
47
|
+
BrotherPrint.addListener('onIpAddressAvailable', info => {
|
|
48
|
+
resolve(info);
|
|
49
|
+
});
|
|
46
50
|
});
|
|
47
|
-
});
|
|
48
51
|
|
|
49
|
-
const ble = () =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
const ble = () =>
|
|
53
|
+
new Promise(resolve => {
|
|
54
|
+
BrotherPrint.addListener('onBLEAvailable', info => {
|
|
55
|
+
resolve(info);
|
|
56
|
+
});
|
|
52
57
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
Promise.all([wifi(), ble()]).then((values) => {
|
|
58
|
+
|
|
59
|
+
Promise.all([wifi(), ble()]).then(values => {
|
|
56
60
|
console.log(values);
|
|
57
61
|
});
|
|
58
62
|
|
|
59
63
|
BrotherPrint.searchWiFiPrinter();
|
|
60
64
|
BrotherPrint.searchBLEPrinter();
|
|
61
|
-
}
|
|
65
|
+
}
|
|
62
66
|
}
|
|
63
67
|
```
|
|
64
68
|
|
|
65
69
|
## Installation
|
|
70
|
+
|
|
66
71
|
```
|
|
67
72
|
$ npm install --save @rdlabo/capacitor-brotherprint
|
|
68
73
|
```
|
|
69
74
|
|
|
70
75
|
### Android configuration
|
|
71
|
-
In file `android/app/src/main/java/**/**/MainActivity.java`, add the plugin to the initialization list:
|
|
72
76
|
|
|
73
|
-
|
|
74
|
-
import jp.rdlabo.capacitor.plugin.brotherprint.BrotherPrint;
|
|
77
|
+
1. prepare the following files under the android folder of Capacitor
|
|
75
78
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
add(BrotherPrint.class);
|
|
79
|
-
[...]
|
|
80
|
-
}});
|
|
81
|
-
```
|
|
79
|
+
- android/BrotherPrintLibrary/BrotherPrintLibrary.aar
|
|
80
|
+
- android/BrotherPrintLibrary/build.gradle
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
https://support.brother.co.jp/j/s/support/html/mobilesdk/guide/getting-started/getting-started-android.html
|
|
82
|
+
`BrotherPrintLibrary.aar` is the Brother Print SDK library. You can get it 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
|
|
85
83
|
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
The contents of `android/BrotherPrintLibrary/build.gradle` is this.
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
configurations.maybeCreate(“default”)
|
|
88
|
+
artifacts.add(“default”, file('BrotherPrintLibrary.aar'))
|
|
89
|
+
```
|
|
88
90
|
|
|
89
|
-
|
|
90
|
-
以下デモの動かし方です。
|
|
91
|
+
Add the following to android/settings.gradle.
|
|
91
92
|
|
|
92
93
|
```
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
% npx cap open ios
|
|
94
|
+
include ':BrotherPrintLibrary.aar''
|
|
95
|
+
include ':BrotherPrintLibrary'.
|
|
96
|
+
project(':BrotherPrintLibrary').projectDir = new File('. /BrotherPrintLibrary/')
|
|
97
97
|
```
|
|
98
|
+
|
|
99
|
+
### iOS configuration
|
|
100
|
+
|
|
101
|
+
No configuration required.
|
package/ios/Podfile
CHANGED
|
@@ -5,7 +5,7 @@ def capacitor_pods
|
|
|
5
5
|
use_frameworks!
|
|
6
6
|
pod 'Capacitor', :path => '../node_modules/@capacitor/ios'
|
|
7
7
|
pod 'CapacitorCordova', :path => '../node_modules/@capacitor/ios'
|
|
8
|
-
pod 'BRLMPrinterKit_v4'
|
|
8
|
+
pod 'BRLMPrinterKit_v4', :git => 'https://github.com/rdlabo/BRLMPrinterKit.git', :branch => 'feat/update_4_9_1'
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
target 'Plugin' do
|