tinderfridge 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1c28bf9d30fc0a07640bc0455e0c79625d9c83891eff91d8e6e4227780c57d3
4
- data.tar.gz: cb7039e16d274378b77af9c065e74ff0ad2ebd07450df034893d04144c5b5302
3
+ metadata.gz: 11aec071db2201e67dee0935c5a37ba2f801d2337cf0dc938ea465a9c0435bd3
4
+ data.tar.gz: ad2faa18ff3320c9320ded930b47f54c38e9471eba0bb52e2aa23cb48da3d108
5
5
  SHA512:
6
- metadata.gz: 3311ac8e16a9233ae652ae8caf50aca8ebe6fa48ba8f0079764da55a8234542d57044ab52c2d7a6358fe22fb57e771c4cef8777e772dff3ad78da1e0e86ba989
7
- data.tar.gz: 466bc1054d70689af056866a5d784050d6731d71fc711937a59e8a053bc7f17335eee594034f241282f918d773237d401486f62cef209d173e37eb95b559e105
6
+ metadata.gz: 440adf1b54a1787963688f4392fe686e07b898eae1361d3f245526a244f6e677b5a29a7cd84f2f3aa0221ef4300372dcbae18b55200cef2b96d6fa7206a0c7d0
7
+ data.tar.gz: 8204e15a1106392bbde997f2e65704b2cfd176c4e18066685f26e8a50a6cd62e3002b10e8fd6224f16540d946c94c66f66e96f6941b90c7255beec4e4c545a60
@@ -15,6 +15,7 @@ module Tinkerforge
15
15
  # With help from:
16
16
  # - https://stackoverflow.com/questions/2393697
17
17
  def descendants
18
+ # NOTE: Ruby 3.1 has Class#subclasses
18
19
  ObjectSpace.each_object(Class).select { |klass| klass < self }
19
20
  end
20
21
 
@@ -4,7 +4,7 @@
4
4
  35,
5
5
  12
6
6
  ],
7
- "weight": 20,
7
+ "weight": 16,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/GPS_V2.html",
9
9
  "versions_identifier": "bricklets:gps_v2",
10
10
  "released": "2017-05-11"
@@ -49,7 +49,7 @@ module Tinkerforge
49
49
  private
50
50
 
51
51
  def _view_21x8
52
- "GPS #{uid_string.rjust 8}\n\n" +
52
+ "GPSv2 #{uid_string.rjust 8}\n\n" +
53
53
  ((c = coordinates) ? (" Lat %10.5f\n Lon %10.5f" % c) : ' no fix')
54
54
  end
55
55
 
@@ -1,4 +1,11 @@
1
1
  {
2
+ "dimensions": [
3
+ 40,
4
+ 40,
5
+ 12
6
+ ],
7
+ "weight": 12,
2
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/GPS_V3.html",
9
+ "versions_identifier": "bricklets:gps_v3",
3
10
  "released": "2022-05-09"
4
11
  }
@@ -0,0 +1,58 @@
1
+ module Tinkerforge
2
+
3
+ class BrickletGPSV3
4
+
5
+ # Returns the device's state.
6
+ def state
7
+ super.merge(
8
+ 'fix_led_config' => get_fix_led_config,
9
+ 'fix' => fix?,
10
+ )
11
+ end
12
+
13
+ # Returns true if a fix is available.
14
+ def fix?
15
+ get_status[0]
16
+ end
17
+
18
+ # Returns latitude and longitude as reported by the GPS Bricklet.
19
+ #
20
+ # Nil when there is no fix (position not determined).
21
+ def coordinates
22
+ if fix?
23
+ c = get_coordinates
24
+ [
25
+ c[0] / (c[1] == 'N' ? 1000000.0 : -1000000.0),
26
+ c[2] / (c[3] == 'E' ? 1000000.0 : -1000000.0)
27
+ ]
28
+ else
29
+ nil
30
+ end
31
+ end
32
+
33
+ # Returns a Time object representing the time as reported by the GPS Bricklet.
34
+ def time
35
+ # FIXME: This will not work after 31-Dec-2099.
36
+ dt = get_date_time.map &:to_s
37
+ dt = dt[0].rjust(6,'0').unpack('a2a2a2').reverse + dt[1].rjust(9,'0').concat('000').unpack('a2a2a2a6')
38
+ dt[0].prepend '20'
39
+ Time.gm *dt.map(&:to_i)
40
+ end
41
+
42
+ # Returns a URL for viewing the current coordinates on OpenStreetMap.
43
+ def openstreetmap_marker_url(zoom=12)
44
+ if c = coordinates
45
+ "https://www.openstreetmap.org/?mlat=%f&mlon=%f&zoom=%d" % [c, zoom].flatten
46
+ end
47
+ end
48
+
49
+ private
50
+
51
+ def _view_21x8
52
+ "GPSv3 #{uid_string.rjust 8}\n\n" +
53
+ ((c = coordinates) ? (" Lat %10.5f\n Lon %10.5f" % c) : ' no fix')
54
+ end
55
+
56
+ end
57
+
58
+ end
@@ -2,6 +2,13 @@ module Tinkerforge
2
2
 
