domotics-core 0.1.10 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/domotics-core.gemspec +1 -0
- data/lib/domotics/core.rb +2 -0
- data/lib/domotics/core/helper/helper.rb +3 -3
- data/lib/domotics/core/server.rb +1 -1
- data/lib/domotics/core/setup.rb +1 -3
- data/lib/domotics/core/version.rb +2 -1
- data/lib/domotics/core/ws_server.rb +21 -0
- data/lib/domotics/file_camera/camera_element.rb +4 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a8ed63671e10315d7088954915555a65e06f584
|
4
|
+
data.tar.gz: 0236feacef77fb06929960aef64ffe8ad76f420d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2bba5ade068a12ef7dab4397f98179034629fbd4f4f6941a9855ccd7ccca3d7b34ae9be38ea7d19010a1a6048b0308625a5ab9531e860d3085a1672357c191f
|
7
|
+
data.tar.gz: e803b482603d93d6b0a37f410165f6dbd36ba241d980c0dc9588cc70a2b52c14c64b236db118a0b7ed643c63bf7f5af6f462a5f4ef1789bb6621e8fd7d9ef032
|
data/domotics-core.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_runtime_dependency "bson_ext"
|
26
26
|
spec.add_runtime_dependency "rack"
|
27
27
|
spec.add_runtime_dependency "rb-inotify"
|
28
|
+
spec.add_runtime_dependency "em-websocket"
|
28
29
|
|
29
30
|
spec.add_development_dependency "bundler"
|
30
31
|
spec.add_development_dependency "rake"
|
data/lib/domotics/core.rb
CHANGED
@@ -6,9 +6,9 @@ Thread.class_eval do
|
|
6
6
|
begin
|
7
7
|
block.call
|
8
8
|
rescue Exception => e
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Domotics::Core::Setup.logger.error { e.message }
|
10
|
+
Domotics::Core::Setup.logger.debug { e }
|
11
|
+
nil
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
data/lib/domotics/core/server.rb
CHANGED
data/lib/domotics/core/setup.rb
CHANGED
@@ -4,15 +4,13 @@ module Domotics::Core
|
|
4
4
|
class Setup < BasicObject
|
5
5
|
@@logger = ::Logger.new(::STDERR)
|
6
6
|
@@logger.level = ::Logger::FATAL
|
7
|
-
$logger = @@logger
|
8
7
|
def self.logger
|
9
8
|
@@logger
|
10
9
|
end
|
11
10
|
def self.logger=(logger)
|
12
11
|
@@logger = logger
|
13
|
-
$logger = @@logger
|
14
12
|
end
|
15
|
-
|
13
|
+
|
16
14
|
def initialize(conf)
|
17
15
|
@current_room = {}
|
18
16
|
@current_device = {}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Domotics::Core
|
2
|
+
class WsServer
|
3
|
+
def initialize(args = {})
|
4
|
+
@args = args
|
5
|
+
@channel = EM::Channel.new
|
6
|
+
end
|
7
|
+
def run
|
8
|
+
EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 8080) do |ws|
|
9
|
+
ws.onopen do
|
10
|
+
sid = @channel.subscribe { |msg| ws.send msg }
|
11
|
+
ws.onmessage do |msg|
|
12
|
+
|
13
|
+
end
|
14
|
+
ws.onclose do
|
15
|
+
@channel.unsubscribe(sid)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: domotics-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- goredar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: domotics-arduino
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: em-websocket
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: bundler
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -197,6 +211,7 @@ files:
|
|
197
211
|
- lib/domotics/core/server.rb
|
198
212
|
- lib/domotics/core/setup.rb
|
199
213
|
- lib/domotics/core/version.rb
|
214
|
+
- lib/domotics/core/ws_server.rb
|
200
215
|
- lib/domotics/file_camera/camera_element.rb
|
201
216
|
- lib/domotics/file_camera/digital_sensor.rb
|
202
217
|
- test/config.test.rb
|