Bluetooth

I need a way (simple, easy, and MAS acceptable) where I can have a XOJO desktop app recieve character stream via bluetooth.
and another desktop app that would send a stream

This is NOT highspeed data, think remote keyboard, with the data being consumed only by the recieving XOJO app. Single characters, or at most a packet of 10 or 20 char

Does anyone have a simple example of sending/recivening characters on two desktop machines? At some point, the sender might become an iOS device, but not for now

when a bluetooth device is paired, it appears as a simple serial port on the mac.

I understand that… what I’m looking for is example code that defines the port, pushes characters out etc…handshaking (if possible) etc.

I doubt it is like the olden hardwired days when OUT 251,“A” worked

For those interested… for iOS devices you use the MultipeerConnectivity framework

here is a SWIFT implementation

http://www.ralfebert.de/tutorials/ios-swift-multipeer-connectivity/

I have used this to have the iOS Simulator, my iPad, my iPod Touch and my wife’s iPhone6+ all talking to each other at the same time. So if someone wants to try and tackle a translation to XOJO… in the meantime I’m going to think up a multi-player game that can take advantage of this :smiley:

I tried to implement Multipeer Connectivity in declares but the problem is it is all asynchronous which doesn’t play nice with Xojo. We need to be able to dispatch shared method calls to the main thread to make this more likely because currently the work involved is huge compared to the demand and rewards. I’d like to implement it but until I have a need it’s unlikely I’ll spend much more time with it.

Unless u use a device with a driver which looks like rs232 comms, u maybe looking at MBS or declares. That’s my guess. That’s the way it works in Windows anyways.

Why not simply treat the bluetooth port like any other network port and use UDP packets. My desktop and web apps, utilize a UDP protocol I developed where changes on one app on the network are then broadcast out over UDP. Any other devices listening on the UDP Group IP that I have set up will then receive the data and update their UI appropriately. It works quite well and I can have 10 different instances of my desktop, web app or both all running on a LAN and they are all kept in sync.

Utilize what we have available - the code to take advantage of a pair BT port is already in existence in Xojo. Why re-invent the wheel.

Now, iOS can’t utilize this until they implement a UDP socket for iOS which I hope will be soon.

as I mentioned above… I have everything working just fine… thanks