-
Notifications
You must be signed in to change notification settings - Fork 48
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
Incoming data format #17
Comments
Hi, Did you try changing the encoding of the string in the |
Exactly, i tried using all of this http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html |
Ok, that's really weird then. I'd do a double check and some logging on the data you are receiving if you know for sure that you should be receiving something specific. |
What am i currently doing is returning what ever it returns from the creation of a new string with different formats back to the plugin and then back to the phonegap output. Im also using 'adb logcat' command to debug my phonegap application. How can i debug the plugin using the phonegap application? What currently i am going to try is playing around line 936 in BluetoothWrapper.java - Here is where the message is formed from the input stream, i see the BUFFER_SIZE constant is 1024, why? I will debug this as soon as i know how to do it. btw im using a Samsung Galaxy S4, does this matters? |
I don't think the device matters. The buffer size is a magic number, it just means how many bytes the plugin will read from the About debugging, I have usually just used: Log.d("debug message"); Maybe I should look into some proper debuggers... EDIT I discussed this issue with a colleague and he said that the data you are receiving is probably the raw RFID data, and that the printed version is already parsed somehow into a more readable format. I can't really comment on that though, since I have no experience with anything RFID. |
Hello.
I have been doing some research about this issue. I am doing readings with an RFID reader and some tags.
Offtopic but related (?): There is a strange behaviour with the plugin. When i start connection and run the startConnectionManager method and then i perform some readings, the plugin notifies on 2 incoming streams. The first one seems to be a random partial of the full stream. And the second stream most of the times becomes the full stream. I.e:
a. First incoming data: ":"
b. Second incoming data: ":FXDB=001553930C123019233192"
a. First incoming data: ":F"
b. Second incoming data: "FXDB=001553930C123019233192"
I figured this out with a method like this:
bluetooth.startConnectionManager(incoming_data,fail);
function incoming_data(data){
data = $.trim(data);
if(data.length < 5){ //random number, any incoming data with less than 5 chars is not valid for me
console.log("Ignoring this incoming data: " + data);
return;
}
data = data.split("=");
data = data[1] //Now i get just the number, this is worthful data for me
process_data(data);
}
Now, turns out that the real data (what is suppose to be read with the reader and be received by the application) from my tag is printed on a side of the it. i.e: 0000123
My stick reader has a led screen that shows the same number printed in the tag and this tells me that somehow the incoming data is parsed to this number.
Summing up, the plugin is receiving something like: "FXDB=13C0000C0150180000000" and what must be received is something like: "0003091"
I was looking in the BluetoothPlugin.java (line 953) at BluetoothWrapper.MSG_READ case and saw that this is where data is parsed and sent back to the plugin. I have tried to change the format on the constructor of the String 'data' object with no luck, also i have played around this case but im clueless now.
The text was updated successfully, but these errors were encountered: