Author: bklaas
Date: Mon Jul 19 12:49:54 2010
New Revision: 8965

URL: http://svn.slimdevices.com/jive?rev=8965&view=rev
Log:
 r40...@daddymac (orig r8960):  ayoung | 2010-07-19 00:32:15 -0500
 bug 16295: SB Radio changes state & display on its own. 
 Avoid using player state information for the current player from a 
serverstatus notification except under specific conditions:
 - when the state indicates a change in server;
 - when the state indicates a change in connected status.
 r40...@daddymac (orig r8962):  bklaas | 2010-07-19 12:58:58 -0500
 Fixed Bug: 16149
 Description: honor alarm timeout from server for fallback alarm.
 in the absence of the SBS 7.5/trunk checkin r31076, player hard coded to a 60 
minute timeout (which is also the server default for a player's alarm timeout)
 

Modified:
    7.6/trunk/   (props changed)
    
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
    7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua
    7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/SlimServer.lua

Propchange: 7.6/trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Mon Jul 19 12:49:54 2010
@@ -13,7 +13,7 @@
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/fab4-skin:4552
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/new-alsa:6567
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:8423
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.5/trunk:8955
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.5/trunk:8962
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:2013
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua?rev=8965&r1=8964&r2=8965&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
 Mon Jul 19 12:49:54 2010
@@ -129,6 +129,9 @@
 function notify_playerAlarmState(self, player, alarmState, alarmNext)
 
        log:warn('notify_playerAlarmState received for ', player, ' with 
alarmState of ', alarmState)
+       if not player then
+               return
+       end
        if player:isLocal() then
                log:warn('**************************** notify_playerAlarmState 
received: ', alarmState, ' ', alarmNext)
                -- if there's an existing alarm window on the screen and the 
rtc alarm isn't firing, 
@@ -253,6 +256,9 @@
 
 function notify_playerLoaded(self, player)
        log:info("notify_playerLoaded(", player, ")")
+       if not player then
+               return
+       end
        if player == self.localPlayer then
 --             self:_alarm_sledgehammerRearm('notify_playerLoaded')
                -- check for pending server alarm in case that one is pending 
instead, since we may have changed players to force 
@@ -265,6 +271,9 @@
 
 
 function notify_playerPower(self, player, power)
+       if not player then
+               return
+       end
         if player ~= self.localPlayer then
                 return
         end
@@ -293,6 +302,9 @@
 
 function notify_playerModeChange(self, player, mode)
        log:warn('notify_playerModeChange: player (', player,') mode has been 
changed to ', mode)
+       if not player then
+               return
+       end
        local status = decode:status()
        log:warn('notify_playerModeChange: - audioState is ', status.audioState)
 end
@@ -300,6 +312,9 @@
 
 function notify_playerConnected(self, player)
        log:warn('notify_playerConnected: ', player, ' ', self.alarmInProgress)
+       if not player then
+               return
+       end
        if player == self.localPlayer then
 --             self:_alarm_sledgehammerRearm('notify_playerConnected')
                self.server = player:getSlimServer()
@@ -312,6 +327,9 @@
 
 function notify_playerDisconnected(self, player)
        log:warn('notify_playerDisconnected ', player, self.alarmInProgress)
+       if not player then
+               return
+       end
        if player == self.localPlayer then
        end
 end
@@ -428,6 +446,21 @@
        )
        self.fadeInTimer:start()
 
+       local alarmTimeoutSeconds = self.localPlayer:getAlarmTimeoutSeconds() 
or ( 60 * 60 ) -- defaults to 1 hour
+       if alarmTimeoutSeconds ~= 0 then
+               local alarmTimeoutMsecs = alarmTimeoutSeconds * 1000
+               log:info("Fallback alarm will timeout in ", 
alarmTimeoutSeconds, " seconds")
+               self.fallbackAlarmTimeout = Timer(alarmTimeoutMsecs,
+                               function ()
+                                       if self.alarmInProgress == 'rtc' then
+                                               log:warn('rtc alarm has timed 
out')
+                                               self:_alarmOff()
+                                       end
+                               end
+               )
+               self.fallbackAlarmTimeout:start()
+       end
+
 end
 
 
@@ -655,6 +688,11 @@
                log:warn('_alarmOff: send stopAlarm to connected server')
                self.localPlayer:stopAlarm()
        end
+
+       if self.fallbackAlarmTimeout and self.fallbackAlarmTimeout:isRunning() 
then
+               self.fallbackAlarmTimeout:stop()
+       end
+
 end
 
 

Modified: 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua?rev=8965&r1=8964&r2=8965&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua (original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua Mon Jul 19 
12:49:54 2010
@@ -1188,7 +1188,10 @@
        self.playlistCurrentIndex = event.data.playlist_cur_index and 
tonumber(event.data.playlist_cur_index) + 1
        self.definedPresets = event.data.preset_loop
        -- alarm snooze seconds for player, defaults to 540
-       self.alarmSnoozeSeconds = event.data.alarm_snooze_seconds
+       self.alarmSnoozeSeconds  = event.data.alarm_snooze_seconds
+       -- alarm timeout seconds for player, defaults to 3600 (same as server 
default)
+       self.alarmTimeoutSeconds = event.data.alarm_timeout_seconds
+
        -- Bug 15814: flag for when the audio hasn't started streaming yet but 
mode is play
        self.waitingToPlay = event.data.waitingToPlay or false
 
@@ -1874,6 +1877,10 @@
        return self.alarmSnoozeSeconds or 540
 end
 
+function getAlarmTimeoutSeconds(self)
+       return self.alarmTimeoutSeconds or 3600
+end
+
 function isConnected(self)
        return self.slimServer and self.slimServer:isConnected() and 
self.info.connected
 end

Modified: 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/SlimServer.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/SlimServer.lua?rev=8965&r1=8964&r2=8965&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/SlimServer.lua 
(original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/SlimServer.lua Mon 
Jul 19 12:49:54 2010
@@ -254,19 +254,37 @@
                        if not self.players[playerId] then
                                self.players[playerId] = Player(self.jnt, 
playerId)
                        end
+                       
+                       local player = self.players[playerId]
 
                        -- update player state
 
                        local useSequenceNumber = false
                        local isSequenceNumberInSync = true
-                       if self.players[playerId]:isLocal() and 
player_info.seq_no then
+                       if player:isLocal() and player_info.seq_no then
                                useSequenceNumber = true
-                               if not 
self.players[playerId]:isSequenceNumberInSync(tonumber(player_info.seq_no)) then
+                               if not 
player:isSequenceNumberInSync(tonumber(player_info.seq_no)) then
                                        isSequenceNumberInSync = false
                                end
                        end
-
-                       self.players[playerId]:updatePlayerInfo(self, 
player_info, useSequenceNumber, isSequenceNumberInSync)
+                       
+                       -- Bug 16295: ignore serverStatus updates with 
information about the current player
+                       -- because serverStatus from SN can contain out-of-date 
information (cached query);
+                       -- just rely on (player)status notifications for that 
information,
+                       -- unless this status indicates a change of server 
(possibly from none) for the player
+                       -- or the connected status has changed (should be 
reliable).
+                       --
+                       -- It is important that these tests allow the first 
serverstatus for the current player
+                       -- to be used because otherwise the correct 
notifications are not issued and various
+                       -- necessary initialization functions are not run, 
including those that subscribe to
+                       -- (player)status notifications.
+                       
+                       if Player:getCurrentPlayer() ~= player
+                               or player:getSlimServer() ~= self
+                               or player:isConnected() ~= 
(tonumber(player_info.connected) == 1)
+                       then
+                               player:updatePlayerInfo(self, player_info, 
useSequenceNumber, isSequenceNumberInSync)
+                       end
                end
        else
                log:debug(self, ": has no players!")

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to