Bluetooth in Ruby (Mac/Cross Platform)
I'm trying to get a list of the bluetooth addresses (the MAC address-like hex digits unique to each bluetooth device) within range of the bluetooth device inside my mac in the ruby language.
I'm hoping to make my work publicly available, so it'd be nice if it was platform agnostic.
Googling only helps so much:
- hcitool etc aren't available on OS X: snippets.dzone.com/posts/show/5764
- Ruby_Bluetooth is nearly 4 years old, and I can't make it work!: rubyforge.org/projects/ruby-bluetooth/
- Herval is attempting to continue that project, but the git repo is only a day old开发者_如何学编程…
I don't need to create any services or interact with bluetooth in any extensive way, only list the device ids that are within range.
Does anyone have any other ideas? (Even for non ruby, platform specific hcitool equivalents?)
Have you thought about leveraging a Java Bluetooth API and using it from JRuby?
This might make it easier to create platform agnostic code.
For instance bluecove looks like it would cover all the major platforms.
You could go the non-platform specific route and use the native frameworks instead.
For example
- RubyCocoa for the bridge between Ruby and Objective-C
- OSX's native Bluetooth API Call out to this from Ruby using RubyCocoa
There are other options for other platforms, such as Ruby and Win32OLE/COM.
精彩评论