openplacos 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -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
@@ -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
 
@@ -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 :name, :opos ,:main ,:config
21
- def initialize(name_)
23
+ attr_reader :path, :opos ,:main ,:config
24
+ def initialize(path_)
22
25
  @server_ready_queue = Queue.new
23
- @name = name_
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
- @config = @opos.getConfig[0]
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
- Process.exit(0)
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
- @server_ready_queue.pop
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
- ENV["DBUS_THREADED_ACCESS"] = "1" #activate threaded dbus
17
- require 'dbus-openplacos'
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: 23
5
- prerelease: false
4
+ hash: 21
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
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-02-26 00:00:00 +01:00
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.7
82
+ rubygems_version: 1.5.3
83
83
  signing_key:
84
84
  specification_version: 3
85
85
  summary: "Openplacos libraries : Libclient, LibPlugin, LibDriver"