ESTABLISHING A CONNECTIONS



ESTABLISHING CONNECTIONS

The iHome Suite has a separate player/browser “service” running for each sound zone. A connection is established by opening a socket or telnet session using the hostname or IP address of the iHome followed by the port number corresponding to each service. The following table shows how to connect to the sound zone services:

|Zone |Port# |Telnet Command |

|1 |1234 |telnet 1234 |

|2 |1235 |telnet 1235 |

PROTOCOL DESCRIPTION

UNICODE

The service communicates using the UTF-8 Unicode character set. For systems that do not support Unicode character sets, this protocol is a binary protocol as each character is 2 bytes long. The following table shows text and corresponding hex codes:

|Text |ASCII hex codes |UTF-8 hex codes |

|Get |0x47,0x65,0x74 |0x00,0x47,0x00,0x65,0x00,0x74 |

For standard ascii characters from 0x00 – 0x7F, UTF-8 is simply a 2-byte version of the same code, i.e. ‘G’ = 0x0047. Therefore, to convert from ascii to Unicode when writing, write out a leading 0x00 byte before the ascii character. To convert when reading, read 2 bytes at a time. All Unicode characters in the range of 0x0000-0x007F can be converted to ascii by simply dropping the leading 0x00. Any characters above this range can either be discarded or used as special delimiters.

From this point forward in the document, assume that all characters and character strings are double byte UTF-8 character strings.

COMMAND FORMAT

is 0x0000

See table below

|Unicode Command String |Example (All chars are Unicode UTF-8) |Example Response (All chars are Unicode UTF-8) |

|Get .Count |Get Artists.Count //get the total count of |Artists.Count=9 |

| |artists | |

|Get (,1Classical2 |

| | |//where 0x001D and 0x001E are Unicode versions |

| | |of ascii group separator and ascii record |

| | |separator characters. |

|Get ( ).Count |Get Albums(3).Count //get the number of |Albums(3).Count=5 |

| |tracks in the 4th album. | |

|Get .(, |Get Playlists.3(0,2) //get the names of the |Playlists.3(0,2)=My |

|) |first 2 tracks of the 4th playlist. |Immortal0Bounce1 |

|Get Current. |Get Current.Path //get the path of the |Current.Path=Albums.3.2 //the 3rd track of the |

| |currently playing track. |4th album |

|SelectMedia . |SelectMedia Playlists.4 //start playing the |//it starts playing the 1st track in the 5th |

| |5th playlist |playlist and sends back the following |

| | |unsolicited responses: |

| | |Current.Track=Hey Mama0 //Name of song |

| | |and its index in the playlist |

| | |Current.Artist=Black Eyed Peas |

| | |Current.Album=Hey Mama |

| | |Current.Playlist=Top 25 Most Played |

| | |Current.Path=Playlists.5.0 |

| | |Current.Playstate=Play |

|SelectMedia ..|SelectMedia Genres.2.1 //play the 2nd track |//it starts playing the specified track and |

| |in the 3rd genre |sends unsolicited status as above |

|Stop |Stop |//stops the player and sends the following |

| | |unsolicited response |

| | |Current.Playstate=Stopped |

|Pause |Pause |//pauses the player and sends the following |

| | |unsolicited response: |

| | |Current.Playstate=Paused |

|Play |Play |//restarts the player on the current track. If|

| | |paused, it actually starts playing where it was|

| | |paused. If stopped, restarts the current |

| | |track. |

| | |Current.Playstate=Play |

|Next |Next |//skips to the next track and sends the |

| | |following unsolicited responses: |

| | |Current.Track=Hey Mama0 //Name of song |

| | |and its index in the playlist |

| | |Current.Artist=Black Eyed Peas |

| | |Current.Album=Hey Mama |

| | |Current.Playlist=Top 25 Most Played |

| | |Current.Path=Playlists.5.0 |

| | |Current.Playstate=Play |

|Previous |Previous |//skips to the previous track and sends the |

| | |following unsolicited responses: |

| | |Current.Track=Hey Mama0 //Name of song |

| | |and its index in the playlist |

| | |Current.Artist=Black Eyed Peas |

| | |Current.Album=Hey Mama |

| | |Current.Playlist=Top 25 Most Played |

| | |Current.Path=Playlists.5.0 |

| | |Current.Playstate=Play |

|Playmode and shuffle mode commands |ToggleShuffle |//sets shuffle and repeat modes of the player |

| |ShuffleOn |as indicated. Responds with the following |

| |ShuffleOff |unsolicited responses: |

| |RepeatPlaylist |Current.PlayMode=RepeatPlaylist |

| |RepeatTrack |Current.Shuffle=On |

| |RepeatOff | |

RESPONSE FORMAT

=

is the echo of the data portion of the Get command or the Current state being reported if response is unsolicited.

is depends on the request. See table in COMMAND FORMAT section.

is 0x0000

KEYWORD TABLE

|Keyword Type |Keyword |Keyword Description |

|Command |Get |Instructs the sound zone service to respond to the specified |

| | |request |

| |SelectMedia |Instructs the sound zone service to begin playing the specified|

| | |playlist, artist, album, genre, or track |

| |Stop |Stops the player – subsequent play will restart the current |

| | |track |

| |Pause |Pauses the player – subsequent play will continue playing where|

| | |paused |

| |Play |Restarts the player |

| |Next |Goes to next track in the current playlist, artist, album, or |

| | |genre |

| |Previous |Goes to previous track in the current playlist, artist, album, |

| | |or genre |

| |ToggleShuffle |Toggles the current shuffle mode |

| |ShuffleOn |Turns on shuffle |

| |ShuffleOff |Turns off shuffle |

| |RepeatPlaylist |Sets playmode to repeat current playlist, artist, genre, or |

| | |album |

| |RepeatTrack |Sets playmode to repeat current track |

| |RepeatOff |Turns off repeat |

|Category |Playlists |All playlists in database |

| |Artists |All artists in database |

| |Albums |All albums in database |

| |Genres |All genres in database |

|Property //as in Current.|Track |Current.Track=Hey Mama0 //Name of song and its index in|

|or Album.4.5. | |the playlist |

| |Name |Playlist.1.Name=Top 25 Most Played |

| | |//Name of specified item |

| |Artist |Curren.Artist=Black Eyed Peas |

| | |//Name of artist associated with current track |

| |Album |Current.Album=Hey Mama |

| | |//Name of album associated with current track |

| |Path |Current.Path=Playlist.3.2 |

| | |//Path associated with current track |

| |Playlist |Current.Playlist=Top 25 Most Played |

| | |//Name of playlist associated with current track |

| |PlayState |Current.PlayState=Play |

| | |Current.PlayState=Stop |

| | |Current.PlayState=Pause |

| |PlayMode |Current.PlayMode=RepeatOff |

| | |Current.PlayMode=RepeatPlaylist |

| | |Current.PlayMode=RepeatTrack |

| |Shuffle |Current.Shuffle=On |

| | |Current.Shuffle=Off |

SPECIAL CHARACTERS/DELIMITERS

|Character Type |Character Code |Description |

| |0x0000 |Delimits a complete command or response |

| |0x001E |Delimits a line in a list in responses that involve lists of|

| | |items as in Get Playlists(0,5). |

| |0x001D |Separates the name from it’s index. The response to |

| | |Playlists(0,5) is of the form Name1Index1… |

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download