Skip to content

Commit 9b5b6a3

Browse files
fix: stop low-level card scan & deactivate RF on stop detection
1 parent 2f6bc0e commit 9b5b6a3

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Fixed
9+
- Card scanning process. Now, the low-level card scanning is properly stopped and the RF field is
10+
deactivated when the card detection is stopped, resulting in improved battery life for the
11+
terminal.
812

913
## [2.1.1] - 2023-01-10
1014
### Added

bluebird-plugin/src/main/kotlin/org/calypsonet/keyple/plugin/bluebird/BluebirdContactlessReaderAdapter.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,11 @@ internal class BluebirdContactlessReaderAdapter(activity: Activity) :
294294
try {
295295
nfcBroadcastReceiver.listener = listener
296296
nfcReader.cardTypeForScan = pollingProtocols
297-
var status = nfcReader.startScan()
297+
var status = nfcReader.BBextNfcCarrierOn()
298+
if (status != ExtNfcReader.ResultCode.SUCCESS) {
299+
Timber.e("Error while setting the RF field on")
300+
}
301+
status = nfcReader.startScan()
298302
// If the reader is already started -> stop it then re-start it
299303
if (status == ExtNfcReader.ResultCode.ERROR_ALREADY_ON_SCANNING) {
300304
status = nfcReader.stopScan()
@@ -342,6 +346,14 @@ internal class BluebirdContactlessReaderAdapter(activity: Activity) :
342346
*/
343347
override fun onStopDetection() {
344348
Timber.d("Stop card scan")
349+
var status = nfcReader.stopScan()
350+
if (status != ExtNfcReader.ResultCode.SUCCESS) {
351+
Timber.e("Error while stopping the scan")
352+
}
353+
status = nfcReader.BBextNfcCarrierOff()
354+
if (status != ExtNfcReader.ResultCode.SUCCESS) {
355+
Timber.e("Error while setting the RF field off")
356+
}
345357
nfcBroadcastReceiver.unregister()
346358
}
347359

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
group = org.calypsonet.keyple
22
title = Keyple Plugin CNA Bluebird Specific NFC Java Lib
33
description = Keyple add-on to manage Bluebird Specific NFC readers
4-
version = 2.1.1
4+
version = 2.1.2
55
archivesBaseName = keyple-plugin-cna-bluebird-specific-nfc-java-lib
66

77
javaSourceLevel = 1.6

0 commit comments

Comments
 (0)