Git Product home page Git Product logo

feitiansmartcardreader / feitian_mobile_readers Goto Github PK

View Code? Open in Web Editor NEW
22.0 11.0 13.0 246.21 MB

This is first Combo SDK, support bR301,iR301,bR301BLE,bR500

Home Page: http://www.pcscreader.com/docs/getting_started.html

Java 34.94% Objective-C 8.45% C 2.17% C++ 17.25% Objective-C++ 1.73% Swift 0.24% Makefile 0.02% CMake 0.17% HTML 0.01% Shell 0.01% C# 17.72% AIDL 0.06% LLVM 17.24%
bluetooth-smart lightning cardreader pcsclite contactless contact

feitian_mobile_readers's Introduction

Get Start: http://www.pcscreader.com/docs/getting_started.html

Take a test: http://www.pcscreader.com/docs/usage.html

Install App on iOS:
https://itunes.apple.com/us/app/smartcard-reader/id525954151?mt=8

Install App on Android:
iReader: https://play.google.com/store/apps/details?id=com.ftsafe.ireader
PCSCLite: https://play.google.com/store/apps/details?id=com.ftsafe.pcscdemo&hl=en&gl=US 
Private API: https://play.google.com/store/apps/details?id=com.ftsafe.cardreader&hl=en&gl=US



User manual and Developer manual:
http://www.pcscreader.com/docs/getting_started.html

History:
2024/04/12
	- upload iOS_SDK_ForApplePrimitiveCCID, this version iOS SDK is specific made for Apple primitive suport for CCID compliant reader by utilizing the CryptoTokenKit framework.
2022/05/17
	- update android SDK, lib upgrade to 1.0.9.6
	- update iOS SDK, lib upgrade to 3.5.64
2020/11/04
	- Upload android sdk v1.0.8, first release version
	- Update iOS SDK to 3.5.61
2020/09/14
	- Upload android sdk v1.0.3
2020/09/02
	- Update iOS Lib to 3.5.60, add new protocol string which are com.ftsafe.ir301 and com.ftsafe.br301
2020/07/02
	- Update iOS Lib 3.5.59, add background mode support, to have support background mode, you will need add "external accessory communication" key in your settings. more details, check https://developer.apple.com/documentation/uikit/app_and_environment/scenes/preparing_your_ui_to_run_in_the_background/about_the_background_execution_sequence
2020/05/12
	- Update iReader demo, add PC/SC library which only support PCSC API
2020/05/08
    	- Update iOS SDK, check the first two bytes of UUID for connection
    	- Android SDK may update in these two weeks, the old SDK won't be using anymore
2020/4/14
	- Update iOS SDK, lib upgrade to 3.5.57
2020/1/22
	- Update iOS SDK, lib upgrade to 3.5.55
2019/4/12
	- Update android SDK, jar up to 0.7.04
	- Update iOS SDK, lib up to 3.5.45
2018/01/19
	- Update demo app, demo update to 2.0.1
	    1. Using CoreBluetooth API to scan the BLE readers and through the UUID rules to do filter
	    2. Using a thread to check the Bluetooth broadcast information each 1s, to make the BLE reader list up to date
	    3. Output the log into demo App, the user can connect their iOS device into a computer, through iTunes to export the log, this improve help us to locate the issues
	    4. Fix issue for display the battery status of Bluetooth Smart reader (bR500BLE,bR301BLE)	
	- Update iOS SDK, new lib is 3.5.40, changed debugging flag, to void compilation conflicts with client Libraries
2018/12/18
	- Update iOS SDK, new lib is 3.5.39, the change log can find in iOS folder -> readme
2018/12/04
	- Update iOS SDK, a minor update of demo code
2018/10/15
	- Update iOS SDK, add iReader basic demo to github
2018/10/12
	- Update iOS SDK, release version is 3.5.29
	- Update iOS OC Demo code, support all feitian reader, and improve UI
	- 3.5.29 support Autopair or manual pair with bR301BLE and bR500
	- 3.5.29 support get battery status for bR500, bR301BLE not support yet, we are working to add this feature
2018/6/25
	- Update iOS SDK, release version is 3.5.16
	- After call SCardEstablishContext, the scan thread will start scan the BLE device
	- The 3.5.16 lib will automaticly do scan and connect the closest reader
	- Imrpove the thread safe
	- ScardDisconnect will only disconnect smart card
	- Merger iR301 and bR301 SDK(v1.32.5) into combo SDK
	- Fixed few bugs for BLE reader
2018/4/12
	- Update Android SDK, release combo Android SDK, support R301,R502,vR504,iR301,bR301,bR301BLE,bR500 
	- Will update iOS SDK recently, the lib is working on improve, should be upgrade in two weeks.
2018/1/22 
	- Update Lib to 3.5.9, modify features of bR301BLE and bR500, modify SCardListReader API, this is debug version, and not release yet, only for test, once release will update GIT, thanks for your support.
2018/1/15 
	- Update iOS lib to 3.5.8 and Update demo code(put two demos in one SDK)

feitian_mobile_readers's People

Contributors

feitiansmartcardreader avatar richard605 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

feitian_mobile_readers's Issues

Need updates and documentation on Android 13 (SDK 33)

Hi,

I would like to integrate the sdk in my reactnative app, i tried to take your demo app but it seems that it's not working on SDK 33. No readers founded when i scan...
Can you update the demo app to see how to scan on theses devices ? Is it possible to have a documentation ont the permissions we have to ask to scan and connect ?

Best regards.

/Android_SDK/new_android_sdk/Private_API/Demo code/ doesn't work with new FTReaderAPI_1.0.9.jar

When in "private API DemoCode" change FTReaderAPI_1.0.8.jar to FTReaderAPI_1.0.9.jar app crashes.

  1. put file FTReaderAPI_1.0.9.jar in folder ..\Android_SDK\new_android_sdk\Private_API\Demo code\app\libs and delete old file FTReaderAPI_1.0.8.jar
  2. change in file ..\Android_SDK\new_android_sdk\Private_API\Demo code\app\build.gradle row "implementation files('libs/FTReaderAPI_1.0.8.jar')" to "implementation files('libs/FTReaderAPI_1.0.9.jar')"
  3. build and run app
  4. set device type BT4, press find, select found BR301BLE card reader (FT_xxxxx)
  5. press power on in app and app crashes

