@padosoft/react-native-ecr17 0.0.0 → 2.0.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/Ecr17.podspec +39 -39
- package/README.md +348 -348
- package/android/CMakeLists.txt +41 -41
- package/android/build.gradle +148 -148
- package/android/fix-prefab.gradle +50 -50
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/cpp/cpp-adapter.cpp +8 -8
- package/android/src/main/java/com/margelo/nitro/ecr17/HybridEcr17Transport.kt +233 -233
- package/android/src/main/java/com/padosoft/ecr17/Ecr17Package.kt +30 -30
- package/cpp/Ecr17.hpp +1 -1
- package/cpp/Ecr17Client/HybridEcr17Client.cpp +598 -598
- package/cpp/Ecr17Client/HybridEcr17Client.hpp +85 -85
- package/cpp/Ecr17Protocol/Ecr17Protocol.cpp +277 -277
- package/cpp/Ecr17Protocol/Ecr17Protocol.hpp +103 -103
- package/cpp/Ecr17Response/Ecr17Response.cpp +155 -155
- package/cpp/Ecr17Response/Ecr17Response.hpp +113 -113
- package/cpp/Lcr/Lcr.cpp +42 -42
- package/cpp/Lcr/Lcr.hpp +21 -21
- package/cpp/PacketCodec/PacketCodec.cpp +145 -145
- package/cpp/PacketCodec/PacketCodec.hpp +47 -47
- package/cpp/Session/Ecr17Session.cpp +260 -260
- package/cpp/Session/Ecr17Session.hpp +97 -97
- package/cpp/Session/RetryPolicy.hpp +23 -23
- package/cpp/Transport/FakeTransport.hpp +95 -95
- package/cpp/Transport/NativeTransportAdapter.cpp +42 -42
- package/cpp/Transport/NativeTransportAdapter.hpp +32 -32
- package/cpp/Transport/Transport.hpp +30 -30
- package/cpp/tests/CMakeLists.txt +55 -55
- package/cpp/tests/PosixTcpTransport.hpp +105 -105
- package/cpp/tests/stubs/LrcMode.hpp +25 -25
- package/cpp/tests/test_flows.cpp +148 -148
- package/cpp/tests/test_integration_terminal.cpp +72 -72
- package/cpp/tests/test_lrc.cpp +66 -66
- package/cpp/tests/test_packet_codec.cpp +164 -164
- package/cpp/tests/test_protocol.cpp +102 -102
- package/cpp/tests/test_protocol_commands.cpp +190 -190
- package/cpp/tests/test_response.cpp +164 -164
- package/cpp/tests/test_retry_policy.cpp +28 -28
- package/cpp/tests/test_session.cpp +262 -262
- package/ios/HybridEcr17Transport.swift +103 -103
- package/lib/commonjs/index.js +50 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/client.nitro.js +17 -0
- package/lib/commonjs/specs/client.nitro.js.map +1 -0
- package/lib/commonjs/specs/transport.nitro.js +6 -0
- package/lib/commonjs/specs/transport.nitro.js.map +1 -0
- package/lib/commonjs/types/client.js +2 -0
- package/lib/commonjs/types/client.js.map +1 -0
- package/lib/commonjs/utils/client.js +13 -0
- package/lib/commonjs/utils/client.js.map +1 -0
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/specs/client.nitro.js +13 -0
- package/lib/module/specs/client.nitro.js.map +1 -0
- package/lib/module/specs/transport.nitro.js +4 -0
- package/lib/module/specs/transport.nitro.js.map +1 -0
- package/lib/module/types/client.js +2 -0
- package/lib/module/types/client.js.map +1 -0
- package/lib/module/utils/client.js +9 -0
- package/lib/module/utils/client.js.map +1 -0
- package/lib/typescript/src/index.d.ts +5 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/client.nitro.d.ts +63 -0
- package/lib/typescript/src/specs/client.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/transport.nitro.d.ts +13 -0
- package/lib/typescript/src/specs/transport.nitro.d.ts.map +1 -0
- package/lib/typescript/src/types/client.d.ts +138 -0
- package/lib/typescript/src/types/client.d.ts.map +1 -0
- package/lib/typescript/src/utils/client.d.ts +3 -0
- package/lib/typescript/src/utils/client.d.ts.map +1 -0
- package/nitro.json +30 -30
- package/package.json +4 -4
- package/react-native.config.js +18 -18
- package/src/index.ts +4 -4
- package/src/specs/client.nitro.ts +102 -102
- package/src/specs/transport.nitro.ts +25 -25
- package/src/types/client.ts +196 -196
- package/src/utils/client.ts +10 -10
package/nitro.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://nitro.margelo.com/nitro.schema.json",
|
|
3
|
-
"cxxNamespace": ["ecr17"],
|
|
4
|
-
"ios": {
|
|
5
|
-
"iosModuleName": "Ecr17"
|
|
6
|
-
},
|
|
7
|
-
"android": {
|
|
8
|
-
"androidNamespace": ["ecr17"],
|
|
9
|
-
"androidCxxLibName": "Ecr17"
|
|
10
|
-
},
|
|
11
|
-
"autolinking": {
|
|
12
|
-
"Ecr17Client": {
|
|
13
|
-
"all": {
|
|
14
|
-
"language": "c++",
|
|
15
|
-
"implementationClassName": "HybridEcr17Client"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"Ecr17Transport": {
|
|
19
|
-
"ios": {
|
|
20
|
-
"language": "swift",
|
|
21
|
-
"implementationClassName": "HybridEcr17Transport"
|
|
22
|
-
},
|
|
23
|
-
"android": {
|
|
24
|
-
"language": "kotlin",
|
|
25
|
-
"implementationClassName": "HybridEcr17Transport"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"ignorePaths": ["**/node_modules"]
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://nitro.margelo.com/nitro.schema.json",
|
|
3
|
+
"cxxNamespace": ["ecr17"],
|
|
4
|
+
"ios": {
|
|
5
|
+
"iosModuleName": "Ecr17"
|
|
6
|
+
},
|
|
7
|
+
"android": {
|
|
8
|
+
"androidNamespace": ["ecr17"],
|
|
9
|
+
"androidCxxLibName": "Ecr17"
|
|
10
|
+
},
|
|
11
|
+
"autolinking": {
|
|
12
|
+
"Ecr17Client": {
|
|
13
|
+
"all": {
|
|
14
|
+
"language": "c++",
|
|
15
|
+
"implementationClassName": "HybridEcr17Client"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"Ecr17Transport": {
|
|
19
|
+
"ios": {
|
|
20
|
+
"language": "swift",
|
|
21
|
+
"implementationClassName": "HybridEcr17Transport"
|
|
22
|
+
},
|
|
23
|
+
"android": {
|
|
24
|
+
"language": "kotlin",
|
|
25
|
+
"implementationClassName": "HybridEcr17Transport"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"ignorePaths": ["**/node_modules"]
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@padosoft/react-native-ecr17",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "react-native-ecr17 is a RN package built with Nitro for the ECR17 protocol, allowing integration with POS terminals.",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"workspaces": [
|
|
42
42
|
"example"
|
|
43
43
|
],
|
|
44
|
-
"repository": "https://github.com/padosoft/react-native-ecr17.git",
|
|
44
|
+
"repository": "https://github.com/padosoft/react-native-ecr17-protocol.git",
|
|
45
45
|
"author": "padosoft",
|
|
46
46
|
"license": "MIT",
|
|
47
|
-
"bugs": "https://github.com/padosoft/react-native-ecr17/issues",
|
|
48
|
-
"homepage": "https://github.com/padosoft/react-native-ecr17#readme",
|
|
47
|
+
"bugs": "https://github.com/padosoft/react-native-ecr17-protocol/issues",
|
|
48
|
+
"homepage": "https://github.com/padosoft/react-native-ecr17-protocol#readme",
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public",
|
|
51
51
|
"registry": "https://registry.npmjs.org/"
|
package/react-native.config.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
// React Native CLI autolinking config for this native module.
|
|
2
|
-
// https://github.com/react-native-community/cli/blob/main/docs/dependencies.md
|
|
3
|
-
//
|
|
4
|
-
// Declaring the android/ios platforms makes the CLI treat this package as a
|
|
5
|
-
// native dependency and autolink it. On Android that registers Ecr17Package,
|
|
6
|
-
// whose static initializer loads libEcr17.so (System.loadLibrary) so the Nitro
|
|
7
|
-
// HybridObjects are registered before JS creates them.
|
|
8
|
-
|
|
9
|
-
module.exports = {
|
|
10
|
-
dependency: {
|
|
11
|
-
platforms: {
|
|
12
|
-
/** @type {import('@react-native-community/cli-types').IOSDependencyParams} */
|
|
13
|
-
ios: {},
|
|
14
|
-
/** @type {import('@react-native-community/cli-types').AndroidDependencyParams} */
|
|
15
|
-
android: {},
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
};
|
|
1
|
+
// React Native CLI autolinking config for this native module.
|
|
2
|
+
// https://github.com/react-native-community/cli/blob/main/docs/dependencies.md
|
|
3
|
+
//
|
|
4
|
+
// Declaring the android/ios platforms makes the CLI treat this package as a
|
|
5
|
+
// native dependency and autolink it. On Android that registers Ecr17Package,
|
|
6
|
+
// whose static initializer loads libEcr17.so (System.loadLibrary) so the Nitro
|
|
7
|
+
// HybridObjects are registered before JS creates them.
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
dependency: {
|
|
11
|
+
platforms: {
|
|
12
|
+
/** @type {import('@react-native-community/cli-types').IOSDependencyParams} */
|
|
13
|
+
ios: {},
|
|
14
|
+
/** @type {import('@react-native-community/cli-types').AndroidDependencyParams} */
|
|
15
|
+
android: {},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./specs/client.nitro";
|
|
2
|
-
export * from "./specs/transport.nitro";
|
|
3
|
-
export * from "./types/client";
|
|
4
|
-
export * from "./utils/client";
|
|
1
|
+
export * from "./specs/client.nitro";
|
|
2
|
+
export * from "./specs/transport.nitro";
|
|
3
|
+
export * from "./types/client";
|
|
4
|
+
export * from "./utils/client";
|
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
import type { HybridObject } from "react-native-nitro-modules";
|
|
2
|
-
import type {
|
|
3
|
-
CardVerificationRequest,
|
|
4
|
-
CardVerificationResult,
|
|
5
|
-
CloseSessionResult,
|
|
6
|
-
ConnectionState,
|
|
7
|
-
IncrementalAuthRequest,
|
|
8
|
-
LrcMode,
|
|
9
|
-
PaymentRequest,
|
|
10
|
-
PaymentResult,
|
|
11
|
-
PreAuthClosureRequest,
|
|
12
|
-
PreAuthRequest,
|
|
13
|
-
PreAuthResult,
|
|
14
|
-
ProgressEvent,
|
|
15
|
-
ReceiptLine,
|
|
16
|
-
ReversalRequest,
|
|
17
|
-
ReversalResult,
|
|
18
|
-
TotalsResult,
|
|
19
|
-
VasResult,
|
|
20
|
-
} from "../types/client";
|
|
21
|
-
|
|
22
|
-
export interface Ecr17Config {
|
|
23
|
-
host: string;
|
|
24
|
-
port?: number;
|
|
25
|
-
|
|
26
|
-
terminalId: string;
|
|
27
|
-
cashRegisterId: string;
|
|
28
|
-
|
|
29
|
-
lrcMode?: LrcMode;
|
|
30
|
-
|
|
31
|
-
keepAlive?: boolean;
|
|
32
|
-
autoReconnect?: boolean;
|
|
33
|
-
|
|
34
|
-
connectionTimeoutMs?: number;
|
|
35
|
-
responseTimeoutMs?: number;
|
|
36
|
-
ackTimeoutMs?: number;
|
|
37
|
-
|
|
38
|
-
// After a transaction result, keep forwarding 'S' receipt lines (onReceiptLine)
|
|
39
|
-
// until this many ms of silence. 0/undefined = off. Set when ECR-printing is on.
|
|
40
|
-
receiptDrainMs?: number;
|
|
41
|
-
|
|
42
|
-
retryCount?: number;
|
|
43
|
-
retryDelayMs?: number;
|
|
44
|
-
|
|
45
|
-
debug?: boolean;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const PosTerminalStatusMessage = {
|
|
49
|
-
0: "Terminal not configured",
|
|
50
|
-
1: "Terminal configured, no DLL",
|
|
51
|
-
2: "Terminal operative (after a DLL)",
|
|
52
|
-
3: "Terminal not aligned (first DLL requested)",
|
|
53
|
-
4: "KMPB/KPOS key corrupted (first DLL requested)",
|
|
54
|
-
5: "DLL solicited by GT pending",
|
|
55
|
-
6: "Remote SW updated request pending",
|
|
56
|
-
[-1]: "Unknown",
|
|
57
|
-
} as const;
|
|
58
|
-
|
|
59
|
-
export type PosTerminalStatus = keyof typeof PosTerminalStatusMessage;
|
|
60
|
-
|
|
61
|
-
export interface PosStatusResponse {
|
|
62
|
-
terminalId: string;
|
|
63
|
-
terminalDateTime: Date;
|
|
64
|
-
status: PosTerminalStatus;
|
|
65
|
-
softwareRelease: string;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface Ecr17Client
|
|
69
|
-
extends HybridObject<{
|
|
70
|
-
ios: "c++";
|
|
71
|
-
android: "c++";
|
|
72
|
-
}> {
|
|
73
|
-
// --- Configuration (synchronous) ---
|
|
74
|
-
configure(config: Ecr17Config): void;
|
|
75
|
-
configuration(): Ecr17Config;
|
|
76
|
-
|
|
77
|
-
// --- Connection ---
|
|
78
|
-
connect(): Promise<void>;
|
|
79
|
-
disconnect(): void;
|
|
80
|
-
isConnected(): boolean;
|
|
81
|
-
|
|
82
|
-
// --- Commands (asynchronous: each performs a full request/response exchange) ---
|
|
83
|
-
status(): Promise<PosStatusResponse>; // 's'
|
|
84
|
-
pay(request: PaymentRequest): Promise<PaymentResult>; // 'P'
|
|
85
|
-
payExtended(request: PaymentRequest): Promise<PaymentResult>; // 'X'
|
|
86
|
-
reverse(request: ReversalRequest): Promise<ReversalResult>; // 'S'
|
|
87
|
-
preAuth(request: PreAuthRequest): Promise<PreAuthResult>; // 'p'
|
|
88
|
-
incrementalAuth(request: IncrementalAuthRequest): Promise<PreAuthResult>; // 'i'
|
|
89
|
-
preAuthClosure(request: PreAuthClosureRequest): Promise<PaymentResult>; // 'c'
|
|
90
|
-
verifyCard(request: CardVerificationRequest): Promise<CardVerificationResult>; // 'H'
|
|
91
|
-
closeSession(): Promise<CloseSessionResult>; // 'C'
|
|
92
|
-
totals(): Promise<TotalsResult>; // 'T'
|
|
93
|
-
sendLastResult(): Promise<PaymentResult>; // 'G'
|
|
94
|
-
enableEcrPrinting(enabled: boolean): Promise<void>; // 'E'
|
|
95
|
-
reprint(toEcr: boolean): Promise<void>; // 'R'
|
|
96
|
-
vas(xmlRequest: string): Promise<VasResult>; // 'K'
|
|
97
|
-
|
|
98
|
-
// --- Events ---
|
|
99
|
-
setOnProgress(callback: (event: ProgressEvent) => void): void;
|
|
100
|
-
setOnReceiptLine(callback: (line: ReceiptLine) => void): void;
|
|
101
|
-
setOnConnectionStateChange(callback: (state: ConnectionState) => void): void;
|
|
102
|
-
}
|
|
1
|
+
import type { HybridObject } from "react-native-nitro-modules";
|
|
2
|
+
import type {
|
|
3
|
+
CardVerificationRequest,
|
|
4
|
+
CardVerificationResult,
|
|
5
|
+
CloseSessionResult,
|
|
6
|
+
ConnectionState,
|
|
7
|
+
IncrementalAuthRequest,
|
|
8
|
+
LrcMode,
|
|
9
|
+
PaymentRequest,
|
|
10
|
+
PaymentResult,
|
|
11
|
+
PreAuthClosureRequest,
|
|
12
|
+
PreAuthRequest,
|
|
13
|
+
PreAuthResult,
|
|
14
|
+
ProgressEvent,
|
|
15
|
+
ReceiptLine,
|
|
16
|
+
ReversalRequest,
|
|
17
|
+
ReversalResult,
|
|
18
|
+
TotalsResult,
|
|
19
|
+
VasResult,
|
|
20
|
+
} from "../types/client";
|
|
21
|
+
|
|
22
|
+
export interface Ecr17Config {
|
|
23
|
+
host: string;
|
|
24
|
+
port?: number;
|
|
25
|
+
|
|
26
|
+
terminalId: string;
|
|
27
|
+
cashRegisterId: string;
|
|
28
|
+
|
|
29
|
+
lrcMode?: LrcMode;
|
|
30
|
+
|
|
31
|
+
keepAlive?: boolean;
|
|
32
|
+
autoReconnect?: boolean;
|
|
33
|
+
|
|
34
|
+
connectionTimeoutMs?: number;
|
|
35
|
+
responseTimeoutMs?: number;
|
|
36
|
+
ackTimeoutMs?: number;
|
|
37
|
+
|
|
38
|
+
// After a transaction result, keep forwarding 'S' receipt lines (onReceiptLine)
|
|
39
|
+
// until this many ms of silence. 0/undefined = off. Set when ECR-printing is on.
|
|
40
|
+
receiptDrainMs?: number;
|
|
41
|
+
|
|
42
|
+
retryCount?: number;
|
|
43
|
+
retryDelayMs?: number;
|
|
44
|
+
|
|
45
|
+
debug?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const PosTerminalStatusMessage = {
|
|
49
|
+
0: "Terminal not configured",
|
|
50
|
+
1: "Terminal configured, no DLL",
|
|
51
|
+
2: "Terminal operative (after a DLL)",
|
|
52
|
+
3: "Terminal not aligned (first DLL requested)",
|
|
53
|
+
4: "KMPB/KPOS key corrupted (first DLL requested)",
|
|
54
|
+
5: "DLL solicited by GT pending",
|
|
55
|
+
6: "Remote SW updated request pending",
|
|
56
|
+
[-1]: "Unknown",
|
|
57
|
+
} as const;
|
|
58
|
+
|
|
59
|
+
export type PosTerminalStatus = keyof typeof PosTerminalStatusMessage;
|
|
60
|
+
|
|
61
|
+
export interface PosStatusResponse {
|
|
62
|
+
terminalId: string;
|
|
63
|
+
terminalDateTime: Date;
|
|
64
|
+
status: PosTerminalStatus;
|
|
65
|
+
softwareRelease: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface Ecr17Client
|
|
69
|
+
extends HybridObject<{
|
|
70
|
+
ios: "c++";
|
|
71
|
+
android: "c++";
|
|
72
|
+
}> {
|
|
73
|
+
// --- Configuration (synchronous) ---
|
|
74
|
+
configure(config: Ecr17Config): void;
|
|
75
|
+
configuration(): Ecr17Config;
|
|
76
|
+
|
|
77
|
+
// --- Connection ---
|
|
78
|
+
connect(): Promise<void>;
|
|
79
|
+
disconnect(): void;
|
|
80
|
+
isConnected(): boolean;
|
|
81
|
+
|
|
82
|
+
// --- Commands (asynchronous: each performs a full request/response exchange) ---
|
|
83
|
+
status(): Promise<PosStatusResponse>; // 's'
|
|
84
|
+
pay(request: PaymentRequest): Promise<PaymentResult>; // 'P'
|
|
85
|
+
payExtended(request: PaymentRequest): Promise<PaymentResult>; // 'X'
|
|
86
|
+
reverse(request: ReversalRequest): Promise<ReversalResult>; // 'S'
|
|
87
|
+
preAuth(request: PreAuthRequest): Promise<PreAuthResult>; // 'p'
|
|
88
|
+
incrementalAuth(request: IncrementalAuthRequest): Promise<PreAuthResult>; // 'i'
|
|
89
|
+
preAuthClosure(request: PreAuthClosureRequest): Promise<PaymentResult>; // 'c'
|
|
90
|
+
verifyCard(request: CardVerificationRequest): Promise<CardVerificationResult>; // 'H'
|
|
91
|
+
closeSession(): Promise<CloseSessionResult>; // 'C'
|
|
92
|
+
totals(): Promise<TotalsResult>; // 'T'
|
|
93
|
+
sendLastResult(): Promise<PaymentResult>; // 'G'
|
|
94
|
+
enableEcrPrinting(enabled: boolean): Promise<void>; // 'E'
|
|
95
|
+
reprint(toEcr: boolean): Promise<void>; // 'R'
|
|
96
|
+
vas(xmlRequest: string): Promise<VasResult>; // 'K'
|
|
97
|
+
|
|
98
|
+
// --- Events ---
|
|
99
|
+
setOnProgress(callback: (event: ProgressEvent) => void): void;
|
|
100
|
+
setOnReceiptLine(callback: (line: ReceiptLine) => void): void;
|
|
101
|
+
setOnConnectionStateChange(callback: (state: ConnectionState) => void): void;
|
|
102
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import type { HybridObject } from "react-native-nitro-modules";
|
|
2
|
-
|
|
3
|
-
// Low-level byte transport for the ECR17 LAN connection.
|
|
4
|
-
//
|
|
5
|
-
// Implemented natively (Swift on iOS, Kotlin on Android) so it can use the
|
|
6
|
-
// platform networking stacks. The C++ protocol core consumes it through a thin
|
|
7
|
-
// adapter; all ECR17 framing/orchestration stays in shared C++.
|
|
8
|
-
//
|
|
9
|
-
// Received bytes are delivered via setOnData (called from a native reader
|
|
10
|
-
// thread). `send` is fire-and-forget; back-pressure/ordering is the transport's
|
|
11
|
-
// responsibility.
|
|
12
|
-
export interface Ecr17Transport
|
|
13
|
-
extends HybridObject<{
|
|
14
|
-
ios: "swift";
|
|
15
|
-
android: "kotlin";
|
|
16
|
-
}> {
|
|
17
|
-
connect(host: string, port: number, timeoutMs: number): Promise<void>;
|
|
18
|
-
disconnect(): void;
|
|
19
|
-
isConnected(): boolean;
|
|
20
|
-
|
|
21
|
-
send(bytes: ArrayBuffer): void;
|
|
22
|
-
|
|
23
|
-
setOnData(callback: (bytes: ArrayBuffer) => void): void;
|
|
24
|
-
setOnDisconnect(callback: () => void): void;
|
|
25
|
-
}
|
|
1
|
+
import type { HybridObject } from "react-native-nitro-modules";
|
|
2
|
+
|
|
3
|
+
// Low-level byte transport for the ECR17 LAN connection.
|
|
4
|
+
//
|
|
5
|
+
// Implemented natively (Swift on iOS, Kotlin on Android) so it can use the
|
|
6
|
+
// platform networking stacks. The C++ protocol core consumes it through a thin
|
|
7
|
+
// adapter; all ECR17 framing/orchestration stays in shared C++.
|
|
8
|
+
//
|
|
9
|
+
// Received bytes are delivered via setOnData (called from a native reader
|
|
10
|
+
// thread). `send` is fire-and-forget; back-pressure/ordering is the transport's
|
|
11
|
+
// responsibility.
|
|
12
|
+
export interface Ecr17Transport
|
|
13
|
+
extends HybridObject<{
|
|
14
|
+
ios: "swift";
|
|
15
|
+
android: "kotlin";
|
|
16
|
+
}> {
|
|
17
|
+
connect(host: string, port: number, timeoutMs: number): Promise<void>;
|
|
18
|
+
disconnect(): void;
|
|
19
|
+
isConnected(): boolean;
|
|
20
|
+
|
|
21
|
+
send(bytes: ArrayBuffer): void;
|
|
22
|
+
|
|
23
|
+
setOnData(callback: (bytes: ArrayBuffer) => void): void;
|
|
24
|
+
setOnDisconnect(callback: () => void): void;
|
|
25
|
+
}
|