@sincpro/printer-expo 1.0.4 → 1.0.6
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/android/build.gradle
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expo Module for Bixolon Thermal Printer
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT: Kotlin formatting
|
|
5
|
+
* - Use Android Studio/IntelliJ IDE formatter (Code → Reformat Code)
|
|
6
|
+
* - Do NOT use ktlint - it conflicts with Expo Modules API lambda syntax
|
|
7
|
+
* - Zero-parameter Coroutine lambdas require trailing arrow: { -> ... }
|
|
8
|
+
*/
|
|
1
9
|
package sincpro.expo.printer.entrypoint
|
|
2
10
|
|
|
3
11
|
import android.content.Context
|
|
@@ -82,13 +90,13 @@ class PrinterModule : Module() {
|
|
|
82
90
|
).getOrThrow()
|
|
83
91
|
}
|
|
84
92
|
|
|
85
|
-
AsyncFunction("connectUsb") Coroutine {
|
|
93
|
+
AsyncFunction("connectUsb") Coroutine { ->
|
|
86
94
|
sdk.bixolon.connectivity
|
|
87
95
|
.connectUsb()
|
|
88
96
|
.getOrThrow()
|
|
89
97
|
}
|
|
90
98
|
|
|
91
|
-
AsyncFunction("disconnect") Coroutine {
|
|
99
|
+
AsyncFunction("disconnect") Coroutine { ->
|
|
92
100
|
sdk.bixolon.connectivity
|
|
93
101
|
.disconnect()
|
|
94
102
|
.getOrThrow()
|
|
@@ -98,7 +106,7 @@ class PrinterModule : Module() {
|
|
|
98
106
|
sdk.bixolon.connectivity.isConnected()
|
|
99
107
|
}
|
|
100
108
|
|
|
101
|
-
AsyncFunction("getStatus") Coroutine {
|
|
109
|
+
AsyncFunction("getStatus") Coroutine { ->
|
|
102
110
|
val status =
|
|
103
111
|
sdk.bixolon.connectivity
|
|
104
112
|
.getStatus()
|
|
@@ -113,7 +121,7 @@ class PrinterModule : Module() {
|
|
|
113
121
|
)
|
|
114
122
|
}
|
|
115
123
|
|
|
116
|
-
AsyncFunction("getInfo") Coroutine {
|
|
124
|
+
AsyncFunction("getInfo") Coroutine { ->
|
|
117
125
|
val info =
|
|
118
126
|
sdk.bixolon.connectivity
|
|
119
127
|
.getInfo()
|
package/expo-module.config.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"platforms": ["android"],
|
|
2
|
+
"platforms": ["android", "ios"],
|
|
3
3
|
"android": {
|
|
4
4
|
"modules": ["sincpro.expo.printer.entrypoint.PrinterModule"],
|
|
5
5
|
"gradleAarProjects": [
|
|
@@ -12,5 +12,8 @@
|
|
|
12
12
|
"aarFilePath": "android/libs/pdf/Bixolon_pdf.aar"
|
|
13
13
|
}
|
|
14
14
|
]
|
|
15
|
+
},
|
|
16
|
+
"ios": {
|
|
17
|
+
"modules": ["ExpoBixolonModule"]
|
|
15
18
|
}
|
|
16
19
|
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expo Module for Sincpro Printer SDK
|
|
3
|
+
*
|
|
4
|
+
* iOS Stub Implementation:
|
|
5
|
+
* This module provides a compatible API surface for iOS builds,
|
|
6
|
+
* but does not implement actual printer functionality.
|
|
7
|
+
* All functions return safe default values without throwing exceptions.
|
|
8
|
+
*
|
|
9
|
+
* Production use is only supported on Android platform.
|
|
10
|
+
*/
|
|
11
|
+
import ExpoModulesCore
|
|
12
|
+
|
|
13
|
+
public class ExpoBixolonModule: Module {
|
|
14
|
+
public func definition() -> ModuleDefinition {
|
|
15
|
+
Name("SincproPrinter")
|
|
16
|
+
|
|
17
|
+
// ============================================================
|
|
18
|
+
// BLUETOOTH API
|
|
19
|
+
// ============================================================
|
|
20
|
+
|
|
21
|
+
Function("getPairedDevices") {
|
|
22
|
+
return []
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Function("getPairedPrinters") {
|
|
26
|
+
return []
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// ============================================================
|
|
30
|
+
// CONNECTION API
|
|
31
|
+
// ============================================================
|
|
32
|
+
|
|
33
|
+
AsyncFunction("connectBluetooth") { (address: String, timeoutMs: Double?) in
|
|
34
|
+
// No-op: iOS stub
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
AsyncFunction("connectWifi") { (ip: String, port: Int?, timeoutMs: Double?) in
|
|
38
|
+
// No-op: iOS stub
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
AsyncFunction("connectUsb") {
|
|
42
|
+
// No-op: iOS stub
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
AsyncFunction("disconnect") {
|
|
46
|
+
// No-op: iOS stub
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
Function("isConnected") {
|
|
50
|
+
return false
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
AsyncFunction("getStatus") {
|
|
54
|
+
return [
|
|
55
|
+
"connectionState": "DISCONNECTED",
|
|
56
|
+
"hasPaper": false,
|
|
57
|
+
"isCoverOpen": false,
|
|
58
|
+
"isOverheated": false,
|
|
59
|
+
"hasError": false,
|
|
60
|
+
"errorMessage": nil
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
AsyncFunction("getInfo") {
|
|
65
|
+
return [
|
|
66
|
+
"model": "",
|
|
67
|
+
"firmware": "",
|
|
68
|
+
"serial": "",
|
|
69
|
+
"dpi": 0
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
Function("getDpi") {
|
|
74
|
+
return 203
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ============================================================
|
|
78
|
+
// CONFIGURATION API
|
|
79
|
+
// ============================================================
|
|
80
|
+
|
|
81
|
+
AsyncFunction("setConfig") { (config: [String: Any]) in
|
|
82
|
+
// No-op: iOS stub
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
Function("getConfig") {
|
|
86
|
+
return [:]
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// ============================================================
|
|
90
|
+
// PRINT API - TEXT
|
|
91
|
+
// ============================================================
|
|
92
|
+
|
|
93
|
+
AsyncFunction("printText") { (text: String, options: [String: Any]?) in
|
|
94
|
+
// No-op: iOS stub
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
AsyncFunction("printTexts") { (texts: [String], options: [String: Any]?) in
|
|
98
|
+
// No-op: iOS stub
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ============================================================
|
|
102
|
+
// PRINT API - QR & BARCODE
|
|
103
|
+
// ============================================================
|
|
104
|
+
|
|
105
|
+
AsyncFunction("printQR") { (data: String, options: [String: Any]?) in
|
|
106
|
+
// No-op: iOS stub
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
AsyncFunction("printBarcode") { (data: String, options: [String: Any]?) in
|
|
110
|
+
// No-op: iOS stub
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ============================================================
|
|
114
|
+
// PRINT API - IMAGES & PDF
|
|
115
|
+
// ============================================================
|
|
116
|
+
|
|
117
|
+
AsyncFunction("printImageBase64") { (base64Data: String, options: [String: Any]?) in
|
|
118
|
+
// No-op: iOS stub
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
AsyncFunction("printPdfBase64") { (base64Data: String, options: [String: Any]?) in
|
|
122
|
+
// No-op: iOS stub
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
Function("getPdfPageCount") { (base64Data: String) in
|
|
126
|
+
return 0
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ============================================================
|
|
130
|
+
// PRINT API - RECEIPT & KEY-VALUE
|
|
131
|
+
// ============================================================
|
|
132
|
+
|
|
133
|
+
AsyncFunction("printReceipt") { (receiptData: [String: Any], options: [String: Any]?) in
|
|
134
|
+
// No-op: iOS stub
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
AsyncFunction("printKeyValue") { (key: String, value: String, options: [String: Any]?) in
|
|
138
|
+
// No-op: iOS stub
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'SincproPrinter'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.description = package['description']
|
|
10
|
+
s.license = package['license']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.homepage = package['homepage']
|
|
13
|
+
s.platforms = {
|
|
14
|
+
:ios => '15.1',
|
|
15
|
+
:tvos => '15.1'
|
|
16
|
+
}
|
|
17
|
+
s.swift_version = '5.4'
|
|
18
|
+
s.source = { git: 'https://github.com/Sincpro-SRL/sincpro_printer_expo' }
|
|
19
|
+
s.static_framework = true
|
|
20
|
+
|
|
21
|
+
s.dependency 'ExpoModulesCore'
|
|
22
|
+
|
|
23
|
+
# Swift/Objective-C compatibility
|
|
24
|
+
s.pod_target_xcconfig = {
|
|
25
|
+
'DEFINES_MODULE' => 'YES',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
s.source_files = "**/*.{h,m,mm,swift,hpp,cpp}"
|
|
29
|
+
end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sincpro/printer-expo",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Expo module for controlling Bixolon thermal printers with Bluetooth connectivity",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"build",
|
|
28
28
|
"android",
|
|
29
|
+
"ios",
|
|
29
30
|
"expo-module.config.json",
|
|
30
31
|
"README.md",
|
|
31
32
|
"LICENSE"
|