debug info before crash:
A/safe.cardreade: java_vm_ext.cc:578] JNI DETECTED ERROR IN APPLICATION: JNI CallIntMethod called with pending exception java.lang.NoSuchMethodError: no non-static method "Lcom/ftsafe/comm/CommBase;.getDevType()I"
java_vm_ext.cc:578] at int com.ftsafe.ftnative.FTNative.readerPowerOn(int, byte[], int[], int) ((null):-2)
java_vm_ext.cc:578] at byte[] com.ftsafe.comm.CommBase.a(int, int) ((null):-1)
java_vm_ext.cc:578] at byte[] com.ftsafe.readerScheme.FTReader.readerPowerOn(int) ((null):-1)
java_vm_ext.cc:578] at void com.ftsafe.cardreader.MainActivity$6.run() (MainActivity.java:433)
java_vm_ext.cc:578] at void com.ftsafe.cardreader.MainActivity$20.run() (MainActivity.java:720)
java_vm_ext.cc:578] at void java.lang.Thread.run() (Thread.java:923)
java_vm_ext.cc:578]
java_vm_ext.cc:578] in call to CallIntMethod
java_vm_ext.cc:578] from int com.ftsafe.ftnative.FTNative.readerPowerOn(int, byte[], int[], int)
...
A/safe.cardreade: runtime.cc:677] Runtime aborting...
runtime.cc:677] Dumping all threads without mutator lock held
runtime.cc:677] All threads:
runtime.cc:677] DALVIK THREADS (98):
runtime.cc:677] "Thread-305" prio=5 tid=90 Runnable
runtime.cc:677] | group="" sCount=0 dsCount=0 flags=0 obj=0x12f0ef28 self=0x72fd2e5800
runtime.cc:677] | sysTid=3192 nice=0 cgrp=default sched=0/0 handle=0x72973b8cc0
runtime.cc:677] | state=R schedstat=( 12118961 183616 11 ) utm=0 stm=0 core=7 HZ=100
runtime.cc:677] | stack=0x72972b5000-0x72972b7000 stackSize=1043KB
runtime.cc:677] | held mutexes= "abort lock" "mutator lock"(shared held)
runtime.cc:677] native: #00 pc 00000000004a7ee8 /apex/com.android.art/lib64/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+140)
runtime.cc:677] native: #1 pc 00000000005b59dc /apex/com.android.art/lib64/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits >&, bool, BacktraceMap*, bool) const+376)
runtime.cc:677] native: #2 pc 00000000005d2b14 /apex/com.android.art/lib64/libart.so (art::DumpCheckpoint::Run(art::Thread*)+924)
runtime.cc:677] native: #3 pc 00000000005cca54 /apex/com.android.art/lib64/libart.so (art::ThreadList::RunCheckpoint(art::Closure*, art::Closure*)+528)
runtime.cc:677] native: #4 pc 00000000005cbc20 /apex/com.android.art/lib64/libart.so (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits >&, bool)+1920)
runtime.cc:677] native: #5 pc 000000000056656c /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+1864)
runtime.cc:677] native: #6 pc 0000000000013978 /system/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+76)
runtime.cc:677] native: #7 pc 0000000000012fa4 /system/lib64/libbase.so (android::base::LogMessage::~LogMessage()+320)
runtime.cc:677] native: #8 pc 000000000038e1d4 /apex/com.android.art/lib64/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+2572)
runtime.cc:677] native: #9 pc 000000000038e24c /apex/com.android.art/lib64/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+108)
runtime.cc:677] native: #10 pc 000000000037ff2c /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::AbortF(char const*, ...)+144)
runtime.cc:677] native: #11 pc 000000000037ea44 /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::CheckPossibleHeapValue(art::ScopedObjectAccess&, char, art::(anonymous namespace)::JniValueType)+3108)
runtime.cc:677] native: #12 pc 000000000037d6a4 /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::(anonymous namespace)::JniValueType*)+612)
runtime.cc:677] native: #13 pc 0000000000382e48 /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CheckCallArgs(art::ScopedObjectAccess&, art::(anonymous namespace)::ScopedCheck&, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, art::InvokeType, art::(anonymous namespace)::VarArgs const*)+132)
runtime.cc:677] native: #14 pc 0000000000381d94 /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CallMethodV(char const*, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, std::__va_list, art::Primitive::Type, art::InvokeType)+728)
runtime.cc:677] native: #15 pc 000000000036ff20 /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CallIntMethod(_JNIEnv*, _jobject*, _jmethodID*, ...)+152)
runtime.cc:677] native: #16 pc 000000000000431c /data/app/~~oja4l9HTxVEsYi3m3CmD7g==/com.ftsafe.cardreader-tQlw1cxSRdvVI66WlhUj-Q==/lib/arm64/libFTReaderPCSC_1.0.8.so (getDeviceType+280)
runtime.cc:677] native: #17 pc 0000000000009a7c /data/app/~~oja4l9HTxVEsYi3m3CmD7g==/com.ftsafe.cardreader-tQlw1cxSRdvVI66WlhUj-Q==/lib/arm64/libFTReaderPCSC_1.0.8.so (CmdPowerOn+68)
runtime.cc:677] native: #18 pc 00000000000032b8 /data/app/~~oja4l9HTxVEsYi3m3CmD7g==/com.ftsafe.cardreader-tQlw1cxSRdvVI66WlhUj-Q==/lib/arm64/libFTReaderPCSC_1.0.8.so (readerPowerOn(_JNIEnv*, _jobject*, int, _jbyteArray*, _jintArray*, int)+184)
runtime.cc:677] at com.ftsafe.ftnative.FTNative.readerPowerOn(Native method)
runtime.cc:677] at com.ftsafe.comm.CommBase.a(unavailable:-1)
runtime.cc:677] at com.ftsafe.readerScheme.FTReader.readerPowerOn(unavailable:-1)
runtime.cc:677] at com.ftsafe.cardreader.MainActivity$6.run(MainActivity.java:433)
runtime.cc:677] at com.ftsafe.cardreader.MainActivity$20.run(MainActivity.java:720)
runtime.cc:677] at java.lang.Thread.run(Thread.java:923)
...

PS
with prev FTReaderAPI_1.0.8.jar all OK

[ERROR][com.ftsafe.readerScheme.FTReader:readerXfr][err : 612][com.ftsafe.readerScheme.FTException: err : 612]

hello, I'm getting this error on some devices,
can you help me?

here is the whole stacktrace:

Exception: com.ftsafe.readerScheme.FTException: [ERROR][com.ftsafe.readerScheme.FTReader:readerXfr][err : 612]
[com.ftsafe.readerScheme.FTException: err : 612]
	at com.ftsafe.readerScheme.FTReader.throwFTError(FTReader.java:566)
	at com.ftsafe.readerScheme.FTReader.readerXfr(FTReader.java:133)
	at uz.newtech.mobilkassa.ui.activities.MainActivity$sendCommands$2.invokeSuspend(MainActivity.kt:522)
	at uz.newtech.mobilkassa.ui.activities.MainActivity$sendCommands$2.invoke(Unknown Source)
	at uz.newtech.mobilkassa.ui.activities.MainActivity$sendCommands$2.invoke(Unknown Source)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
	at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
	at uz.newtech.mobilkassa.ui.activities.MainActivity.sendCommands(MainActivity.kt:515)
	at uz.newtech.mobilkassa.ui.activities.MainActivity$sendCommand$1.invokeSuspend(MainActivity.kt:703)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33)
	at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

Card reader error

when do these errors occur??

[ERROR][com.ftsafe.readerScheme.FTReader:readerXfr][usb_recv error len:-1][com.ftsafe.usb.UsbException: usb_recv error len:-1]

