Skip to content

Commit

Permalink
#71 - Add OSS support for Athesi E5L integrated scanner (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaSpood authored May 5, 2022
1 parent 73e06dc commit d553429
Show file tree
Hide file tree
Showing 16 changed files with 230 additions and 48 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Zebra | Integrated: TC25... | Yes | No | EmdkPro
Zebra | BT ring RS6000,5100 | Yes | Yes | BtZebraProvider | BT SPP | | Yes | All 1D | Yes | On startup | No | Yes | Yes | Yes | ?
Zebra | BT ring RS6000,5100 | No | No | ZebraOssSppScannerProvider | BT SPP | Alternate pure OSS provider | Yes | All 1D | Yes | On startup | No | Yes | Yes | Yes | Yes
Bluebird | Integrated: EF500... | No | No | BluebirdProvider | Integrated | | Yes | Most, save D25 | Yes | ? | No | Yes | N/A | ? | ?
Athesi | Integrated: SPA43LTE | No | No | HHTProvider | Integrated | Device must be named SPA43LTE | Yes | All 1D | Yes | On startup | No | Yes | N/A | No? | Yes
Athesi | Integrated: SPA43LTE | No | No | AthesiHHTProvider | Integrated | Device must be named SPA43LTE | Yes | All 1D | Yes | On startup | No | Yes | N/A | No? | Yes
Athesi | Integrated: SPA43LTE | No | No | AthesiE5LProvider | Integrated | Device must be named RD50TE | Yes | All 1D | No | No? | No | No | N/A | No? | Yes
Honeywell | Integrated: EDA50... | Yes | Yes | AIDCProvider | Integrated | AIDC devices (Intermec) | Yes | All 1D | Yes | On startup | No | ? | N/A | No? | ?
Honeywell | Integrated: EDA52 | No | No | HoneywellOssIntegratedScannerProvider | Integrated | Device must be named EDA52 | Yes | All 1D | Yes | No | No | ? | N/A | No? | Yes
Honeywell | BT Voyager 1602g | No | No | HoneywellOssSppScannerProvider | BT SPP | | Yes | All 1D | Yes | No | No | ? | N/A | No? | Yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import android.widget.Switch;

