capacitor-rfid-plugin-ox 0.0.6 → 0.0.8

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.
@@ -4,32 +4,15 @@ 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;
9
7
 
10
8
  public class MainActivity extends BridgeActivity {
11
9
 
12
- public static final String TAG = "usdk";
13
-
14
- public RfidManager mRfidManager;
10
+ public static final String TAG = "MainActivity";
15
11
  @Override
16
12
  public void onCreate(Bundle savedInstanceState) {
17
- this.initRfid();
13
+ registerPlugin(RFIDPlugin.class);
14
+ Log.i(TAG, "initRfid() onCreate...");
18
15
  super.onCreate(savedInstanceState);
19
16
  }
20
17
 
21
- private void initRfid() {
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
18
  }
@@ -15,10 +15,40 @@ public class RFIDPlugin extends Plugin {
15
15
 
16
16
  private RFID implementation = new RFID();
17
17
 
18
- // @PluginMethod
19
- // public void inventory(PluginCall call) {
20
- // Log.d(TAG, String.valueOf(mRfidManager.getRange()));
21
- // }
18
+ public static final String TAG = "usdk";
19
+
20
+ public RfidManager mRfidManager;
21
+
22
+ private void initRfid() {
23
+ // 在异步回调中拿到RFID实例
24
+ USDKManager.getInstance().init(BaseApplication.getContext(), new USDKManager.InitListener() {
25
+ @Override
26
+ public void onStatus(USDKManager.STATUS status) {
27
+ if (status == USDKManager.STATUS.SUCCESS) {
28
+ Log.d(TAG, "initRfid() success.");
29
+ mRfidManager = USDKManager.getInstance().getRfidManager();
30
+ } else {
31
+ Log.d(TAG, "initRfid fail.");
32
+ }
33
+ }
34
+ });
35
+ }
36
+
37
+ @Override
38
+ public void load() {
39
+ RFIDPlugin RFIDPlugin = this;
40
+ getBridge().getActivity().runOnUiThread(new Runnable() {
41
+ @Override
42
+ public void run() {
43
+ RFIDPlugin.initRfid();
44
+ }
45
+ });
46
+ }
47
+
48
+ @PluginMethod
49
+ public void inventory(PluginCall call) {
50
+ Log.d(TAG, String.valueOf(mRfidManager.getRange()));
51
+ }
22
52
 
23
53
  @PluginMethod
24
54
  public void echo(PluginCall call) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-rfid-plugin-ox",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "rfid reader (not ready to use)",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",