Skip to content

Commit 74ffe24

Browse files
authored
Update README.md and comments in NativeHCEModule.ts (#52)
1 parent d889d6c commit 74ffe24

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

packages/host-card-emulation/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Afterwards, follow the subsections below for each platform that you need to supp
117117
This module provides a uniform low-level HCE API for both mobile platforms.
118118

119119
> [!NOTE]
120-
> Raw native module's API specification is available in [packages/host-card-emulation/js/NativeHCEModule.ts](https://github.com/icedevml/react-native-host-card-emulation/blob/master/packages/host-card-emulation/js/NativeHCEModule.ts).
120+
> Raw native module's API specification is available in [packages/host-card-emulation/js](https://github.com/icedevml/react-native-host-card-emulation/blob/master/packages/host-card-emulation/js) subdirectory.
121121
> Check it out in order to understand what methods you can call against the module and what are the expected parameters/return values.
122122
123123
> [!NOTE]
@@ -256,5 +256,5 @@ for instance - your app may emulate an NDEF tag even when it's not launched on t
256256
257257
### More resources
258258
259-
* [Module's API specification](https://github.com/icedevml/react-native-host-card-emulation/blob/master/packages/host-card-emulation/js/NativeHCEModule.ts)
259+
* [Module's API specification](https://github.com/icedevml/react-native-host-card-emulation/blob/master/packages/host-card-emulation/js)
260260
* [Demo App's Code (Example Library Usage)](https://github.com/icedevml/react-native-host-card-emulation/blob/master/packages/demo-ndef-app/App.tsx)

packages/host-card-emulation/js/NativeHCEModule.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ export interface Spec extends TurboModule {
7474
*/
7575
isSessionRunning(): boolean;
7676

77-
beginBackgroundHCE(handle: string): boolean;
78-
finishBackgroundHCE(handle: string): boolean;
79-
8077
/**
8178
* iOS: Start the card emulation.
8279
* Android: Enable HCE service.
@@ -89,6 +86,7 @@ export interface Spec extends TurboModule {
8986
stopHCE(status: HCEModuleStopReason): Promise<void>;
9087
/**
9188
* Send R-APDU (hex-encoded string) as a response to the last received C-APDU event.
89+
* Set handle=null when calling this function from foreground app.
9290
*/
9391
respondAPDU(handle: string | null, rapdu: string): Promise<void>;
9492
/**
@@ -97,7 +95,30 @@ export interface Spec extends TurboModule {
9795
*/
9896
isHCERunning(): Promise<boolean>;
9997

98+
/**
99+
* Android: Report that the JS headless task is ready to handle HCE interaction in the background.
100+
* NOTE: Don't call this API directly, use wrapper hceBackground.ts:createBackgroundHCE.
101+
* See demo app or README.md for example wrapper usage.
102+
*/
103+
beginBackgroundHCE(handle: string): boolean;
104+
105+
/**
106+
* Android: Report the background HCE interaction was finished.
107+
* NOTE: Don't call this API directly, use wrapper hceBackground.ts:createBackgroundHCE.
108+
* See demo app or README.md for example wrapper usage.
109+
*/
110+
finishBackgroundHCE(handle: string): boolean;
111+
112+
/**
113+
* Event handler for foreground HCE interactions.
114+
*/
100115
readonly onEvent: CodegenTypes.EventEmitter<HCEModuleEvent>;
116+
117+
/**
118+
* Event handler for background HCE interactions.
119+
* NOTE: Don't subscribe to that handler directly, use wrapper hceBackground.ts:createBackgroundHCE.
120+
* See demo app or README.md for example wrapper usage.
121+
*/
101122
readonly onBackgroundEvent: CodegenTypes.EventEmitter<HCEModuleBackgroundEvent>;
102123
}
103124

0 commit comments

Comments
 (0)