capacitor-rfid-plugin-ox 0.0.6 → 0.0.7
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 = "
|
|
13
|
-
|
|
14
|
-
public RfidManager mRfidManager;
|
|
10
|
+
public static final String TAG = "MainActivity";
|
|
15
11
|
@Override
|
|
16
12
|
public void onCreate(Bundle savedInstanceState) {
|
|
17
|
-
|
|
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,34 @@ public class RFIDPlugin extends Plugin {
|
|
|
15
15
|
|
|
16
16
|
private RFID implementation = new RFID();
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
this.initRfid();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@PluginMethod
|
|
43
|
+
public void inventory(PluginCall call) {
|
|
44
|
+
Log.d(TAG, String.valueOf(mRfidManager.getRange()));
|
|
45
|
+
}
|
|
22
46
|
|
|
23
47
|
@PluginMethod
|
|
24
48
|
public void echo(PluginCall call) {
|