[Netlinx-modules-commit] NetLinx-Modules/SlimServer SlimServerMod.axi, 1.3, 1.4 SlimServerMod.axs,
Brought to you by:
coffler
|
From: Jeff C. <co...@us...> - 2007-02-25 20:44:58
|
Update of /cvsroot/netlinx-modules/NetLinx-Modules/SlimServer In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18532/SlimServer Modified Files: SlimServerMod.axi SlimServerMod.axs Log Message: Fix DawnDuskMod.axs for latest 2007 daylight savings time rules. Latest SlimServerMod changes (primarily for async update support). Index: SlimServerMod.axi =================================================================== RCS file: /cvsroot/netlinx-modules/NetLinx-Modules/SlimServer/SlimServerMod.axi,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SlimServerMod.axi 21 Sep 2005 14:27:17 -0000 1.3 --- SlimServerMod.axi 25 Feb 2007 20:44:54 -0000 1.4 *************** *** 18,22 **** (*}}PS_SOURCE_INFO *) (* *) ! (* copyright : (C) 2004-2005 by Jeff Coffler *) (* email : net...@ta... *) (* *) --- 18,22 ---- (*}}PS_SOURCE_INFO *) (* *) ! (* copyright : (C) 2004-2006 by Jeff Coffler *) (* email : net...@ta... *) (* *) Index: SlimServerMod.axs =================================================================== RCS file: /cvsroot/netlinx-modules/NetLinx-Modules/SlimServer/SlimServerMod.axs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SlimServerMod.axs 1 Nov 2005 20:40:26 -0000 1.3 --- SlimServerMod.axs 25 Feb 2007 20:44:54 -0000 1.4 *************** *** 12,16 **** (* FILE CREATED ON: 10/03/2004 AT: 09:00:00 *) (***********************************************************) ! (* FILE_LAST_MODIFIED_ON: 10/30/2005 AT: 09:52:47 *) (***********************************************************) (* ORPHAN_FILE_PLATFORM: 1 *) --- 12,16 ---- (* FILE CREATED ON: 10/03/2004 AT: 09:00:00 *) (***********************************************************) ! (* FILE_LAST_MODIFIED_ON: 05/20/2006 AT: 15:15:38 *) (***********************************************************) (* ORPHAN_FILE_PLATFORM: 1 *) *************** *** 26,30 **** (*}}PS_SOURCE_INFO *) (* *) ! (* copyright : (C) 2004-2005 by Jeff Coffler *) (* email : net...@ta... *) (* *) --- 26,30 ---- (*}}PS_SOURCE_INFO *) (* *) ! (* copyright : (C) 2004-2006 by Jeff Coffler *) (* email : net...@ta... *) (* *) *************** *** 79,84 **** char MAX_UI_Level = 5; // Maximum number of levels in UI item array - char MIN_Status_Freq = 2; // Minimum number of seconds that must elapse to issue 'status' - char CmdCommands[][20] = { // Valid commands for SS_opDoCommand 'play', 'stop', 'pause', '~B jump_fwd', // 01-04 --- 79,82 ---- *************** *** 105,109 **** // Support for NetLinx timelines - LONG tlGetStatusUpds = 1; // Timeline to perform automatic status updates LONG tlConnectProgress = 2; // Progress with connection to SlimServer LONG ConnectSeconds = 10; // Number of seconds for connection notifications (0=None) --- 103,106 ---- *************** *** 177,181 **** volatile integer vdChannelsUsed = 255; // Number of channels used for virtual device feedback (255 by default) ! volatile integer statusUpdSecs = 30; // By default, update status every 30 seconds volatile integer panelUpdateFlags = 0; // Default flags set for panel updating --- 174,178 ---- volatile integer vdChannelsUsed = 255; // Number of channels used for virtual device feedback (255 by default) ! volatile integer statusUpdSecs = 60; // By default, update status every 30 seconds volatile integer panelUpdateFlags = 0; // Default flags set for panel updating *************** *** 360,366 **** updateTimes[1] = secs * 1000; - if (timeline_active(tlConnectProgress)) - timeline_kill(tlConnectProgress); - timeline_create(tlConnectProgress, updateTimes, 1, TIMELINE_ABSOLUTE, TIMELINE_REPEAT); } --- 357,360 ---- *************** *** 375,379 **** define_function Connect() ! // Connect: Establish a TCP/IP connection (via HTTP) to the SlimServer { slong slStatus; --- 369,373 ---- define_function Connect() ! // Connect: Establish a TCP/IP connection (via CLI) to the SlimServer { slong slStatus; *************** *** 390,397 **** Q_HasItems = FALSE; - // Cease status updates if they're currently in progress - if (timeline_active(tlGetStatusUpds)) - timeline_kill(tlGetStatusUpds); - lConnectRetryCount = 0; return; --- 384,387 ---- *************** *** 521,599 **** } - define_function BeginStatusTimeline(char fRestart) - // BeginStatusTimeline: Start (or restart) a status timeline - // fRestart: Restart the timeline if it's already running - { - long updateTimes[1]; - integer loop, maxLoopCount; - integer secsEntry[SS_MAX_PlayerCount]; // Number of seconds for particular entry - integer secsTimeline; // Number of seconds to next update - - // Restart timeline if it's already running? - - if (timeline_active(tlGetStatusUpds) && !fRestart) - return; - - // Determine how long we need to wait for the next status update - - secsTimeline = 0; - maxLoopCount = min_value(length_array(sUnitAddr), SS_MAX_PlayerCount); - - for (loop = 1; loop <= maxLoopCount; loop++) { - secsEntry[loop] = 0; - off[stateData[loop].fPerformStatus]; - if (stateData[loop].fFeedbackEnabled) { - secsEntry[loop] = statusUpdSecs; // Default value - - // Figure out the next optimum time for this unit to update - - if (Status[loop].Mode == SS_PlayMode_Play) { - if (Status[loop].SongDuration > 0) { - if (Status[loop].SongDuration >= Status[loop].SongTime) { - integer timeRemaining; - - timeRemaining = Status[loop].SongDuration - Status[loop].SongTime + 1; - secsEntry[loop] = max_value(min_value(timeRemaining, statusUpdSecs), MIN_Status_Freq); - } - else { - // One would think this wouldn't happen (time index into song > song length), - // but it does occationally. When it does, just refresh - it's transient. - secsEntry[loop] = MIN_Status_Freq; - } - } - } - } - - if (secsEntry[loop] > 0 && (secsTimeline == 0 || secsEntry[loop] < secsTimeline)) - secsTimeline = secsEntry[loop]; - } - - // Set (or reset) the timeline for automatic updates - - if (secsTimeline <> 0) { - // Set feedback flag for all panels who are "next up" - - for (loop = 1; loop <= maxLoopCount; loop++) - if (secsEntry[loop] > 0 && secsEntry[loop] == secsTimeline) - on[stateData[loop].fPerformStatus]; - - // Start the timeline - - updateTimes[1] = secsTimeline * 1000; - - if (timeline_active(tlGetStatusUpds)) - timeline_kill(tlGetStatusUpds); - - Diag(llSlimServer, Debug, sTagSlimServer, "'Creating timeline tlGetStatusUpds with ',itoa(updateTimes[1]),' milliseconds ...'"); - timeline_create(tlGetStatusUpds, updateTimes, 1, TIMELINE_ABSOLUTE, TIMELINE_ONCE); - } - else { - if (timeline_active(tlGetStatusUpds)) { - Diag(llSlimServer, Debug, sTagSlimServer, 'Deleting timeline tlGetStatusUpds ...'); - timeline_kill(tlGetStatusUpds); - } - } - } - define_function DoCommand(char unitNum, char opCode) // DoCommand: Handler for SlimServer command --- 511,514 ---- *************** *** 682,688 **** playerID = "GetPlayerID(unitNum)"; if (startSong == 0) ! sBuffer = "playerID,'status - ',itoa(numSongs),' charset:iso-8859-1 tags:gal'"; else ! sBuffer = "playerID,'status ',itoa(startSong),' ',itoa(numSongs),' charset:iso-8859-1 tags:gal'"; // To avoid "flooding" SlimServer with status requests, --- 597,603 ---- playerID = "GetPlayerID(unitNum)"; if (startSong == 0) ! sBuffer = "playerID,'status - ',itoa(numSongs),' charset:iso-8859-1 tags:gal subscribe:',itoa(statusUpdSecs)"; else ! sBuffer = "playerID,'status ',itoa(startSong),' ',itoa(numSongs),' charset:iso-8859-1 tags:gal subscribe:',itoa(statusUpdSecs)"; // To avoid "flooding" SlimServer with status requests, *************** *** 707,711 **** // flags: Special flags (global) to use for panel updates { ! if (secs > 0) { Diag(llSlimServer, Info, sTagSlimServer, "'SetStatusUpdates: Update frequency set to ',itoa(secs),' seconds'"); statusUpdSecs = secs; --- 622,626 ---- // flags: Special flags (global) to use for panel updates { ! if (secs >= 0) { Diag(llSlimServer, Info, sTagSlimServer, "'SetStatusUpdates: Update frequency set to ',itoa(secs),' seconds'"); statusUpdSecs = secs; *************** *** 747,760 **** off[stateData[unitNum].fStatusRequested]; ! // We're starting to track (or clearing) this panel - get on the fly status and set timeline if (numPanels) { on[stateData[unitNum].fForceRefresh]; GetStatus(unitNum, 0, 2); - BeginStatusTimeline(FALSE); SetCoverArtPath(unitNum); } - else - BeginStatusTimeline(TRUE); // Did user request extra-anal ( :-) ) per-second updates? --- 662,672 ---- off[stateData[unitNum].fStatusRequested]; ! // We're starting to track (or clearing) this panel - get on the fly status if (numPanels) { on[stateData[unitNum].fForceRefresh]; GetStatus(unitNum, 0, 2); SetCoverArtPath(unitNum); } // Did user request extra-anal ( :-) ) per-second updates? *************** *** 1840,1855 **** ParseVolumeResponse(str, cmdParams[1]); ! active (TRUE): { ! // Major hack! We need to be much smarter about updating status ! // data ourselves for "trivial" changes (rather than query again) ! // ! // Note: This will likely all go away anyway with async updates ! char unitNum; ! unitNum = GetPlayerUnitNum(cmdParams[1]); ! if (unitNum) ! GetStatus(unitNum, 0, 2); ! Diag(llSlimServer, Debug, sTagSlimServer, "'ProcessResponse: Ignoring response, p1=',cmdParams[1],', p2=',cmdParams[2]"); - } } --- 1752,1757 ---- ParseVolumeResponse(str, cmdParams[1]); ! active (TRUE): Diag(llSlimServer, Debug, sTagSlimServer, "'ProcessResponse: Ignoring response, p1=',cmdParams[1],', p2=',cmdParams[2]"); } *************** *** 2022,2026 **** } } ! active (sTag = 'tags' || sTag = 'charset'): { // Carry over from the command - we recognize it and ignore it } --- 1924,1928 ---- } } ! active (sTag = 'charset' || sTag = 'tags' || sTag = 'subscribe'): { // Carry over from the command - we recognize it and ignore it } *************** *** 2071,2079 **** UpdateVirtualDevice(); - - // Kick off the next timeline ... - - Cancel_Wait 'Failsafe_Dead_Slimserver'; - BeginStatusTimeline(TRUE); } --- 1973,1976 ---- *************** *** 2715,2718 **** --- 2612,2619 ---- sTagSlimServer = "'SlimServer ',DumpDPS(dvSlimServer)"; + // Finally, try to connect in order to get async updates + + Connect(); + (***********************************************************) *************** *** 2724,2727 **** --- 2625,2630 ---- { Online: { + char unitNum; + Diag(llSlimServer, Info, sTagSlimServer, 'Connected to SlimServer via TCP/IP networking'); lConnectRetryCount = 0; *************** *** 2732,2735 **** --- 2635,2644 ---- ConnectNotify(0); + + // We have a connection, so ask the SlimServer to monitor player changes + + for (unitNum = 1; unitNum <= length_array(sUnitAddr); unitNum++) + GetStatus(unitNum, 0, 2); + ProcessQueue(); } *************** *** 2783,2802 **** } - Timeline_Event[tlGetStatusUpds] - { - char loop, maxLoopCount; - - maxLoopCount = min_value(length_array(sUnitAddr), SS_MAX_PlayerCount); - for (loop = 1; loop <= maxLoopCount; loop++) - if (stateData[loop].fPerformStatus) - GetStatus(loop, 0, 2); - - // Normally the status timeline is updated after a status command is received - // In the event that we never get one, make sure our timer starts eventually - - Wait 50 'Failsafe_Dead_Slimserver' - BeginStatusTimeline(FALSE); - } - Timeline_Event[tlConnectProgress] { --- 2692,2695 ---- |