openplacos 0.0.4 → 0.0.5
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/VERSION +1 -1
- data/lib/openplacos/libclient.rb +3 -0
- data/lib/openplacos/libdriver.rb +5 -0
- data/lib/openplacos/libplugin.rb +22 -13
- data/lib/openplacos.rb +2 -2
- metadata +6 -6
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/lib/openplacos/libclient.rb
CHANGED
@@ -14,6 +14,9 @@
|
|
14
14
|
# along with Openplacos. If not, see <http://www.gnu.org/licenses/>.
|
15
15
|
|
16
16
|
|
17
|
+
ENV["DBUS_THREADED_ACCESS"] = "1" #activate threaded dbus
|
18
|
+
require 'dbus-openplacos'
|
19
|
+
|
17
20
|
module Openplacos
|
18
21
|
class Client # client for openplacos server
|
19
22
|
attr_accessor :config, :objects, :service, :sensors, :actuators, :rooms, :reguls, :initial_room
|
data/lib/openplacos/libdriver.rb
CHANGED
@@ -13,6 +13,11 @@
|
|
13
13
|
# You should have received a copy of the GNU General Public License
|
14
14
|
# along with Openplacos. If not, see <http://www.gnu.org/licenses/>.
|
15
15
|
#
|
16
|
+
|
17
|
+
ENV["DBUS_THREADED_ACCESS"] = "1" #activate threaded dbus
|
18
|
+
require 'dbus-openplacos'
|
19
|
+
|
20
|
+
|
16
21
|
module Openplacos
|
17
22
|
module Driver
|
18
23
|
|
data/lib/openplacos/libplugin.rb
CHANGED
@@ -14,13 +14,16 @@
|
|
14
14
|
# along with Openplacos. If not, see <http://www.gnu.org/licenses/>.
|
15
15
|
|
16
16
|
|
17
|
+
ENV["DBUS_THREADED_ACCESS"] = "1" #activate threaded dbus
|
18
|
+
require 'dbus-openplacos'
|
19
|
+
|
17
20
|
module Openplacos
|
18
21
|
|
19
22
|
class Plugin
|
20
|
-
attr_reader :
|
21
|
-
def initialize(
|
23
|
+
attr_reader :path, :opos ,:main ,:config
|
24
|
+
def initialize(path_)
|
22
25
|
@server_ready_queue = Queue.new
|
23
|
-
@
|
26
|
+
@path = File.expand_path(path_)
|
24
27
|
#DBus
|
25
28
|
if(ENV['DEBUG_OPOS'] ) ## Stand for debug
|
26
29
|
@clientbus = DBus::SessionBus.instance
|
@@ -33,39 +36,45 @@ module Openplacos
|
|
33
36
|
@opos = server.object("/plugins")
|
34
37
|
@opos.introspect
|
35
38
|
@opos.default_iface = "org.openplacos.plugins"
|
36
|
-
|
37
|
-
@
|
38
|
-
|
39
|
+
|
40
|
+
@id = @opos.register_plug(@path)[0]
|
41
|
+
puts "My plug ID: "+ @id.to_s
|
42
|
+
@config = @opos.getConfig(@id)[0]
|
43
|
+
@name = @config["name"]
|
44
|
+
|
39
45
|
@opos.on_signal("quit") do
|
40
46
|
self.quit
|
41
47
|
end
|
42
|
-
|
48
|
+
|
43
49
|
@opos.on_signal("ready") do
|
44
50
|
@server_ready_queue.push "Go"
|
45
51
|
end
|
46
|
-
|
52
|
+
|
47
53
|
end
|
48
54
|
|
49
55
|
def run
|
50
56
|
@main = DBus::Main.new
|
51
57
|
@main << @clientbus
|
52
|
-
@opos.plugin_is_ready(@name)
|
58
|
+
@opos.plugin_is_ready(@name, @id)
|
53
59
|
@main.run
|
54
60
|
end
|
55
61
|
|
56
62
|
def quit
|
57
63
|
@main.quit
|
58
|
-
|
64
|
+
puts "Quitting"
|
65
|
+
Process.exit!
|
59
66
|
end
|
60
|
-
|
67
|
+
|
61
68
|
def nonblock_run
|
62
69
|
@mainthread = Thread.new{
|
63
70
|
@main = DBus::Main.new
|
64
71
|
@main << @clientbus
|
65
|
-
@opos.plugin_is_ready(@name)
|
72
|
+
@opos.plugin_is_ready(@name, @id)
|
66
73
|
@main.run
|
67
74
|
}
|
68
|
-
@
|
75
|
+
if not @opos.is_server_ready[0]
|
76
|
+
@server_ready_queue.pop
|
77
|
+
end
|
69
78
|
end
|
70
79
|
|
71
80
|
end
|
data/lib/openplacos.rb
CHANGED
@@ -13,8 +13,8 @@
|
|
13
13
|
# You should have received a copy of the GNU General Public License
|
14
14
|
# along with Openplacos. If not, see <http://www.gnu.org/licenses/>.
|
15
15
|
#
|
16
|
-
|
17
|
-
|
16
|
+
|
17
|
+
# Please keep as it, each file should be included separetly
|
18
18
|
require 'openplacos/libplugin'
|
19
19
|
require 'openplacos/libclient'
|
20
20
|
require 'openplacos/libdriver'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openplacos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 21
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Openplacos Team
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-03-24 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements: []
|
80
80
|
|
81
81
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.3
|
82
|
+
rubygems_version: 1.5.3
|
83
83
|
signing_key:
|
84
84
|
specification_version: 3
|
85
85
|
summary: "Openplacos libraries : Libclient, LibPlugin, LibDriver"
|