how does OF connect to bluetooth devices (a.e. a mobile) - does it use poco for that? Are there any examples around, or is the arduino serial example what I’m searching for?
That’s pretty tricky stuff. You’d need to either communicate with the bluetooth stack on your OS or another application handle that part send OSC (or some other kind of message) to your OF application.
I’d point you to libraries but I vouch for any of the C++ ones, just the Java ones that Processing uses.
oh, didn’t know that’s so hard to handle.
… what I basically wanna do is sending a image from my mobile to the computer (to openframeworks or directly to plain c++), process the image there and send it back to the handy. there are some pretty easy python examples floating around (also using python on the phone), so maybe it would be smart to use python as a bridge in between!?
any tips for choosing a library (on windows) or how to interface with the windows bluetooth system stack? other tips are also welcome
much thanks in advance
phones used to (and I’m pretty sure still do) be able to send files via OBEX, so looking up windows OBEX examples would be the best place to start. Python would be a good choice since you can run python on your phone too. Also, if your phone can run mobile processing you could link up to the processing BluetoothDesktop library. You can also check this stackoverflow post for some more links:
After snooping MSDN for a little bit, there is some demo code here written in C# that could show you how to talk to the underlying bluetooth WinAPI but it doesn’t look like fun and you’d have to be pretty comfortable with C#. That’s probably not what you want to do though. Use a Java or Python lib. I’m not super knowledgable about Windows (or bluetooth for that matter) so sorry I can’t be of more help.
ok, thanks for the infos.
any tips on what’s the best way to connect python with c++ or openframeworks? …I use psy60 on my phone, like it much more than mobile processing
Sending OSC messages between a python app and an OF app would probably be the easiest option, though someone else might know of something better.
reading literature and tutorials - it seems to be possible to use the standard serial library for the communication with the mobile phone?! at least under windows it’s possible to build a virtual com port for any bluetooth device?!
have to read some more literature … I will report back when I know more.
Yeah, Bluetooth communication is done through a serial port, you just need to make sure you setup the connection between the clients correctly. That’s essentially what that C# code was doing, startup a winsock, handling all the different opcode for bluetooth and OBEX, though it’s doing it all using the massive .NET libs. I guess the challenge would be getting the winapi stuff. This would be helpful:
There is also serial over bluetooth. I have been using it to connect to an arduino for example. Once you have set up the serial channel in you OS’s bluethooth settings your app simply uses a virtual serial port that is no different from normal serial stuff.
@stefan - Do you have any code you could post up? I think I’m imagining that this is more difficult than it is.
On OSX I know you can use the Bluetooth Setup Assistant to connect to a device if you know it ahead of time and then communicate with it over serial (ala Arduino BT or bluesmirf), but I was thinking he wanted to have a code that could detect new device and connect with it.
ok, I think the serial stuff is what I need. what I basically wanna do is shooting a photo, transfer it to the computer (on the phone runs python to handle that task), process the picture and send it back (or let the phone poll every x seconds to check if the new photo is available).
so, for my task it’s enough to open a connection manually - a plus would be if it’s possible to automatically reconnect if the connection gets lost.
Yeah, I think that’s as easy as opening a Serial port using ofSerial, if you set it up correctly in your OS. I was thinking you wanted to discover and pair with devices automatically, sorry for the confusion. Your phone will probably have a baud rate that it wants to communicate at, so you just need to open a serial port at that rate.