Ejemplo n.º 1
0
/**
  * @brief  Gets Wav Object Names.
  * @param  None
  * @retval Returns Status 0 if OK, otherwise 1.
  */
uint8_t MTP_GetWavObjectName(uint16_t object_index, uint8_t *filename)
{
  uint8_t ret = 1;
  MTP_ObjectInfoTypedef objectinfo;
  
  if(USBH_MTP_GetObjectInfo(&hUSBHost, WavHandles.Handler[object_index], &objectinfo) == USBH_OK)
  {
    strcpy((char *)filename, (char *)objectinfo.Filename);
    ret = 0;
  }
  return ret;
}
Ejemplo n.º 2
0
Archivo: mtp.c Proyecto: z80/stm32f429
/**
  * @brief  Explores Wav Files. 
  * @param  None
  * @retval Returns 0 if OK, otherwise 1.
  */
uint8_t MTP_ExploreWavFile(void)
{
  uint8_t ret = 1;
  uint32_t index;
  MTP_ObjectInfoTypedef objectinfo;
  
  MTP_Init();
  
  if(USBH_MTP_IsReady(&hUSBHost) > 0)
  {
    LCD_UsrLog("\nAvailable wav files:\n");
 
    /* Get Available WAV files number */
    if((NumObs = MTP_GetWavObjectNumber()) > 0)
    {
      /* Get objects handlers */
      if(MTP_GetWavObjectHandles() == 0)
      {
        ret = 0; 
        
        for (index = 0; index < NumObs; index ++)
        {
          if( USBH_MTP_GetObjectInfo (&hUSBHost, 
                                      WavHandles.Handler[index], 
                                      &objectinfo) == USBH_OK)
            
          {
            LCD_DbgLog(" %lu- %s\n", index, objectinfo.Filename);
          }
          else
          {
            ret = 1; 
          }
        }
      }
    }
  }
  else
  {
    LCD_ErrLog("MTP Device Not yet ready...\n");
  }
  
  return ret;
}