File: ruby_example.rb

package info (click to toggle)
obexftp 0.24.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 792 kB
  • sloc: ansic: 7,735; ruby: 229; sh: 89; perl: 43; makefile: 39; python: 16
file content (23 lines) | stat: -rwxr-xr-x 437 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env ruby

require 'obexftp'

intfs = Obexftp.discover(Obexftp::USB)
intfs.each { |i| puts i }

# - or -

obex = Obexftp::Client.new(Obexftp::BLUETOOTH)
intfs = obex.discover
intfs.each { |i| puts i }

# - then -

dev = intfs.first
channel = Obexftp.browsebt(dev, 0) # default is ftp

obex = Obexftp::Client.new(Obexftp::BLUETOOTH) # or reuse the above
puts obex.connect(dev, channel)
puts obex.list('/')
puts obex.disconnect