[Netlinx-modules-commit] NetLinx-Modules/SlimServer Main-Sample.axs,NONE,1.1 README.txt,NONE,1.1 Sli
Brought to you by:
coffler
Update of /cvsroot/netlinx-modules/NetLinx-Modules/SlimServer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19891 Added Files: Main-Sample.axs README.txt SlimServer,MVP-8400.TP4 SlimServer,VPN-CP.tpd SlimServer.apw SlimServerMod.axi SlimServerMod.doc Log Message: Initial checkin preparing for v1.0 release of SlimServerMod --- NEW FILE: Main-Sample.axs --- PROGRAM_NAME='SlimServer-Sample' (*{{PS_SOURCE_INFO(PROGRAM STATS) *) (***********************************************************) (* FILE CREATED ON: 08/19/2000 AT: 12:35:12 *) (***********************************************************) (* FILE_LAST_MODIFIED_ON: 04/02/2005 AT: 14:38:31 *) (***********************************************************) (* ORPHAN_FILE_PLATFORM: 1 *) (***********************************************************) (*!!FILE REVISION: Rev 0 *) (* REVISION DATE: 01/15/2005 *) (* *) (* COMMENTS: *) (***********************************************************) (*}}PS_SOURCE_INFO *) (***********************************************************) (***********************************************************) (* System Type : Netlinx *) (***********************************************************) (* REV HISTORY: *) (***********************************************************) (***********************************************************) (* DEFINE PANEL TYPE BELOW USING #define! *) (* *) (* If you comment out USING_MODERO_PANEL, then this code *) (* assumes that you're using a VPN-CP panel. Every effort *) (* was made to keep the code base identical between the *) (* two types of panels, but a small number of differences *) (* were unavoidable. *) (* *) (* As of this time, there are two code differences: *) (* 1. Device definition *) (* 2. How to pop up keyboard for searching. This can be *) (* avoided, but not without giving up ability to hide *) (* the "Search" button based on context on G3 panels. *) (***********************************************************) //#define USING_MODERO_PANEL (***********************************************************) (* DEVICE NUMBER DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_DEVICE // Modero Viewpoint Panels #if_defined USING_MODERO_PANEL TP_Setup = 10001:1:1; // Family Room - Souce Select TP_SServer = 10001:9:1; // Family Room - Source: SlimServer #else TP_Setup = 198:1:1; // Family Room - Souce Select TP_SServer = 200:1:1; // Family Room - Source: SlimServer #end_if // Other virtual devices vdSlimServer = 34003:1:0; // SlimServer communications (***********************************************************) (* COMBINED DEVICE DEFINITIONS GO BELOW *) (***********************************************************) (***********************************************************) (* CONSTANT DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_CONSTANT DEV vdSyslog = 0:0:0; // SyslogMod communications // "Fake" device since we don't use Syslog here // Port number (must be unique) for SlimServer DEV dvSlimServer = 0:2:0; char SlimS_Unit_Count = 3; // Number of SqueezeBox players that we've got char SlimS_Unit_Family = 1; // First Unit: Family Room char SlimS_Unit_Boys = 2; // Second Unit: Boys Room char SlimS_Unit_Test = 3; // Third Unit: Test Unit (SoftSqueeze) // Set up generic arrays of all touch panels in the system Integer GenericChans[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127 }; (***********************************************************) (* INCLUDE FILES GO BELOW *) (***********************************************************) #include 'SyslogMod.axi'; // SYSLOG logging routines #include 'SlimServerMod.axi'; // SlimServer Network Music Player (***********************************************************) (* DATA TYPE DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_TYPE (***********************************************************) (* VARIABLE DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_VARIABLE // Support for SlimServer module volatile char sSlimServer_Addr[] = 'slimserver.taltos.com'; volatile char sSlimServer_Units[SlimS_Unit_Count][SS_MAX_PlayerID] = { '00:04:20:05:69:dc', // SqueezeBox: Family Room '00:04:20:05:69:5e', // SqueezeBox: Boys Room '06:20:83:7f:fe:07' }; // SoftSqueeze: Test Unit volatile char SlimServer_fDebugFeedback = 0; volatile char g_SlimServer_UnitNum; // Global - Current SlimServer unit # we're controlling volatile char SServer_BScroll[SS_MAX_BrowseSessions], SServer_LastLev[SS_MAX_BrowseSessions]; // Flag to indicate if browse scroll bar currently being adjusted (***********************************************************) (* LATCHING DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_LATCHING (***********************************************************) (* MUTUALLY EXCLUSIVE DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_MUTUALLY_EXCLUSIVE (***********************************************************) (* SUBROUTINE/FUNCTION DEFINITIONS GO BELOW *) (***********************************************************) (* EXAMPLE: DEFINE_FUNCTION <RETURN_TYPE> <NAME> (<PARAMETERS>) *) (* EXAMPLE: DEFINE_CALL '<NAME>' (<PARAMETERS>) *) DEFINE_FUNCTION PlayerStart (char unitNum) { dev panelList[SS_MAX_PanelsInSystem]; g_SlimServer_UnitNum = unitNum; SS_DoCommand(vdSlimServer, g_SlimServer_UnitNum, SS_cmdPower_On); // Assign touchpanel for feedback panelList[1] = TP_SServer; set_length_array(panelList, 1); SS_SetPanels(vdSlimServer, g_SlimServer_UnitNum, panelList); } DEFINE_FUNCTION PlayerStop { // Disable updates for this unit (MUST be done before monitoring another Squeezebox!) SS_SetPanels(vdSlimServer, g_SlimServer_UnitNum, SS_noPanelList); // If desired, you can do the following to stop and turn off the player SS_DoCommand(vdSlimServer, g_SlimServer_UnitNum, SS_cmdStop); SS_DoCommand(vdSlimServer, g_SlimServer_UnitNum, SS_cmdPower_Off); g_SlimServer_UnitNum = 0; } (***********************************************************) (* STARTUP CODE GOES BELOW *) (***********************************************************) DEFINE_START (***********************************************************) (* MODULE DEFINITIONS GO BELOW *) (***********************************************************) Define_Module 'SlimServerMod' SlimServer( dvSlimServer, vdSlimServer, sSlimServer_Addr, sSlimServer_Units, vdSyslog, llSlimServer); (***********************************************************) (* THE EVENTS GOES BELOW *) (***********************************************************) DEFINE_EVENT // Set up string handler for implementation of "Search" capability data_event [TP_Setup] { online: { on [TP_Setup, 1]; // Online with NetLinx controller } string: { Select { // Support for popup keyboard - search for items (artists, albums, etc) Active (Data.Text == 'KEYB-ABORT'): { // Upon an abort, we don't want to perform a search } Active (left_string(data.text, 5) == 'KEYB-'): { char searchString[SS_LEN_Item]; searchString = Right_String(Data.Text,Length_Array(Data.Text)-5); SS_UI_Search(vdSlimServer, 1, searchString); } // Support for popup keypad - enter sleep time Active (data.text == 'KEYP-ABORT'): { // Upon an abort, we don't want to sleep } Active (remove_string(data.text,'KEYP-',1) <> ''): { SS_DoExtCommand (vdSlimServer, g_SlimServer_UnitNum, SS_extCmdSleep, 0, atoi(data.text)); } } } } // Source selection buttons button_event [TP_Setup, 11] // Select Squeezebox in Family Room { PUSH: PlayerStart (SlimS_Unit_Family); } button_event [TP_Setup, 12] // Select Squeezebox in Boys Room { PUSH: PlayerStart (SlimS_Unit_Boys); } button_event [TP_Setup, 13] // Select test player (SoftSqueeze) { PUSH: PlayerStart (SlimS_Unit_Test); } button_event [TP_Setup, 20] // Stop playing current Squeezebox { PUSH: PlayerStop(); } // Communicate with SlimServer module as necessary to implement capabilities data_event [vdSlimServer] { online: { // Enable both song level and song time feedback SS_SetStatusUpdates (vdSlimServer, 30, SS_Flag_SongLvl | SS_Flag_SongTime); } string: { switch (data.text[1]) { case SS_Pkt_UI_Error: { // Got some sort of error feedback from the SlimServer (beep panels) send_command TP_SServer, 'ADBEEP'; } } } } // Example of how to use channel feedback on virtual device to make system changes channel_event[vdSlimServer, 1] // Online/Offline changes { on: on[TP_SServer,256]; off: off[TP_SServer,256]; } channel_event[vdSlimServer, 2] // Idle/Busy changes { on: on[TP_SServer,257]; off: off[TP_SServer,257]; } channel_event[vdSlimServer, SlimServer_Chan(1, 3)] // Family "Play" state changes { on: { cancel_wait 'SlimS_Unit_Family_Shutdown'; } off: { // If we're still listening in the family room, start the shutdown timer if (g_SlimServer_UnitNum == SlimS_Unit_Family) { // Squeezebox stopped playing; shutdown in 1 minute wait 600 'SlimS_Unit_Family_Shutdown' PlayerStop(); } } } Button_Event [TP_SServer,GenericChans] // Modero SlimServer Handler { PUSH: SS_DoCommand(vdSlimServer, g_SlimServer_UnitNum, TYPE_CAST(Button.Input.Channel)); } Button_Event [TP_SServer,128] { PUSH: SS_PanelForceUpdate(vdSlimServer, g_SlimServer_UnitNum); } button_event [TP_SServer,129] // Modero SlimServer: Extended Debugging Output { PUSH: { SlimServer_fDebugFeedback = !SlimServer_fDebugFeedback; SS_SetDebugDetail(vdSlimServer, SlimServer_fDebugFeedback); if (SlimServer_fDebugFeedback) llSlimServer[llEntry_Console] = Debug; else llSlimServer[llEntry_Console] = Warning; } } Button_Event [TP_SServer,130] // Modero SlimServer: Deselect Browse Session { PUSH: { // If you have a queue of available browse sessions, add this session here } } Button_Event [TP_SServer,131] // Modero SlimServer: Select Songs (Select Browse Session) { PUSH: // If you have a queue of available browse sessions, get it now // (code below hard-coded to browse session #1) SS_UI_Begin(vdSlimServer, Button.Input.Device, 1, 8); } Button_Event [TP_SServer,132] // Modero SlimServer: Back up one level { PUSH: SS_UI_Backup(vdSlimServer, 1); } Button_Event [TP_SServer,133] // Modero SlimServer: Scroll back one page { PUSH: SS_UI_Prev(vdSlimServer, 1); HOLD [10]: // If button held down, scroll to top SS_UI_SetPage(vdSlimServer, 1, 255); } Button_Event [TP_SServer,134] // Modero SlimServer: Scroll forward one page { PUSH: SS_UI_Next(vdSlimServer, 1); HOLD [10]: // If button held down, scroll to bottom SS_UI_SetPage(vdSlimServer, 1, 0); } button_event [TP_SServer,138] // Modero SlimServer: Enter sleep time { PUSH: { // No program action to begin entering sleep time } } Button_Event [TP_SServer,139] // Modero SlimServer: Search current items { PUSH: { // Note: Following command assumes G4 panel (AKB) #if_defined USING_MODERO_PANEL send_command TP_Setup, '@AKB-;Enter Music Search Substring'; #else send_command TP_Setup, 'AKEYB'; #end_if } } Button_Event [TP_SServer,SS_Channels_Items] // Modero SlimServer: Select item (drill down) { PUSH: SS_UI_Select(vdSlimServer, 1, Button.input.Channel-SS_Channels_Items[1]+1); } Button_Event [TP_SServer,SS_Channels_Add] // Modero SlimServer: Add item to queue { PUSH: { SS_UI_Queue(vdSlimServer, g_SlimServer_UnitNum, 1, Button.input.Channel-SS_Channels_Add[1]+1); SS_DoCommand(vdSlimServer, g_SlimServer_UnitNum, SS_cmdPlay); } } button_event [TP_SServer,254] // Sense if a finger is on the scroll bar for browsing ... { PUSH: SServer_BScroll[1] = 1; RELEASE: { // If level event actually fired, then send SetPage to module if (SServer_BScroll[1] = 2) SS_UI_SetPage(vdSlimServer, 1, SServer_LastLev[1]); off[SServer_BScroll[1]]; } } level_event [TP_SServer,5] { // Save the last level, set flag to indicate we've set the level SServer_LastLev[1] = level.value; SServer_BScroll[1] = 2; } (***********************************************************) (* THE ACTUAL PROGRAM GOES BELOW *) (***********************************************************) DEFINE_PROGRAM (***********************************************************) (* END OF PROGRAM *) (* DO NOT PUT ANY CODE BELOW THIS COMMENT *) (***********************************************************) --- NEW FILE: SlimServer,VPN-CP.tpd --- (This appears to be a binary file; contents omitted.) --- NEW FILE: SlimServerMod.axi --- PROGRAM_NAME='SlimServerMod' (*{{PS_SOURCE_INFO(PROGRAM STATS) *) (***********************************************************) (* FILE CREATED ON: 10/03/2004 AT: 09:00:00 *) (***********************************************************) (* FILE_LAST_MODIFIED_ON: 03/28/2005 AT: 22:52:18 *) (***********************************************************) (* ORPHAN_FILE_PLATFORM: 1 *) (***********************************************************) (*!!FILE REVISION: Rev 0 *) (* REVISION DATE: 10/03/2004 *) (* *) (* COMMENTS: *) (* *) (* Initial Release *) (* *) (***********************************************************) (*}}PS_SOURCE_INFO *) (* *) (* copyright : (C) 2004-2005 by Jeff Coffler *) (* email : net...@ta... *) (* *) (* This library is free software; you can redistribute it *) (* and/or modify it under the terms of the GNU Lesser *) (* General Public License as published by the Free *) (* Software Foundation; either version 2.1 of the License, *) (* or (at your option) any later version. *) (* *) (* This library is distributed in the hope that it will be *) (* useful, but WITHOUT ANY WARRANTY; without even the *) (* implied warranty of MERCHANTABILITY or FITNESS FOR A *) (* PARTICULAR PURPOSE. See the GNU Lesser General Public *) (* License for more details. *) (* *) (* You should have received a copy of the GNU Lesser *) (* General Public License along with this library; if not, *) (* write to the Free Software Foundation, Inc., 59 Temple *) (* Place, Suite 330, Boston, MA 02111-1307 USA *) (***********************************************************) #if_not_defined __SlimServer_Include__ #define __SlimServer_Include__ #include 'SyslogMod.axi'; (***********************************************************) (* DEVICE NUMBER DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_DEVICE (***********************************************************) (* CONSTANT DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_CONSTANT // Edit Constants/Recompile module if necessary char SS_MAX_PlayerCount = 8; // Maximum # of players supported char SS_MAX_PanelsInSystem = 4; // Maximum # of panels using single player at once char SS_MAX_BrowseSessions = 2; // Maximum # of concurrent "browse" sessions char SS_MAX_BrowseItemCount = 20; // Maximum # of items displayed per screen // Length of various data elements integer SS_LEN_Item = 128; integer SS_LEN_URL = 256; integer SS_LEN_Title = 96; integer SS_LEN_Artist = 48; integer SS_LEN_Album = 96; integer SS_LEN_Genre = 32; integer SS_LEN_Track = 4; integer SS_LEN_Year = 4; // Do not suggest editing below this point (malfunctions may result) char SS_Base_FeedbackP_Varchar = 20; // Number of varchar's reserved for panel feedback char SS_Base_FeedbackV_Channels = 5; // Base channel # for player VD feedback char SS_Base_FeedbackV_Levels = 5; // Base level # for player for VD feedback char SS_Range_FeedbackV_Channels = 10; // # of channels used in VD feedback for any one unit char SS_Range_FeedbackV_Levels = 12; // # of levels used in VD feedback for any one unit char SS_Base_Browse_Items = 140; // Base varchar number for browse items char SS_Base_Browse_AddBtn = 160; // Base varchar number for browse "Add" button long SS_MAX_vdBuf = 128; // Maximum size of virtual device message char SS_MAX_PlayerID = 32; // Maximum length of player ID (TCP/IP # or MAC addr) - URL Encoded char SS_MAX_UI_errText = 80; // Maximum length of UI error text // Flags to control module updates for panel char SS_Flag_No_G4_Optimize = 1; // Optimize for G4 panels (if device > 255) char SS_Flag_No_Album_Art = 2; // Do not display album art on G4 panels char SS_Disable_Panel_Channels = 4; // Disable channel feedback on touchpanels char SS_Flag_SongLvl = 8; // Show level as song progresses char SS_Flag_SongTime = 16; // Show time as song progresses (more I/O to panel) // SlimServer Valid Commands: char SS_opDoCommand = 1; // Perform command (Play, Pause, etc) char SS_opGetStatus = 10; // Request one-time status from SlimServer char SS_opSetStatusUpds = 100; // Override status update frequency at "steady state" char SS_opSetPanels = 101; // Set panels that module should keep up to date char SS_opPanelForceUpd = 102; // Force panel to update state immediately char SS_opSetDebugDetail = 103; // Set debugging detail char SS_opDoExtCommand = 104; // Perform extended command (Sleep, Volume, etc) char SS_opUICommand = 150; // Module cmd: UI (User Interface) operation // Types of operations (and parameters) for SS_opDoCommand: char SS_cmdPlay = 1; // Equivalent to pressing the play button char SS_cmdStop = 2; char SS_cmdPause = 3; char SS_cmdJump_Fwd = 4; char SS_cmdJump_Rew = 5; char SS_cmdScan_Fwd = 6; char SS_cmdScan_Rew = 7; char SS_cmdScan_End = 8; char SS_cmdPower_Toggle = 9; char SS_cmdNumber_0 = 10; char SS_cmdNumber_1 = 11; char SS_cmdNumber_2 = 12; char SS_cmdNumber_3 = 13; char SS_cmdNumber_4 = 14; char SS_cmdNumber_5 = 15; char SS_cmdNumber_6 = 16; char SS_cmdNumber_7 = 17; char SS_cmdNumber_8 = 18; char SS_cmdNumber_9 = 19; char SS_cmdRescan = 20; char SS_cmdVolume_Up = 24; char SS_cmdVolume_Down = 25; char SS_cmdVolume_Mute = 26; char SS_cmdPower_Off = 27; char SS_cmdPower_On = 28; char SS_cmdBright_Tog = 30; char SS_cmdBright_Down = 31; char SS_cmdBright_Up = 32; char SS_cmdTextSz_Tog = 33; char SS_cmdTextSz_Down = 34; char SS_cmdTextSz_Up = 35; char SS_cmdShuffl_Off = 40; char SS_cmdShuffl_Song = 41; char SS_cmdShuffl_Album = 42; char SS_cmdRepeat_Off = 43; char SS_cmdRepeat_One = 44; char SS_cmdRepeat_All = 45; char SS_cmdPlaydisp_Tog = 50; char SS_cmdPlaydisp_0 = 51; char SS_cmdPlaydisp_1 = 52; char SS_cmdPlaydisp_2 = 53; char SS_cmdPlaydisp_3 = 54; char SS_cmdPlaydisp_4 = 55; char ss_cmdPlaydisp_5 = 56; char ss_cmdPlayL_Clear = 60; // Types of operations (and parameters) for SS_opDoExtCommand: char SS_extCmdVolume = 1; // Volume adjustments (supports relative adjustment) // Limit -> 0-100 Absolute, -100 - +100 Relative char SS_extCmdSleep = 2; // Sleep time adjustment (absolute only) // Play modes (from structure _sSS_StatusInfo) char SS_PlayMode_Unknown = 0; // Play Mode: Unknown char SS_PlayMode_Play = 1; // Play Mode: Play char SS_PlayMode_Pause = 2; // Play Mode: Pause char SS_PlayMode_Stop = 3; // Play Mode: Stop char SS_PlayMode_Off = 4; // Play Mode: Off // Response packets that we send to mainline code char SS_Pkt_Status = 1; // Status response char SS_Pkt_Playlist = 2; // Playlist response char SS_Pkt_UI_Error = 10; // UI Error Packet // Types of operations for _sSS_GetBrowseInfo: char SS_infoTitle = 1; // Get list of available titles char SS_infoArtist = 2; // Get list of available artists char SS_infoAlbum = 3; // Get list of available albums char SS_infoGenre = 4; // Get list of available genre char SS_infoList = 5; // Get list of available Playlists char SS_infoTitleFromList = 6; // Get list of titles given a playlist // UI (user interface) operation codes char SS_UI_opBegin = 1; // Begin presenting UI to caller char SS_UI_opReset = 2; // Reset UI to "root" screen char SS_UI_opSelect = 3; // "Select" specified item (drill down) char SS_UI_opQueue = 4; // Queue specified item char SS_UI_opBackup = 5; // Go back one "level" (unselect) char SS_UI_opNext = 6; // Set cursor to next page char SS_UI_opPrev = 7; // Set cursor to previous page char SS_UI_opSearch = 8; // Search for item at the current level char SS_UI_opSetPage = 9; // Position browse screen to specific location in list // UI (user interface) error response codes: char SS_UI_errNoBegin = 1; // UI interface has not been started yet char SS_UI_errBadSession = 2; // UI session number is not valid char SS_UI_errBadLevel = 3; // UI 'level number' is not valid char SS_UI_errListTooShort = 10; // UI list length is too short char SS_UI_errListTooLong = 11; // UI list length is longer than compiled maximum char SS_UI_errInvalidParameter = 12; // Parameter to routine is invalid char SS_UI_errNoSuchItem = 13; // Selecting or queueing an item that doesn't exist char SS_UI_errSelectTermItem = 14; // Can't select terminal item (title) char SS_UI_errMaxLevelReached = 15; // Can't select items at this level (max level reached) char SS_UI_errInvalidQueueLvl = 16; // Can't queue items at this level char SS_UI_errBackupTooFar = 17; // Can't back up before first page char SS_UI_errForwardTooFar = 18; // Can't go forward beyond last page char SS_UI_errSinglePage = 19; // Can't search when all data fits on screen char SS_UI_errStringNotFound = 20; // Requested search string not found // Arrays to easily define definitions for browse purposes integer SS_Channels_Items[] = { 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160 }; integer SS_Channels_Add[] = { 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180 }; // 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, // 191, 192, 193, 194, 195, 196, 197, 198, 199, 200 (***********************************************************) (* DATA TYPE DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_TYPE // Packets to transmit to the SlimServer module structure _sSS_DoExtOpcode { char opCode; char unitNum; // Most extended commands integer intParam1; integer intParam2; // Specifically used for SS_DoExtCommand slong slParam1; } structure _sSS_UI_DoCommand { char sessionNum; char opCode; integer param1; char sParam1[SS_LEN_Item]; } structure _sSS_QueueFile { char type; // Specify either the URL *OR* the itemID to queue char item[SS_LEN_URL]; long itemID; // Filtering criteria long idGenre; long idArtist; long idAlbum; // Filtering criteria (via QueueFile API - if written) char sfGenre[SS_LEN_Genre]; char sfArtist[SS_LEN_Artist]; char sfAlbum[SS_LEN_Album]; } // Packets sent from SlimServer module to caller structure _sSS_StatusInfo { // Response to a status request: char PlayerName[32]; // Player name (size can be increased if needed) char fPlayer_Connected; // Player currently connected? char fPower; // Player currently powered on? char SignalStrength; // Signal Strength (1-100, 0 if not wireless) char Mode; // Play mode (see SS_PlayMode_* constants) sinteger Rate; // Rate (Rewinding: <0, Fast Fwd: >1, Play: 1 integer SongTime; // Seconds of song that have been played integer SongDuration; // Total seconds of current song integer sleepTime; // Number of minutes player was set to sleep integer sleepRemaining; // Number of minutes remaining prior to sleep (if sleepTime is set) char MixerVolume; // Current Volume Setting: 0-100 char MixerBalance; // Reserved: Current Balance Setting: 0-100 char MixerBass; // Reserved: Current Bass Setting: 0-100 char MixerTreble; // Reserved: Current Treble Setting: 0-100 char MixerPitch; // Reserved: Current Pitch Setting: 80-120 char PlaylistRepeat; // Playlist Repeat State (0: Stop at end, 1: Repeat current song, 2: Repeat all songs) char PlaylistShuffle; // Playlist Shuffle State (0: None, 1: Songs, 2: Albums) long PlaylistCurIndex; // Index of currently played item (1 is first item) long PlaylistTracks; // Total number of tracks in playlist } structure _sSS_Playlist { // Response to a status playlist request: long lIndex; // Index of this song in the playlist long lID; // Internal database ID of item in playlist char sTitle[SS_LEN_Title]; // Remaining fields: Tag data char sArtist[SS_LEN_Artist]; char sAlbum[SS_LEN_Album]; char sGenre[SS_LEN_Genre]; } // UI related packets structure _sSS_UI_ErrorResult { // Response if a UI command fails in some way char sessionNum; // Browser session number char lvl; // Current depth/level of UI code integer errCode; // Error code from SlimServer UI component char errText[SS_MAX_UI_errText]; // Error text from SlimServer UI component } structure _sSS_GetBrowseInfo { // Packet to fetch browse information char type; // Type of fetch operation long startItem; // Starting item number to fetch long countItem; // Number of items to fetch for page char fSortTrack; // If getting title list, sort by track? // Filtering criteria long idArtist; long idAlbum; long idGenre; // Perform "search" (limit list of items returned to those containing search string) char sListDir[SS_LEN_URL]; // Directory/URL for playlist char sSearch[SS_LEN_Item]; // Search restriction text // Returned once query is performed long maxItems; // Maximum number of items available } (***********************************************************) (* VARIABLE DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_VARIABLE #if_not_defined __SlimServer_Module_Compilation__ // Note on logging levels: // "Debug" is VERY verbose ... // "Info" logs all responses from SlimServer module // "Notice" and higher notes unusual exceptions only // See Syslog module for further details on logging levels char llSlimServer[llEntry_MAX] = // Logging for SlimServer notifications { Warning (*or Debug or Info or Warning*), Error (*No_Errors*) }; volatile DEV SS_noPanelList[1]; // Empty panel list (for ease in stopping panel updates) #end_if // __SlimServer_Module_Compilation__ (***********************************************************) (* LATCHING DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_LATCHING (***********************************************************) (* MUTUALLY EXCLUSIVE DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_MUTUALLY_EXCLUSIVE (***********************************************************) (* SUBROUTINE/FUNCTION DEFINITIONS GO BELOW *) (***********************************************************) (* EXAMPLE: DEFINE_FUNCTION <RETURN_TYPE> <NAME> (<PARAMETERS>) *) (* EXAMPLE: DEFINE_CALL '<NAME>' (<PARAMETERS>) *) define_function integer SlimServer_Chan(char unitNum, char theChan) // SlimServer_Chan: Returns the channel number for associated SlimServer unit/channel combination { return SS_Base_FeedbackV_Channels + ((unitNum - 1) * SS_Range_FeedbackV_Channels) + theChan; } define_function SS_DoCommand (dev vd, char unitNum, char op) { char sBuffer[SS_MAX_vdBuf]; // Marshall the data and transmit to the virtual device sBuffer = "SS_opDoCommand,unitNum,op"; Diag(llSlimServer, Debug, 'SlimServer', "'Sending SS_DoCommand request to module; bytes=',Length_String(sBuffer)"); Send_Command vd, "sBuffer"; } define_function SS_DoExtCommand (dev vd, char unitNum, char opCode, char fRelative, slong param) // SS_DoExtCommand: Request SlimServer to perform an extended command // vd: Virtual device for transmits to SlimServer module // unitNum: Unit number that we'd like status for // opCode: Operations code to perform (see documentation / headers) // fRelative: Relative or absolute setting (0 -> Absolute); // relative only valid for some commands // param: Parameter to be set for related opCode { _sSS_DoExtOpcode cmdData; cmdData.opCode = SS_opDoExtCommand; cmdData.unitNum = unitNum; cmdData.intParam1 = opCode; cmdData.intParam2 = fRelative; cmdData.slParam1 = param; Diag(llSlimServer, Debug, 'SlimServer', "'Sending SS_opDoExtCommand (opcode=',itoa(opCode),') request to module'"); SS_DoExtOpcode(vd, cmdData); } define_function SS_DoExtOpcode (dev vd, _sSS_DoExtOpcode cmdData) { char sBuffer[SS_MAX_vdBuf]; long lPos; sinteger siStatus; // Marshall the data and transmit to the virtual device sBuffer = "cmdData.opCode"; // Store opCode lPos = 2; siStatus = Variable_To_String(cmdData, sBuffer, lPos); if (siStatus == 0) // Success Send_Command vd, "sBuffer"; else // Failure Diag(llSlimServer, Error, 'SlimServer', "'Failure encoding SS_DoExtOpcode data, Error=',itoa(siStatus)"); } define_function SS_GetStatus (dev vd, char unitNum, integer startSong, integer numSongs) // SS_GetStatus: Request SlimServer to return it's current status // vd: Virtual device for transmits to SlimServer module // unitNum: Unit number that we'd like status for // startSong: Starting song number (zero based for current song) // numSong: Number of songs that we'd like in the playlist { _sSS_DoExtOpcode cmdData; cmdData.opCode = SS_opGetStatus; cmdData.unitNum = unitNum; cmdData.intParam1 = startSong; cmdData.intParam2 = numSongs; Diag(llSlimServer, Debug, 'SlimServer', "'Sending SS_opGetStatus request to module'"); SS_DoExtOpcode(vd, cmdData); } define_function SS_SetDebugDetail (dev vd, char fExtDebug) // SS_SetDebugDetail: Set level of debugging detail // vd: Virtual device for transmits to SlimServer module // fExtDebug: 0 -> No extended debugging, != 0 -> Extended debugging // // Note: Extended debugging returns (via logging mechanisms) every response from // the Slim Server in excruciating detail. Almost never needed unless directed. { _sSS_DoExtOpcode cmdData; cmdData.opCode = SS_opSetDebugDetail; cmdData.intParam1 = fExtDebug; Diag(llSlimServer, Debug, 'SlimServer', "'Sending SS_opSetDebugDetail request to module'"); SS_DoExtOpcode(vd, cmdData); } define_function SS_SetStatusUpdates (dev vd, integer secs, integer flags) // SS_SetStatusUpdates: Override defaults for frequency of status updates // vd: Virtual device for transmits to SlimServer module // secs: Number of seconds for updates (Note: Module forces minimum value) // flags: Special flags (global) to use for panel updates { _sSS_DoExtOpcode cmdData; cmdData.opCode = SS_opSetStatusUpds; cmdData.intParam1 = secs; cmdData.intParam2 = flags; Diag(llSlimServer, Debug, 'SlimServer', "'Sending SS_opSetStatusUpds request to module'"); SS_DoExtOpcode(vd, cmdData); } define_function SS_SetPanels (dev vd, char unitNum, dev panelList[]) // SS_SetPanels: Set panels that module should keep up to date // vd: Virtual device for transmits to SlimServer module // unitNum: Unit number to set (or clear) for feedback // panelList: List of panels that should be kept up to date { char sBuffer[SS_MAX_vdBuf]; long lPos; sinteger siStatus; // Marshall the data and transmit to the virtual device sBuffer = "SS_opSetPanels,unitNum,length_array(panelList)"; lPos = 4; siStatus = Variable_To_String(panelList, sBuffer, lPos); if (siStatus == 0) { // Success Diag(llSlimServer, Debug, 'SlimServer', "'Sending SS_opSetPanels request to module with panelList len=',itoa(length_array(panelList))"); Send_Command vd, "sBuffer"; } else // Failure Diag(llSlimServer, Error, 'SlimServer', "'Failure encoding _sSS_SetPanels data, Error=',itoa(siStatus)"); } define_function SS_PanelForceUpdate (dev vd, char unitNum) // SS_PanelForceUpdate: Force panel to be updated immediately // vd: Virtual device for transmits to SlimServer module // unitNum: Unit number to update { Diag(llSlimServer, Debug, 'SlimServer', "'Sending SS_opForcePanelUpd request to module with unitNum=',itoa(unitNum)"); Send_Command vd, "SS_opPanelForceUpd,unitNum"; } // User Interface Simulation Routines // // The following routines implement a sample UI for the SlimServer: // // SS_UI_Begin: Begin UI Operations // SS_UI_Reset: Reset UI to "root" screen // SS_UI_Select: "Select" specified item (drill down) // SS_UI_Queue: Queue specified item // SS_UI_Backup: Back up one "level" (essentially unselect) // SS_UI_Next: Set cursor to next page // SS_UI_Prev: Set cursor to previous page // SS_UI_Search: Search for item containing w/param at current level // SS_UI_SetPage: Position browse screen to specific location in list define_function SS_UI_PerformOp(dev vd, char sessionNum, char op, integer param, char str[]) // SS_UI_PerformOp: Internal routine to perform a UI operation // vd: Virtual device for transmits to SlimServer module // sessionNum: Browse session number for query purposes // op: Type of UI operation to perform // param: Parameter for command (or zero) // str: String parameter for command (or empty string) { char sBuffer[SS_MAX_vdBuf]; long lPos; sinteger siStatus; _sSS_UI_DoCommand uiBuffer; uiBuffer.sessionNum = sessionNum; uiBuffer.opCode = op; uiBuffer.param1 = param; uiBuffer.sParam1 = str; // Marshall the data and transmit to the virtual device sBuffer = "SS_opUICommand"; // Store UI opCode (performing UI command) lPos = 2; siStatus = Variable_To_String(uiBuffer, sBuffer, lPos); if (siStatus == 0) { // Success Diag(llSlimServer, Debug, 'SlimServer', "'Sending SS_opUICommand request to module; opCode=',itoa(op),', bytes=',itoa(lPos-1)"); Send_Command vd, "sBuffer"; } else // Failure Diag(llSlimServer, Error, 'SlimServer', "'Failure encoding SS_opUICommand data, Error=',itoa(siStatus)"); } define_function SS_UI_Begin(dev vd, dev panel, char sessionNum, integer numLines) // SS_UI_Begin: Begin UI Operations // vd: Virtual device for transmits to SlimServer module // panel: Panel device that will be browsing music collection // sessionNum: Browse session number for query purposes // numLines: Number of lines to present for UI interface { char sBuffer[SS_LEN_Item]; long lPos; sinteger siStatus; // Marshall the data and transmit to the virtual device Diag(llSlimServer, Debug, 'SlimServer', 'Preparing SS_opUICommand (SS_UI_opBegin) request'); clear_buffer sBuffer; lPos = 1; siStatus = Variable_To_String(panel, sBuffer, lPos); if (siStatus != 0) { // Failure Diag(llSlimServer, Error, 'SlimServer', "'Failure encoding panel in SS_UI_Begin, Error=',itoa(siStatus)"); return; } SS_UI_PerformOp(vd, sessionNum, SS_UI_opBegin, numLines, sBuffer); } define_function SS_UI_Reset(dev vd, char sessionNum) // SS_UI_Reset: Reset UI to "root" screen // vd: Virtual device for transmits to SlimServer module // sessionNum: Browse session number for query purposes { Diag(llSlimServer, Debug, 'SlimServer', 'Preparing SS_opUICommand (SS_UI_opReset) request'); SS_UI_PerformOp(vd, sessionNum, SS_UI_opReset, 0, ''); } define_function SS_UI_Select(dev vd, char sessionNum, integer item) // SS_UI_Select: "Select" specified item (drill down) // vd: Virtual device for transmits to SlimServer module // browseNum: Browse session number for query purposes // item: Item number to select { Diag(llSlimServer, Debug, 'SlimServer', 'Preparing SS_opUICommand (SS_UI_opSelect) request'); SS_UI_PerformOp(vd, sessionNum, SS_UI_opSelect, item, ''); } define_function SS_UI_Queue(dev vd, char unitNum, char sessionNum, integer item) // SS_UI_Queue: Queue specified item // vd: Virtual device for transmits to SlimServer module // unitNum: Unit number to queue item(s) for // sessionNum: Browse session number for query purposes // item: Item number to select { Diag(llSlimServer, Debug, 'SlimServer', 'Preparing SS_opUICommand (SS_UI_opQueue) request'); SS_UI_PerformOp(vd, sessionNum, SS_UI_opQueue, item, "unitNum"); } define_function SS_UI_Backup(dev vd, char sessionNum) // SS_UI_Backup: Back up one "level" (essentially unselect) // vd: Virtual device for transmits to SlimServer module // sessionNum: Browse session number for query purposes { Diag(llSlimServer, Debug, 'SlimServer', 'Preparing SS_opUICommand (SS_UI_opBackup) request'); SS_UI_PerformOp(vd, sessionNum, SS_UI_opBackup, 0, ''); } define_function SS_UI_Next(dev vd, char sessionNum) // SS_UI_Next: Set cursor to next page // vd: Virtual device for transmits to SlimServer module // sessionNum: Browse session number for query purposes { Diag(llSlimServer, Debug, 'SlimServer', 'Preparing SS_opUICommand (SS_UI_opNext) request'); SS_UI_PerformOp(vd, sessionNum, SS_UI_opNext, 0, ''); } define_function SS_UI_Prev(dev vd, char sessionNum) // SS_UI_Prev: Set cursor to previous page // vd: Virtual device for transmits to SlimServer module // sessionNum: Browse session number for query purposes { Diag(llSlimServer, Debug, 'SlimServer', 'Preparing SS_opUICommand (SS_UI_opPrev) request'); SS_UI_PerformOp(vd, sessionNum, SS_UI_opPrev, 0, ''); } define_function SS_UI_Search(dev vd, char sessionNum, char str[]) // SS_UI_Search: Search for item at the current level // vd: Virtual device for transmits to SlimServer module // sessionNum: Browse session number for query purposes // str: String to search for (beginning of item searches only) { Diag(llSlimServer, Debug, 'SlimServer', 'Preparing SS_opUICommand (SS_UI_opSearch) request'); SS_UI_PerformOp(vd, sessionNum, SS_UI_opSearch, 0, str); } define_function SS_UI_SetPage(dev vd, char sessionNum, char location) // SS_UI_SetPage: Position browse screen to specific location in browse list // vd: Virtual device for transmits to SlimServer module // sessionNum: Browse session number for query purposes // percentage: Percentage of distance through list (255=start of list, 0=end) { Diag(llSlimServer, Debug, 'SlimServer', 'Preparing SS_opUICommand (SS_UI_opSetPage) request'); SS_UI_PerformOp(vd, sessionNum, SS_UI_opSetPage, location, ''); } (***********************************************************) (* STARTUP CODE GOES BELOW *) (***********************************************************) DEFINE_START (***********************************************************) (* THE EVENTS GOES BELOW *) (***********************************************************) DEFINE_EVENT (***********************************************************) (* THE ACTUAL PROGRAM GOES BELOW *) (***********************************************************) DEFINE_PROGRAM #end_if // __SlimServer_Include__ --- NEW FILE: SlimServerMod.doc --- (This appears to be a binary file; contents omitted.) --- NEW FILE: SlimServer.apw --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Workspace [ <!-- Common Elements --> <!ELEMENT Identifier (#PCDATA)> <!ELEMENT Comments (#PCDATA)> <!ELEMENT CreationDate (#PCDATA)> <!-- Workspace Elements--> <!ELEMENT Workspace ( Identifier, CreateVersion, PJS_File?, PJS_ConvertDate?, PJS_CreateDate?, Comments?, Project*)> <!ATTLIST Workspace CurrentVersion CDATA #REQUIRED> <!ELEMENT CreateVersion (#PCDATA)> <!-- Conversion data only: only included for files converted from the old .pjs database --> <!ELEMENT PJS_File (#PCDATA)> <!ELEMENT PJS_ConvertDate (#PCDATA)> <!ELEMENT PJS_CreateDate (#PCDATA)> <!ELEMENT Project ( Identifier, Designer?, DealerID?, SalesOrder?, PurchaseOrder?, Comments?, System*)> <!ELEMENT Designer (#PCDATA)> <!ELEMENT DealerID (#PCDATA)> <!ELEMENT SalesOrder (#PCDATA)> <!ELEMENT PurchaseOrder (#PCDATA)> <!ELEMENT System ( Identifier, SysID, TransSerial?, TransModem?, TransTCPIP?, VirtualNetLinxMasterFlag?, VNMRestoreIPSettings?, VNMSystemID?, IsAuthenticationEnabled?, UserName?, Password?, Comments?, File*)> <!ATTLIST System IsActive (true | false) "false" Platform (Axcess | Netlinx) "Axcess" Transport (Serial | Modem | TCPIP) "Serial"> <!ELEMENT SysID (#PCDATA)> <!ELEMENT TransSerial (#PCDATA)> <!ELEMENT TransModem (#PCDATA)> <!ELEMENT TransTCPIP (#PCDATA)> <!ELEMENT VirtualNetLinxMasterFlag (#PCDATA)> <!ELEMENT VNMRestoreIPSettings (#PCDATA)> <!ELEMENT VNMSystemID (#PCDATA)> <!ELEMENT IsAuthenticationEnabled (#PCDATA)> <!ELEMENT UserName (#PCDATA)> <!ELEMENT Password (#PCDATA)> <!ELEMENT File ( Identifier, FilePathName, Comments?, DeviceMap*, IRDB*)> <!ATTLIST File Type (Source | MasterSrc | Include | Module | AXB | IR | TPD | TP4 | KPD | TKO | AMX_IR_DB | IRN_DB | Other | DUET) "Other" CompileType (Axcess | Netlinx | None) "None"> <!ELEMENT FilePathName (#PCDATA)> <!ELEMENT DeviceMap (DevName)> <!ATTLIST DeviceMap DevAddr CDATA #REQUIRED> <!ELEMENT DevName (#PCDATA)> <!ELEMENT IRDB (Property, DOSName, UserDBPathName, Notes)> <!ATTLIST IRDB DBKey CDATA #REQUIRED> <!ELEMENT Property (#PCDATA)> <!ELEMENT DOSName (#PCDATA)> <!ELEMENT UserDBPathName (#PCDATA)> <!ELEMENT Notes (#PCDATA)> ]> <Workspace CurrentVersion="3.0"><Identifier>SlimServer WS</Identifier> <CreateVersion>2.1</CreateVersion> <PJS_File></PJS_File> <PJS_ConvertDate></PJS_ConvertDate> <PJS_CreateDate></PJS_CreateDate> <Comments>Sample Workspace for SlimServer Sample Program</Comments> <Project><Identifier>SlimServer</Identifier> <Designer>Jeff Coffler</Designer> <DealerID>N/A</DealerID> <SalesOrder>N/A</SalesOrder> <PurchaseOrder></PurchaseOrder> <Comments></Comments> <System IsActive="true" Platform="Netlinx" Transport="TCPIP"><Identifier>NetLinx</Identifier> <SysID>1</SysID> <TransSerial>COM1,38400,8,None,1,None</TransSerial> <TransModem>COM1,38400,8,None,1,None</TransModem> <TransTCPIP>netlinx.taltos.com:1319:1</TransTCPIP> <VirtualNetLinxMasterFlag>0</VirtualNetLinxMasterFlag> <VNMRestoreIPSettings>0.0.0.0:1319:1</VNMRestoreIPSettings> <VNMSystemID>1</VNMSystemID> <IsAuthenticationEnabled>0</IsAuthenticationEnabled> <UserName></UserName> <Password></Password> <Comments>Primary NetLinx Controller</Comments> <File CompileType="Netlinx" Type="MasterSrc"><Identifier>Main-Sample</Identifier> <FilePathName>Main-Sample.axs</FilePathName> <Comments></Comments> </File> <File CompileType="None" Type="TP4"><Identifier>SlimServer-Sample</Identifier> <FilePathName>SlimServer-Sample.TP4</FilePathName> <Comments>Sample Touchpanel File for MVP-8400</Comments> </File> <File CompileType="None" Type="Include"><Identifier>SlimServerMod</Identifier> <FilePathName>SlimServerMod.axi</FilePathName> <Comments></Comments> </File> <File CompileType="None" Type="Include"><Identifier>SyslogMod</Identifier> <FilePathName>SyslogMod.axi</FilePathName> <Comments></Comments> </File> </System> </Project> </Workspace> --- NEW FILE: README.txt --- This file is intended to be viewed with "Notepad" in word-wrap mode (see "Format" menu). Released Version: B1.0 (Beta Release Candidate 1) Release Date: Saturday, 02-Apr-2005 ----- Setup information and notes for SlimServerMod Module: The SlimServer project integrates an AMX NetLinx control system and a wireless (or wired) 2-way touchpanel with a Squeezebox or Squeezebox2 from Slim Devices (http://www.slimdevices.com). As of the time of this release, the SlimServerMod module is compatible with the released build of SlimServer v6.0 or v6.0.1. This module is not compatible with any previous version of the SlimServer software. The following files are provided: LICENSE.txt: Open source license; you are obligated to abide by this or not use the software Main-Sample.axs: Sample (mainline) Driver Program README.txt: This file SlimServer,MVP8400.TP4: Sample MVP-8400 (TPDesign4) File SlimServer,VPN-CP.tpd: Sample VPN-CP (TPDesign3) File SlimServer.apw: NetLinx Studio (v2.x) workspace file SlimServerMod.axi: SlimServer Include file and API definition file SlimServerMod.doc: Complete documetation file on the module SlimServerMod.tko: SlimServer Module (compiled) SyslogMod.axi: Syslog Include file Notes on Syslog: All files under SourceForge project NetLinx-Modules are "syslog friendly". This means that you may choose to use syslog, or you may choose to not use syslog. By default, syslog is disabled (and only controls logging levels to the NetLinx console via 'SEND_STRING 0' commands). For SlimServerMod, SlimServerMod.axi defines variable 'llSlimServer', and controls logging levels for the module. SlimServerMod represents an open-source project. If you want source files, they are available via CVS from the SourceForge project 'NetLinx-Modules'. You are free to download the source code if you wish. If you make improvements to the code that you believe is generally useful, please submit your changes to netlinx-modules(at)taltos.com. That way, everyone can benefit from your changes. Thanks! The SlimServerMod code is regularly used by the author and several other sites. It is anticipated that it'll work with virtually any version of applicable AMX code. However, to be precise, SlimServerMod has been successfully tested with: SlimServer v6.0 and later NetLinx Master (NXC) firmware 2.31.137, v3.00.316 Modero MVP-8400 firmware 2.46.38, 2.55.43 TPDesign3 version 3.16 (Build 200) TPDesign4 version 2.3.1 (Build 353), version 2.4.0 (Build 406) --- NEW FILE: SlimServer,MVP-8400.TP4 --- (This appears to be a binary file; contents omitted.) |