Author: bklaas
Date: Mon Apr 12 11:25:58 2010
New Revision: 8686
URL: http://svn.slimdevices.com/jive?rev=8686&view=rev
Log:
Fixed Bug: 15663
Bug: 15901
Description: send WOL packet with 5 mins lead time before alarm (or immediately
as a best effort if alarm time is < 5 mins away)
partial fix for bug 15901, add window listener for pause button that stops
alarm tone, whether fallback or server-based
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
URL:
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua?rev=8686&r1=8685&r2=8686&view=diff
==============================================================================
---
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
(original)
+++
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
Mon Apr 12 11:25:58 2010
@@ -64,15 +64,25 @@
end,
true
)
- self.wakeOnLanTimer = Timer(timeToAlarm,
- function()
- if self.server then
- log:warn('WOL packet being sent to ',
self.server)
- self.server:wakeOnLan()
- end
- end,
- true
- )
+
+ local wolLeadTime = 1000 * 60 * 5 -- 5 minutes
+ -- Bug 15663: send wol packet well before alarm time
+ -- if timeToAlarm is less than wolLeadTime, send the wakeOnLan packet
immediately as a best effort
+ if self.server and timeToAlarm and timeToAlarm < wolLeadTime then
+ self.server:wakeOnLan()
+ -- if startTimer is true and timeToAlarm >= wolLeadTime, send a wol
packet wolLeadTime in front of timeToAlarm
+ elseif startTimer then
+ local wakeUp = timeToAlarm - wolLeadTime
+ self.wakeOnLanTimer = Timer(wakeUp,
+ function()
+ if self.server then
+ log:warn('WOL packet being sent
to ', self.server)
+ self.server:wakeOnLan()
+ end
+ end,
+ true
+ )
+ end
self.statusPoller = Timer(1000,
function ()
@@ -94,7 +104,7 @@
-- this timer is for debug purposes only, to log state information
every second for tracking purposes
-- very useful when needed...
- -- self.statusPoller:start()
+ --self.statusPoller:start()
if startTimer then
self:_startTimer()
@@ -248,6 +258,22 @@
end
+function notify_playerPower(self, player, power)
+ if player ~= self.player then
+ return
+ end
+ log:debug("notify_playerPower(): ", power)
+
+ -- turning power off while alarm is in progress always means alarm
should be cancelled
+ if not power then
+ if self.alarmInProgress then
+ log:warn('Power turned off while alarm in progress. By
design, turn the alarm off')
+ self:_alarmOff(true)
+ end
+ end
+end
+
+
function notify_playerCurrent(self, player)
log:info("notify_playerCurrent(", player, ")")
if player == self.localPlayer then
@@ -481,6 +507,12 @@
return EVENT_CONSUME
end
+ local pauseAction = function()
+ window:playSound("WINDOWHIDE")
+ self:_alarmOff(true)
+ return EVENT_UNUSED
+ end
+
local consumeAction = function()
log:warn('Consuming this action')
Framework:playSound("BUMP")
@@ -501,6 +533,7 @@
menu:addActionListener("back", self, cancelAction)
menu:addActionListener("power", self, offAction)
menu:addActionListener("mute", self, snoozeAction)
+ menu:addActionListener("pause", self, pauseAction)
window:ignoreAllInputExcept(
--these actions are not ignored
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins