3 -- try loading the various logging plugins
4 m:try_load_plugin('systemd')
5 m:try_load_plugin('dlog')
7 -- load the console plugin
8 m:try_load_plugin('console')
10 m:try_load_plugin('console.disabled', 'webconsole', {
11 address = 'wsck:127.0.0.1:3000/murphy',
12 httpdir = '/usr/share/murphy/webconsole' });
14 -- load the dbus plugin
15 if m:plugin_exists('dbus') then
19 -- load the native resource plugin
20 if m:plugin_exists('resource-native') then
21 m:load_plugin('resource-native')
22 m:info("native resource plugin loaded")
24 m:info("No native resource plugin found...")
27 -- load the dbus resource plugin
28 m:try_load_plugin('resource-dbus', {
30 dbus_service = "org.Murphy",
32 default_zone = "driver",
33 default_class = "implicit"
36 -- load the domain control plugin
37 if m:plugin_exists('domain-control') then
38 m:load_plugin('domain-control')
40 m:info("No domain-control plugin found...")
43 -- load the AMB plugin
44 if m:plugin_exists('amb') then
47 m:info("No amb plugin found...")
50 -- load the ASM resource plugin
51 if m:plugin_exists('resource-asm') then
52 m:load_plugin('resource-asm', {
54 share_mmplayer = "player:AVP,mandatory,exclusive,relaxed"
57 m:info("No audio session manager plugin found...")
60 if m:plugin_exists('ivi-resource-manager.disabled') then
61 m:load_plugin('ivi-resource-manager')
64 -- define application classes
65 application_class { name="interrupt", priority=99, modal=true , share=false, order="fifo" }
66 application_class { name="emergency", priority=80, modal=false, share=false, order="fifo" }
67 application_class { name="alert" , priority=51, modal=false, share=false, order="fifo" }
68 application_class { name="navigator", priority=50, modal=false, share=true , order="fifo" }
69 application_class { name="phone" , priority=6 , modal=false, share=true , order="lifo" }
70 application_class { name="camera" , priority=5 , modal=false, share=false, order="lifo" }
71 application_class { name="event" , priority=4 , modal=false, share=true , order="fifo" }
72 application_class { name="game" , priority=3 , modal=false, share=false, order="lifo" }
73 --# doesn't need to be created here, ivi-resource-manager creates it if loaded
74 --#application_class { name="basic" , priority=2 , modal=false, share=false, order="lifo" }
75 application_class { name="player" , priority=1 , modal=false, share=true , order="lifo" }
76 application_class { name="implicit" , priority=0 , modal=false, share=false, order="lifo" }
78 -- define zone attributes
80 type = {mdb.string, "common", "rw"},
81 location = {mdb.string, "anywhere", "rw"}
89 location = "front-left"
97 location = "front-right"
105 location = "back-left"
113 location = "back-right"
121 location = "back-left"
126 -- define resource classes
127 if not m:plugin_exists('ivi-resource-manager.disabled') then
129 name = "audio_playback",
132 role = { mdb.string, "music", "rw" },
133 pid = { mdb.string, "<unknown>", "rw" },
134 policy = { mdb.string, "relaxed", "rw" }
140 name = "audio_recording",
143 role = { mdb.string, "music" , "rw" },
144 pid = { mdb.string, "<unknown>", "rw" },
145 policy = { mdb.string, "relaxed" , "rw" }
150 name = "video_playback",
155 name = "video_recording",
159 if not m:plugin_exists('ivi-resource-manager.disabled') then
160 resource.method.veto = {
161 function(zone, rset, grant, owners)
162 rset_priority = application_class[rset.application_class].priority
164 owner_id = owners.audio_playback.resource_set
167 if (rset_priority >= 50 and owner_id ~= rset_id) then
168 print("*** resource-set "..rset_id.." - veto")
177 -- test for creating selections
179 name = "audio_owner",
180 table = "audio_playback_owner",
181 columns = {"application_class"},
182 condition = "zone_name = 'driver'"
186 name = "vehicle_speed",
187 table = "amb_vehicle_speed",
189 condition = "key = 'VehicleSpeed'"
193 name = "speed2volume",
194 inputs = { speed = mdb.select.vehicle_speed, param = 9 },
195 outputs = { mdb.table { name = "speedvol",
196 index = {"zone", "device"},
197 columns = {{"zone", mdb.string, 16},
198 {"device", mdb.string, 16},
199 {"value", mdb.floating}},
204 update = function(self)
205 speed = self.inputs.speed.single_value
207 volume = (speed - 144.0) / 7.0
211 diff = volume - self.oldvolume
212 if (diff*diff > self.inputs.param) then
213 print("*** element "..self.name.." update "..volume)
214 self.oldvolume = volume
215 mdb.table.speedvol:replace({zone = "driver", device = "speakers", value = volume})
220 -- load the telephony plugin
221 m:try_load_plugin('telephony')