Forum: Ruby Bluetooth on OSX

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cfd2734f1de31db479ec2a8a4ecbd649?d=identicon&s=25 rictic (Guest)
on 2005-11-29 06:54
(Received via mailing list)
I'm looking to automate transferring pics from a cellphone via bluetooth
on
OS X.  Any suggestions on where to start with this project?  Ruby is the
natural language for this, not just because I love it so dearly, but
because
I hope to integrate this with a Rails photo gallery app.

My google-fu is failing me on relevant libraries, ruby or otherwise.
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 gregory.t.brown (Guest)
on 2005-11-29 07:23
(Received via mailing list)
On 11/29/05, Peter Burns <rictic@gmail.com> wrote:
> I'm looking to automate transferring pics from a cellphone via bluetooth on
> OS X.  Any suggestions on where to start with this project?  Ruby is the
> natural language for this, not just because I love it so dearly, but because
> I hope to integrate this with a Rails photo gallery app.
>
> My google-fu is failing me on relevant libraries, ruby or otherwise.

I have no experience in this area at all, but i remember seeing a
cellphone bluetooth XMMS remote control program on RAA, so I looked it
up for you:

http://linuxbrit.co.uk/bluexmms/

You might be able to tear the protocol stuff out of there and modify it.
HTH
33eda546f35b0667856505f21f940529?d=identicon&s=25 reinder (Guest)
on 2005-11-29 09:28
(Received via mailing list)
In article
<2f9bef730511282150p247fc372v78ce27495414704e@mail.gmail.com>,
 Peter Burns <rictic@gmail.com> wrote:

> I'm looking to automate transferring pics from a cellphone via bluetooth on
> OS X.  Any suggestions on where to start with this project?  Ruby is the
> natural language for this, not just because I love it so dearly, but because
> I hope to integrate this with a Rails photo gallery app.
>
> My google-fu is failing me on relevant libraries, ruby or otherwise.

gnokii (www.gnokii.org) works for me from the command line. A simple
ryby script around it is:

    info = `gnokii --monitor once`

    numUnreadSMSes = 0
    numSMSes = 0

    info.scan( /^SMS Messages: Unread ([0-9]+), Number ([0-9]+)/) {
|x,y|
        numUnreadSMSes = x
        numSMSes = y
    }

    puts numUnreadSMSes
    puts numSMSes

Aside: I may not be possible at all to transfer pictures from your phone
over Bluetooth. Mobile operators would rather have you use MMS to mail
them to yourself.

Reinder
3d0713626ba9abdd25ccb24014de54d2?d=identicon&s=25 i.script (Guest)
on 2005-11-29 11:34
(Received via mailing list)
A simple way to do it is using RubyCocoa. RubyCocoa offers two
solutions. Either through the usage of its AppleScript bridge. With
embedded AppleScript it becomes possible to control the application
"Bluetooth File Exchanger" inside the "Utilities" folder.

..or you use native cocoa classes inside your Ruby code. This approach
requires some knowledge about OBEX. Have a look into the application
OBEXSample inside /Developer/Examples/Bluetooth !

Finally it will look similar to this

-----------------------------------------------------
require 'osx/cocoa'

OSX::NSBundle.bundleWithPath("/System/Library/Frameworks/IOBluetoothUI.framework").load
OSX.ns_import :IOBluetoothDeviceSelectorController



bluedevices = OSX::IOBluetoothDeviceSelectorController.deviceSelector
bluedevices.runModal
blue_data = bluedevices.getResults
puts blue_data
-----------------------------------------------------

- Tom
Cfd2734f1de31db479ec2a8a4ecbd649?d=identicon&s=25 rictic (Guest)
on 2005-11-29 12:34
(Received via mailing list)
Thanks for the two wonderful replies, this just turned a wishful
thinking project into something that I could have working in a couple
hours.

I can use the Bluetooth File Exchange app to grab pictures off of my
mobile (that was definitely something I was looking for in a phone; I
wasn't going to pay a dollar a piece for the privilege of emailing
myself my own pictures), so I'm confident that if I can't wrangle
gnokil to access the pics, I'll be able to by talking to the Bluetooth
File Exchange app.

I'll post the code here once I get it working and perhaps it will help
someone else along.
This topic is locked and can not be replied to.