import com.enioka.scanner.api.ScannerSearchOptions;
import com.enioka.scanner.sdk.athesi.HHTProvider;
import com.enioka.scanner.sdk.athesi.RD50TE.AthesiE5LProvider;
import com.enioka.scanner.sdk.athesi.SPA43LTE.AthesiHHTProvider;
import com.enioka.scanner.sdk.bluebird.BluebirdProvider;
import com.enioka.scanner.sdk.generalscan.GsSppScannerProvider;
import com.enioka.scanner.sdk.honeywelloss.integrated.HoneywellOssIntegratedScannerProvider;
Expand Down Expand Up @@ -39,7 +40,8 @@ protected void onCreate(Bundle savedInstanceState) {
((Switch) findViewById(R.id.switchPairingFlow)).setChecked(preferences.getBoolean(ScannerServiceApi.EXTRA_SEARCH_ALLOW_PAIRING_FLOW_BOOLEAN, options.allowPairingFlow));

final Set<String> allowedProviderKeys = preferences.getStringSet(ScannerServiceApi.EXTRA_SEARCH_ALLOWED_PROVIDERS_STRING_ARRAY, Collections.emptySet());
((CheckBox) findViewById(R.id.checkAllowedHHTProvider)).setChecked(allowedProviderKeys.contains(HHTProvider.PROVIDER_KEY));
((CheckBox) findViewById(R.id.checkAllowedHHTProvider)).setChecked(allowedProviderKeys.contains(AthesiHHTProvider.PROVIDER_KEY));
((CheckBox) findViewById(R.id.checkAllowedE5LProvider)).setChecked(allowedProviderKeys.contains(AthesiE5LProvider.PROVIDER_KEY));
((CheckBox) findViewById(R.id.checkAllowedBluebirdProvider)).setChecked(allowedProviderKeys.contains(BluebirdProvider.PROVIDER_KEY));
((CheckBox) findViewById(R.id.checkAllowedProgloveProvider)).setChecked(allowedProviderKeys.contains(ProgloveProvider.PROVIDER_KEY));
((CheckBox) findViewById(R.id.checkAllowedGsSppScannerProvider)).setChecked(allowedProviderKeys.contains(GsSppScannerProvider.PROVIDER_KEY));
Expand All @@ -49,7 +51,8 @@ protected void onCreate(Bundle savedInstanceState) {
((CheckBox) findViewById(R.id.checkAllowedHoneywellOssIntegratedScannerProvider)).setChecked(allowedProviderKeys.contains(HoneywellOssIntegratedScannerProvider.PROVIDER_KEY));

final Set<String> excludedProviderKeys = preferences.getStringSet(ScannerServiceApi.EXTRA_SEARCH_EXCLUDED_PROVIDERS_STRING_ARRAY, Collections.emptySet());
((CheckBox) findViewById(R.id.checkExcludedHHTProvider)).setChecked(excludedProviderKeys.contains(HHTProvider.PROVIDER_KEY));
((CheckBox) findViewById(R.id.checkExcludedHHTProvider)).setChecked(excludedProviderKeys.contains(AthesiHHTProvider.PROVIDER_KEY));
((CheckBox) findViewById(R.id.checkExcludedE5LProvider)).setChecked(excludedProviderKeys.contains(AthesiE5LProvider.PROVIDER_KEY));
((CheckBox) findViewById(R.id.checkExcludedBluebirdProvider)).setChecked(excludedProviderKeys.contains(BluebirdProvider.PROVIDER_KEY));
((CheckBox) findViewById(R.id.checkExcludedProgloveProvider)).setChecked(excludedProviderKeys.contains(ProgloveProvider.PROVIDER_KEY));
((CheckBox) findViewById(R.id.checkExcludedGsSppScannerProvider)).setChecked(excludedProviderKeys.contains(GsSppScannerProvider.PROVIDER_KEY));
Expand All @@ -70,7 +73,8 @@ public void onClickSave(View v) {
editor.putBoolean(ScannerServiceApi.EXTRA_SEARCH_ALLOW_PAIRING_FLOW_BOOLEAN, ((Switch) findViewById(R.id.switchPairingFlow)).isChecked());

final Set<String> allowedProviderKeys = new HashSet<>();
if (((CheckBox) findViewById(R.id.checkAllowedHHTProvider)).isChecked()) { allowedProviderKeys.add(HHTProvider.PROVIDER_KEY); }
if (((CheckBox) findViewById(R.id.checkAllowedHHTProvider)).isChecked()) { allowedProviderKeys.add(AthesiHHTProvider.PROVIDER_KEY); }
if (((CheckBox) findViewById(R.id.checkAllowedE5LProvider)).isChecked()) { allowedProviderKeys.add(AthesiE5LProvider.PROVIDER_KEY); }
if (((CheckBox) findViewById(R.id.checkAllowedBluebirdProvider)).isChecked()) { allowedProviderKeys.add(BluebirdProvider.PROVIDER_KEY); }
if (((CheckBox) findViewById(R.id.checkAllowedProgloveProvider)).isChecked()) { allowedProviderKeys.add(ProgloveProvider.PROVIDER_KEY); }
if (((CheckBox) findViewById(R.id.checkAllowedGsSppScannerProvider)).isChecked()) { allowedProviderKeys.add(GsSppScannerProvider.PROVIDER_KEY); }
Expand All @@ -81,7 +85,8 @@ public void onClickSave(View v) {
editor.putStringSet(ScannerServiceApi.EXTRA_SEARCH_ALLOWED_PROVIDERS_STRING_ARRAY, allowedProviderKeys);

final Set<String> excludedProviderKeys = new HashSet<>();
if (((CheckBox) findViewById(R.id.checkExcludedHHTProvider)).isChecked()) { excludedProviderKeys.add(HHTProvider.PROVIDER_KEY); }
if (((CheckBox) findViewById(R.id.checkExcludedHHTProvider)).isChecked()) { excludedProviderKeys.add(AthesiHHTProvider.PROVIDER_KEY); }
if (((CheckBox) findViewById(R.id.checkExcludedE5LProvider)).isChecked()) { excludedProviderKeys.add(AthesiE5LProvider.PROVIDER_KEY); }
if (((CheckBox) findViewById(R.id.checkExcludedBluebirdProvider)).isChecked()) { excludedProviderKeys.add(BluebirdProvider.PROVIDER_KEY); }
if (((CheckBox) findViewById(R.id.checkExcludedProgloveProvider)).isChecked()) { excludedProviderKeys.add(ProgloveProvider.PROVIDER_KEY); }
if (((CheckBox) findViewById(R.id.checkExcludedGsSppScannerProvider)).isChecked()) { excludedProviderKeys.add(GsSppScannerProvider.PROVIDER_KEY); }
Expand Down
62 changes: 56 additions & 6 deletions demoscannerapp/src/main/res/layout/activity_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewPairingFlow" />

<!-- Athesi -->
<!-- Athesi HTT -->
<TextView
android:id="@+id/textViewAllowedHHTProvider"
android:layout_width="fill_parent"
Expand All @@ -229,6 +229,31 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewAllowedProviders" />

<!-- Athesi E5L -->
<TextView
android:id="@+id/textViewAllowedE5LProvider"
android:layout_width="fill_parent"
android:layout_height="24dp"
android:layout_marginStart="48dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="16dp"
android:text="@string/e5lprovider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewAllowedHHTProvider" />

<CheckBox
android:id="@+id/checkAllowedE5LProvider"
android:layout_width="fill_parent"
android:layout_height="24dp"
android:layout_marginStart="16dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintRight_toLeftOf="@+id/textViewAllowedE5LProvider"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewAllowedHHTProvider" />

<!-- Bluebird -->
<TextView
android:id="@+id/textViewAllowedBluebirdProvider"
Expand All @@ -240,7 +265,7 @@
android:text="@string/bluebirdprovider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewAllowedHHTProvider" />
app:layout_constraintTop_toBottomOf="@+id/textViewAllowedE5LProvider" />

<CheckBox
android:id="@+id/checkAllowedBluebirdProvider"
Expand All @@ -252,7 +277,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintRight_toLeftOf="@+id/textViewAllowedBluebirdProvider"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewAllowedHHTProvider" />
app:layout_constraintTop_toBottomOf="@+id/textViewAllowedE5LProvider" />

<!-- Proglove -->
<TextView
Expand Down Expand Up @@ -418,7 +443,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/checkAllowedHoneywellOssIntegratedScannerProvider" />

<!-- Athesi -->
<!-- Athesi HTT-->
<TextView
android:id="@+id/textViewExcludedHHTProvider"
android:layout_width="fill_parent"
Expand All @@ -443,6 +468,31 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewExcludedProviders" />

<!-- Athesi E5L -->
<TextView
android:id="@+id/textViewExcludedE5LProvider"
android:layout_width="fill_parent"
android:layout_height="24dp"
android:layout_marginStart="48dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="16dp"
android:text="@string/e5lprovider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewExcludedHHTProvider" />

<CheckBox
android:id="@+id/checkExcludedE5LProvider"
android:layout_width="fill_parent"
android:layout_height="24dp"
android:layout_marginStart="16dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintRight_toLeftOf="@+id/textViewExcludedE5LProvider"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewExcludedHHTProvider" />

<!-- Bluebird -->
<TextView
android:id="@+id/textViewExcludedBluebirdProvider"
Expand All @@ -454,7 +504,7 @@
android:text="@string/bluebirdprovider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewExcludedHHTProvider" />
app:layout_constraintTop_toBottomOf="@+id/textViewExcludedE5LProvider" />

<CheckBox
android:id="@+id/checkExcludedBluebirdProvider"
Expand All @@ -466,7 +516,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintRight_toLeftOf="@+id/textViewExcludedBluebirdProvider"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewExcludedHHTProvider" />
app:layout_constraintTop_toBottomOf="@+id/textViewExcludedE5LProvider" />

<!-- Proglove -->
<TextView
Expand Down
3 changes: 2 additions & 1 deletion demoscannerapp/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<string name="excluded_providers">Providers Exclus (vide = aucun):</string>
<string name="save">Enregistrer</string>

<string name="hhtprovider">HHTProvider</string>
<string name="hhtprovider">AthesiHHTProvider</string>
<string name="e5lprovider">AthesiE5LProvider</string>
<string name="bluebirdprovider">BluebirdProvider</string>
<string name="progloveprovider">ProgloveProvider</string>
<string name="gssppscannerprovider">GsSppScannerProvider</string>
Expand Down
3 changes: 2 additions & 1 deletion demoscannerapp/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
<string name="excluded_providers">Excluded Providers (empty = none):</string>
<string name="save">Save</string>

<string name="hhtprovider">HHTProvider</string>
<string name="hhtprovider">AthesiHHTProvider</string>
<string name="e5lprovider">AthesiE5LProvider</string>
<string name="bluebirdprovider">BluebirdProvider</string>
<string name="progloveprovider">ProgloveProvider</string>
<string name="gssppscannerprovider">GsSppScannerProvider</string>
Expand Down
13 changes: 12 additions & 1 deletion enioka_scan/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,18 @@
<!-- Other scanner providers -->

<service
android:name=".sdk.athesi.HHTProvider"
android:name=".sdk.athesi.SPA43LTE.AthesiHHTProvider"
android:description="@string/service_description"
android:exported="false"
tools:ignore="Instantiatable">

<intent-filter>
<action android:name="com.enioka.scan.PROVIDE_SCANNER" />
</intent-filter>
</service>

<service
android:name=".sdk.athesi.RD50TE.AthesiE5LProvider"
android:description="@string/service_description"
android:exported="false"
tools:ignore="Instantiatable">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Build;
import android.util.Log;

import com.enioka.scanner.api.Scanner;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.enioka.scanner.sdk.athesi.RD50TE;

/**
* Intent actions, extras and related constants for the Athesi E5L integrated scanner, observed through android error logs.
*/
public class AthesiE5LIntents {
public static final String BARCODE_EVENT = "com.android.serial.BARCODEPORT_RECEIVEDDATA_ACTION";
public static final String BARCODE_DATA_EXTRA = "DATA";
public static final String PRESS_TRIGGER = "com.android.action.keyevent.KEYCODE_KEYCODE_SCAN_L_DOWN";
public static final String RELEASE_TRIGGER = "com.android.action.keyevent.KEYCODE_KEYCODE_SCAN_L_UP";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.enioka.scanner.sdk.athesi.RD50TE;

import android.content.Context;

import com.enioka.scanner.api.Scanner;
import com.enioka.scanner.api.ScannerSearchOptions;
import com.enioka.scanner.helpers.intent.IntentScannerProvider;

/**
* Provider for Athesi E5L scanners.
* May use similar intents as other modern Athesi scanners but only the E5L is accepted as it is the only one that could be tested.
*/
public class AthesiE5LProvider extends IntentScannerProvider {
public static final String PROVIDER_KEY = "AthesiE5LProvider";

@Override
protected void configureProvider() {
specificDevices.add("RD50TE");
}

@Override
public String getKey() {
return PROVIDER_KEY;
}

@Override
protected Scanner createNewScanner(Context ctx, ScannerSearchOptions options) {
return new AthesiE5LScanner();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.enioka.scanner.sdk.athesi.RD50TE;

import android.content.Context;
import android.content.Intent;
import android.support.annotation.Nullable;

import com.enioka.scanner.api.Scanner;
import com.enioka.scanner.api.proxies.ScannerCommandCallbackProxy;
import com.enioka.scanner.data.Barcode;
import com.enioka.scanner.data.BarcodeType;
import com.enioka.scanner.helpers.intent.IntentScanner;

import java.util.ArrayList;
import java.util.List;

/**
* Scanner interface for modern Athesi scanners (i.e. E5L)
*/
public class AthesiE5LScanner extends IntentScanner<String> implements Scanner.WithTriggerSupport {
private static final String LOG_TAG = "AthesiE5LScanner";

@Override
public void onReceive(Context context, Intent intent) {
List<Barcode> barcodes = new ArrayList<>();
barcodes.add(new Barcode(intent.getStringExtra(AthesiE5LIntents.BARCODE_DATA_EXTRA), BarcodeType.UNKNOWN));
if (dataCb != null) {
dataCb.onData(this, barcodes);
}
}

@Override
public String getProviderKey() {
return AthesiE5LProvider.PROVIDER_KEY;
}


////////////////////////////////////////////////////////////////////////////////////////////////
// LIFE CYCLE
////////////////////////////////////////////////////////////////////////////////////////////////

@Override
protected void configureProvider() {
broadcastIntentFilters.add(AthesiE5LIntents.BARCODE_EVENT);
disableScanner = null; // FIXME
enableScanner = null; // FIXME
}


////////////////////////////////////////////////////////////////////////////////////////////////
// SOFTWARE TRIGGERS
////////////////////////////////////////////////////////////////////////////////////////////////

@Override
public void pressScanTrigger(@Nullable ScannerCommandCallbackProxy cb) {
broadcastIntent(AthesiE5LIntents.PRESS_TRIGGER);
if (cb != null) {
cb.onSuccess();
}
}

@Override
public void releaseScanTrigger(@Nullable ScannerCommandCallbackProxy cb) {
broadcastIntent(AthesiE5LIntents.RELEASE_TRIGGER);
if (cb != null) {
cb.onSuccess();
}
}
}
Loading

0 comments on commit d553429

Please sign in to comment.