3 -- load the dlog plugin
4 m:try_load_plugin('dlog')
6 -- load the console plugin
7 m:try_load_plugin('console')
9 -- load the dbus plugin
10 if m:plugin_exists('dbus') then
14 -- load the native resource plugin
15 if m:plugin_exists('resource-native') then
16 m:load_plugin('resource-native')
17 m:info("native resource plugin loaded")
19 m:info("No native resource plugin found...")
22 -- load the dbus resource plugin
23 m:try_load_plugin('resource-dbus', {
25 dbus_service = "org.Murphy",
27 default_zone = "driver",
28 default_class = "implicit"
31 -- load the domain control plugin
32 if m:plugin_exists('domain-control') then
33 m:load_plugin('domain-control')
35 m:info("No domain-control plugin found...")
38 -- load the AMB plugin
39 if m:plugin_exists('amb') then
42 m:info("No amb plugin found...")
45 -- load the ASM resource plugin
46 if m:plugin_exists('resource-asm') then
47 m:load_plugin('resource-asm', { zone = "driver" })
49 m:info("No audio session manager plugin found...")
52 -- define application classes
53 application_class { name = "navigator", priority = 4 }
54 application_class { name = "phone" , priority = 3 }
55 application_class { name = "game" , priority = 2 }
56 application_class { name = "player" , priority = 1 }
57 application_class { name = "implicit" , priority = 0 }
59 -- define zone attributes
61 type = {mdb.string, "common", "rw"},
62 location = {mdb.string, "anywhere", "rw"}
70 location = "front-left"
78 location = "front-right"
86 location = "back-left"
94 location = "back-right"
102 location = "back-left"
107 -- define resource classes
109 name = "audio_playback",
112 role = { mdb.string, "music", "rw" }
117 name = "audio_recording",
122 name = "video_playback",
127 name = "video_recording",
131 -- test for creating selections
134 name = "audio_owner",
135 table = "audio_playback_owner",
136 columns = {"application_class"},
137 condition = "zone_name = 'driver'"
142 name = "vehicle_speed",
143 table = "amb_vehicle_speed",
145 condition = "key = 'VehicleSpeed'"
149 name = "speed2volume",
150 inputs = { speed = mdb.select.vehicle_speed, param = 9 },
151 outputs = { mdb.table { name = "speedvol",
152 index = {"zone", "device"},
153 columns = {{"zone", mdb.string, 16},
154 {"device", mdb.string, 16},
155 {"value", mdb.floating}},
160 update = function(self)
161 speed = self.inputs.speed.single_value
163 volume = (speed - 144.0) / 7.0
167 diff = volume - self.oldvolume
168 if (diff*diff > self.inputs.param) then
169 print("*** element "..self.name.." update "..volume)
170 self.oldvolume = volume
171 mdb.table.speedvol:replace({zone = "driver", device = "speakers", value = volume})
176 -- load the telephony plugin
177 m:try_load_plugin('telephony')