fluent-plugin-arduino 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e9c3f9dfd19bb8e6fbf7046bf249eb658f5f2470
4
+ data.tar.gz: 1adfc4f39c27b33850cc85f8e0da9c5063c0457a
5
+ SHA512:
6
+ metadata.gz: 378253241dd7e06dba60bc3d5b82f9422990afc72d0b88f80b37ab4213ab89d8de58d227f88d6b4e4588deb23ac1b441835e4526c597b97cba1841937312c2e1
7
+ data.tar.gz: 4117e74b70eaebc912b842d795511daf77c2d655aba73c358fa321de7cb9f59b7df909cb2b5754ae41c3c6240f453bbd2ae93a0f4173bd0d6ef5b09ef3d6614d
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-arduino.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 futoase
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Fluent::Plugin::Arduino
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'fluent-plugin-arduino'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install fluent-plugin-arduino
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,16 @@
1
+ -
2
+ "0": "A"
3
+ "1": "B"
4
+ "2": "C"
5
+ "3": "D"
6
+ "4": "E"
7
+ "5": "F"
8
+ "6": "G"
9
+ "7": "H"
10
+ "8": "I"
11
+ "9": "J"
12
+ "10":"K"
13
+ "11":"L"
14
+ "12":"M"
15
+ "13":"N"
16
+
@@ -0,0 +1,45 @@
1
+ <source>
2
+ type forward
3
+ port 24224
4
+ </source>
5
+
6
+ <match arduino.test1.**>
7
+ type arduino
8
+ key name
9
+ value kaiki
10
+ pin 13
11
+ port /dev/cu.usbmodem1431
12
+ </match>
13
+
14
+ <match arduino.test2.**>
15
+ type arduino
16
+ key name
17
+ value senjogahara
18
+ pin 12
19
+ port /dev/cu.usbmodem1431
20
+ </match>
21
+
22
+ <match arduino.test3.**>
23
+ type arduino
24
+ key name
25
+ value araragi
26
+ pin 11
27
+ port /dev/cu.usbmodem1431
28
+ </match>
29
+
30
+ <match arduino.test4.**>
31
+ type arduino
32
+ key name
33
+ value sengoku
34
+ pin 10
35
+ port /dev/cu.usbmodem1431
36
+ </match>
37
+
38
+ <match arduino.test5.**>
39
+ type arduino
40
+ key name
41
+ value hanekawa
42
+ pin 9
43
+ port /dev/cu.usbmodem1431
44
+ </match>
45
+
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "fluent-plugin-arduino"
7
+ spec.version = "0.0.1"
8
+ spec.authors = ["futoase"]
9
+ spec.email = ["futoase@gmail.com"]
10
+ spec.description = %q{Arduino connect plugin.}
11
+ spec.summary = %q{fluent-plugin-arduino}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "rake"
22
+
23
+ spec.add_dependency "fluentd"
24
+ spec.add_dependency "serialport"
25
+ end
@@ -0,0 +1,71 @@
1
+
2
+ require "serialport"
3
+
4
+ module Fluent
5
+ class ArduinoOutput < Fluent::Output
6
+ Fluent::Plugin.register_output('arduino', self)
7
+
8
+ PIN_NUMBER = {
9
+ "0" => "A",
10
+ "1" => "B",
11
+ "2" => "C",
12
+ "3" => "D",
13
+ "4" => "E",
14
+ "5" => "F",
15
+ "6" => "G",
16
+ "7" => "H",
17
+ "8" => "I",
18
+ "9" => "J",
19
+ "10" => "K",
20
+ "11" => "L",
21
+ "12" => "M",
22
+ "13" => "N"
23
+ }
24
+
25
+ DATA_BITS = 8
26
+ STOP_BITS = 1
27
+ PARITY = SerialPort::NONE
28
+
29
+ config_param :device_type, :string, default: "led"
30
+ config_param :pin, :string, default: "13"
31
+ config_param :key, :string, default: nil
32
+ config_param :value, :string, default: nil
33
+
34
+ config_param :baud_rate, :string, default: 9600
35
+ config_param :port, :string, default: nil
36
+
37
+ def configure(conf)
38
+ super
39
+
40
+ if @device_type != "led"
41
+ raise Fluent::ConfigError, "this use type is led only"
42
+ end
43
+
44
+ @sw = true
45
+ @serial = SerialPort.new(@port, @baud_rate, DATA_BITS, STOP_BITS, PARITY)
46
+ end
47
+
48
+ def start
49
+ super
50
+ end
51
+
52
+ def shutdown
53
+ super
54
+ end
55
+
56
+ def emit(tag, es, chain)
57
+ es.each do |time, record|
58
+ v = record[@key].strip
59
+ if v == @value and @sw == true
60
+ @serial.write(PIN_NUMBER[@pin.to_s].downcase)
61
+ @sw = !@sw
62
+ elsif v == @value and @sw == false
63
+ @serial.write(PIN_NUMBER[@pin.to_s].upcase)
64
+ @sw = !@sw
65
+ end
66
+ end
67
+ chain.next
68
+ end
69
+
70
+ end
71
+ end
@@ -0,0 +1,24 @@
1
+ #define UPPER_CASE 65
2
+ #define LOWER_CASE 97
3
+
4
+ void setup() {
5
+ for(int i = 0; i <= 13; i++) {
6
+ pinMode(i, OUTPUT);
7
+ }
8
+ Serial.begin(9600);
9
+ Serial.print("\nSetup...");
10
+ }
11
+
12
+ void loop() {
13
+ if (Serial.available()) {
14
+ char c = Serial.read();
15
+ // LOW
16
+ if (int(c) < 97){
17
+ digitalWrite((int(c) - UPPER_CASE), LOW);
18
+ }
19
+ // HIGH
20
+ else {
21
+ digitalWrite((int(c) - LOWER_CASE), HIGH);
22
+ }
23
+ }
24
+ }
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-arduino
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - futoase
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: fluentd
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: serialport
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Arduino connect plugin.
70
+ email:
71
+ - futoase@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - conf/pin_number.yml
82
+ - example/fluent.conf
83
+ - fluent-plugin-arduino.gemspec
84
+ - lib/fluent/plugin/out_arduino.rb
85
+ - src/led.ino
86
+ homepage: ''
87
+ licenses:
88
+ - MIT
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.0.3
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: fluent-plugin-arduino
110
+ test_files: []