blue_cr
Version, currently 0.0.11 version
- 0.0.1latestMar 5, 2018
github.com/NeuraLegion/blue_cr
BlueZ bluetooth binding in Crystal
13 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
blue_cr:
github: NeuraLegion/blue_cr
version: ~> 0.0.1Then run:
shards installshard.yml
- Crystal
0.24.0+58- License
- MIT
- Author
- bararchy <bar.hofesh@safe-t.com>
Dependencies
Runtime Dependencies
- dbus*github: oprypin/crystal-dbus
README
# blue_cr
Bluetooth interface using crystal and bluez
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
blue_cr:
github: NeuraLegion/blue_cr
```
## Usage
```crystal
require "blue_cr"
# List all adaptors in the machine (hci*)
adaptors = BlueCr.list_adaptors
# Get first avilable adaptor and get back the adaptor object
adaptor = BlueCr::Adaptor.new(adaptors.first)
# Start discovery
adaptor.start_discovery
sleep 5
# Get back array of all device address
devices = adaptor.list_devices
adaptor.stop_discovery
# For each device found, get some info
devices.each do |name|
device = adaptor.get_device(name)
if device
begin
next unless device.alive?
puts device.connect
sleep 5
device.refresh
puts "#######################"
puts "Device: #{device.name}"
puts "Address: #{device.address}"
puts "UUIDs: #{device.uuids}"
puts "Dump: #{device.all_properties}"
device.list_services
device.services.each do |uuid, service|
puts "Service: #{uuid}: #{service.service_type}"
service.list_characteristics
service.characteristics.each do |uuid, char|
puts " Characteristic: #{uuid}: #{char.characteristic_type}"
puts " Value: #{char.read_value}"
end
end
puts "#######################\n"
puts device.disconnect
rescue Exception
next
end
end
end
end
end
```
## Development
- [x] scan for devices and get back array of addresses
- [x] connect to a remote device
- [x] send arbitery commands to remote device
- Additional features should be asked for via Issues.
## Contributing
1. Fork it ( https://github.com/NeuraLegion/blue_cr/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request
## Contributors
- [bararchy](https://github.com/bararchy) - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.0.1- Tagged
- Mar 5, 2018
- Commit
b371cd23a051- Crystal
0.24.0+58- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/NeuraLegion/blue_cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 13, 2026
- Synced
- Aug 13, 2026
- Versions
- 1