/** * @brief Starts Audio streaming. * @param None * @retval Returns 0 if OK, otherwise 1. */ uint8_t MTP_Init(void) { static uint8_t is_initialized = 0; uint8_t ret = 1; if(is_initialized == 0) { if(USBH_MTP_IsReady(&hUSBHost) > 0) { if(USBH_MTP_GetNumObjects(&hUSBHost, 0, PTP_OFC_WAV, PTP_AT_Undefined, &NumObs) == USBH_OK) { /* Get objects handlers */ if(MTP_GetWavObjectHandles() == 0) { is_initialized = 1; ret = 0; } } } } else { ret = 0; } return ret; }
/** * @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; }