3 -- try loading console plugin
4 m:try_load_plugin('console')
7 if m:plugin_exists('test') then
8 m:load_plugin('test', {
9 string2 = 'this is now string2',
13 -- m:load_plugin('test', 'test2')
14 -- m:info("Successfully loaded two instances of test...")
17 -- load the dbus plugin if it exists
18 if m:plugin_exists('dbus') then
22 -- load glib plugin, ignoring any errors
23 m:try_load_plugin('glib')
25 -- load the native resource plugin
26 if m:plugin_exists('resource-native') then
27 m:load_plugin('resource-native')
28 m:info("native resource plugin loaded")
30 m:info("No native resource plugin found...")
33 -- load the dbus resource plugin
34 if m:plugin_exists('resource-dbus') then
35 m:try_load_plugin('resource-dbus', {
37 dbus_service = "org.Murphy",
39 default_zone = "driver",
40 default_class = "implicit"
42 m:info("dbus resource plugin loaded")
44 m:info("No dbus resource plugin found...")
48 -- load the domain control plugin if it exists
49 if m:plugin_exists('domain-control') then
50 m:load_plugin('domain-control')
52 m:info("No domain-control plugin found...")
56 -- define application classes
57 application_class { name="interrupt", priority=99, modal=true , share=false, order="fifo" }
58 application_class { name="navigator", priority=4 , modal=false, share=true , order="fifo" }
59 application_class { name="phone" , priority=3 , modal=false, share=true , order="lifo" }
60 application_class { name="game" , priority=2 , modal=false, share=true , order="lifo" }
61 application_class { name="player" , priority=1 , modal=false, share=true , order="lifo" }
62 application_class { name="implicit" , priority=0 , modal=false, share=true , order="lifo" }
64 -- define zone attributes
66 type = {mdb.string, "common", "rw"},
67 location = {mdb.string, "anywhere", "rw"}
75 location = "front-left"
83 location = "front-right"
91 location = "back-left"
99 location = "back-right"
107 location = "back-left"
112 -- define resource classes
114 name = "audio_playback",
117 role = { mdb.string, "music", "rw" },
118 pid = { mdb.string, "<unknown>", "rw" },
119 policy = { mdb.string, "relaxed", "rw" }
124 name = "audio_recording",
127 role = { mdb.string, "music", "rw" },
128 pid = { mdb.string, "<unknown>", "rw" },
129 policy = { mdb.string, "relaxed", "rw" }
134 name = "video_playback",
139 name = "video_recording",
143 -- test for creating selections
145 name = "audio_owner",
146 table = "audio_playback_owner",
147 columns = {"application_class"},
148 condition = "zone_name = 'driver'",
152 name = "speed2volume",
153 inputs = { owner = mdb.select.audio_owner, param = 5 },
154 outputs = { mdb.table { name = "speedvol",
155 index = {"zone", "device"},
156 columns = {{"zone", mdb.string, 16},
157 {"device", mdb.string, 16},
158 {"value", mdb.floating}},
162 update = function(self)
163 if (self.inputs.owner.single_value) then
164 print("*** element "..self.name.." update "..
165 self.inputs.owner.single_value)
167 print("*** element "..self.name.." update <nil>")