Skip to content

Commit 0ffc4ee

Browse files
authored
Merge pull request #51 from cslrfid/develop
Develop
2 parents 8209930 + 3c27ff2 commit 0ffc4ee

25 files changed

+785
-989
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ android {
1111
applicationId "com.csl.cs108ademoapp"
1212
minSdk 23
1313
targetSdk 35
14-
versionCode 42
15-
versionName "2.14.38"
14+
versionCode 44
15+
versionName "2.15.0"
1616
}
1717
}
1818

Binary file not shown.
Binary file not shown.

app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
1616

17-
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
18-
<uses-permission android:name="androdi.permission.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE"/>
19-
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION"/>
17+
<!--uses-permission android:name="android.permission.FOREGROUND_SERVICE"/-->
18+
<!--uses-permission android:name="androdi.permission.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE"/-->
19+
<!--uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION"/-->
2020

2121
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
2222
<uses-permission android:name="android.permission.INTERNET" />
@@ -35,12 +35,12 @@
3535
android:requestLegacyExternalStorage="true"
3636
android:theme="@style/AppTheme">
3737

38-
<service
38+
<!--service
3939
android:enabled="true"
4040
android:name="MyForegroundService"
4141
android:foregroundServiceType="location"
4242
android:exported="false"
43-
android:stopWithTask="true" />
43+
android:stopWithTask="true" /-->
4444

4545
<service android:name="CustomIME"
4646
android:label="@string/app_ime_cs108"

app/src/main/java/com/csl/cs108ademoapp/AccessTask1.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public String deformatWriteAccessData(String strIn) {
8888
return strOut;
8989
}
9090