3
3
  class BrickletOutdoorWeather
4
4
 
5
+ # Returns the device's state.
6
+ def state
7
+ super.merge(
8
+ 'sensor_data' => sensors,
9
+ )
10
+ end
11
+
5
12
  # Returns the last measured data for all sensors.
6
13
  #
7
14
  # The result is a Hash, with sensor identifiers as the keys. Values per sensor are:
@@ -0,0 +1,14 @@
1
+ module Tinkerforge
2
+
3
+ class BrickletPiezoSpeakerV2
4
+
5
+ # Beeps briefly.
6
+ #
7
+ # Volume (0..10) defaults to 0.
8
+ def blip(volume=0)
9
+ set_beep(600, volume, 80)
10
+ end
11
+
12
+ end
13
+
14
+ end
@@ -3,7 +3,7 @@ require 'tinkerforge/version'
3
3
  module Tinkerforge
4
4
 
5
5
  # Tinderfridge version.
6
- TINDERFRIDGE_VERSION = '0.11.0'
6
+ TINDERFRIDGE_VERSION = '0.12.0'
7
7
 
8
8
  # About Tinkerforge & Tinderfridge.
9
9
  def self.about
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinderfridge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lllist.eu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-24 00:00:00.000000000 Z
11
+ date: 2022-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tinkerforge
@@ -77,6 +77,7 @@ files:
77
77
  - lib/tinderfridge/devices/bricklet_gps_v2/bricklet_gps_v2.json
78
78
  - lib/tinderfridge/devices/bricklet_gps_v2/bricklet_gps_v2.rb
79
79
  - lib/tinderfridge/devices/bricklet_gps_v3/bricklet_gps_v3.json
80
+ - lib/tinderfridge/devices/bricklet_gps_v3/bricklet_gps_v3.rb
80
81
  - lib/tinderfridge/devices/bricklet_hall_effect_v2/bricklet_hall_effect_v2.json
81
82
  - lib/tinderfridge/devices/bricklet_hall_effect_v2/bricklet_hall_effect_v2.rb
82
83
  - lib/tinderfridge/devices/bricklet_humidity_v2/bricklet_humidity_v2.json
@@ -121,6 +122,7 @@ files:
121
122
  - lib/tinderfridge/devices/bricklet_particulate_matter/bricklet_particulate_matter.json
122
123
  - lib/tinderfridge/devices/bricklet_performance_dc/bricklet_performance_dc.json
123
124
  - lib/tinderfridge/devices/bricklet_piezo_speaker_v2/bricklet_piezo_speaker_v2.json
125
+ - lib/tinderfridge/devices/bricklet_piezo_speaker_v2/bricklet_piezo_speaker_v2.rb
124
126
  - lib/tinderfridge/devices/bricklet_ptc_v2/bricklet_ptc_v2.json
125
127
  - lib/tinderfridge/devices/bricklet_real_time_clock_v2/bricklet_real_time_clock_v2.json
126
128
  - lib/tinderfridge/devices/bricklet_remote_switch_v2/bricklet_remote_switch_v2.json