@haroldtran/react-native-pax 1.0.13 → 1.0.14

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.
@@ -5,7 +5,7 @@ import com.facebook.react.bridge.WritableMap
5
5
  object PaxPosConstant {
6
6
  const val DEFAULT_ID: String = ""
7
7
  const val PORT: String = "10009"
8
- const val TIMEOUT: Int = 300000
8
+ const val TIMEOUT: Int = 3000
9
9
  }
10
10
 
11
11
  // Data holder for PAX request parameters
@@ -66,13 +66,15 @@ class PaxPosLinkModule(
66
66
  @ReactMethod
67
67
  fun initPOSLink(
68
68
  ip: String,
69
+ port: String?,
70
+ timeout: Int?,
69
71
  promise: Promise,
70
72
  ) {
71
73
  val tcpSetting =
72
74
  TcpSetting().apply {
73
75
  this.ip = ip
74
- this.port = PaxPosConstant.PORT
75
- this.timeout = PaxPosConstant.TIMEOUT
76
+ this.port = port ?: PaxPosConstant.PORT
77
+ this.timeout = timeout ?: PaxPosConstant.TIMEOUT
76
78
  }
77
79
  Log.i("TcpSetting", "tcpSetting info: ip=$ip, port=${tcpSetting.port}, timeout=${tcpSetting.timeout}")
78
80
  val map = Arguments.createMap()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haroldtran/react-native-pax",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "React Native native module for PAX devices",
5
5
  "main": "./src/index.ts",
6
6
  "files": [
package/src/index.ts CHANGED
@@ -38,10 +38,16 @@ const PaxPosLink = isAndroid
38
38
  /**
39
39
  * Initializes the POSLink connection.
40
40
  * @param {string} [ip] - The IP address of the POS device.
41
+ * @param {object} [options] - Optional parameters.
42
+ * @param {string} [options.port] - The port number of the POS device.
43
+ * @param {number} [options.timeout] - The timeout value for the connection.
41
44
  * @returns {Promise<PaxInitModel>} A promise resolving to the initPOSLink result.
42
45
  */
43
- export function initPOSLink(ip: string): Promise<PaxInitModel> {
44
- return PaxPosLink.initPOSLink(ip);
46
+ export function initPOSLink(
47
+ ip: string,
48
+ options?: { port?: string; timeout?: number }
49
+ ): Promise<PaxInitModel> {
50
+ return PaxPosLink.initPOSLink(ip, options?.port, options?.timeout);
45
51
  }
46
52
 
47
53
  /**