Bluetooth on OSX


#1

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.


#2

On 11/29/05, Peter B. removed_email_address@domain.invalid 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


#3

In article
removed_email_address@domain.invalid,
Peter B. removed_email_address@domain.invalid 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


#4

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.


#5

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