91-
boolean isResultReady = false; int tryCount = 0, tryCountMax = 3;
91+
boolean isResultReady = false; int tryCount = 0, tryCountMax = 8;
9292
public boolean isResultReady() {
9393
boolean bValue = false;
9494
if (accessTask == null) { }

app/src/main/java/com/csl/cs108ademoapp/MainActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757

5858
public class MainActivity extends AppCompatActivity {
5959
final boolean DEBUG = false; final String TAG = "Hello";
60+
public static boolean foregroundServiceEnable = false;
6061
public static boolean activityActive = false;
6162
public static DrawerPositions drawerPositionsDefault = DrawerPositions.MAIN;
6263

app/src/main/java/com/csl/cs108ademoapp/MyForegroundService.java

Lines changed: 92 additions & 74 deletions
Large diffs are not rendered by default.

app/src/main/java/com/csl/cs108ademoapp/fragments/AccessUcode8Fragment.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.csl.cs108ademoapp.fragments;
22

33
import static com.csl.cslibrary4a.RfidReader.TagType.TAG_NXP;
4-
import static com.csl.cslibrary4a.RfidReader.TagType.TAG_NXP_UCODE8;
54
import static com.csl.cslibrary4a.RfidReader.TagType.TAG_NXP_UCODE8_EPC;
65
import static com.csl.cslibrary4a.RfidReader.TagType.TAG_NXP_UCODE8_EPCBRAND;
76
import static com.csl.cslibrary4a.RfidReader.TagType.TAG_NXP_UCODE8_EPCBRANDTID;

app/src/main/java/com/csl/cs108ademoapp/fragments/ConnectionFragment.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class ConnectionFragment extends CommonFragment {
3737
private ScanCallback mScanCallback;
3838
private ArrayList<ReaderDevice> readersList = MainActivity.sharedObjects.readersList;
3939

40-
private ArrayList<BluetoothGatt.Cs108ScanData> mScanResultList = new ArrayList<>();
40+
private ArrayList<BluetoothGatt.CsScanData> mScanResultList = new ArrayList<>();
4141
private Handler mHandler = new Handler();
4242
private DeviceConnectTask deviceConnectTask;
4343

@@ -179,8 +179,8 @@ private class DeviceScanTask extends AsyncTask<Void, String, String> {
179179
protected String doInBackground(Void... a) {
180180
while (isCancelled() == false) {
181181
if (wait4process == false) {
182-
BluetoothGatt.Cs108ScanData cs108ScanData = MainActivity.csLibrary4A.getNewDeviceScanned();
183-
if (cs108ScanData != null) mScanResultList.add(cs108ScanData);
182+
BluetoothGatt.CsScanData csScanData = MainActivity.csLibrary4A.getNewDeviceScanned();
183+
if (csScanData != null) mScanResultList.add(csScanData);
184184
if (scanning == false || mScanResultList.size() != 0 || System.currentTimeMillis() - timeMillisUpdate > 10000) {
185185
wait4process = true; publishProgress("");
186186
}
@@ -198,7 +198,7 @@ protected void onProgressUpdate(String... output) {
198198
}
199199
boolean listUpdated = false;
200200
while (mScanResultList.size() != 0) {
201-
BluetoothGatt.Cs108ScanData scanResultA = mScanResultList.get(0);
201+
BluetoothGatt.CsScanData scanResultA = mScanResultList.get(0);
202202
mScanResultList.remove(0);
203203
if (getActivity() == null) continue;
204204
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {

app/src/main/java/com/csl/cs108ademoapp/fragments/DirectWedgeFragment.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,9 @@ public void run() {
367367
listUpdated = true;
368368
} else {
369369
while (true) {
370-
BluetoothGatt.Cs108ScanData cs108ScanData = MainActivity.csLibrary4A.getNewDeviceScanned();
371-
if (cs108ScanData != null) {
372-
BluetoothGatt.Cs108ScanData scanResultA = cs108ScanData;
370+
BluetoothGatt.CsScanData csScanData = MainActivity.csLibrary4A.getNewDeviceScanned();
371+
if (csScanData != null) {
372+
BluetoothGatt.CsScanData scanResultA = csScanData;
373373
if (getActivity() == null) continue;
374374
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
375375
if (ActivityCompat.checkSelfPermission(getActivity().getApplicationContext(), BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {

app/src/main/java/com/csl/cs108ademoapp/fragments/HomeFragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ public void run() {
237237
MainActivity.csLibrary4A.appendToLog("runnableStartService: ActivityCompat.checkSelfPermission(activity, POST_NOTIFICATIONS) = " + ActivityCompat.checkSelfPermission(mContext, POST_NOTIFICATIONS));
238238
if (NotificationManagerCompat.from(getActivity()).areNotificationsEnabled()) MainActivity.csLibrary4A.appendToLog("Notification is enabled");
239239
else MainActivity.csLibrary4A.appendToLog("Notification is disabled");
240-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
240+
if (!MainActivity.foregroundServiceEnable) { }
241+
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
241242
if (ActivityCompat.checkSelfPermission(mContext, POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
242243
MainActivity.csLibrary4A.appendToLog("runnableStartService: requestPermissions POST_NOTIFICATIONS");
243244
requestPermissions(new String[] { POST_NOTIFICATIONS }, 10); //POST_NOTIFICATIONS, FOREGROUND_SERVICE_LOCATION

app/src/main/java/com/csl/cs108ademoapp/fragments/SettingAdminFragment.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.os.Bundle;
44
import android.os.Handler;
55
import android.text.InputFilter;
6+
import android.text.Layout;
67
import android.view.LayoutInflater;
78
import android.view.View;
89
import android.view.ViewGroup;
@@ -377,6 +378,10 @@ public void onClick(View v) {
377378
checkBoxDebugEnable = (CheckBox) getActivity().findViewById(R.id.settingAdminDebugEnable);
378379
checkBoxForegroundService = (CheckBox) getActivity().findViewById(R.id.settingAdminForegroundEnable);
379380

381+
if (!MainActivity.foregroundServiceEnable) {
382+
LinearLayout linearLayout = (LinearLayout) getActivity().findViewById(R.id.settingAdminForegroundLayout);
383+
linearLayout.setVisibility(View.GONE);
384+
}
380385
if (sameCheck == false) MainActivity.csLibrary4A.setSameCheck(false);
381386
mHandler.post(updateRunnable);
382387
}
@@ -702,7 +707,7 @@ else if (MainActivity.csLibrary4A.setServerTimeout(iServerTimeout) == false)
702707
invalidRequest = true;
703708
}
704709
}
705-
if (invalidRequest == false && checkBoxForegroundService != null) {
710+
if (invalidRequest == false && checkBoxForegroundService != null && MainActivity.foregroundServiceEnable) {
706711
MainActivity.csLibrary4A.appendToLog("getForegroundServiceEnable = " + MainActivity.csLibrary4A.getForegroundServiceEnable() + ", foregroundServiceEnable = " + foregroundServiceEnable);
707712
if (MainActivity.csLibrary4A.getForegroundServiceEnable() != foregroundServiceEnable || sameCheck == false) {
708713
sameSetting = false;

app/src/main/res/layout/fragment_settings_admin.xml

Lines changed: 105 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -459,75 +459,129 @@
459459
style="@style/style_normal_font" />
460460
</TableRow>
461461

462-
<TableRow
462+
<LinearLayout
463+
android:id="@+id/settingAdminForegroundLayout"
463464
android:layout_width="match_parent"
464465
android:layout_height="wrap_content"
465-
android:layout_gravity="center_vertical">
466+
android:gravity="center|bottom"
467+
android:orientation="vertical" >
466468

467-
<TextView
468-
android:layout_width="wrap_content"
469-
style="@style/style_normal_font"
470-
android:text="Inventory Cloud Saving" />
469+
<View
470+
android:layout_width="match_parent"
471+
android:layout_height="1dp"
472+
android:background="@android:color/darker_gray" />
471473

472-
<RadioGroup
474+
<TableRow
473475
android:layout_width="match_parent"
474476
android:layout_height="wrap_content"
475-
android:orientation='horizontal'>
477+
android:layout_gravity="center_vertical"
478+
android:visibility="visible">
476479

477-
<RadioButton
478-
android:id="@+id/settingAdminCloudSaveNone"
480+
<TextView
479481
android:layout_width="wrap_content"
480-
android:layout_height="wrap_content"
481-
android:text="none"
482-
android:checked="true"/>
482+
style="@style/style_normal_font"
483+
android:text="Foreground Service:" />
483484

484-
<RadioButton
485-
android:id="@+id/settingAdminCloudSaveHttp"
486-
android:layout_width="wrap_content"
487-
android:layout_height="wrap_content"
488-
android:text="HTTP" />
485+
<CheckBox
486+
android:id="@+id/settingAdminForegroundEnable"
487+
android:layout_width="0dp"
488+
android:layout_weight="1"
489+
style="@style/style_normal_font"
490+
android:text="Enable" />
491+
</TableRow>
492+
493+
<TableRow
494+
android:layout_width="match_parent"
495+
android:layout_height="wrap_content"
496+
android:layout_gravity="center_vertical">
497+
498+
<TextView
499+
android:id="@+id/settingAdminDupElimDelayLabel"
500+
android:layout_width="0dp"
501+
android:layout_weight="5"
502+
style="@style/style_normal_font"
503+
android:text="Foreground Duplication Elimination in seconds" />
504+
505+
<EditText
506+
android:id="@+id/settingAdminDupElimDelay"
507+
android:layout_width="0dp"
508+
android:layout_weight="1"
509+
android:background="@drawable/my_edittext_background"
510+
android:inputType="numberDecimal"
511+
android:text="1"
512+
style="@style/style_normal_font" />
513+
</TableRow>
514+
515+
<TableRow
516+
android:layout_width="match_parent"
517+
android:layout_height="wrap_content"
518+
android:layout_gravity="center_vertical">
489519

490-
<RadioButton
491-
android:id="@+id/settingAdminCloudSaveMqtt"
520+
<TextView
492521
android:layout_width="wrap_content"
522+
style="@style/style_normal_font"
523+
android:text="Inventory Cloud Saving" />
524+
525+
<RadioGroup
526+
android:layout_width="match_parent"
493527
android:layout_height="wrap_content"
494-
android:text="MQTT" />
495-
</RadioGroup>
496-
</TableRow>
528+
android:orientation='horizontal'>
529+
530+
<RadioButton
531+
android:id="@+id/settingAdminCloudSaveNone"
532+
android:layout_width="wrap_content"
533+
android:layout_height="wrap_content"
534+
android:text="none"
535+
android:checked="true"/>
536+
537+
<RadioButton
538+
android:id="@+id/settingAdminCloudSaveHttp"
539+
android:layout_width="wrap_content"
540+
android:layout_height="wrap_content"
541+
android:text="HTTP" />
542+
543+
<RadioButton
544+
android:id="@+id/settingAdminCloudSaveMqtt"
545+
android:layout_width="wrap_content"
546+
android:layout_height="wrap_content"
547+
android:text="MQTT" />
548+
</RadioGroup>
549+
</TableRow>
497550

498-
<TableRow
499-
android:layout_width="match_parent"
500-
android:layout_height="wrap_content"
501-
android:layout_gravity="center_vertical">
551+
<TableRow
552+
android:layout_width="match_parent"
553+
android:layout_height="wrap_content"
554+
android:layout_gravity="center_vertical">
502555

503-
<TextView
504-
android:layout_width="wrap_content"
505-
style="@style/style_normal_font"
506-
android:text="MQTT address" />
556+
<TextView
557+
android:layout_width="wrap_content"
558+
style="@style/style_normal_font"
559+
android:text="MQTT address" />
507560

508-
<EditText
509-
android:id="@+id/settingAdminMqttServer"
510-
style="@style/style_normal_font"
511-
android:inputType="textNoSuggestions|textVisiblePassword|textMultiLine"
512-
android:gravity="center" />
513-
</TableRow>
561+
<EditText
562+
android:id="@+id/settingAdminMqttServer"
563+
style="@style/style_normal_font"
564+
android:inputType="textNoSuggestions|textVisiblePassword|textMultiLine"
565+
android:gravity="center" />
566+
</TableRow>
514567

515-
<TableRow
516-
android:layout_width="match_parent"
517-
android:layout_height="wrap_content"
518-
android:layout_gravity="center_vertical">
568+
<TableRow
569+
android:layout_width="match_parent"
570+
android:layout_height="wrap_content"
571+
android:layout_gravity="center_vertical">
519572

520-
<TextView
521-
android:layout_width="wrap_content"
522-
style="@style/style_normal_font"
523-
android:text="MQTT topic" />
573+
<TextView
574+
android:layout_width="wrap_content"
575+
style="@style/style_normal_font"
576+
android:text="MQTT topic" />
524577

525-
<EditText
526-
android:id="@+id/settingAdminTopicMqtt"
527-
style="@style/style_normal_font"
528-
android:inputType="textNoSuggestions|textVisiblePassword|textMultiLine"
529-
android:gravity="center" />
530-
</TableRow>
578+
<EditText
579+
android:id="@+id/settingAdminTopicMqtt"
580+
style="@style/style_normal_font"
581+
android:inputType="textNoSuggestions|textVisiblePassword|textMultiLine"
582+
android:gravity="center" />
583+
</TableRow>
584+
</LinearLayout>
531585

532586
<TableRow
533587
android:layout_width="match_parent"
@@ -618,52 +672,6 @@
618672
android:gravity="center" />
619673
</TableRow>
620674

621-
<View
622-
android:layout_width="match_parent"
623-
android:layout_height="1dp"
624-
android:background="@android:color/darker_gray" />
625-
626-
<TableRow
627-
android:layout_width="match_parent"
628-
android:layout_height="wrap_content"
629-
android:layout_gravity="center_vertical"
630-
android:visibility="visible">
631-
632-
<TextView
633-
android:layout_width="wrap_content"
634-
style="@style/style_normal_font"
635-
android:text="Foreground Service:" />
636-
637-
<CheckBox
638-
android:id="@+id/settingAdminForegroundEnable"
639-
android:layout_width="0dp"
640-
android:layout_weight="1"
641-
style="@style/style_normal_font"
642-
android:text="Enable" />
643-
</TableRow>
644-
645-
<TableRow
646-
android:layout_width="match_parent"
647-
android:layout_height="wrap_content"
648-
android:layout_gravity="center_vertical">
649-
650-
<TextView
651-
android:id="@+id/settingAdminDupElimDelayLabel"
652-
android:layout_width="0dp"
653-
android:layout_weight="5"
654-
style="@style/style_normal_font"
655-
android:text="Foreground Duplication Elimination in seconds" />
656-
657-
<EditText
658-
android:id="@+id/settingAdminDupElimDelay"
659-
android:layout_width="0dp"
660-
android:layout_weight="1"
661-
android:background="@drawable/my_edittext_background"
662-
android:inputType="numberDecimal"
663-
android:text="1"
664-
style="@style/style_normal_font" />
665-
</TableRow>
666-
667675
<View
668676
android:layout_width="match_parent"
669677
android:layout_height="1dp"

cslibrary4a/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ android {
1010
defaultConfig {
1111
minSdk 23
1212
targetSdk 35
13-
buildConfigField 'String', 'VERSION_NAME', "\"34\""
13+
buildConfigField 'String', 'VERSION_NAME', "\"0\""
1414
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1515
}
1616

0 commit comments

Comments
 (0)