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 = 8 }
54 application_class { name = "event" , priority = 7 }
55 application_class { name = "phone" , priority = 6 }
56 application_class { name = "camera" , priority = 5 }
57 application_class { name = "alert" , priority = 4 }
58 application_class { name = "game" , priority = 3 }
59 application_class { name = "radio" , priority = 2 }
60 application_class { name = "player" , priority = 1 }
61 application_class { name = "implicit" , priority = 0 }
63 -- define zone attributes
65 type = {mdb.string, "common", "rw"},
66 location = {mdb.string, "anywhere", "rw"}
74 location = "front-left"
82 location = "front-right"
90 location = "back-left"
98 location = "back-right"
106 location = "back-left"
111 -- define resource classes
113 name = "audio_playback",
116 role = { mdb.string, "music", "rw" }
121 name = "audio_recording",
126 name = "video_playback",
131 name = "video_recording",
135 -- test for creating selections
138 name = "audio_owner",
139 table = "audio_playback_owner",
140 columns = {"application_class"},
141 condition = "zone_name = 'driver'"
146 name = "vehicle_speed",
147 table = "amb_vehicle_speed",
149 condition = "key = 'VehicleSpeed'"
153 name = "speed2volume",
154 inputs = { speed = mdb.select.vehicle_speed, param = 9 },
155 outputs = { mdb.table { name = "speedvol",
156 index = {"zone", "device"},
157 columns = {{"zone", mdb.string, 16},
158 {"device", mdb.string, 16},
159 {"value", mdb.floating}},
164 update = function(self)
165 speed = self.inputs.speed.single_value
167 volume = (speed - 144.0) / 7.0
171 diff = volume - self.oldvolume
172 if (diff*diff > self.inputs.param) then
173 print("*** element "..self.name.." update "..volume)
174 self.oldvolume = volume
175 mdb.table.speedvol:replace({zone = "driver", device = "speakers", value = volume})
180 -- load the telephony plugin
181 m:try_load_plugin('telephony')