[ERROR][com.ftsafe.readerScheme.FTReader:readerXfr][null][#<ERROR the result should be I-block>]

[ERROR][com.ftsafe.readerScheme.FTReader:readerXfr][null][#<ERROR bSeq not equal>]

[ERROR][com.ftsafe.readerScheme.FTReader:readerXfr][null][#<ERROR this is error>]

how to solve them?

com.ftsafe.readerScheme.FTException: err : 612 - FTReaderAPI library does not work

Hi,

I'm trying to migrate from BR500_AND_BR301BLE_V4.0.6_RELEASE.jar to FTReaderAPI_2.0.1.3.jar. In the new version (2.0.1.3) I got this error:

readerXfr_index ====== :0
onResult=======================128
onResult=======================128
recvHead===============:
BT4_BlueToothRead()_len==============:2
BT4_BlueToothRead()_readDataBuffLen==============:12
onResult=======================128
onResult=======================128
recvHead===============:
BT4_BlueToothRead()_len==============:0
BT4_BlueToothRead()_readDataBuffLen==============:10
com.ftsafe.readerScheme.FTException: err : 612
at com.ftsafe.comm.CommBase.readerXfrBlock(CommBase.java:401)
at com.ftsafe.readerScheme.FTReader.readerXfr(FTReader.java:128)

I also got the same error in version 1.0.9.6... What does error 612 mean?
I have these BT readers:

Tested on Huawei Mate 20 Pro with Android 9 and EMUI 9.1.0.

Thanks in advance for trying to help me solve this problem.

Multiple reader usage on Android 9

When multiple readers attached via USB to Android, SCardListReaders method does not return all readers but just one. It is tested under Androidx86 virtual machine with bR301 and bR301 BLE.

Same behaviour also with this method:
String[] names = mFtReader.readerOpen(null);

names containes just one element which is first occurence of usb's.

Does iOS SDK support frameworks?

Hi.

Is it possible to use Feitian SDK in swift framework? I'm able to use Feitian SDK successfully in iOS application but when I include the SDK into framework and try to build it, I get multiple errors from the "libiRockey301_3.5.64_Release.a" file.

Undefined symbols for architecture arm64: "_OBJC_CLASS_$_UIApplication", referenced from: objc-class-ref in libiRockey301_3.5.64_Release.a(EADSessionController.o) "_UIApplicationDidBecomeActiveNotification", referenced from: -[EADSessionController RegisterAccessoryConnectNotification] in libiRockey301_3.5.64_Release.a(EADSessionController.o) "_UIApplicationDidEnterBackgroundNotification", referenced from: -[EADSessionController RegisterAccessoryConnectNotification] in libiRockey301_3.5.64_Release.a(EADSessionController.o) "_UIBackgroundTaskInvalid", referenced from: -[EADSessionController HandleAppDidEnterBackground:] in libiRockey301_3.5.64_Release.a(EADSessionController.o) ___52-[EADSessionController HandleAppDidEnterBackground:]_block_invoke in libiRockey301_3.5.64_Release.a(EADSessionController.o) ___52-[EADSessionController HandleAppDidEnterBackground:]_block_invoke.212 in libiRockey301_3.5.64_Release.a(EADSessionController.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I also tried to build framework from command line using "xcodebuild -create-xcframework -library libiRockey301_3.5.64_Release.a -headers include -output FeitianLibrary.xcframework" without success. Any help would be appreciated.

Possible power saving issue or memory full on Android, no problems for iOS

Hi,

We use your SDK and every now and then a user that uses Android reports that after 6 or so eID readouts their cardreader stops functioning and gives this error:
[com.ftsafe.readerScheme.FTReader:readerPowerOn][err : 612]

re-connecting gives this error when cardreader is not turned off firstly:
[ERROR][com.ftsafe.readerScheme.FTReader:readerOpen][mBluetoothLeClass.connect failed][com.ftsafe.comm.bt4.Bt4Exception: mBluetoothLeClass.connect failed]
at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) <0x7c81bd69b0 + 0x0012f> in <42748fcc36b74733af2d9940a8f3cc8e>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) <0x7c81bdda10 + 0x000df> in <42748fcc36b74733af2d9940a8f3cc8e>:0
at Com.Ftsafe.ReaderScheme.FTReader.ReaderOpen (Java.Lang.Object device) [0x00031] in <24ea65c5157d402bad6ff897348300ba>:0
at C4nMobile.Droid.Dependency.Handle.ConnectProcedure (System.Boolean IsFavReaderKnown, Android.Bluetooth.BluetoothDevice device) [0x00183] in <19535e1548034f909791cc7764be1051>:0
--- End of managed Com.Ftsafe.ReaderScheme.FTException stack trace ---
com.ftsafe.readerScheme.FTException: [ERROR][com.ftsafe.readerScheme.FTReader:readerOpen][mBluetoothLeClass.connect failed][com.ftsafe.comm.bt4.Bt4Exception: mBluetoothLeClass.connect failed]
at com.ftsafe.readerScheme.FTReader.throwFTError(FTReader.java:566)
at com.ftsafe.readerScheme.FTReader.readerOpen(FTReader.java:43)

I dunno for sure but my best guess is the bluetooth device object or some related object will turn to null after a while because of Android OS dependant energy policy management of which we have almost no control over as developers but:

Turning the cardreader off and back on physically solves the issue for a while, probably because of the renewed objects and connection states, is there an option for us to reset the cardreader programatically in the FEITIAN_MOBILE_READERS Android private SDK? (so that user don't have to turn off and on)

The IOS app doesn't detect the BR301

I've tested your app demo which was available on appstore to see how it works.
But it doesn't detect the BR301 reader. I precise that the BR301 was switched on.

PCSC API, FT_SCardListReaders always returns SCARD_E_NO_READERS_AVAILABLE after FT_SCardConnect is called

After calling method FT_SCardConnect (return SCARD_S_SUCCESS) the method FT_SCardListReaders always returns 0x8010002E (SCARD_E_NO_READERS_AVAILABLE), but BLE reader is connected (blue and green leds are on).
Is it correct behavior?
Why if YES?

How to reproduce:

1) open project FEITIAN_MOBILE_READERS-master1.0.9.2\Android_SDK\new_android_sdk\PCSC_API\Demo code\pcscdemo
2) unhide (android:visibility="visible") button id="@+id/btn_list_readers" in "activity_main.xml" layout
3) add code below in "MainActivity", public void onClick,case R.id.btn_list_readers:

byte[] readerNames = new byte[1024];
ret = PCSCNative.SCardListReaders(readerNames);
showMessage("PCSCNative.SCardListReaders ret : 0x" + Integer.toHexString(ret));
String[] readers = new String(readerNames).split("\0");
if (readers.length > 0) showMessage("PCSCNative.SCardListReaders readers[0]: " + readers[0]);

4) build and run app, turn on BLE reader
5) press ESTABLISH, CONNECT, select scanned reader, then press GET READER NAME. It always returns 0x8010002E (SCARD_E_NO_READERS_AVAILABLE).

This is critical for me since after the first successful reading of the certificates from the card in my app it is impossible to do refresh the certificates again or refresh after card changing in reader. My PKCS11-lib calls SCardListReaders again and receives the NO_READERS_AVAILABLE and everything stops there (no certificates found). But BLE reader is connected and all ok with it.

SCardListReaders returns SCARD_E_NO_READERS_AVAILABLE on iOS

I've recently upgraded the SDK from version 1.x to 3.5.59 in my iOS project for better compatibility with the latest SDK and since then I've had problems connecting to card readers.

I request bluetooth authorization through CBCentralManager. As soon as the state is poweredOn and I have authorization, I call SCardEstablishContext and SCardListReaders. This has worked great in the past but now I get a return value of SCARD_E_NO_READERS_AVAILABLE even though EAAccessoryManager tells me my bR301 is connected. I can temporarily fix this by disconnecting and reconnecting the card reader but the problem reappears after a while.

I've also seen similar behavior with the iR301 though debugging that is a bit harder since I obviously can't connect my debugger through USB at the same time as the iR301 and wifi debugging isn't possible because our test devices aren't allowed to be in our company network.

I assume with the new SDK I have to explicitly connect to the devices to make them show up in SCardListReaders but I haven't quite figured out how to do that and the documentation isn't quite clear on how to do that.

ftReader.readerXfr();

Hello,
I found this line in example code:

byte[] recv = ftReader.readerXfr(0,send);

and I guess the method works asyncronly. Why not async task?

Xfr with aspected result runs in an issue

Hello,
all APDU which returns 9000 works as aspected.

This APDU for getting data from card runs in an issue:

byte[] READ_PD = new byte[] { 0x00, (byte) 0xb0, (byte) (0x80 + 0x01), 0x00, 0x00, 0x00, 0x00 };
ftReader.readerXfr(0, READ_PD);		

returns:

[com.ftsafe.readerScheme.FTReader:readerXfr]
[apdu send recv error]
[java.lang.Exception: apdu send recv error]

Any ideas whats going wrong?

Release Notes for iOS Library v3.5.64

What is changed from iOS Library v3.5.61 to v3.5.64?
We are having issues with v3.5.61 where SCardTransmit() hangs for more than 30 seconds for specific addresses on ~5% of the smart cards.
Is this corrected in v3.5.64? What else are the changes implemented?

Connecting to PIV applet on br301

I am trying to send APDU commands to a PIV card on iOS and i keep getting back the same error:

0x80100016: An attempt was made to end a non-existent transaction

I have tried different cards, all the ios demo apps, and the app in the iOS app store. The reader connects fine over bluetooth and shows the ATR value. I then send the select applet command APDU:

00a404000ba0000003974349445f0100

but the error comes back the same. Everything works fine if I connect the reader directly to my Mac over USB. Is there a way to get direct access to the Bluetooth characteristics or does everything have to go through the SDK?

The version of iOS is iOS14. I have also tried other cards (credit cards--mainly mastercard) just to see if I could get any APDU commands to work. Only 1 of my credit cards returned anything beside the "non-existent transaction" error.

