# Bluetooth on OSX

**URL:** <https://www.ruby-forum.com/t/bluetooth-on-osx/70999>\
**Category:** Ruby\
**Created:** [February 20, 2006, 9:44pm UTC](https://www.ruby-forum.com/t/bluetooth-on-osx/70999 "2006-02-20T21:44:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 20, 2006, 9:44pm UTC](https://www.ruby-forum.com/t/bluetooth-on-osx/70999/1 "2006-02-20T21:44:52Z")

</div>

Hi,  
I’m trying to connect, over bluetooth, to a mobile device and send a  
picure.  
That’s my code:

require ‘osx/cocoa’

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

OSX.ns\_import :IOBluetoothDeviceSelectorController

bluedevices = OSX::IOBluetoothDeviceSelectorController.deviceSelector  
bluedevices.runModal;  
result = bluedevices.getResults;

bluetoothDevice = result.objectAtIndex(0);

OSX::NSBundle.bundleWithPath("/System/Library/Frameworks/IOBluetooth.framework").load;  
OSX.ns\_import :IOBluetoothOBEXSession;  
obexSession =  
OSX::IOBluetoothOBEXSession.withDevice\_channelID(bluetoothDevice, 9);

OSX.ns\_import :OBEXFileTransferServices;  
service = OSX::OBEXFileTransferServices.withOBEXSession(obexSession);

connectResult = service.connectToFTPService;  
puts connectResult;  
sleep 3;  
sendResult=service.sendFile("/Users/davide/myPicture.jpeg");  
puts sendResult;  
sleep 3;  
service.disconnect;

I know the channel id for ftp on my device is 9, puts connectResult  
displays 0, but puts sendResult shows -21875 (i.e busy) and of course,  
no picture is sent to the device.  
Do you understand this behavior?  
TIA  
Davide

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 21, 2006, 9:31pm UTC](https://www.ruby-forum.com/t/bluetooth-on-osx/70999/2 "2006-02-21T21:31:35Z")

</div>

Any hints?  
Davide
