UPM support for the WT5001 Serial MP3 module. This was tested specifically with the Grove Serial MP3 module.
 
   
  
  
  int cmd = -1;
  if (argc > 1)
    cmd = atoi(argv[1]);
  
  
    {
      cerr << "Failed to setup tty port parameters" << endl;
      return 1;
    }
  
  switch (cmd)
    {
    case 0:
      break;
   
    case 1:
      mp3->
play(upm::WT5001::SD, 1);
 
      break;
   
    case 2:
      break;
   
    case 3:
      break;
   
    case 4:
      break;
    default:
      
      printUsage(argv[0]);
      break;
    }   
  
  
  
  
  
  uint8_t vol = 0;
    cout << "The current volume is: " << int(vol) << endl;
  uint8_t ps = 0;
    cout << "The current play state is: " << int(ps) << endl;
  uint16_t numf = 0;
    cout << "The number of files on the SD card is: " << int(numf) << endl;
  uint16_t curf = 0;
    cout << "The current file is: " << int(curf) << endl;
  uint16_t year = 0;
  uint8_t month = 0, day = 0;
  if (mp3->
getDate(&year, &month, &day))
 
    cout << "The device date is: " << int(month) << "/" << int(day) 
         << "/" << int(year) << endl;
  uint8_t hour = 0, minute = 0, second = 0;
  if (mp3->
getTime(&hour, &minute, &second))
 
    cout << "The device time is: " << int(hour) << ":" << int(minute) 
         << ":" << int(second) << endl;
 
 | 
| enum   | WT5001_OPCODE_T {  
  NONE = 0x00, 
PLAY_SD = 0xa0, 
PLAY_SPI = 0xa1, 
PLAY_UDISK = 0xa2, 
 
  PAUSE = 0xa3, 
STOP = 0xa4, 
NEXT = 0xa5, 
PREVIOUS = 0xa6, 
 
  SET_VOLUME = 0xa7, 
QUEUE = 0xa8, 
PLAY_MODE = 0xa9, 
COPY_SD2FLASH = 0xaa, 
 
  COPY_UDISK2FLASH = 0xab, 
INSERT_SONG = 0xac, 
SET_DATE = 0xb1, 
SET_TIME = 0xb2, 
 
  SET_ALARM = 0xb3, 
SET_ALARM_DUR = 0xb4, 
CLEAR_ALARM = 0xb5, 
CLEAR_ALARM_DUR = 0xb6, 
 
  READ_VOLUME = 0xc1, 
READ_PLAY_STATE = 0xc2, 
READ_SPI_NUMF = 0xc3, 
READ_SD_NUMF = 0xc4, 
 
  READ_UDISK_NUMF = 0xc5, 
READ_CUR_FNAME = 0xc6, 
READ_CF_CHAR = 0xc7, 
READ_DATE = 0xd1, 
 
  READ_TIME = 0xd2
 
 } | 
|   | 
| enum   | WT5001_PLAYMODE_T { NORMAL = 0x00, 
SINGLE_REPEAT = 0x01, 
ALL_REPEAT = 0x02, 
RANDOM = 0x03
 } | 
|   | 
| enum   | WT5001_PLAYSOURCE_T { SD, 
SPI, 
UDISK
 } | 
|   | 
 | 
|   | WT5001 (int uart) | 
|   | 
|   | ~WT5001 () | 
|   | 
| bool  | dataAvailable (unsigned int millis) | 
|   | 
| int  | readData (char *buffer, size_t len) | 
|   | 
| int  | writeData (char *buffer, size_t len) | 
|   | 
| bool  | setupTty (speed_t baud=B9600) | 
|   | 
| bool  | checkResponse (WT5001_OPCODE_T opcode) | 
|   | 
| bool  | play (WT5001_PLAYSOURCE_T psrc, uint16_t index) | 
|   | 
| bool  | stop () | 
|   | 
| bool  | pause () | 
|   | 
| bool  | next () | 
|   | 
| bool  | previous () | 
|   | 
| bool  | setVolume (uint8_t vol) | 
|   | 
| bool  | queue (uint16_t index) | 
|   | 
| bool  | setPlayMode (WT5001_PLAYMODE_T pm) | 
|   | 
| bool  | insert (uint16_t index) | 
|   | 
| bool  | setDate (uint16_t year, uint8_t month, uint8_t day) | 
|   | 
| bool  | setTime (uint8_t hour, uint8_t minute, uint8_t second) | 
|   | 
| bool  | setAlarm (uint8_t hour, uint8_t minute, uint8_t second) | 
|   | 
| bool  | clearAlarm () | 
|   | 
| bool  | getVolume (uint8_t *vol) | 
|   | 
| bool  | getPlayState (uint8_t *ps) | 
|   | 
| bool  | getNumFiles (WT5001_PLAYSOURCE_T psrc, uint16_t *numf) | 
|   | 
| bool  | getCurrentFile (uint16_t *curf) | 
|   | 
| bool  | getDate (uint16_t *year, uint8_t *month, uint8_t *day) | 
|   | 
| bool  | getTime (uint8_t *hour, uint8_t *minute, uint8_t *second) | 
|   |