add appid property back to resource attributes
[profile/ivi/pulseaudio-module-murphy-ivi.git] / murphy / murphy-ivi.lua
index f78aa1d..88eb3d6 100644 (file)
@@ -37,12 +37,14 @@ routing_group {
 }
 
 application_class {
+    class = "event",
     node_type = node.event,
     priority = 6,
     route = {
         output = { driver = routing_group.default_driver_output }
     },
-    roles = { event = no_resource }
+    roles = { event  = no_resource,
+              speech = no_resource }
 }
 
 application_class {
@@ -71,7 +73,7 @@ application_class {
     priority = 3,
     route = {
         output = { driver = routing_group.default_driver_output,
-                  passanger1 = routing_group.default_passanger1_output }
+               passanger1 = routing_group.default_passanger1_output }
     },
     roles = { navigator = {0, "autorelease", "mandatory", "shared"} },
     binaries = { ['net.zmap.navi'] = { 0, "autorelease", "mandatory", "shared" } }
@@ -83,7 +85,7 @@ application_class {
     priority = 2,
     route = {
         output = { driver = routing_group.default_driver_output,
-                  passanger1 = routing_group.default_passanger1_output }
+               passanger1 = routing_group.default_passanger1_output }
     },
     roles = { game = {0, "mandatory", "exclusive"} }
 }
@@ -104,12 +106,15 @@ application_class {
     priority = 1,
     route = {
         output = { driver = routing_group.default_driver_output,
-                  passanger1 = routing_group.default_passanger1_output }
+                   passanger1 = routing_group.default_passanger1_output }
     },
-    roles = { music   = {0, "mandatory", "exclusive"},
-              video   = {0, "mandatory", "exclusive"},
-             test    = {0, "mandatory", "exclusive"}
-    }
+    roles = { music    = {0, "mandatory", "exclusive"},
+              video    = {0, "mandatory", "exclusive"},
+              test     = {0, "mandatory", "exclusive"},
+              bt_music = no_resource,
+              player   = no_resource
+    },
+    binaries = { ['t8j6HTRpuz.MediaPlayer'] = "music" }
 }
 
 application_class {
@@ -118,7 +123,7 @@ application_class {
     priority = 1,
     route = {
         output = { driver = routing_group.default_driver_output,
-                  passanger1 = routing_group.default_passanger1_output }
+               passanger1 = routing_group.default_passanger1_output }
     },
     roles = { browser = {0, "mandatory", "shared"} }
 }
@@ -129,7 +134,9 @@ audio_resource {
     name = { recording = "audio_recording", playback = "audio_playback" },
     attributes = {
        role = {"media.role", mdb.string, "music"},
-       pid  = {"application.process.id", mdb.string, "<unknown>"}
+       pid  = {"application.process.id", mdb.string, "<unknown>"},
+       name = {"resource.set.name", mdb.string, "<unknown>"},
+       appid = {"resource.set.appid", mdb.string, "<unknown>"}
     }
 }
 
@@ -147,24 +154,32 @@ mdb.import {
     condition = "zone_name = 'driver'",
     maxrow = 1,
     update = function(self)
-       zid = self[1].zone_id
-       if (zid == nil) then zid = "<nil>" end
-       class = self[1].application_class
-       if (class == nil) then class = "<nil>" end
-       role = self[1].role
-       if (role == nil) then role = "<nil>" end
+        zid = self[1].zone_id
+    if (zid == nil) then zid = "<nil>" end
+    class = self[1].application_class
+    if (class == nil) then class = "<nil>" end
+    role = self[1].role
+    if (role == nil) then role = "<nil>" end
 --      print("*** import "..self.table.." update: zone:"..zid.." class:"..class.." role:"..role)
     end
 }
 
 mdb.import {
-    table = "amb_shift_position",
-    columns = {"shift_position"},
-    condition = "id = 0",
+    table = "amb_gear_position",
+    columns = { "value" },
+    condition = "key = 'GearPosition'",
     maxrow = 1,
     update = builtin.method.make_volumes
 }
 
+mdb.import {
+    table = "volume_context",
+    columns = {"value"},
+    condition = "id = 1",
+    maxrow = 1,
+    update = builtin.method.change_volume_context
+}
+
 volume_limit {
     name = "speed_adjust",
     type = volume_limit.generic,
@@ -173,25 +188,48 @@ volume_limit {
 }
 
 volume_limit {
-    name = "suppress",
+    name = "phone_suppress",
     type = volume_limit.class,
-    limit = -20;
-    node_type = { node.phone, node.navigator },
+    limit = -20,
+    node_type = { node.phone },
     calculate = builtin.method.volume_supress
 }
 
+
+volume_limit {
+    name = "navi_suppress",
+    type = volume_limit.class,
+    limit = -20,
+    node_type = { node.navigator, node.phone },
+    calculate = builtin.method.volume_supress
+}
+
+volume_limit {
+    name = "navi_maxlim",
+    type = volume_limit.maximum,
+    limit = -10,
+    node_type = { node.navigator }
+}
+
+volume_limit {
+    name = "player_maxlim",
+    type = volume_limit.maximum,
+    limit = -20,
+    node_type = { node.player }
+}
+
 volume_limit {
     name = "video",
     type = volume_limit.class,
     limit = -90,
     node_type = { node.player, node.game },
-    calculate = function(self, class, device)
---     print("*** limit "..self.name.." class:"..class.." stream:"..device.name)
-       position = mdb.import.amb_shift_position[1].shift_position
-       if (position  and position == 128) then
-           return self.limit
-       end
-       return 0
+    calculate = function(self, class, device, mask)
+--      print("*** limit "..self.name.." class:"..class.." stream:"..device.name)
+        position = mdb.import.amb_gear_position[1].value
+        if (position and position == 128) then
+            return self.limit
+        end
+        return 0
     end
 }