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', { zone = "driver" })
53 m:info("No audio session manager plugin found...")
56 -- define application classes
57 application_class { name = "navigator", priority = 8 }
58 application_class { name = "event" , priority = 7 }
59 application_class { name = "phone" , priority = 6 }
60 application_class { name = "camera" , priority = 5 }
61 application_class { name = "alert" , priority = 4 }
62 application_class { name = "game" , priority = 3 }
63 application_class { name = "radio" , priority = 2 }
64 application_class { name = "player" , priority = 1 }
65 application_class { name = "implicit" , priority = 0 }
67 -- define zone attributes
69 type = {mdb.string, "common", "rw"},
70 location = {mdb.string, "anywhere", "rw"}
78 location = "front-left"
86 location = "front-right"
94 location = "back-left"
102 location = "back-right"
110 location = "back-left"
115 -- define resource classes
117 name = "audio_playback",
120 role = { mdb.string, "music", "rw" }
125 name = "audio_recording",
130 name = "video_playback",
135 name = "video_recording",
139 -- test for creating selections
142 name = "audio_owner",
143 table = "audio_playback_owner",
144 columns = {"application_class"},
145 condition = "zone_name = 'driver'"
150 name = "vehicle_speed",
151 table = "amb_vehicle_speed",
153 condition = "key = 'VehicleSpeed'"
157 name = "speed2volume",
158 inputs = { speed = mdb.select.vehicle_speed, param = 9 },
159 outputs = { mdb.table { name = "speedvol",
160 index = {"zone", "device"},
161 columns = {{"zone", mdb.string, 16},
162 {"device", mdb.string, 16},
163 {"value", mdb.floating}},
168 update = function(self)
169 speed = self.inputs.speed.single_value
171 volume = (speed - 144.0) / 7.0
175 diff = volume - self.oldvolume
176 if (diff*diff > self.inputs.param) then
177 print("*** element "..self.name.." update "..volume)
178 self.oldvolume = volume
179 mdb.table.speedvol:replace({zone = "driver", device = "speakers", value = volume})
184 -- load the telephony plugin
185 m:try_load_plugin('telephony')