-
Notifications
You must be signed in to change notification settings - Fork 109
/
Rakefile
49 lines (44 loc) · 1.2 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$:.unshift(File.dirname(File.expand_path('../lib/blue_hydra.rb',__FILE__)))
require 'blue_hydra'
require 'pry'
desc "Print the version."
task "version" do
puts BlueHydra::VERSION
end
desc "Sync all records to pulse"
task "sync_all" do
BlueHydra::Device.all.each do |dev|
puts "Syncing #{dev.address}"
dev.sync_to_pulse(true)
end
end
desc "BlueHydra Console"
task "console" do
binding.pry
end
desc "Summarize Devices"
task "summary" do
BlueHydra::Device.all.each do |dev|
puts "Device -- #{dev.address}"
dev.attributes.each do |name, val|
next if [:address, :classic_rssi, :le_rssi].include?(name)
if %w{
classic_features le_features le_flags classic_channels
le_16_bit_service_uuids classic_16_bit_service_uuids
le_128_bit_service_uuids classic_128_bit_service_uuids classic_class
le_rssi classic_rssi primary_services
}.map(&:to_sym).include?(name)
unless val == '[]' || val == nil
puts " #{name}:"
JSON.parse(val).each do |v|
puts " #{v}"
end
end
else
unless val == nil
puts " #{name}: #{val}"
end
end
end
end
end