p1_meter_reader 0.1.0 → 0.1.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a153cd915a9a90ea647a8aa53080a6f2576cc1a9
|
4
|
+
data.tar.gz: 5805e34db9eddf3070f0f2762bd11a11c385a497
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b2ac2f42d78acfa7bdd292b9373f84ffbf4dac860be27f5fb587efa8784b98991f56ab7b190233e2a632e4bd7f28cb341bb7054d2a8c76060131d32abbe7038
|
7
|
+
data.tar.gz: 704671bcc2965fbb40cd9bfe229093de69e6aeafe064ce50ff0a7c66e6364ef1ec48c4800cf850c42a2adaab390041343bafe678b54d4de55661e4d451f30e13
|
@@ -1,9 +1,11 @@
|
|
1
|
+
require 'serialport'
|
2
|
+
|
1
3
|
module P1MeterReader
|
2
4
|
module DataParsing
|
3
5
|
class StreamSplitter
|
4
|
-
def initialize(
|
6
|
+
def initialize(message_start, input: serial_port)
|
5
7
|
@message_start = message_start
|
6
|
-
@stream =
|
8
|
+
@stream = input.each_line
|
7
9
|
end
|
8
10
|
|
9
11
|
def read
|
@@ -20,6 +22,17 @@ module P1MeterReader
|
|
20
22
|
return result if line.strip == "!"
|
21
23
|
end
|
22
24
|
end
|
25
|
+
|
26
|
+
private
|
27
|
+
def serial_port
|
28
|
+
serial_port = SerialPort.new("/dev/ttyUSB0", 9600)
|
29
|
+
serial_port.data_bits = 7
|
30
|
+
serial_port.stop_bits = 1
|
31
|
+
serial_port.parity = SerialPort::EVEN
|
32
|
+
|
33
|
+
serial_port
|
34
|
+
end
|
23
35
|
end
|
24
36
|
end
|
25
37
|
end
|
38
|
+
|
data/p1_meter_reader.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
|
-
spec.
|
26
|
+
spec.add_runtime_dependency "serialport", "1.3.1"
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler", "~> 1.8"
|
29
29
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: p1_meter_reader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lennaert Meijvogel
|
@@ -14,16 +14,16 @@ dependencies:
|
|
14
14
|
name: serialport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.3.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.3.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|