Bluetooth on OSX

V

varvello

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top