Please provide any guidance on how to send APDU commands over bluetooth to a PIV card.

libiRockey301_ccid_V3.5.40_debug.a, missing required architecture x86_64

Hello, I got error when build project detail as below

`ld: warning: ignoring file /Users/ipopular/Documents/Project/Freelance/Brainstem/FEITIAN_MOBILE_READERS-master/iOS SDK/iReader for Appstore/Swift Demo/iReader/Sdk/lib/libiRockey301_ccid_V3.5.40_release.a, missing required architecture x86_64 in file /Users/ipopular/Documents/Project/Freelance/Brainstem/FEITIAN_MOBILE_READERS-master/iOS SDK/iReader for Appstore/Swift Demo/iReader/Sdk/lib/libiRockey301_ccid_V3.5.40_release.a (4 slices)ld: warning: ignoring file /Users/ipopular/Documents/Project/Freelance/Brainstem/FEITIAN_MOBILE_READERS-master/iOS SDK/iReader for Appstore/Swift Demo/iReader/Sdk/lib/libiRockey301_ccid_V3.5.40_debug.a, missing required architecture x86_64 in file /Users/ipopular/Documents/Project/Freelance/Brainstem/FEITIAN_MOBILE_READERS-master/iOS SDK/iReader for Appstore/Swift Demo/iReader/Sdk/lib/libiRockey301_ccid_V3.5.40_debug.a (4 slices)

Undefined symbols for architecture x86_64:
"_SCardEstablishContext", referenced from:
iReader_swift.ScanDeviceController.viewDidLoad() -> () in ScanDeviceController.o
"_FtGetSerialNum", referenced from:
closure #2 () -> () in closure #1 () -> () in iReader_swift.DeviceInfoTableViewController.getDeviceInfo() -> () in DeviceInfoTableViewController.o
"_FtGetDevVer", referenced from:
closure #1 () -> () in closure #1 () -> () in iReader_swift.DeviceInfoTableViewController.getDeviceInfo() -> () in DeviceInfoTableViewController.o
"_FtGetLibVersion", referenced from:
closure #3 () -> () in closure #1 () -> () in iReader_swift.DeviceInfoTableViewController.getDeviceInfo() -> () in DeviceInfoTableViewController.o
"OBJC_CLASS$_ReaderInterface", referenced from:
objc-class-ref in ScanDeviceController.o
"_FtGetDeviceUID", referenced from:
closure #1 () -> Swift.Int32 in iReader_swift.CardCommandViewController.readUID() -> () in CardCommandViewController.o
"_SCardListReaders", referenced from:
closure #1 () -> () in iReader_swift.ScanDeviceController.scanDevice() -> () in ScanDeviceController.o
"_FtReadFlash", referenced from:
closure #1 () -> Swift.Int32 in iReader_swift.CardCommandViewController.readFlash() -> () in CardCommandViewController.o
"_SCardDisconnect", referenced from:
closure #1 () -> Swift.Int32 in iReader_swift.CardCommandViewController.disConnectCard() -> () in CardCommandViewController.o
"_FtWriteFlash", referenced from:
closure #1 () -> Swift.Int32 in iReader_swift.CardCommandViewController.writeFlash() -> () in CardCommandViewController.o
"_SCardConnect", referenced from:
closure #1 () -> Swift.Int32 in iReader_swift.CardCommandViewController.connectReader() -> () in CardCommandViewController.o
"_SCardTransmit", referenced from:
closure #1 () -> Swift.Int32 in iReader_swift.CardCommandViewController.sendTheCommand(command: Swift.String) -> () in CardCommandViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)`

Help me please!

Thank for you support.

com.ftsafe.readerScheme.FTException: err : 612

I'm having a Problem with my reader. I have already tried a different reader and a different card so I really don't know what the issue is. It used to work before. I'm using the bluetoothLe variant of the reader.
Could you enlighten me what err 612 means?

W/System.err: com.ftsafe.readerScheme.FTException: err : 612
W/System.err:     at com.ftsafe.comm.CommBase.readerXfrBlock(CommBase.java:401)
W/System.err:     at com.ftsafe.readerScheme.FTReader.readerXfr(FTReader.java:128)
W/System.err:     at com.example.cardreader.dataReader.ConnectThread.sendXfr(ConnectThread.java:71)
W/System.err:     at com.example.cardreader.dataReader.ConnectThread.queryData(ConnectThread.java:142)
W/System.err:     at com.example.cardreader.dataReader.ConnectThread$1.handleMessage(ConnectThread.java:124)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
W/System.err:     at android.os.Looper.loopOnce(Looper.java:226)
W/System.err:     at android.os.Looper.loop(Looper.java:313)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:8757)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
W/System.err: com.ftsafe.readerScheme.FTException: [ERROR][com.ftsafe.readerScheme.FTReader:readerXfr][err : 612][com.ftsafe.readerScheme.FTException: err : 612]
W/System.err:     at com.ftsafe.readerScheme.FTReader.throwFTError(FTReader.java:580)
W/System.err:     at com.ftsafe.readerScheme.FTReader.readerXfr(FTReader.java:135)
W/System.err:     at com.example.cardreader.dataReader.ConnectThread.sendXfr(ConnectThread.java:71)
W/System.err:     at com.example.cardreader.dataReader.ConnectThread.queryData(ConnectThread.java:142)
W/System.err:     at com.example.cardreader.dataReader.ConnectThread$1.handleMessage(ConnectThread.java:124)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
W/System.err:     at android.os.Looper.loopOnce(Looper.java:226)
W/System.err:     at android.os.Looper.loop(Looper.java:313)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:8757)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

PCSC API always crashes in method FT_SCardListReaders() in case of mszReaders=NULL

According documentation

_[out] mszReaders

Multi-string that lists the card readers within the supplied reader groups. If this value is NULL, SCardListReaders ignores the buffer length supplied in pcchReaders, writes the length of the buffer that would have been returned if this parameter had not been NULL to pcchReaders, and returns a success code._

FTException: err : 612 with some of the cards

Hi,

I get an exception
com.ftsafe.readerScheme.FTException: [ERROR]
[com.ftsafe.readerScheme.FTReader:readerPowerOn][err : 612]
[com.ftsafe.readerScheme.FTException: err : 612]
when I try to power on a card.

I am using your library FTReaderAPI_1.0.9.6.jar in my Android application.

This problem occurs with Feitian bR301 reader (151015AA00065H) both with USB and Bluetooth modes.

Power on fails only when I am using our own cards. Cards made by another organization works fine with this reader. I have no problems with our own test cards when I am using readers from other manufacturers (for example ACS). So the Feitian reader should be fine as it works with the other cards. And our own cards should be fine as they work with other readers. Maybe your library is not parsing the ATR from our own cards correctly?

Own card ATR (This does not work):
3B 9F 95 81 31 FE 9F 00 66 46 53 05 10 00 FF 71 DF 00 00 00 00 00 EC
JavaCOS A22 dual interface Java card - 150K (JavaCard)
(ATR got with winscard SCardStatus function: 3B 9F 95 81 31 FE 9F 00 66 46 53 05 10 00 FF 71 DF 00 00 00 00 00 EC FF 03 00 00 00 AE B4 D2 01, last bytes are some extra bytes?)

Card made by another organization, ATR (This works):
3B DD 96 00 80 31 FE 45 00 31 B8 64 04 29 EC C1 73 94 01 80 82 48
Finnish Digital and Population Services Agency Organisation Card (eID)
(ATR got with winscard SCardStatus function: 3B DD 96 00 80 31 FE 45 00 31 B8 64 04 29 EC C1 73 94 01 80 82 48 FF FF 03 00 00 00 AE B4 D2 01, last bytes are some extra bytes?)

Use Feitian library on mac os platform

Hello Team,
Is there a way to use the library "libiRockey301_3.5.64_Release.a" on mac os platform, it's generated for iOS platform, can you please generate a mac os one ?

