capacitor-rfid-plugin-ox 0.0.9 → 0.0.11

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 CHANGED
@@ -13,6 +13,7 @@ npx cap sync
13
13
 
14
14
  <docgen-index>
15
15
 
16
+ * [`initRfid()`](#initrfid)
16
17
  * [`inventory()`](#inventory)
17
18
  * [`echo(...)`](#echo)
18
19
 
@@ -21,6 +22,17 @@ npx cap sync
21
22
  <docgen-api>
22
23
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
23
24
 
25
+ ### initRfid()
26
+
27
+ ```typescript
28
+ initRfid() => Promise<{ value: string; }>
29
+ ```
30
+
31
+ **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
32
+
33
+ --------------------
34
+
35
+
24
36
  ### inventory()
25
37
 
26
38
  ```typescript
@@ -1,2 +1,22 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
- </manifest>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ xmlns:tools="http://schemas.android.com/tools">
4
+ <!--<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>-->
5
+ <application
6
+ android:name="uz.ox.plugins.rfid.BaseApplication"
7
+ android:allowBackup="true"
8
+ android:label="@string/app_name"
9
+ >
10
+ <activity
11
+ android:name="uz.ox.plugins.rfid.MainActivity"
12
+ android:exported="true">
13
+ <intent-filter>
14
+ <action android:name="android.intent.action.MAIN" />
15
+
16
+ <category android:name="android.intent.category.LAUNCHER" />
17
+ </intent-filter>
18
+ </activity>
19
+
20
+ </application>
21
+
22
+ </manifest>
@@ -4,14 +4,33 @@ import android.os.Bundle;
4
4
  import android.util.Log;
5
5
 
6
6
  import com.getcapacitor.BridgeActivity;
7
+ import com.ubx.usdk.USDKManager;
8
+ import com.ubx.usdk.rfid.RfidManager;
7
9
 
8
10
  public class MainActivity extends BridgeActivity {
11
+ public RfidManager mRfidManager;
12
+ public static final String TAG = "usdk";
9
13
 
10
14
  @Override
11
- public void onCreate(Bundle savedInstanceState) {
15
+ protected void onCreate(Bundle savedInstanceState) {
12
16
  registerPlugin(RFIDPlugin.class);
13
- Log.i("usdk1", "main activity onCreate...");
14
17
  super.onCreate(savedInstanceState);
15
18
  }
16
19
 
20
+ private void initRfid() {
21
+ // RfidManager mRfidManager = this.mRfidManager;
22
+ // 在异步回调中拿到RFID实例
23
+ USDKManager.getInstance().init(BaseApplication.getContext(), new USDKManager.InitListener() {
24
+ @Override
25
+ public void onStatus(USDKManager.STATUS status) {
26
+ if (status == USDKManager.STATUS.SUCCESS) {
27
+ Log.d(TAG, "initRfid() success.");
28
+ mRfidManager = USDKManager.getInstance().getRfidManager();
29
+ } else {
30
+ Log.d(TAG, "initRfid fail.");
31
+ }
32
+ }
33
+ });
34
+ }
35
+
17
36
  }
@@ -19,6 +19,7 @@ public class RFIDPlugin extends Plugin {
19
19
 
20
20
  public RfidManager mRfidManager;
21
21
 
22
+ @PluginMethod
22
23
  private void initRfid() {
23
24
  // 在异步回调中拿到RFID实例
24
25
  USDKManager.getInstance().init(BaseApplication.getContext(), new USDKManager.InitListener() {
@@ -34,21 +35,9 @@ public class RFIDPlugin extends Plugin {
34
35
  });
35
36
  }
36
37
 
37
- @Override
38
- public void load() {
39
- Log.d("usdk1", "plugin load");
40
- RFIDPlugin RFIDPlugin = this;
41
- getBridge().getActivity().runOnUiThread(new Runnable() {
42
- @Override
43
- public void run() {
44
- // RFIDPlugin.initRfid();
45
- }
46
- });
47
- }
48
-
49
38
  @PluginMethod
50
39
  public void inventory(PluginCall call) {
51
- Log.d(TAG, String.valueOf(mRfidManager.getRange()));
40
+ Log.d(TAG, String.valueOf(mRfidManager.getDeviceId()));
52
41
  }
53
42
 
54
43
  @PluginMethod
package/dist/docs.json CHANGED
@@ -5,6 +5,16 @@
5
5
  "docs": "",
6
6
  "tags": [],
7
7
  "methods": [
8
+ {
9
+ "name": "initRfid",
10
+ "signature": "() => Promise<{ value: string; }>",
11
+ "parameters": [],
12
+ "returns": "Promise<{ value: string; }>",
13
+ "tags": [],
14
+ "docs": "",
15
+ "complexTypes": [],
16
+ "slug": "initrfid"
17
+ },
8
18
  {
9
19
  "name": "inventory",
10
20
  "signature": "() => Promise<{ value: string; }>",
@@ -1,4 +1,7 @@
1
1
  export interface RFIDPlugin {
2
+ initRfid(): Promise<{
3
+ value: string;
4
+ }>;
2
5
  inventory(): Promise<{
3
6
  value: string;
4
7
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface RFIDPlugin {\n inventory(): Promise<{ value: string }>;\n echo(options: { value: string }): Promise<{ value: string }>;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface RFIDPlugin {\n initRfid(): Promise<{ value: string }>;\n inventory(): Promise<{ value: string }>;\n echo(options: { value: string }): Promise<{ value: string }>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
2
  import type { RFIDPlugin } from './definitions';
3
3
  export declare class RFIDWeb extends WebPlugin implements RFIDPlugin {
4
+ initRfid(): Promise<{
5
+ value: string;
6
+ }>;
4
7
  inventory(): Promise<{
5
8
  value: string;
6
9
  }>;
package/dist/esm/web.js CHANGED
@@ -1,8 +1,12 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
2
  export class RFIDWeb extends WebPlugin {
3
+ async initRfid() {
4
+ console.log('initRfid');
5
+ return { value: 'initRfid' };
6
+ }
3
7
  async inventory() {
4
8
  console.log('inventory');
5
- return { value: 'salom' };
9
+ return { value: 'inventory' };
6
10
  }
7
11
  async echo(options) {
8
12
  console.log('ECHO', options);
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,OAAQ,SAAQ,SAAS;IACpC,KAAK,CAAC,SAAS;QACb,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzB,OAAO,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC;IAC1B,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { RFIDPlugin } from './definitions';\n\nexport class RFIDWeb extends WebPlugin implements RFIDPlugin {\n async inventory(): Promise<{ value: string }> {\n console.log('inventory');\n return {value: 'salom'};\n }\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', options);\n return options;\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,OAAQ,SAAQ,SAAS;IACpC,KAAK,CAAC,QAAQ;QACZ,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACxB,OAAO,EAAC,KAAK,EAAE,UAAU,EAAC,CAAC;IAC7B,CAAC;IACD,KAAK,CAAC,SAAS;QACb,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzB,OAAO,EAAC,KAAK,EAAE,WAAW,EAAC,CAAC;IAC9B,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { RFIDPlugin } from './definitions';\n\nexport class RFIDWeb extends WebPlugin implements RFIDPlugin {\n async initRfid(): Promise<{ value: string }> {\n console.log('initRfid');\n return {value: 'initRfid'};\n }\n async inventory(): Promise<{ value: string }> {\n console.log('inventory');\n return {value: 'inventory'};\n }\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', options);\n return options;\n }\n}\n"]}
@@ -9,9 +9,13 @@ const RFID = core.registerPlugin('RFID', {
9
9
  });
10
10
 
11
11
  class RFIDWeb extends core.WebPlugin {
12
+ async initRfid() {
13
+ console.log('initRfid');
14
+ return { value: 'initRfid' };
15
+ }
12
16
  async inventory() {
13
17
  console.log('inventory');
14
- return { value: 'salom' };
18
+ return { value: 'inventory' };
15
19
  }
16
20
  async echo(options) {
17
21
  console.log('ECHO', options);
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst RFID = registerPlugin('RFID', {\n web: () => import('./web').then(m => new m.RFIDWeb()),\n});\nexport * from './definitions';\nexport { RFID };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class RFIDWeb extends WebPlugin {\n async inventory() {\n console.log('inventory');\n return { value: 'salom' };\n }\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,IAAI,GAAGA,mBAAc,CAAC,MAAM,EAAE;AACpC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;AACzD,CAAC;;ACFM,MAAM,OAAO,SAASC,cAAS,CAAC;AACvC,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACjC,QAAQ,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAClC,KAAK;AACL,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrC,QAAQ,OAAO,OAAO,CAAC;AACvB,KAAK;AACL;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst RFID = registerPlugin('RFID', {\n web: () => import('./web').then(m => new m.RFIDWeb()),\n});\nexport * from './definitions';\nexport { RFID };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class RFIDWeb extends WebPlugin {\n async initRfid() {\n console.log('initRfid');\n return { value: 'initRfid' };\n }\n async inventory() {\n console.log('inventory');\n return { value: 'inventory' };\n }\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,IAAI,GAAGA,mBAAc,CAAC,MAAM,EAAE;AACpC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;AACzD,CAAC;;ACFM,MAAM,OAAO,SAASC,cAAS,CAAC;AACvC,IAAI,MAAM,QAAQ,GAAG;AACrB,QAAQ,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAChC,QAAQ,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AACrC,KAAK;AACL,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACjC,QAAQ,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AACtC,KAAK;AACL,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrC,QAAQ,OAAO,OAAO,CAAC;AACvB,KAAK;AACL;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -6,9 +6,13 @@ var capacitorRFID = (function (exports, core) {
6
6
  });
7
7
 
8
8
  class RFIDWeb extends core.WebPlugin {
9
+ async initRfid() {
10
+ console.log('initRfid');
11
+ return { value: 'initRfid' };
12
+ }
9
13
  async inventory() {
10
14
  console.log('inventory');
11
- return { value: 'salom' };
15
+ return { value: 'inventory' };
12
16
  }
13
17
  async echo(options) {
14
18
  console.log('ECHO', options);
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst RFID = registerPlugin('RFID', {\n web: () => import('./web').then(m => new m.RFIDWeb()),\n});\nexport * from './definitions';\nexport { RFID };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class RFIDWeb extends WebPlugin {\n async inventory() {\n console.log('inventory');\n return { value: 'salom' };\n }\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,IAAI,GAAGA,mBAAc,CAAC,MAAM,EAAE;IACpC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;IACzD,CAAC;;ICFM,MAAM,OAAO,SAASC,cAAS,CAAC;IACvC,IAAI,MAAM,SAAS,GAAG;IACtB,QAAQ,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACjC,QAAQ,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAClC,KAAK;IACL,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,OAAO,OAAO,CAAC;IACvB,KAAK;IACL;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst RFID = registerPlugin('RFID', {\n web: () => import('./web').then(m => new m.RFIDWeb()),\n});\nexport * from './definitions';\nexport { RFID };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class RFIDWeb extends WebPlugin {\n async initRfid() {\n console.log('initRfid');\n return { value: 'initRfid' };\n }\n async inventory() {\n console.log('inventory');\n return { value: 'inventory' };\n }\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,IAAI,GAAGA,mBAAc,CAAC,MAAM,EAAE;IACpC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;IACzD,CAAC;;ICFM,MAAM,OAAO,SAASC,cAAS,CAAC;IACvC,IAAI,MAAM,QAAQ,GAAG;IACrB,QAAQ,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAChC,QAAQ,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;IACrC,KAAK;IACL,IAAI,MAAM,SAAS,GAAG;IACtB,QAAQ,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACjC,QAAQ,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IACtC,KAAK;IACL,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,OAAO,OAAO,CAAC;IACvB,KAAK;IACL;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-rfid-plugin-ox",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "rfid reader (not ready to use)",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",