3 -- load the dlog plugin
4 m:try_load_plugin('dlog')
6 -- load the console plugin
7 m:try_load_plugin('console')
9 m:try_load_plugin('console.disabled', 'webconsole', {
10 address = 'wsck:127.0.0.1:3000/murphy',
11 httpdir = '/usr/share/murphy/webconsole' });
13 -- load the dbus plugin
14 if m:plugin_exists('dbus') then
18 -- load the native resource plugin
19 if m:plugin_exists('resource-native') then
20 m:load_plugin('resource-native')
21 m:info("native resource plugin loaded")
23 m:info("No native resource plugin found...")
26 -- load the dbus resource plugin
27 m:try_load_plugin('resource-dbus', {
29 dbus_service = "org.Murphy",
31 default_zone = "driver",
32 default_class = "implicit"
35 -- load the domain control plugin
36 if m:plugin_exists('domain-control') then
37 m:load_plugin('domain-control')
39 m:info("No domain-control plugin found...")
42 -- load the AMB plugin
43 if m:plugin_exists('amb') then
46 m:info("No amb plugin found...")
49 -- load the ASM resource plugin
50 if m:plugin_exists('resource-asm') then
51 m:load_plugin('resource-asm', {
55 m:info("No audio session manager plugin found...")
58 -- define application classes
59 application_class { name="interrupt", priority=99, modal=true , share=false, order="fifo" }
60 application_class { name="alert" , priority=51, modal=false, share=false, order="fifo" }
61 application_class { name="navigator", priority=50, modal=false, share=true , order="fifo" }
62 application_class { name="phone" , priority=6 , modal=false, share=true , order="lifo" }
63 application_class { name="camera" , priority=5 , modal=false, share=false, order="lifo" }
64 application_class { name="event" , priority=4 , modal=false, share=true , order="fifo" }
65 application_class { name="game" , priority=3 , modal=false, share=false, order="lifo" }
66 application_class { name="player" , priority=1 , modal=false, share=true , order="lifo" }
67 application_class { name="implicit" , priority=0 , modal=false, share=false, order="lifo" }
69 -- define zone attributes
71 type = {mdb.string, "common", "rw"},
72 location = {mdb.string, "anywhere", "rw"}
80 location = "front-left"
88 location = "front-right"
96 location = "back-left"
104 location = "back-right"
112 location = "back-left"
117 -- define resource classes
119 name = "audio_playback",
122 role = { mdb.string, "music" , "rw" },
123 pid = { mdb.string, "<unknown>", "rw" },
124 policy = { mdb.string, "strict" , "rw" }
129 name = "audio_recording",
132 role = { mdb.string, "music" , "rw" },
133 pid = { mdb.string, "<unknown>", "rw" },
134 policy = { mdb.string, "relaxed" , "rw" }
139 name = "video_playback",
144 name = "video_recording",
148 resource.method.veto = {
149 function(zone, rset, grant, owners)
150 rset_priority = application_class[rset.application_class].priority
152 owner_id = owners.audio_playback.resource_set
155 if (rset_priority >= 50 and owner_id ~= rset_id) then
156 print("*** resource-set "..rset_id.." - veto")
164 -- test for creating selections
166 name = "audio_owner",
167 table = "audio_playback_owner",
168 columns = {"application_class"},
169 condition = "zone_name = 'driver'"
173 name = "vehicle_speed",
174 table = "amb_vehicle_speed",
176 condition = "key = 'VehicleSpeed'"
180 name = "speed2volume",
181 inputs = { speed = mdb.select.vehicle_speed, param = 9 },
182 outputs = { mdb.table { name = "speedvol",
183 index = {"zone", "device"},
184 columns = {{"zone", mdb.string, 16},
185 {"device", mdb.string, 16},
186 {"value", mdb.floating}},
191 update = function(self)
192 speed = self.inputs.speed.single_value
194 volume = (speed - 144.0) / 7.0
198 diff = volume - self.oldvolume
199 if (diff*diff > self.inputs.param) then
200 print("*** element "..self.name.." update "..volume)
201 self.oldvolume = volume
202 mdb.table.speedvol:replace({zone = "driver", device = "speakers", value = volume})
207 -- load the telephony plugin
208 m:try_load_plugin('telephony')