In /Users/lexpersona/Documents/AppName/shared/resources/libs/feitian/libiRockey301_3.5.64_Release.a(DUKPT.o),
 building for macOS, but linking in object file built for iOS Simulator, file
  '/Users/lexpersona/Documents/AppName/shared/resources/libs/feitian/libiRockey301_3.5.64_Release.a'
   for architecture x86_64

Best Regards

reader not detected

I downloaded the androidSDK for android studio and had to change 2 things in the build.gradle (module:app) because the ndk and cmake were not supported anymore: here is what I changed ;
cmake {
cppFlags ""
arguments '-DANDROID_PLATFORM=android-23',
'-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_static'
}
ndk {
abiFilters 'armeabi-v7a'
}

I changed also replaced in dependencies "compile files" by
implementation files('libs/ftsafe_0.7.04.jar')
And then I ran the application.
Before I did that, I downloaded the demo apk directly and tried it, It worked great.
Now I would want to make my own app from it. But now that I installed the apk file from the android sdk, the app is running, but when I try to find my reader nothing happens, I have got the following in the logcat :
04-18 14:20:34.099 12338-12338/com.example.ftReaderStandard D/libFTReaderStandard: SCardEstablishContext ok
04-18 14:20:45.983 12338-12451/com.example.ftReaderStandard D/BluetoothAdapter: startLeScan(): null
04-18 14:20:45.984 12338-12451/com.example.ftReaderStandard E/BluetoothAdapter: LE Scan has already started
04-18 14:20:45.985 12338-12338/com.example.ftReaderStandard D/libFTReaderStandard: SCardListReaders2 error 8010002e
Could you help fix this issue?

CRASH BUG IN FTReaderAPI, in method com.ftsafe.comm.bt4.BT4.BlueToothRead() - OutOfMemoryError

Crash occurs in method "com.ftsafe.comm.bt4.BT4.BlueToothRead()" when reading certs from card with BLE reader in my app using PCSC API or private API (doesn't matter in both cases). It is rare but has already met several times. Sometimes we catch this exemption "com.ftsafe.comm.bt4.Bt4Exception: BlueToothRead:getPipeByte timeout" without crash. But sometimes there is such exemption with warning like this "Throwing OutOfMemoryError "Failed to allocate a 2030055072 byte allocation with 2957247 free bytes and 189MB until OOM" and with crash.

As I understand sometimes there is attempt to allocate a huge size of memory for readDataBuff in method "com.ftsafe.comm.bt4.BT4.BlueToothRead". May be here should done some validation before memory allocation.

I thing it's impossible to fix this on my app side, only in libs it's possible to fix.

info from logcat when crash occurs:

2021-12-19 16:20:26.912 2101-4917/com.androidfeitianfirstapp.my E/FTSAFE: [BT4-SEND]6F05000000006A000000803200000A
2021-12-19 16:20:26.917 2101-4917/com.androidfeitianfirstapp.my E/FTSAFE: timeout:3000
2021-12-19 16:20:26.918 2101-2986/com.androidfeitianfirstapp.my E/FTSAFE: [BLE-onCharacteristicWrite]6F05000000006A000000803200000A
2021-12-19 16:20:26.983 2101-2986/com.androidfeitianfirstapp.my E/FTSAFE: [BLE-onCharacteristicChanged]800C000000006A0000001FCC862E007900270004
2021-12-19 16:20:26.984 2101-2986/com.androidfeitianfirstapp.my E/FTSAFE: NEW:800c000000006a0000001fcc862e007900270004
2021-12-19 16:20:26.985 2101-2986/com.androidfeitianfirstapp.my E/FTSAFE: [BLE-onCharacteristicChanged]9000
2021-12-19 16:20:26.985 2101-2986/com.androidfeitianfirstapp.my E/FTSAFE: NEW:9000
2021-12-19 16:20:29.991 2101-4917/com.androidfeitianfirstapp.my W/System.err: com.ftsafe.comm.bt4.Bt4Exception: BlueToothRead:getPipeByte timeout
2021-12-19 16:20:29.993 2101-4917/com.androidfeitianfirstapp.my W/System.err:     at com.ftsafe.comm.bt4.BT4.BlueToothRead(BT4.java:595)
2021-12-19 16:20:29.995 2101-4917/com.androidfeitianfirstapp.my W/System.err:     at com.ftsafe.comm.bt4.BT4.ft_recv(BT4.java:375)
2021-12-19 16:20:29.997 2101-4917/com.androidfeitianfirstapp.my W/System.err:     at com.ftsafe.comm.CommBase.readData(CommBase.java:110)
2021-12-19 16:20:29.999 2101-4917/com.androidfeitianfirstapp.my W/System.err:     at sun.security.pkcs11.wrapper.PKCS11.C_FindObjectsInit(Native Method)
2021-12-19 16:20:30.000 2101-4917/com.androidfeitianfirstapp.my W/System.err:     at ua.avtor.DsLib.PrivateKeys.PKCS11Utils.Pkcs11Session.findAllObjects(Unknown Source:4)
2021-12-19 16:20:30.001 2101-4917/com.androidfeitianfirstapp.my W/System.err:     at ua.avtor.DsLib.PrivateKeys.PKCS11Utils.Pkcs11Session.findAllObjects(Unknown Source:13)
2021-12-19 16:20:30.002 2101-4917/com.androidfeitianfirstapp.my W/System.err:     at ua.avtor.DsLib.KeyStores.KeyStorePKCS11.ensureCertificates(Unknown Source:42)
2021-12-19 16:20:30.003 2101-4917/com.androidfeitianfirstapp.my W/System.err:     at ua.avtor.DsLib.KeyStores.KeyStorePKCS11.getCertificates(Unknown Source:0)
2021-12-19 16:20:30.005 2101-4917/com.androidfeitianfirstapp.my W/System.err:     at com.androidfeitianfirstapp.avmacbook.androidfeitianfirstapp.MainActivity$1$1.run(MainActivity.java:89)
2021-12-19 16:20:30.005 2101-4917/com.androidfeitianfirstapp.my W/System.err:     at java.lang.Thread.run(Thread.java:923)
2021-12-19 16:20:30.006 2101-4917/com.androidfeitianfirstapp.my E/FTSAFE: timeout:3000
2021-12-19 16:20:30.079 2101-4917/com.androidfeitianfirstapp.my W/tianfirstapp.m: Throwing OutOfMemoryError "Failed to allocate a 2030055068 byte allocation with 2967462 free bytes and 189MB until OOM, target footprint 5934926, growth limit 201326592" (VmSize 5841512 kB)
2021-12-19 16:20:30.138 2101-4917/com.androidfeitianfirstapp.my W/tianfirstapp.m: Throwing OutOfMemoryError "Failed to allocate a 2030055072 byte allocation with 2957247 free bytes and 189MB until OOM, target footprint 5914495, growth limit 201326592" (VmSize 5841512 kB)
2021-12-19 16:20:30.139 2101-4917/com.androidfeitianfirstapp.my A/tianfirstapp.m: java_vm_ext.cc:578] JNI DETECTED ERROR IN APPLICATION: JNI GetByteArrayElements called with pending exception java.lang.OutOfMemoryError: Failed to allocate a 2030055072 byte allocation with 2957247 free bytes and 189MB until OOM, target footprint 5914495, growth limit 201326592
java_vm_ext.cc:578]   at byte[] com.ftsafe.comm.bt4.BT4.BlueToothRead(int) (BT4.java:584)
java_vm_ext.cc:578]   at byte[] com.ftsafe.comm.bt4.BT4.ft_recv(int, int) (BT4.java:375)
java_vm_ext.cc:578]   at int com.ftsafe.comm.CommBase.readData(int, int, byte[], int[]) (CommBase.java:110)
java_vm_ext.cc:578]   at void sun.security.pkcs11.wrapper.PKCS11.C_FindObjectsInit(long, sun.security.pkcs11.wrapper.CK_ATTRIBUTE[]) (PKCS11.java:-2)
java_vm_ext.cc:578]   at long[] ua.avtor.DsLib.PrivateKeys.PKCS11Utils.Pkcs11Session.findAllObjects(sun.security.pkcs11.wrapper.CK_ATTRIBUTE[]) ((null):-1)
java_vm_ext.cc:578]   at long[] ua.avtor.DsLib.PrivateKeys.PKCS11Utils.Pkcs11Session.findAllObjects(long) ((null):-1)
java_vm_ext.cc:578]   at void ua.avtor.DsLib.KeyStores.KeyStorePKCS11.ensureCertificates() ((null):-1)
java_vm_ext.cc:578]   at ua.avtor.DsLib.Certificate[] ua.avtor.DsLib.KeyStores.KeyStorePKCS11.getCertificates(int, boolean, int, java.lang.String) ((null):-1)
java_vm_ext.cc:578]   at void com.androidfeitianfirstapp.avmacbook.androidfeitianfirstapp.MainActivity$1$1.run() (MainActivity.java:89)

