-
Notifications
You must be signed in to change notification settings - Fork 1
Patch for usage of Nfc iso7816 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -214,6 +214,8 @@ protocols: | |||
name: didInvalidate | |||
'-tagReaderSession:didDetectTags:': | |||
name: didDetectTags | |||
'-tagReaderSessionDidBecomeActive:': | |||
name: tagReaderSessionDidBecomeActive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tagReaderSessionDidBecomeActive
is not available on iOS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://developer.apple.com/documentation/corenfc/nfctagreadersessiondelegate/3282002-tagreadersessiondidbecomeactive
states it is available since 13.0+
It also gets called during our process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad, misread.
Anyway its already available in 2.3.10-SNAPSHOT.
The only moment I probably would rename it to match other methods (to didBecomeActive
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found it - thank you!
@@ -77,6 +77,6 @@ protected NFCTagReaderSession() {} | |||
* @since Available in iOS 13.0 and later. | |||
*/ | |||
@Method(selector = "connectToTag:completionHandler:") | |||
public native void connectToTag(NFCTag tag, @Block VoidBlock1<NSError> completionHandler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NFCTag is valid as per iOS api
(actually it should be something like this <T extends NSObject & NFCTag > void connectToTag(T tag...
but its overkill)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The api docs tell NFCTag, that's correct. However we use
https://developer.apple.com/documentation/corenfc/nfctagreadersessiondelegate/3075577-tagreadersession?language=objc
to start conversation with the card. this functions has a signature like
(NFCTagReaderSession session, NSArray<?> tags)
on the java side.
However i found no way to cast the objects contained in "tags" to NFCTag class to call connectToTag with it. I am getting exceptions stating that NSObject cannot be cast to NFCTag.
That's why i altered the signature of the connectToTag() function to accept NSObject which works fine for us.
It's been a while since we did this, but I rechecked it today and found no way of accomplishing the cast. Chances are that this can be solved in another way i am not aware of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so it has to be fixed in delegate callback with marshaller like this
session, @org.robovm.rt.bro.annotation.Marshaler(NSArray.AsListMarshaler.class) List<NFCTag> tags)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, and thanks for the suggestion - the Marshaller does the job - however i then get the error, that the delegate does not implement the method didDetectTags(....)
.
Since the signature differs.
Any hints on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, said that too fast. I now put the signature:
void didDetectTags(NFCTagReaderSession session, @org.robovm.rt.bro.annotation.Marshaler(NSArray.AsListMarshaler.class) List<NFCTag> tags)
to NFCTagReaderSessionDelegate and its adapter in robovm - and implemented the callback accordingly. still i get a classcastexception stating that NSObject cannot be cast to NFCTag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks for letting know, will give it a short investigation (probably marshaller doesn't handle protocols correctly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any news on this. I tried to figure out a proper way but didn't came very far. :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will take a look today
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just tested your dev branch successfully - thanks a lot.
sorry missed your PR as wasn't watching own repos. have added comments for lines. |
@legion151 |
Oh sry - oversaw your answer - in case you oversaw mine. Thanks again |
np, have create a PR yesterday |
…-to-12 exp2 -- v10.2.2, update to Libcore 12
We use is7816 successfully in our project. However these patches are needed for this.