Home › Forums › Ask the Flomies › FloBLE and Cordova
-
AuthorPosts
-
February 17, 2016 at 1:54 am #54490
Hi,
I would like to use FloBLE to read NFC tags from my Ionic/Cordova app.
Is that possible through the Cordova Plugin?
How would that work? The plugin recognises automatically the FloBLE via Bluetooth or do I need to search for Blietooth devices and pair it?
Thanks for your answer.
Bye
LucaFebruary 17, 2016 at 9:45 am #54496Hi Luca, yes this is possible and something we’ve been using internally for some time. Version 2.0 of the iOS Flomio SDK and Cordova Plugin will allow you to build Ionic apps that work with our readers very quickly. Our estimated release date is mid March but will be beta testing with select customers as soon as next week. If you’d like to be considered as a beta tester, let us know. We will expect you to provide feedback on issues directly on this forum or on GitHub.
February 17, 2016 at 9:53 am #54497I would be happy to beta test the SDK.
Some details of my app are in http://www.diveplanapp.com, and I am starting a cooperation with a company that will insert, if everything works fine, the FloBLE inside their standard sales package for their products.
Their product has an integrated NFC card that stores various information (in NDEF format) received from the product and that shall be capable to transfer this information to my app (offline).
How can I proceed? Shall I buy one FloBLE? Which version?
Thanks
LucaFebruary 17, 2016 at 10:36 am #54498Congrats on your app! looks great. We have an NDEF parser in our SDK but you may need to upgrade to a Pro license to address your use case. Our Basic SDK license, which is included with the purchase of any Flomio reader, could work for you but requires your host device (mobile phone or tablet pairing with the reader) to be cloud connected when scanning tags. Alternatively, the Pro SDK works completely offline but costs $150 a la carte or $125.01 as an upgrade from an existing Basic license. Each license is bound to the reader’s device id so every reader sold would need to have a license in order to work with your app. I hope that makes sense.
To proceed with getting setup, I would recommend you purchase a FloBLE Plus over an EMV or Mini because it’s the most powerful reader in the FloBLE product line. So tags of all shapes and sizes will have great read performance. This avoids problems that lead to a poor user experience with NFC, i.e. no “searching for the sweet spot”.
Lemme know if you have more questions, glad to help.
RichardFebruary 17, 2016 at 10:43 am #54499Thanks.
So how can I purchase a FloBLE Plus + Pro license?
I see standard FloBLE at 79.99USD, but it does not have a “PRO license” option.February 17, 2016 at 10:54 am #54500Yeah, we still haven’t setup the Pro license product on the store… will be working on that in the coming weeks. Just purchase the FloBLE Plus for now which will come with Basic license support and later you can go through this process to upgrade.
March 17, 2016 at 6:07 am #54804I have received my FloBLE. How can get inside the beta for Cordova?
March 17, 2016 at 7:58 am #54806The Flomio SDK can be downloaded from here:
https://www.dropbox.com/s/y5qloadwievtjp4/FlomioSDK.zip?dl=0
The Flomio Cordova Plugin can be cloned from our GitHub repo here:
https://github.com/flomio/flomio_cordova_plugin
thanks,
RichardMarch 17, 2016 at 10:13 am #54809Done.
Now the app has found and paired the FloBLE, but it seems to initialize also the FloJack, and starts a continuous sound that I don’t manage to remove.
Also the app crashes as soon as the FloBLE disconnects or re-connects:2016-03-17 15:08:12.632 DivePlan[4633:835935] Init FloJack
2016-03-17 15:08:13.700 DivePlan[4633:835935] Updated settings for reader 0x156f2110
2016-03-17 15:08:13.701 DivePlan[4633:835935] THREAD WARNING: [‘FLOPlugin’] took ‘1076.934814’ ms. Plugin should use a background thread.
2016-03-17 15:08:13.703 DivePlan[4633:836076] Created reader 0x156f2110
2016-03-17 15:08:13.708 DivePlan[4633:835935] Init FloBLE Plus
2016-03-17 15:08:13.739 DivePlan[4633:835935] ::centralManagerDidUpdateState supports 5
ReceiverAndMicrophone
2016-03-17 15:08:26.950 DivePlan[4633:835935] ::discovered peripheral ACR1255U-J1-000059 <__NSConcreteUUID 0x156e5030> A7DBD4BF-72E4-2EBE-4704-E9F923A558ED
2016-03-17 15:08:27.295 DivePlan[4633:835935] Peripheral Connected
2016-03-17 15:08:27.399 DivePlan[4633:835935] Services Discovered
2016-03-17 15:08:27.401 DivePlan[4633:835935] Reader Detected
2016-03-17 15:08:27.517 DivePlan[4633:835935] Peripheral Successfully Attached
2016-03-17 15:08:27.579 DivePlan[4633:835935] E1 00 00 45 00 16 5C AB 5D D2 67 63 AC A6 0F 88 DA 7C 1E F6 28
2016-03-17 15:08:27.641 DivePlan[4633:835935] E1 00 00 46 00 0B 3D 7F CD E4 9E 7C C6 58 AF FA DA 20 F9 72 51
2016-03-17 15:08:27.641 DivePlan[4633:835935] Peripheral Successfully Authenticated
2016-03-17 15:08:27.643 DivePlan[4633:835935] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘Invalid type in JSON write (CBPeripheral)’
*** First throw call stack:
(0x24c9e2eb 0x2446adff 0x24c9e231 0x2552800d 0x2552a093 0x24bc80cf 0x24bc0c41 0x25529a2b 0x25527f81 0x25527d53 0x25528c0d 0x13c07f 0x12975f 0x13d02f 0x125507 0x6f0cbf 0x6f0cab 0x6f5771 0x24c60fc5 0x24c5f4bf 0x24bb1bb9 0x24bb19ad 0x25e2baf9 0x28e9dfb5 0xc088b 0x24864873)
libc++abi.dylib: terminating with uncaught exception of type NSExceptionMarch 21, 2016 at 11:56 am #54835Any news on this subject?
ThanksMarch 21, 2016 at 2:17 pm #54840Still debugging this issue… should have a fix by later today.
March 31, 2016 at 8:24 am #54949Hi. Any news on this subject?
April 5, 2016 at 10:19 am #55017Still no news?
April 5, 2016 at 10:31 am #55019Hi Luca, sorry for the delay but there is still no news. We are working to get our SDK2.0 release out to address this issue. Given it’s a major release we didn’t think it made sense to repair the v1.9 bug that is the root cause of the issue listed here. In tandem this is high season for conferences including Launch Festival, SXSW, Payments Summit, and RFID Journal Live. Flomio was asked to present at all of them so it’s presented some management challenges for us.
Of course, you are our priority and we will continue to hustle to get you the working SDK you paid for. I just wanted to provide some context so that you didn’t think we weren’t taking your request seriously.
best,
RichardApril 5, 2016 at 10:32 am #55020Thank you. I appreciate you answer.
I will be waiting for a fix as soon as possible.
Regards,
LucaApril 7, 2016 at 2:40 pm #55049Hey Luca, this thread seems to have resolved the issue. Check it against the Cordova plugin and let me know if you’re still experiencing issues.
thanks,
RichardApril 8, 2016 at 4:57 am #55055It seems that with Cordova the problem is still there.
2016-04-08 10:54:19.409 HelloCordova[3277:1136358] ::centralManagerDidUpdateState supports 5 2016-04-08 10:54:25.807 HelloCordova[3277:1136358] ::discovered peripheral ACR1255U-J1-000059 <__NSConcreteUUID 0x165bc930> A7DBD4BF-72E4-2EBE-4704-E9F923A558ED 2016-04-08 10:54:26.570 HelloCordova[3277:1136358] Peripheral Connected 2016-04-08 10:54:26.675 HelloCordova[3277:1136358] Services Discovered 2016-04-08 10:54:26.679 HelloCordova[3277:1136358] Reader Detected 2016-04-08 10:54:26.795 HelloCordova[3277:1136358] Peripheral Successfully Attached 2016-04-08 10:54:26.859 HelloCordova[3277:1136358] E1 00 00 45 00 D1 EA CF 97 43 AC 35 0E 6E 85 DE 72 EE F4 21 E6 2016-04-08 10:54:26.946 HelloCordova[3277:1136358] E1 00 00 46 00 60 E4 6F 35 B5 3A CA C0 97 0C 8F 1F 52 70 83 E0 2016-04-08 10:54:26.946 HelloCordova[3277:1136358] Peripheral Successfully Authenticated 2016-04-08 10:54:26.950 HelloCordova[3277:1136358] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (CBPeripheral)' *** First throw call stack: (0x22995b8b 0x22152dff 0x22995ad1 0x232307ed 0x23232873 0x228ba79f 0x228b3311 0x2323220b 0x23230761 0x23230533 0x232313ed 0x11b2a7 0x108c47 0x11c24b 0x104ed9 0x2e9ba7 0x2e9b93 0x2ee659 0x229577d5 0x22955ccf 0x228a4289 0x228a407d 0x23ec0af9 0x26fcf2c5 0x10075b 0x22550873) libc++abi.dylib: terminating with uncaught exception of type NSException
It’s a standard Ionic starter app with just the implementation of Flomio.
April 26, 2016 at 10:45 am #55274Hi Richard. Any news on the date of release of SDK 2.0?
May 4, 2016 at 12:22 pm #55409Luca, latest news on SDK 2.0 here.
May 13, 2016 at 6:27 am #55466Hi Richard,
it seems that the Cordova plugin requires ReaderManager.h, which is not present anymore in the SDK 2.0.
Any update required also on the cordova plugin side?
Thanks
LucaMay 19, 2016 at 10:57 am #55510Hi, any reply on the above?
June 9, 2016 at 8:15 am #55679I still see no news. Can I have any update, otherwise I will need to ask a refund for the purchase.
Thank you
LucaJune 9, 2016 at 1:09 pm #55684Hi Luca, the Cordova plugin is being reworked for the Flomio SDK 2.0. You can follow updates directly on the flomio_cordova_plugin repo on GitHub.
June 17, 2016 at 6:29 am #55748Hi Richard,
I was able to make the plugin work under my basic Ionic app. Now I can connect the FloBLE and read Tags Uids.
I’m not very familiar with NFC, so my question is, how can I read the NDEF file that is stored in the tag?
Thanks
LucaJune 17, 2016 at 9:04 am #55751Hi again,
I was able to send some Adpu to the tag, but I had to tweak a little the code in FlomioPlugin.m (maybe are bugs that you already know and fixing):
1- didUpdateConnectedDevices: it seems not to set properly the self->connectedDevicesList Array, which stays empty. Adding self->connectedDevicesList = connectedDevices seems to solve the issue
2- sendApdu: device.device == deviceId does not work, since device.device points to the object and not to the deviceId
3- didRespondToApduCommand: callback Id is wrong and should be: [self.commandDelegate sendPluginResult:pluginResult callbackId:apduResponse_callbackId];
4- inside FlomioPlugin.js: FlomioPlugin.prototype.sendApdu should return both deviceId and responseAdpu
function(deviceId, responseApdu)
{
resultCallback({responseApdu: responseApdu});
}Anyway I still don’t get how to read the NDEF file.
Thanks
LucaJune 21, 2016 at 8:32 pm #55782Hi Luca,
A more stable beta of the Flomio SDK v2.0 Cordova plugin is now available from https://github.com/flomio/flomio_cordova_plugin/tree/SDKv2.0
The issues you mentioned should have been fixed with this update. Please note however that the structure of some JavaScript functions have changed.
If you encounter any further problems, please feel free to report them on GitHub or discuss them here.
Regards,
StuartJune 22, 2016 at 3:18 am #55785Thank you, all working now, except I don’t yet understand how to read the NDEF file of the tag. Any suggestion?
Another thing, the onDeviceConnectionChange method now returns an array as deviceId and no status:
{deviceId: ["RR330-000059"], status: undefined}
Thanks
LucaJune 22, 2016 at 7:02 am #55787The change to
onDeviceConnectionChange
was intentional. Returning an array of connected devices brings the function in line with how the SDK works internally and how the test app works. Within your JavaScript code, you could write a function that tracks how the connected device table changes if you need to know when an individual device connects or disconnects.With regard to managing the NDEF contents of a tag, I’ll discuss with the team and integrate this into the Cordova plugin as soon as possible. I’ll post here again when I have an update.
Stuart
June 23, 2016 at 6:33 pm #55805Hi Luca,
Thank you very much for your patience. I have just pushed an update to the Cordova plugin which enables NDEF reading through
getDataBlocks
.Again, it’s available here: https://github.com/flomio/flomio_cordova_plugin/tree/SDKv2.0
It relies on an update to the Flomio SDK, so please re-download the SDK from the link given above:
https://www.dropbox.com/s/y5qloadwievtjp4/FlomioSDK.zip?dl=1Regards,
Stuart- This reply was modified 8 years, 6 months ago by Stuart.
June 23, 2016 at 7:03 pm #55808Update: the Flomio SDK 2.0 functionality has now been merged into our master branch, so please clone the plugin from https://github.com/flomio/flomio_cordova_plugin
Stuart
June 24, 2016 at 3:16 am #55813HI Stuart,
thank you for the update.
Now I get this error when trying to compile:Undefined symbols for architecture arm64: "_OBJC_CLASS_$_FmSessionManager", referenced from: objc-class-ref in FlomioPlugin.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any idea how to solve it?
Thanks
LucaJune 24, 2016 at 8:07 am #55816Hi Luca, what this means is that the Flomio SDK is not being found in your iOS build. Likely cause is that you’ve missed drag/dropping the new Flomio SDK2.0 into your Cordova Xcode project per the instructions in the flomio_cordova_plugin readme.
Best,
RichardJune 24, 2016 at 8:42 am #55819Hi, yes, it was a problem of file linking inside Xcode after I changed the SDK.
I deleted the platform and added again. Now it works.
The result of the NDEF read is anyway always empty:
Transmit Apdu selectNDEFTagApplication: 00 A4 04 00 07 D2 76 00 00 85 01 01
Response apdu:90 00
Transmit Apdu selectCCFile: 00 A4 00 0C 02 E1 03
Response apdu:90 00
Transmit Apdu readCCFile: 00 B0 00 00 00
Response apdu:6A 80Is there any other way to check the content of the tag? I am pretty sure there is data stored inside.
Thanks
LucaJune 24, 2016 at 8:57 am #55820Best way to check is using an Android NFC phone/tablet with an app called NFC TagInfo. I suspect based on your APDU results that you are using an NFC Forum Type 4 tag that we haven’t tested against and our NDEF parser is failing as a result. Can you send us a sample of the tags you’re using or point us to somewhere we can procure them? This will allow us to fix the code as needed.
best,
RichardJune 24, 2016 at 9:02 am #55821Hi. Yes that may the problem. In fact I get this error when I debug in Xcode:
https://www.dropbox.com/s/pyhthg0ufzycx3f/Schermata%202016-06-24%20alle%2014.56.38.png?dl=0
The NFC tag is inside a dive computer:
http://www.seabear-diving.com/t1.htmlDo you think that if I ask to the company producing them to send you a sample you would be to solve the issue?
Thanks
LucaJune 24, 2016 at 9:25 am #55824I was now trying to send Adpu messages following this:
https://bitbucket.org/tkoskine/arduino-pn532/wiki/NFC_Forum_Type_4_tagsThey are similar to yours, except for the “Read Binary” C-APDU, which has 0F at the end, but the response of the Adpu function gives only and empty string, so I am not able to read the response codes.
June 24, 2016 at 10:11 am #55825Hi Luca, I recall your application now. Before sending out a sample lets discuss further. Our first NDEF parser implementation supports Well Known Type URI (URL) decoding only, could it be that the data on the Seabear is stored some other way, like Text or vCard? Check out the basics of NDEF Well Known Types supported in this blog post for more info.
July 5, 2016 at 5:31 am #55891Hi Richard,
I have spoken with the manufacturer and they told me that they use just the standard Android SDK to read the tag.
The NFC chip used is M24SR:
http://www.st.com/content/st_com/en/products/memories/nfc-rfid-memories-and-transceivers/dynamic-nfc-rfid-tags/m24sr-series.html
This is the code the use in Android if it may be of any help to understand:This is the code which I used to read out the NFC tag after it was discovered: public void readTag(Intent intent) { int test = 0; if (test == 0) { if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction()) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) { Parcelable[] messages = intent .getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); if (messages != null) { for (int i = 0; i < messages.length; i++) { try { List<Record> records = new Message( (NdefMessage) messages[i]); for (int k = 0; k < records.size(); k++) { Record record = records.get(k); String str = new String(record.getNdefRecord() .getPayload()); parseAndShow(str); } } catch (Exception e) { Log.e("read NFC", "general error\n"); } } } } else { if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) Log.e("read NFC", "error at read\n"); } } else { parseAndShow(SUEX_TEST_STRING); } }
I appreciate if you can help me on this issue.
Thanks
LucaJuly 7, 2016 at 5:17 am #55917Hi Luca, I see a few things that may be causing your issues. Seems the SeaBear folks have stored their NDEF message as a collection of TXT records. Our current NFC Forum Type 4 NDEF parser was written crudely due to lack of time and only supports single record NDEF messages that are URLs. While we fix this, you can implement a sequence of APDUs to get the data you need. From looking over the APDUs you’ve been able to send/receive via the FloBLE, I saw your instruction to read the Capability Container was requesting 0 bytes which is out of range per the NFC Forum spec (valid range is 01h to FFh).
Transmit Apdu readCCFile: 00 B0 00 00 00 Response apdu:6A 80
6A 80
: Parameters in the data field are incorrect. (reference here)If you change readCCFile APDU to
00 B0 00 00 FF
, you should get a bunch of NDEF data you can parse through and pick out what you need. To help you with troubleshooting this further, I ordered an M24SR development board from STMicro which should arrive in the next couple days. Let me know how far you get and we’ll be able to provide some more support then.best,
RichardJuly 7, 2016 at 5:21 am #55918Thank you very much, I really appreciate your support!
I will keep you updated on the progress.
Regards,
LucaJuly 7, 2016 at 10:14 am #55924I have tried to use the
FF
at the end of the adpu, but the result is always an empty string, even if now I receive a90 00
response:Found tag UUID: 02 84 00 07 A4 AB 33 from device:RR330-000059 sendAdpu 00 A4 04 00 07 D2 76 00 00 85 01 01 00 Transmit Apdu:00 A4 04 00 07 D2 76 00 00 85 01 01 00 count:0 Response apdu:90 00 Received APDU: from device:RR330-000059 sendAdpu 00 A4 00 0C 02 E1 03 Transmit Apdu:00 A4 00 0C 02 E1 03 count:0 sendAdpu 00 B0 00 00 FF Transmit Apdu:00 B0 00 00 FF count:0 Response apdu:90 00
July 7, 2016 at 10:31 am #55926Now I tried to use this
00 B0 00 00 0F
and I received this as a response:
00 0F 20 00 F6 00 F6 04 06 00 01 20 00 00 00 90 00
.
How can I use it?July 7, 2016 at 11:31 am #55927OK. I am moving forward and I think I managed to read the binary data of the NDEF file, but from here I don’t know exactly what to do.
Below the code with the different commands I am sending:var selectNDEFTagApplication = "00 A4 04 00 07 D2 76 00 00 85 01 01 00"; var selectCCFile = "00 A4 00 0C 02 E1 03"; var readCCFile = "00 B0 00 00 0F"; var NDEFSelect = "00 A4 00 0C 02"; var NLEN_field = "00 B0 00 00 02"; function readNDEF () { flomioPlugin.sendApdu(function (result) { console.log("selectNDEFTagApplication",result) flomioPlugin.sendApdu(function (result1) { console.log("selectCCFile",result1) flomioPlugin.sendApdu(function (result2){ var NDEF_identifier = result2.responseApdu.substr(27,5) console.log("readCCFile",result2,NDEF_identifier) flomioPlugin.sendApdu(function (result3){ console.log("NDEFSelect",result3) flomioPlugin.sendApdu(function (result4){ console.log("NLEN_field",result4) var NLEN_length = result4.responseApdu; //now read data from NDEF readFile (NLEN_length); }, $scope.deviceId, NLEN_field); }, $scope.deviceId, NDEFSelect+NDEF_identifier); }, $scope.deviceId, readCCFile); }, $scope.deviceId, selectCCFile); }, $scope.deviceId, selectNDEFTagApplication); } function readFile (NLEN_length) { flomioPlugin.sendApdu(function (result5){ //NLEN length of the NDEF message var length = result5.responseApdu.substr(0,5); //NDEF message field, it contains an empty NDEF message var message = result5.responseApdu.substr(6,8); //NDEF file var file = result5.responseApdu.substr(15,result5.responseApdu.length-15); console.log("READ NDEF ",result5); console.log("NDEF length",length); console.log("NDEF message",message); console.log("NDEF file",file); }, $scope.deviceId, "00 B0 00" + NLEN_length); }
Response I receive is the following:
NDEF length 65 6E NDEF message 56 65 72 NDEF file 73 69 6F 6E 3B 32 2E 30 0A 44 65 76 69 63 65 3B 54 31 0A 53 4E 3B 31 35 38 30 31 32 31 0A 53 6F 66 74 77 61 72 65 20 56 65 72 73 69 6F 6E 3B 31 2E 35 31 0A 44 65 63 6F 20 56 65 72 73 69 6F 6E 3B
I think now I should send some other commands to read the rest of the file, but I don’t find how. And also I don’t get how to “decode” the message to a readable data.
Thanks!
LucaJuly 8, 2016 at 1:35 am #55936Hey Luca, that’s awesome progress!! It’s a true testament to the power of the Flomio SDK and Cordova plugin to see it working for your use case. The NDEF binary is just ASCII so you can decode it with the HEX to ASCII converter. I put your response in and got the following:
I’d say you’re in business! I think you broke out the message from the file incorrectly though since the entire NDEF message that made sense was the concatenation of the two: NDEF message + NDEF file
Keep us posted with feedback on how to make things easier, better, faster for you. Would you be interested in doing a guest blog on our site? that would bring exposure to your project as well as highlight what you went through to get it done.
best,
RichardJuly 8, 2016 at 7:57 am #55944Hi,
I can certainly make a post on your blog. Let me first finalize the details of the app so I can insert more details in the post.
Can you just help me to understand how I can check if there are different NDEF files inside the tag and how I can read the next pieces of each file (I think now I was able to get only the first part, but I still don’t understand clearly how to read the next parts).
Thanks
LucaJuly 11, 2016 at 2:31 am #55967Hi again,
after many trials and errors I think I reached an happy ending.
I copy below the code from my Ionic app that can detect the tag and read the NDEF:function onDeviceConnectionChange(result) { console.log("onDeviceConnectionChange",result); flomioPlugin.getReaderSettings(getReaderSettings); } flomioPlugin.init(); flomioPlugin.selectDeviceType("FloBLE-Plus"); flomioPlugin.onDeviceConnectionChange(onDeviceConnectionChange); // note: reader UID is omitted so all connected devices will start polling function onTagUidRead(result) { console.log("onTagUidRead",result); $scope.tagUid = result.tagUid; $scope.deviceId = result.deviceId; //NOTE: send ADPU only AFTER tag read callback! $ionicLoading.show({ template:"Reading tag. Please don't disconnect until finished..." }); readNDEF (); } flomioPlugin.onTagUidRead(onTagUidRead); function getReaderSettings(result) { console.log("getReaderSettings",result); $ionicLoading.show({ template:"Flomio Connected!", duration: 1000 }); } function onTagStatusChange(result) { console.log("onTagStatusChange",result); } flomioPlugin.onTagStatusChange(onTagStatusChange); var tagUid_adpu = "FF CA 00 00 00"; var readPage0 = "FF B0 00 00 FF"; var selectNDEFTagApplication = "00 A4 04 00 07 D2 76 00 00 85 01 01 00"; var selectCCFile = "00 A4 00 0C 02 E1 03"; var readCCFile = "00 B0 00 00 0F"; var NDEFSelect = "00 A4 00 0C 02"; var NLEN_field = "00 B0 00 00 02"; function readNDEF () { $scope.NDEF = ""; flomioPlugin.sendApdu(function (result) { flomioPlugin.sendApdu(function (result1) { flomioPlugin.sendApdu(function (result2){ var NDEF_identifier = result2.responseApdu.substr(27,5) flomioPlugin.sendApdu(function (result3){ flomioPlugin.sendApdu(function (result4){ console.log("NLEN_field",result4.responseApdu) var NLEN_length1 = "00 0A"// start of the NDEF record var NLEN_length2 = "F6";// max length of bytes that can be read //now read data from NDEF readFile (NLEN_length1,NLEN_length2); }, $scope.deviceId, NLEN_field); }, $scope.deviceId, NDEFSelect+NDEF_identifier); }, $scope.deviceId, readCCFile); }, $scope.deviceId, selectCCFile); }, $scope.deviceId, selectNDEFTagApplication); } function readFile (NLEN_length1,NLEN_length2) { flomioPlugin.sendApdu(function (result5){ //NDEF file $scope.NDEF += hex2a(result5.responseApdu); var next = addHex(NLEN_length1, NLEN_length2); if (result5.responseApdu.length > 0) { //iterate through file readFile (next,NLEN_length2); } else { console.log("NDEF",$scope.NDEF); $ionicLoading.hide(); var confirmPopup = $ionicPopup.alert({ title: 'Tag Successfully read!', template: $scope.NDEF }); } }, $scope.deviceId, "00 B0"+NLEN_length1+NLEN_length2); } function addHex(c1, c2) { var hexStr = (parseInt(c1, 16) + parseInt(c2, 16)).toString(16); while (hexStr.length < 4) { hexStr = '0' + hexStr; } // Zero pad. return hexStr; } function hex2a(hexx) { var hex = hexx.replace(/\s/g, "").toString();//force conversion var str = ''; for (var i = 0; i < hex.length; i += 2) str += String.fromCharCode(parseInt(hex.substr(i, 2), 16)); return str; }
Bye and thank you again for your support.
LucaSeptember 28, 2016 at 5:49 am #56567Hi Richard,
I have noticed that if I put the length of bytes reading to “F6” (which is the maximum values accepted):
var NLEN_length2 = "F6"
then I will miss the last part of the NDEF, because if the last portion is less than F6, then I will not receive it and it will be cut out.
The only option I have to read the complete NDEF is to put “01” as length, but this takes forever to read…
Do you have any suggestion on how to read the complete tag or get the remaining length to be read?
Did you manage to integrate the NDEF reader for my tag version into the SDK?
Thanks
LucaMarch 8, 2017 at 5:02 am #58936Hi all,
Please use flomio_cordova_pluging branch v2.2 to set up Ndef reading using the Flomio cordova plugin.
It is now stable and easy to setup by simply
https://github.com/flomio/flomio_cordova_plugin/commit/<latest-commit-code>
No need to play with Xcode configurations.Kind Regards,
ScottSeptember 21, 2017 at 1:00 am #61105Question – Will this work for android and windows apps ?
November 6, 2017 at 5:59 am #61489Hi Luca,
hoping you’re still getting updates on this thread – we are struggling to get a reliable Android Cordova plugin to work for the ACR35. Would you be willing to share the plugin which you created?
Best regards,
Nick
-
AuthorPosts
You must be logged in to reply to this topic.