getting PendingIntent Flag error in Android 12 (31 or above)

this error occuring when using ft.readerFind() in latest Android versions

W/System.err: java.lang.Exception: java.lang.IllegalArgumentException: uz.newtech.mobilkassa: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
W/System.err: Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
W/System.err:     at com.ftsafe.comm.CommBase.readerFind(CommBase.java:205)
W/System.err:     at com.ftsafe.readerScheme.FTReader.readerFind(FTReader.java:30)
W/System.err:     at uz.*.SamApdu.find(SamApdu.kt:35)
W/System.err:     at uz.*.NewSamHandler.findUsbMode(NewSamHandler.kt:99)
W/System.err:     at uz.*.NewSamHandler$mHandler$1.handleMessage(NewSamHandler.kt:72)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
W/System.err:     at android.os.Looper.loopOnce(Looper.java:226)
W/System.err:     at android.os.Looper.loop(Looper.java:313)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:8663)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
W/System.err: Caused by: java.lang.IllegalArgumentException: uz.newtech.mobilkassa: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
W/System.err: Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
W/System.err:     at android.app.PendingIntent.checkFlags(PendingIntent.java:382)
W/System.err:     at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:673)
W/System.err:     at android.app.PendingIntent.getBroadcast(PendingIntent.java:660)
W/System.err:     at com.ftsafe.comm.usb.USB.ft_find(USB.java:140)
W/System.err:     at com.ftsafe.comm.CommBase.readerFind(CommBase.java:180)

Is posible use PKCS#11 in Android with the BR301

Hi I download the SDK to Android, and I try to read the smart card information with APDU codes. But I don't get good results.

I investigate and some pages recomen use a PKCS#11 to communicate with the smart card, I download I library seek-for-android, this library includes PKCS, but I really don't know how to integrate with the BR301....

If someone know how to do that and can help me, I really appreciated it.

PLEASE FIX CRASH BUG IN FTReaderAPI, in method com.ftsafe.comm.bt4.BT4.ft_find()

Crash occurs in method "com.ftsafe.comm.bt4.BT4.ft_find()" when for example the method "FT_SCardListReaders()" of PCSC API is called. It is not always but very often.

How to reproduce:

1) open project FEITIAN_MOBILE_READERS-master1.0.9.2\Android_SDK\new_android_sdk\PCSC_API\Demo code\pcscdemo
2) unhide (android:visibility="visible") button id="@+id/btn_list_readers" in "activity_main.xml" layout
3) add code below in "MainActivity", public void onClick,case R.id.btn_list_readers:

byte[] readerNames = new byte[1024];
ret = PCSCNative.SCardListReaders(readerNames);
showMessage("PCSCNative.SCardListReaders ret : 0x" + Integer.toHexString(ret));
String[] readers = new String(readerNames).split("\0");
if (readers.length > 0) showMessage("PCSCNative.SCardListReaders readers[0]: " + readers[0]);

4) build and run app, turn on BLE reader
5) press button "ESTABLISH", then press button "GET READER NAME" several times or "ESTABLISH" / "GET READER NAME", very often will be crash.

info from logcat when crash occurs:

2021-12-16 14:38:58.501 19328-19328/com.ftsafe.pcscdemo A/ftsafe.pcscdem: java_vm_ext.cc:578] JNI DETECTED ERROR IN APPLICATION: JNI GetByteArrayElements called with pending exception java.util.ConcurrentModificationException: 
java_vm_ext.cc:578]   at java.lang.Object java.util.ArrayList$Itr.next() (ArrayList.java:860)
java_vm_ext.cc:578]   at void com.ftsafe.comm.bt4.BT4.ft_find() (BT4.java:131)
java_vm_ext.cc:578]   at int com.ftsafe.comm.CommBase.listReaders(byte[], int[]) (CommBase.java:310)
java_vm_ext.cc:578]   at int com.ftsafe.pcscdemo.PCSCNative.SCardListReaders(byte[]) (PCSCNative.java:-2)
java_vm_ext.cc:578]   at void com.ftsafe.pcscdemo.MainActivity.onClick(android.view.View) (MainActivity.java:200)

Why this is happen:

THIS IS BECAUSE DURING ITERATING THROUGH ARRAY LIST arrayForBlueToothDevice in ft_find() THIS LIST CAN BE MODIFIED (ADD NEW ELEMENT) AT ANY TIME BY newLeScanCallback!!!
System will return Bluetooth LE scan results batched on bluetooth controller. Returns immediately, batch scan results data will be delivered through the callback at any time. Therefore situations may arise with a high probability when at the same time there is a passage through the list arrayForBlueToothDevice in ft_find() and its modification in newLeScanCallback which causes an uncaught ConcurrentModificationException and app crashes in such cases.

How to fix:

solution#1
Surround block "while (var3.hasNext())" in "com.ftsafe.comm.bt4.BT4.ft_find()" by try/catch like this

        if (this.mBlueToothAdapter.isDiscovering() && this.scanning) {
            Iterator var3 = this.arrayForBlueToothDevice.iterator();
            try {
                while (var3.hasNext()) {
                    BluetoothDevice device = (BluetoothDevice) var3.next();
                    this.mHandlerSendMessage(129, device);
                }
            } catch (java.util.ConcurrentModificationException e) {
                Log.e("ft_find", "THIS IS BECAUSE ARRAYLIST arrayForBlueToothDevice WAS MODIFIED IN newLeScanCallback DURING ITERATING THROUGH THIS ARRAYLIST!!!");
                e.printStackTrace();
            }
        }

It was tested. It works. Instead of crashes we catch ConcurrentModificationException in such situation.
info from logcat:

2021-12-16 14:20:17.918 17363-17363/com.ftsafe.pcscdemo E/ft_find: THIS IS BECAUSE ARRAYLIST arrayForBlueToothDevice WAS MODIFIED IN newLeScanCallback DURING ITERATING THROUGH THIS ARRAYLIST!!!
2021-12-16 14:20:17.919 17363-17363/com.ftsafe.pcscdemo W/System.err: java.util.ConcurrentModificationException
2021-12-16 14:20:17.921 17363-17363/com.ftsafe.pcscdemo W/System.err:     at java.util.ArrayList$Itr.next(ArrayList.java:860)
2021-12-16 14:20:17.921 17363-17363/com.ftsafe.pcscdemo W/System.err:     at com.ftsafe.comm.bt4.BT4.ft_find(BT4.java:150)
2021-12-16 14:20:17.922 17363-17363/com.ftsafe.pcscdemo W/System.err:     at com.ftsafe.comm.CommBase.listReaders(CommBase.java:310)
2021-12-16 14:20:17.922 17363-17363/com.ftsafe.pcscdemo W/System.err:     at com.ftsafe.pcscdemo.PCSCNative.SCardListReaders(Native Method)
2021-12-16 14:20:17.922 17363-17363/com.ftsafe.pcscdemo W/System.err:     at com.ftsafe.pcscdemo.MainActivity.onClick(MainActivity.java:200)

solution#2
Use CopyOnWriteArrayList for arrayForBlueToothDevice instead of ArrayList. Not tested yet.

