Skip to content
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

Subscribe function not working #20

Closed
sumeetgattewar opened this issue Oct 30, 2013 · 5 comments
Closed

Subscribe function not working #20

sumeetgattewar opened this issue Oct 30, 2013 · 5 comments

Comments

@sumeetgattewar
Copy link

I'm trying to use the plugin for an app which communicates with RFID reader through bluetooth module. I've successfully tested it on RDM6300 module. However, when I'm using it with EM18 RFID reader module which communicates in
10 ASCII DATA (card no.)+ 2 ASCII DATA (XOR result)
The subscribe function is not working.
In the first case (RDM6300) I passed delimeter as ''
In EM18 case I've tried using delimeter as '\n' or '' or 'ETX' but none of them is working. When I punch a rfid card, the data gets saved in buffer but does not invoke the subscribe function. I am able to read the buffered data using .read function.
Please suggest what shall I do to get it work with EM18 reader.

@don
Copy link
Owner

don commented Oct 30, 2013

There was a problem with subscribe in 0.2.0 that should be fixed in 0.2.1.

Can you run the debugger on the Android code and verify what data is getting into the buffer over the serial connection? Make sure there is a \n in the incoming data from the reader. Maybe it is \r?

@sumeetgattewar
Copy link
Author

I tried using the bluetoothserial.read function to read the buffer, The buffer is showing 12 characters stored in it. If I happen to punch the card multiple times it keeps on appending the card tag to the buffer (which I'm reading later through .read function) Once read, the buffer is cleared. The buffer data is not showing any characters like /n or /r

I've tried changing to 0.2.1 (the latest version avlbl)
My list devices function has stopped working. It is not showing any list of devices paired.

@don
Copy link
Owner

don commented Oct 30, 2013

In order to use the subscribe function, the incoming data must have a delimiter that can be used for splitting the data. If the reader is not sending a delimiter, you'll need to manually read the incoming bytes. If you were using 0.2.0, it's likely you were seeing issue #9 which is fixed in version 0.2.1.

Since you're not seeing any devices after upgrading, I'm guessing there is another error. Check adb logcat for errors. Did you cordova plugin remove and reinstall the plugin with cordova?

$ cordova plugin rm com.megster.cordova.BluetoothSerial
$ cordova plugin add https://github.com/don/BluetoothSerial

If the list problem continues with 0.2.1, please open a new issue. Let me know what versions of Cordova, Android SDK, the Hardware you're running on, the version of Android on the hardware.

@sumeetgattewar
Copy link
Author

I was using 0.2.0 and the subscribe function was working with delimeter set
to ''
Yes, I did face issue#9 with that.

I'm not using command line tools. I downloaded the .zip for 0.2.1 and
replaced the two .java files (in src/com/megster/cordova) and one .js file
(in assets/www/js) in my project directory. After this the list device
stopped working.

To use the commands given by you, I tried installing cordova command line
tools, however I'm stuck with it and could not get it working. I'm using
Android Studio with the latest SDK version installed and using Google Nexus
7 with Android 4.3 for testing

On Wed, Oct 30, 2013 at 9:16 PM, Don Coleman notifications@github.comwrote:

In order to use the subscribe function, the incoming data must have a
delimiter that can be used for splitting the data. If the reader is not
sending a delimiter, you'll need to manually read the incoming bytes. If
you were using 0.2.0, it's likely you were seeing issue #9https://github.com/don/BluetoothSerial/issues/9which is fixed in version 0.2.1.

Since you're not seeing any devices after upgrading, I'm guessing there is
another error. Check adb logcat for errors. Did you cordova plugin remove
and reinstall the plugin with cordova?

$ cordova plugin rm com.megster.cordova.BluetoothSerial
$ cordova plugin add https://github.com/don/BluetoothSerial

If the list problem continues with 0.2.1, please open a new issue. Let me
know what versions of Cordova, Android SDK, the Hardware you're running on,
the version of Android on the hardware.


Reply to this email directly or view it on GitHubhttps://github.com//issues/20#issuecomment-27401956
.

_S_umeet _G_attewar

_B_achelor of _Tech_nology,
Manufacturing Science & Engineering
_I_ndian _I_nstitute of _T_echnology, *Kharagpur
*---------------------------------------------------------------
e-mail: sumeetgattewar@gmail.com

Mobile: +91-9881541240

"There is no right decision or wrong decision. There's just a decision."

@don
Copy link
Owner

don commented Nov 27, 2013

@sumeetgattewar hopefully you've solved this problem by now. If not try the Counter example https://github.com/don/BluetoothSerial/tree/master/examples/Counter, I've tested this with Android 4.3 on a Nexus 7 with the latest Android SDK. I used a Sparkfun Bluetooth Mate Silver and the SeeedStudio Bluetooth shield.

@don don closed this as completed Nov 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants