-
Notifications
You must be signed in to change notification settings - Fork 289
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
Is polling required to receive data? #2
Comments
Hey, |
I'm needing this functionality too. I'm checking to see if the product owners want me to contribute to this project to make it work. If they do, do you have general idea of the work. Feel free to dm me if that's easier. P.S. I'm currently targeting Android. |
@jcteague how does it look ? I currently have some free time so if you are not going to do it, i will start working on it |
I'm on hold right now. I will know more next week. On Sep 9, 2016 2:18 PM, "Jakub" [email protected] wrote:
|
@jcteague okay so i will start working on it, i just checked it and it seems that there shoudn't be much work on making it work |
rgr. I'll check in with you next week and see if there is anything I can FYI, my use case. I'm connecting to a bluetooth device connected a On Fri, Sep 9, 2016 at 3:05 PM, Jakub [email protected] wrote:
|
@jcteague i need to do that as well. Did you use this library or developed something your own? |
we've punted on this for now, focusing on other requirements. We will need On Fri, Sep 16, 2016 at 11:14 AM, jcrjaci [email protected] wrote:
|
The BTSerial API is documented here: https://github.com/derektu/react-native-bluetooth-serial |
I'm taking over for @jcteague. Any progress on this? By the way, I can't find a way to receive data from the connected device through polling or any other means. When I I guessing I will need to extend this package to implement at least the read function and perhaps subscribe. Is that correct? |
After some digging I have discovered that In regards to the original question, it would appear that subscribe does the job. However, I have not been able to test that yet. |
@timscott yep you're right, i didn't test these, so i don't know if they're working correctly ... I don't have much time lately ... |
@timscott @rusel1989 |
@jlucier - I've got
|
@timscott |
Subscribe does appear to work. You have to call Bluetooth.subscribe(delimiter).then(whateverfunction). That promise will always just return true but to get the data you need to make a listener with Bluetooth.on('data', dataHandler). |
@Searingfang - Ah ha! That makes sense. Great work! I'll try that ASAP. |
It seems I am also working on something similar @timscott Did you manage to get subscribe working? It would be awesome if someone could update the example app to show how to use subscribe? |
@storerjeremy It does work. I did what @Searingfang said to do and it worked without issue. |
@jlucier Awesome, thanks for the confirmation it works. I'll give it a shot. Cheers |
@jlucier @Searingfang I tried using BluetoothSerial.subscribe('\n').then(whateverfunction) and BluetoothSerial.on('data', dataHandler) in the example app, however when the subscribe method is called it brings up an error "TypeError: _reactNativeBluetoothSerial2.default.subscribe is not a function". Any idea whats going on? |
@storerjeremy Based on the package.json in the example app it uses the version of the bluetooth serial library on github. This is actually a different version than you would get from npm install. The version on github doesn't have the subscribe feature for some reason. So probably all you have to do is change the package.json dependancy for react-native-bluetooth-serial from "file:../" to "^0.1.6". If that doesn't work make a small app from scratch. Cards on the table, I wasn't able to get the example working when I first tried. |
Hi Thanks in advance |
@Searingfang I'm trying to use |
@pewh sending a command uses the |
for the latest github version, I get the listener for receiving data working by the following way. Note that you have to replace the delimiter '\r\n' with the one upon your own case. BluetoothSerial.withDelimiter('\r\n').then((res)=>{ |
Any updates on doing this without |
anyone have subscribe function example ? please share. |
@hungtm84 I created a small project with bluetooth using the subscribe function ( it also use redux ) you can check it here, it is still a work in progress but the bluetooth is working, may be it can help you. |
Hi @babyinthesky , i placed your code in componentWillMount() but no events was catched when my scanner read barcode.
I use this version : "react-native-bluetooth-serial": "^1.0.0-rc1" Thanks in advance |
Any update? |
I want to connect to a Bluetooth Classic SPP device ( not an Arduino device ).
Use Case1:
Use Case2:
Is there an API event or something that can be used to asynchronously handle data reception from the Bluetooth device?
Thanks for sharing your work. Any advice is appreciated.
The text was updated successfully, but these errors were encountered: