Specifications
} else {
/* close old MP3 file */
CloseHandle(FileHandle);
/* send the new song name to the ethernut */
send_song_name(song_no, &song_name[0]);
/* open the new MP3 */
if ((FileHandle = CreateFile( &song_name[0],
GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0))
== INVALID_HANDLE_VALUE)
{
printf("MP3 open failed with error %d\n", GetLastError());
}
}
}
/* The message handler for commands from the ethernut */
DWORD WINAPI CommandThread(LPVOID lpParam)
{
SOCKET sock=(SOCKET)lpParam;
char Buff[100];
while(1){
recv(sock, &Buff[0], 20 , 0);
printf("%s", &Buff[0]);
/* Pause stops the current transfer loop */
if ( strncmp("PAUSE", &Buff[0], 4) == 0){
play = 0;
Sleep(100);
reopen = 1;
/*
* UNPAUSE restarts the transfer
* reopens the file if stopped resets the buffer
*/
} else if ( strncmp("UNPAUSE", &Buff[0], 5) == 0){
if(stop){
open_MP3(song_no);
printf("open\n");
stop = 0;
}
play = 1;
/* STOP stops the current transfer loop */
} else if ( strncmp("STOP", &Buff[0], 3) == 0){
play = 0;
stop = 1;
Sleep(100);
reopen = 1;
/* NEXT increments the song count and opens the new file */
} else if ( strncmp("NEXT", &Buff[0], 3) == 0){
play = 0;
84










