capacitor-rfid-plugin-ox 0.3.1 → 0.3.3

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.
@@ -45,16 +45,20 @@ android {
45
45
  repositories {
46
46
  google()
47
47
  mavenCentral()
48
+
49
+ flatDir {
50
+ dirs("libs")
51
+ }
48
52
  }
49
53
 
50
54
 
51
55
  dependencies {
52
- implementation fileTree(dir: 'libs', include: ['*.jar'])
56
+ implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'])
53
57
  implementation project(':capacitor-android')
54
58
  implementation files('libs/platform_sdk_v3.1.221124.jar')
55
- implementation project(':rfid-urovo-usdk')
59
+ api project(':rfid_urovo_usdk')
56
60
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
57
61
  testImplementation "junit:junit:$junitVersion"
58
62
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
59
63
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
60
- }
64
+ }
@@ -1,2 +1,16 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <application
3
+ android:name="uz.ox.plugins.rfid.BaseApplication"
4
+ android:allowBackup="true">
5
+ <activity
6
+ android:name="uz.ox.plugins.rfid.MainActivity"
7
+ android:exported="true"
8
+ >
9
+ <intent-filter>
10
+ <action android:name="android.intent.action.MAIN" />
11
+
12
+ <category android:name="android.intent.category.LAUNCHER" />
13
+ </intent-filter>
14
+ </activity>
15
+ </application>
2
16
  </manifest>
@@ -6,13 +6,13 @@ import android.util.Log;
6
6
  import androidx.fragment.app.Fragment;
7
7
 
8
8
  import com.ubx.usdk.rfid.aidl.IRfidCallback;
9
- import com.ubx.usdk.util.SoundTool;
10
9
 
11
10
  import java.util.Date;
12
11
  import java.util.HashMap;
13
12
  import java.util.List;
14
13
 
15
14
  import uz.ox.plugins.rfid.pojo.TagScan;
15
+ import uz.ox.plugins.rfid.utils.SoundTool;;
16
16
 
17
17
  public class Scan extends Fragment {
18
18
  private final RFID rfid;
@@ -203,10 +203,11 @@ public class Scan extends Fragment {
203
203
  }
204
204
 
205
205
  private void notiyDatasSearch(String s2, String TID, final String strRSSI) {
206
- Log.d(TAG, "onInventoryTag: ............... epc: " + s2 + " tid: " + TID + " strRSSI: " + TID);
207
-
208
206
  if (searchableTagsMap.containsKey(s2)) {
209
- if (new Date().getTime() - lastBeepTime.getTime() > 100) {
207
+ double beepInterval = (double) (100 - Integer.parseInt(strRSSI)) / 40 * 1500 + 10;
208
+
209
+ Log.d(TAG, "beepInterval: " + beepInterval);
210
+ if (new Date().getTime() - lastBeepTime.getTime() > beepInterval) {
210
211
  SoundTool.getInstance(BaseApplication.getContext()).playBeep(2);
211
212
  lastBeepTime = new Date();
212
213
  }
@@ -0,0 +1,56 @@
1
+ package uz.ox.plugins.rfid.utils;
2
+
3
+ import android.content.Context;
4
+ import android.media.AudioAttributes;
5
+ import android.media.SoundPool;
6
+ import com.ubx.usdk.R.raw;
7
+
8
+ public class SoundTool {
9
+ protected static volatile SoundTool instance;
10
+ protected final int SOUND_SWIPE_CARD;
11
+ protected final int SOUND_SWIPE_FACE;
12
+ protected SoundPool soundPool;
13
+
14
+ private SoundTool(Context context) {
15
+ AudioAttributes audioAttributes = new AudioAttributes.Builder()
16
+ .setUsage(AudioAttributes.USAGE_NOTIFICATION_EVENT)
17
+ .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
18
+ .build();
19
+
20
+ this.soundPool = new SoundPool.Builder()
21
+ .setMaxStreams(3)
22
+ .setAudioAttributes(audioAttributes)
23
+ .build();
24
+
25
+ this.SOUND_SWIPE_CARD = this.soundPool.load(context, raw.scan_buzzer, 1);
26
+ this.SOUND_SWIPE_FACE = this.soundPool.load(context, raw.scan_new, 1);
27
+ }
28
+
29
+ public static synchronized SoundTool getInstance(Context context) {
30
+ if (instance == null) {
31
+ instance = new SoundTool(context);
32
+ }
33
+
34
+ return instance;
35
+ }
36
+
37
+ public void release() {
38
+ if (this.soundPool != null) {
39
+ this.soundPool.release();
40
+ this.soundPool = null;
41
+ instance = null;
42
+ }
43
+ }
44
+
45
+ public void playBeep(int mode) {
46
+ switch (mode) {
47
+ case 0:
48
+ return;
49
+ case 1:
50
+ this.soundPool.play(this.SOUND_SWIPE_CARD, 1.0F, 1.0F, 1, 0, 1.0F);
51
+ break;
52
+ case 2:
53
+ this.soundPool.play(this.SOUND_SWIPE_FACE, 1.0F, 1.0F, 1, 0, 1.0F);
54
+ }
55
+ }
56
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-rfid-plugin-ox",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "rfid read-write",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",