PS
I guess this is an old and critical bug and should be fixed ASAP.

Cannot connect to Feitian bR301 BLE on Android

Dear support,

We bought a brand new Feitian bR301 BLE (so I suppose that the firmware is up-to-date). But I'm not able to connect to that device. It simply cannot find the device. That's what I did:

  1. Downloaded and installed the Feitian Test App from Google Play Store: entered "com.ftsafe.cardreader" as search string, found app "CardReader" and installed it.
  2. Switched the reader on by pressing the power button (blue light is flashing)
  3. Started the app and:
  • Selected "BT4" as device type
  • pressed button "find"
  • scanning process is running endlessly. Nothing is found!

The same is true, if I use another bluetooth test app like "Bluetooth LE Scanner". The feitian scanner is not found! On the other hand, other LE devices are working fine!
When going to the Android Bluetooth settings --> connect new device, I can see the Feitian reader (entry "FT_FC4979...."). When clicking the entry, it says "You need an app to connect to this device". But this is OK, since it's BLE.
I testet it on 2 Android devices: Samsung tablet Galaxy Tab S5e (Android 11) and an Android smartphone with Android 10... both supporting BLE.

Could you please advice.

Best regards, Martin
(We are a software company building a german POS software. We have years of Android knowledge and are familiar with BLE stuff, normally)

bR301 with Android

  1. On the package I see Made for i*, but here I see an Android SDK.
  2. I cannot pair with LG6 either Nokia8. (does I need firmwarew update)

Best regards
Rainer

APDU Command VERIFY returns 6a88

Hi all,

I have a FEITIAN BR301 reader and i am trying to run the VERIFY APDU command but the result is 6a88 (Referenced data not found).

My PIN is "012345" and based on some examples my command APDU is:

00 20 00 00 06 30 31 32 33 34 35

I hope the answer is 9000 but it is 6a88

I have tried both ways (Private API and PC / SC API) and the answer is the same.

This is the code for Private API:

String sendStr = "0020000006303132333435";

byte[] send = Utility.hexStrToBytes(sendStr);

byte[] recv = ftReader.readerXfr(0, send);

showLog("send response ---> "+Utility.bytes2HexStr(recv));

The result is send response ---> 6a88

Could someone help me solve this problem?

Thanks in advance.

Getting error when using FT SDK in Android app

I am getting following error in the app. It is coming during initial loading:

Line causing error:
mFTReader = new FTReader(activity, mHandler, DK.FTREADER_TYPE_BT4);
Error:
java.lang.UnsatisfiedLinkError: dlopen failed: library "libFTReaderPCSC_1.0.8.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
at java.lang.System.loadLibrary(System.java:1664)
at com.ftsafe.ftnative.FTNative.(FTNative.java:8)
at com.ftsafe.ftnative.FTNative.init(Native Method)
at com.ftsafe.comm.CommBase.(CommBase.java:42)
at com.ftsafe.readerScheme.FTReader.(FTReader.java:21)
at com.Modules.UnassistedA.UnassistedSettingsDialog.onClick(UnassistedSettingsDialog.java:529)
at android.view.View.performClick(View.java:8160)
at android.widget.TextView.performClick(TextView.java:16234)
at android.view.View.performClickInternal(View.java:8137)
at android.view.View.access$3700(View.java:888)
at android.view.View$PerformClick.run(View.java:30242)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:247)
at android.app.ActivityThread.main(ActivityThread.java:8676)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

License

Which license is this SDK available for use under? Thanks.

bR301 with iOS

I used your sample project (iReader_Basic), with libiRockey301_ccid_3.5.30_Debug and I changed it to send the following commands:

[self sendCommand:@"00A4040007604632FF000002"];
[self sendCommand:@"00A4000C022F00"];
[self sendCommand:@"00A4080C045F00EF02"];
[self sendCommand:@"00B0000000"];

Everything is fine, until the last command (got this error: "0x80100016"), and got the delegate telling that the card was removed (attached = NO).

But when I use the iR301-U reader everything is just fine.

Here's the output of the commands (bR301):

Sending Command: 00A4040007604632FF000002
==========write:
6f0c0000 00000300 000000a4 04000760 4632ff00 0002
==========read:
80020000 00000300 00009000
Rev:<9000>

Sending Command: 00A4000C022F00
==========write:
6f070000 00000400 000000a4 000c022f 00
==========read:
80020000 00000400 00009000
Rev:<9000>

Sending Command: 00A4080C045F00EF02
==========write:
6f090000 00000500 000000a4 080c045f 00ef02
==========read:
80020000 00000500 00009000
Rev:<9000>

Sending Command: 00B0000000
==========write:
6f050000 00000600 000000b0 000000
0x80100016:An attempt was made to end a non-existent transaction.

And here's the output of the (iR301-U):

Sending Command: 00A4040007604632FF000002
==========write:
6f0c0000 00000900 000000a4 04000760 4632ff00 0002
==========read:
80020000 00000900 00009000
Rev:<9000>

Sending Command: 00A4000C022F00
==========write:
6f070000 00000a00 000000a4 000c022f 00
==========read:
80020000 00000a00 00009000
Rev:<9000>

Sending Command: 00A4080C045F00EF02
==========write:
6f090000 00000b00 000000a4 080c045f 00ef02
==========read:
80020000 00000b00 00009000
Rev:<9000>

Sending Command: 00B0000000
==========write:
6f050000 00000f00 000000b0 000000
==========read:
80020100 00000f00 00005265 ...
Rev:<526570c3 ba626c69 63612050 ...>

Any help would be appreciated. Thanks.

Bluetooth not detecting or Working

I Have Issues using the new SDK with Android 10 and 11 , the Blutoth BLE4 note working , not detecting anything , and not throwing any Erorr And ome thing for the Apk Demo or the App in the play Store .

Cannot connect with my device

Today I have installed the newest apk.
On top title I see FTReaderStandard. I see: Hello World LibVersion 0.7.00.

I select PC/SC API and BT3.0. The list of devices remains empty. The same behavior I observe in the 3 other cases (Private API and BT and BTLE).
The blue device with health card is nearby and the LED is flashing. Whats going wrong?

Second question: I can use the C++ Lib or the Jar. What is the difference, advantage/disadvantage?

Using of Package javax.smartcardio

How can we use it for handling APDU?
example:

 CardChannel channel = card.getBasicChannel();
 ResponseAPDU r = channel.transmit(new CommandAPDU(c1));

in which relation is card to feitian world?

Uncatchable internal lib crash black micro usb ble301 for combination 2.0.1.3 & USB\VID_096E&PID_0624&REV_0112

I have provided some testdata in the hopes of making debugging this issue easier:

cardreader USB-C:
USB\VID_096E&PID_0624&REV_0225
Test : OK (very fast readout)

cardreader USB-C:
USB\VID_096E&PID_0624&REV_0222
Test : OK (fast readout)

cardreader Micro USB:
USB\VID_096E&PID_0624&REV_0112
Test : NOK (uncatchable app crash with 2.0.1.3 | slower readout but ok on older version 1.0.9.6)

cardreader Micro USB:
USB\VID_096E&PID_0624&REV_0112
Test : NOK (uncatchable app crash with 2.0.1.3 | slower readout but ok on older version 1.0.9.6)

All of the older cardreaders type micro usb with product & fw PID_0624&REV_0112 end up in an app crash while ignoring try catches in xamarin.android & pcl xamarin (seems like an uncatchable internal lib error):

