gotempr 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +10 -0
- data/README.md +22 -0
- data/Rakefile +14 -0
- data/gotempr.gemspec +30 -0
- data/lib/exception.rb +3 -0
- data/lib/gotempr.rb +36 -0
- data/lib/gotempr/version.rb +5 -0
- metadata +78 -0
data/Gemfile
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# GoTempR
|
|
2
|
+
|
|
3
|
+
GoTempR is a simple utility gem for retrieving the current
|
|
4
|
+
temperature from a Vernier Go!Temp USB thermometer.
|
|
5
|
+
|
|
6
|
+
# Requirements
|
|
7
|
+
|
|
8
|
+
The current edition requires the ldusb driver and has only
|
|
9
|
+
been tested on Ubuntu Linux and MacOS X.
|
|
10
|
+
|
|
11
|
+
# Using
|
|
12
|
+
|
|
13
|
+
require 'gotempr'
|
|
14
|
+
GoTempR::Fetcher.new("/dev/ldusb0").fahrenheit
|
|
15
|
+
dev = GoTempR::Fetcher.new("/dev/ldusb0")
|
|
16
|
+
dev.celcius
|
|
17
|
+
|
|
18
|
+
# License
|
|
19
|
+
|
|
20
|
+
MIT (See included MIT-LICENSE)
|
|
21
|
+
|
|
22
|
+
Copyright (c) 2009-2010 Dozer Software LLC.
|
data/Rakefile
ADDED
data/gotempr.gemspec
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
|
3
|
+
require "gotempr/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |s|
|
|
6
|
+
s.name = "gotempr"
|
|
7
|
+
s.version = GoTempR::Version::STRING
|
|
8
|
+
s.platform = Gem::Platform::RUBY
|
|
9
|
+
s.authors = ["Kit Plummer"]
|
|
10
|
+
s.email = "kitplummer@dozersoftware.com"
|
|
11
|
+
s.homepage = "http://github.com/dozersoftware/gotempr"
|
|
12
|
+
s.summary = "gotempr-#{GoTempR::Version::STRING}"
|
|
13
|
+
s.description = "GoTemp! interface library for simple Ruby use."
|
|
14
|
+
|
|
15
|
+
s.rubygems_version = "1.3.7"
|
|
16
|
+
|
|
17
|
+
s.extra_rdoc_files = [ "README.md" ]
|
|
18
|
+
s.has_rdoc = true
|
|
19
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
|
20
|
+
s.require_path = "lib"
|
|
21
|
+
s.files = ["Rakefile", "gotempr.gemspec", "Gemfile", "README.md"] +
|
|
22
|
+
Dir.glob("lib/**/*")
|
|
23
|
+
|
|
24
|
+
s.post_install_message = %Q{**************************************************
|
|
25
|
+
Thank you for installing #{s.summary}
|
|
26
|
+
Copyright 2010 - Dozer Software LLC.
|
|
27
|
+
**************************************************
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
end
|
data/lib/exception.rb
ADDED
data/lib/gotempr.rb
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require "exception"
|
|
2
|
+
|
|
3
|
+
module GoTempR
|
|
4
|
+
class Fetcher
|
|
5
|
+
|
|
6
|
+
def initialize(device)
|
|
7
|
+
begin
|
|
8
|
+
@f = File.new(device)
|
|
9
|
+
rescue StandardError => e
|
|
10
|
+
raise GoTempRException, 'Device not found.'
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def celcius
|
|
15
|
+
self.fetch
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def fahrenheit
|
|
20
|
+
((self.celcius * 1.8) + 32)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def fetch
|
|
24
|
+
packet = @f.read(8)
|
|
25
|
+
@f.close
|
|
26
|
+
parsed_packet = packet.unpack('ccsss')
|
|
27
|
+
parsed_packet[2]/128
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: gotempr
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 29
|
|
5
|
+
prerelease: false
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 0
|
|
9
|
+
- 1
|
|
10
|
+
version: 0.0.1
|
|
11
|
+
platform: ruby
|
|
12
|
+
authors:
|
|
13
|
+
- Kit Plummer
|
|
14
|
+
autorequire:
|
|
15
|
+
bindir: bin
|
|
16
|
+
cert_chain: []
|
|
17
|
+
|
|
18
|
+
date: 2010-09-23 00:00:00 -07:00
|
|
19
|
+
default_executable:
|
|
20
|
+
dependencies: []
|
|
21
|
+
|
|
22
|
+
description: GoTemp! interface library for simple Ruby use.
|
|
23
|
+
email: kitplummer@dozersoftware.com
|
|
24
|
+
executables: []
|
|
25
|
+
|
|
26
|
+
extensions: []
|
|
27
|
+
|
|
28
|
+
extra_rdoc_files:
|
|
29
|
+
- README.md
|
|
30
|
+
files:
|
|
31
|
+
- Rakefile
|
|
32
|
+
- gotempr.gemspec
|
|
33
|
+
- Gemfile
|
|
34
|
+
- README.md
|
|
35
|
+
- lib/exception.rb
|
|
36
|
+
- lib/gotempr.rb
|
|
37
|
+
- lib/gotempr/version.rb
|
|
38
|
+
has_rdoc: true
|
|
39
|
+
homepage: http://github.com/dozersoftware/gotempr
|
|
40
|
+
licenses: []
|
|
41
|
+
|
|
42
|
+
post_install_message: |
|
|
43
|
+
**************************************************
|
|
44
|
+
Thank you for installing gotempr-0.0.1
|
|
45
|
+
Copyright 2010 - Dozer Software LLC.
|
|
46
|
+
**************************************************
|
|
47
|
+
|
|
48
|
+
rdoc_options:
|
|
49
|
+
- --charset=UTF-8
|
|
50
|
+
require_paths:
|
|
51
|
+
- lib
|
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
|
+
none: false
|
|
54
|
+
requirements:
|
|
55
|
+
- - ">="
|
|
56
|
+
- !ruby/object:Gem::Version
|
|
57
|
+
hash: 3
|
|
58
|
+
segments:
|
|
59
|
+
- 0
|
|
60
|
+
version: "0"
|
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
|
+
none: false
|
|
63
|
+
requirements:
|
|
64
|
+
- - ">="
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
hash: 3
|
|
67
|
+
segments:
|
|
68
|
+
- 0
|
|
69
|
+
version: "0"
|
|
70
|
+
requirements: []
|
|
71
|
+
|
|
72
|
+
rubyforge_project:
|
|
73
|
+
rubygems_version: 1.3.7
|
|
74
|
+
signing_key:
|
|
75
|
+
specification_version: 3
|
|
76
|
+
summary: gotempr-0.0.1
|
|
77
|
+
test_files: []
|
|
78
|
+
|