openplacos 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/openplacos.rb +1 -2
- data/lib/openplacos/libclient.rb +364 -127
- data/lib/openplacos/libcomponent.rb +550 -0
- data/lib/openplacos/template_client.rb +17 -0
- data/lib/openplacos/widget/Analog.rb +63 -0
- data/lib/openplacos/widget/Digital.rb +55 -0
- data/lib/openplacos/widget/modules.rb +19 -0
- data/openplacos.gemspec +5 -3
- metadata +75 -58
- data/lib/openplacos/libdriver.rb +0 -129
- data/lib/openplacos/libplugin.rb +0 -76
data/lib/openplacos/libplugin.rb
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
# This file is part of Openplacos.
|
2
|
-
#
|
3
|
-
# Openplacos is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# Openplacos is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with Openplacos. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
|
17
|
-
ENV["DBUS_THREADED_ACCESS"] = "1" #activate threaded dbus
|
18
|
-
require 'dbus-openplacos'
|
19
|
-
|
20
|
-
module Openplacos
|
21
|
-
|
22
|
-
class Plugin
|
23
|
-
attr_reader :opos ,:main ,:config
|
24
|
-
def initialize
|
25
|
-
@server_ready_queue = Queue.new
|
26
|
-
@id = nil
|
27
|
-
#DBus
|
28
|
-
if(ENV['DEBUG_OPOS'] ) ## Stand for debug
|
29
|
-
@clientbus = DBus::SessionBus.instance
|
30
|
-
else
|
31
|
-
@clientbus = DBus::SystemBus.instance
|
32
|
-
end
|
33
|
-
|
34
|
-
server = @clientbus.service("org.openplacos.server")
|
35
|
-
|
36
|
-
@opos = server.object("/plugins")
|
37
|
-
@opos.introspect
|
38
|
-
@opos.default_iface = "org.openplacos.plugins"
|
39
|
-
|
40
|
-
@opos.on_signal("quit") do
|
41
|
-
self.quit
|
42
|
-
end
|
43
|
-
|
44
|
-
@opos.on_signal("ready") do
|
45
|
-
@server_ready_queue.push "Go"
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
def run
|
51
|
-
@id = @opos.register
|
52
|
-
@main = DBus::Main.new
|
53
|
-
@main << @clientbus
|
54
|
-
@main.run
|
55
|
-
end
|
56
|
-
|
57
|
-
def quit
|
58
|
-
@main.quit
|
59
|
-
end
|
60
|
-
|
61
|
-
def nonblock_run
|
62
|
-
@id = @opos.register
|
63
|
-
@mainthread = Thread.new{
|
64
|
-
@main = DBus::Main.new
|
65
|
-
@main << @clientbus
|
66
|
-
@main.run
|
67
|
-
}
|
68
|
-
if not @opos.is_server_ready[0]
|
69
|
-
@server_ready_queue.pop
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
|
76
|
-
end
|