[MonoDroid] Java.Lang.NullPointerException: Attempt to invoke virtual method 'android.bluetooth.BluetoothGattCharacteristic android.bluetooth.BluetoothGattService.getCharacteristic(java.util.UUID)' on a null object reference
[MonoDroid] --- End of managed Java.Lang.NullPointerException stack trace ---
[MonoDroid] java.lang.NullPointerException: Attempt to invoke virtual method 'android.bluetooth.BluetoothGattCharacteristic android.bluetooth.BluetoothGattService.getCharacteristic(java.util.UUID)' on a null object reference
[MonoDroid] at com.ftsafe.comm.bt4.BluetoothLeClass.readPowerState(BluetoothLeClass.java:204)
[MonoDroid] at com.ftsafe.comm.bt4.BT4.getPowerState(BT4.java:400)
[MonoDroid] at com.ftsafe.comm.CommBase.getPowerState(CommBase.java:108)
[MonoDroid] at com.ftsafe.readerScheme.FTReader$1.run(FTReader.java:623)
Thread started: < Thread Pool > # 14
[MonoDroid] at java.lang.Thread.run(Thread.java:1012)
Java.Lang.NullPointerException: 'Attempt to invoke virtual method 'android.bluetooth.BluetoothGattCharacteristic android.bluetooth.BluetoothGattService.getCharacteristic(java.util.UUID)' on a null object reference'

Our customers with an older cardreader get this issue only when using the newest driver FTReaderAPI_2.0.1.3.jar, libFTReaderPCSC_2.0.1.3.so

These tests were done on Android 13. We are also open to try out experimental builds

mFtReader.readerPowerOn(0) creates : java.lang.NoSuchMethodError: no non-static method "Lcom/ftsafe/comm/CommBase;.getDevType()I

When trying to upgrade from 1.0.8 to 1.0.9 (private) we are getting the following error when using the method mFtReader.readerPowerOn(0):
java.lang.NoSuchMethodError: no non-static method "Lcom/ftsafe/comm/CommBase;.getDevType()I

There's a big chance this is due obfuscation or the likes, the code is used in a Xamarin Android project as a binding library in our company by thousands of users

Any idea why this happens + where to find FTReaderAPI_1.0.9.5.jar or higher as a download?

Visual Studio Xamarin Forms example request

Is it possible to put an example online for this SDK where Visual studio xamarin forms is used?

A good % of our 3000+ users continue having issue's connecting and we are trying to find out where we are doing something wrong

Old blue br301 reader returns error on FTreader.poweron();

Hiya,

Do you know of any reasons the SDK would return error 612 when using the old blue br301 (bt3) cardreaders (best guess is fine too)?

--- stack trace ---
com.ftsafe.readerScheme.FTException: [ERROR][com.ftsafe.readerScheme.FTReader:readerPowerOn][err : 612][com.ftsafe.readerScheme.FTException: err : 612]
at com.ftsafe.readerScheme.FTReader.throwFTError(FTReader.java:566)
at com.ftsafe.readerScheme.FTReader.readerPowerOn(FTReader.java:86)
at crc646a6d9b4284f7b127.Handle.n_handleMessage(Native Method)
at crc646a6d9b4284f7b127.Handle.handleMessage(Handle.java:53)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:915)
}

EDIT after support answer*
Type of smartcard == the Belgian Electronic ID card (or eID)
this status returns before and after the attempt to power on:
SlotStatus: a card exists but it is not powered.

order of invoking methods
mHandle = new Handle();
FTReader reader = new FTReader(Context, mHandle, DK.FtreaderTypeBt3);

@handler
if(msg.What == bt3)
{
BluetoothDevice device = (BluetoothDevice)msg.Obj;
reader.ReaderOpen(device);
}

if ((msg.What & DK.CardInMask) == DK.CardInMask)
{
byte[] returnvalueATR = reader.ReaderPowerOn(0); <-- this method fails and ATR won't go to returnvalueATR when using blue
}

When using the black br301ble it works perfectly fine with your newest version of the sdk

FT_SCardListReaderGroups: Can not find the bR301 readers

My card reader is one with the C18 casing bR301 and the demo application can not connect to it.
It seems that the SDK FT_SCardListReaderGroups is looking for devices with names starting by FT_ or ID_ but my reader is detected with name FeiTian73, which means that it is ignored.

Is there something I need to do for my reader to use the correct name ? Is this a bug with the SDK ?

Note that the Demo code is still using the version 1.0.8 of the jar, and if I try with the 1.0.9 jar, it crashes. (there is no libFTReaderPCSC_1.0.9.a nor libFTReaderPCSC_1.0.9.so).

Note that I also tried the Private API, v1.0.9, and there is the same issue.

Problem with new SDK (on android) and readers with fimware 1.10

Hi,

i have done ReactNative plugin to use the new SDK, it looks like it works well but when i want to connect to old reader with firmware 1.10. The app crashed instantly when it connects to reader. So i tried with your exemple demo app and found that the demo app has some trouble as well with this firmware. All actions spent a lot of time to be doneand sometimes the app freeze.

Is it possible to review and recheck if it can work well or if there is memory issue (or something other) on these readers ?

Best regards. (Nicolas from HM France)

Connect with specific BLE301 reader only via (BOOL)connectPeripheralReader:(NSString *)readerName timeout:(float)timeout;

Xamarin.iOS Binding library of libiRockey301_ccid_V3.5.64_Debug.a

This works fast but is non specific, even a bluetooth TV will connect:
Device = new ReaderInterface();
Device.setAutoPair(true)
SCardEstablishContext

This doesn't work at the moment:
Device = new ReaderInterface();
Device.setAutoPair(false)
SCardEstablishContext
Device.connectPeripheralReader(string readerName, nfloat time)

What can be the reason the specific cardreader connection does not work, is there something wrong with the order or something else and does the nfloat need to be an int in order for it to work?

Cannot detect bR301BLE after integrating the new lib ftsafe_0.7.04.jar

Hello,

We have our own application based on your SDK.
We have used the version 0.7.00 of the jar and everything works fine.
But now we try to use the last version of the jar (0.7.04), but we have a problem :
When we call readerFind to scan for BLE devices, and then we turn on our BLE reader, the callback DK.BT4_NEW of the handler is never called.
This problem occurs only on android 6 (we tested under another device with android 4 and there is no problem).
Note that we actually add Location permission to AndroidManifest and then requested permission during Runtime, so obviously it is not related to permissions.
We really appreciate any quick feedback from you, thanks !

Best Regards,

Disconnecting Bluetooth reader after use on iOS

My App uses the Feitian SDK to communicate with the Feitian Bluetooth reader. It has a CryptoTokenKit (CTK) extensions which does not have direct access to the container app. Both the extension and the container app communicate with the SDK. Here is how it is supposed to work:

  1. App readers certs off of the PIV card via the Feitian Bluetooth reader.
  2. App disconnects from reader
  3. User goes to a system process (like Safari) and connects to a client certificate protected web service. The CTK extension connects to the reader and does the signing operation.

The issue I am having is the disconnect after #1. It doesn't seem consistent. When I disconnect:

        SCardDisconnect(gContxtHandle, DWORD(SCARD_UNPOWER_CARD))
        SCardReleaseContext(gContxtHandle)
        readerInterface.disConnectCurrentPeripheralReader()

It sometimes turns the reader off and works fine. Other times it remains connected and other apps trying to access it via the reader are denied until I either force quit the containing app or toggle bluetooth.

Here is the steps I am doing:

         //setup the connection
         guard SCardEstablishContext(DWORD(SCARD_SCOPE_SYSTEM), nil, nil, &gContxtHandle)==0 else {
                Logging.printLog(log: "Error establishing context")

                return false
         }
        var dwActiveProtocol: DWORD  = 0;
        readerInterface.setAutoPair(true)
        let s = SCardConnect(gContxtHandle, LPCSTR(readerName?.cString(using: .utf8)), DWORD(SCARD_SHARE_SHARED),DWORD(SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1), &gContxtHandle, &dwActiveProtocol)
        readerInterface.setDelegate(self)

        ... APDU commands and communication to read from the reader ...

        // Disconnect

        SCardDisconnect(gContxtHandle, DWORD(SCARD_UNPOWER_CARD))
        SCardReleaseContext(gContxtHandle)
        readerInterface.disConnectCurrentPeripheralReader()

When I use the sample app and tap "power off", the lights stay on for the reader. I am not sure if the power off is to just power off the card or disconnect from bluetooth.

Is there a way I can disconnect from the reader so other apps can access it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.