config: fix inverted bit field check for a flag
[profile/ivi/murphy.git] / packaging.in / murphy.lua
index 82d2e07..552b309 100644 (file)
@@ -1726,8 +1726,10 @@ if sc then
                 local time = 200
                 if  msg.arg.anim_time then
                     local t = msg.arg.anim_time
+                    -- the actual time for the animation
                     time = m:AND(t, time_mask)
-                    nores = not m:AND(t, nores_mask)
+                    -- flag for ignoring resource control
+                    nores = m:AND(t, nores_mask)
                     if m:AND(t, raise_mask) then
                         msg.arg.raise = 1
                     elseif m:AND(t, lower_mask) then
@@ -1770,8 +1772,10 @@ if sc then
                 local time = 200
                 if msg.arg.anim_time then
                     local t = msg.arg.anim_time
+                    -- the actual time for the animation
                     time = m:AND(t, time_mask)
-                    nores = not m:AND(t, nores_mask)
+                    -- flag for ignoring resource control
+                    nores = m:AND(t, nores_mask)
                 end
                 if msg.arg.anim_name then
                     a.hide = { msg.arg.anim_name, time }
@@ -2063,6 +2067,7 @@ if sc then
                 elseif msg.res.input then
                     key = msg.res.input.name
                 elseif msg.res.window then
+                    -- alarm! this appars to be non-unique?
                     key = msg.res.window.resourceId
                 end
             end
@@ -2071,7 +2076,7 @@ if sc then
         end
 
         createResourceSet = function (ctl, client, msg)
-            cb = function(rset, data)
+            cb = function(rset)
 
                 -- m:info("*** resource_cb: client = '" .. msg.appid .. "'")
 
@@ -2081,8 +2086,8 @@ if sc then
                     requestType = msg.res.type
                 end
 
-                if data.filter_first then
-                    data.filter_first = false
+                if rset.data.filter_first then
+                    rset.data.filter_first = false
                     return
                 end
 
@@ -2094,12 +2099,15 @@ if sc then
                         rset.timer = m:Timer({
                             interval = 5000,
                             oneshot = true,
-                            callback = function (t, data)
-                                m:info("notification resource set timer expired")
+                            callback = function (t)
+                                m:info("notification timer expired")
 
-                                -- destroy the internal resource set
+                                if rset.data then
+                                    reply.res.window = rset.data.window
+                                end
 
-                                rset:destroy()
+                                rset:release()
+                                rset.timer = nil
 
                                 -- Send a "RELEASE" message to client.
                                 -- This triggers the resource deletion
@@ -2113,10 +2121,6 @@ if sc then
                                     }
                                 })
 
-                                if rset.data.window then
-                                    reply.res.window = rset.data.window
-                                end
-
                                 sc:send_message(client, reply)
                             end
                         })
@@ -2125,6 +2129,7 @@ if sc then
                     cmd = 0x00040002 -- release
                     if rset.timer then
                        rset.timer.callback = nil
+                       rset.timer = nil
                     end
                 end
 
@@ -2159,7 +2164,7 @@ if sc then
                 end
             end
 
-            rset = m:ResourceSet({
+            local rset = m:ResourceSet({
                     application_class = "player",
                     zone = "driver", -- msg.zone ("full")
                     callback = cb
@@ -2235,7 +2240,7 @@ if sc then
                 if not sets.cid then
                     sets.cid = {}
                 end
-                sets.cid.key = createResourceSet(self, cid, msg)
+                sets.cid[key] = createResourceSet(self, cid, msg)
             end
 
         elseif msg.command == 0x40012 then -- destroy_res
@@ -2245,6 +2250,7 @@ if sc then
             if key then
                 if sets.cid and sets.cid[key] then
                     sets.cid[key]:release()
+                    sets.cid[key].timer = nil
                     sets.cid[key] = nil -- garbage collecting
                 end
             end
@@ -2254,12 +2260,10 @@ if sc then
             key = getKey(msg)
 
             if key then
-                print("key is " .. tostring(key))
                 if not sets.cid then
                     sets.cid = {}
                 end
                 if not sets.cid[key] then
-                    print("creating a resource set")
                     sets.cid[key] = createResourceSet(self, cid, msg)
                 end
                 print("acquiring the resource set")
@@ -2274,19 +2278,16 @@ if sc then
             if key then
                 if sets.cid and sets.cid[key] then
                     sets.cid[key]:release()
-                end
 
-                if msg.appid == onscreen then
-                    -- in case of OnScreen, this actually means that the
-                    -- resource set is never used again; let gc do its job
-                    if sets.cid and sets.cid[key] then
+                    if msg.appid == onscreen then
+                        -- in case of OnScreen, this actually means that the
+                        -- resource set is never used again; let gc do its job
+                        sets.cid[key].timer = nil
                         sets.cid[key] = nil -- garbage collecting
                     end
                 end
-
             end
 
-
         elseif msg.command == 0x40003 then -- deprive_res
             print("command DEPRIVE_RES")