DownloadSrc.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:21k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * DownloadSrc.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  * MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  * This file implements screen flow and API of Download application
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  *------------------------------------------------------------------------------
  88.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  89.  *============================================================================
  90.  ****************************************************************************/
  91.  /**
  92.  * Copyright Notice
  93.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  94.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  95.  *  (It is illegal to remove this copyright notice from this software or any
  96.  *  portion of it)
  97.  */
  98. /**************************************************************
  99. FILENAME : DownloadSrc.c
  100.    PURPOSE : Main functions of the Fun and Games, Download application
  101. REMARKS : nil
  102. AUTHOR : Gurinder
  103. DATE : July-08-2003
  104. **************************************************************/
  105. #include "MMI_features.h"
  106. #include "StdC.h"
  107. #include "L4Dr1.h"
  108. #include "L4Dr.h"
  109. #include "FunAndGamesDefs.h"
  110. #include "FunAndGamesProts.h"
  111. #include "Unicodexdcl.h"
  112. #include "CommonScreens.h"
  113. #include "IdleAppDef.h"
  114. #include "NVRAMType.h"
  115. #include "NVRAMProt.h"
  116. #include "NVRAMEnum.h"
  117. #include "FileSystemDef.h"
  118. #include "FileSystemGProt.h"
  119. #include "GlobalDefs.h"
  120. #include "resource_audio.h"
  121. #include "EventsGprot.h"
  122. #include "historyGprot.h"
  123. #include "ProtocolEvents.h"
  124. #include "wgui_categories.h"
  125. #include "MainMenuDef.h"
  126. #include "TimerEvents.h"
  127. #include "stdio.h"
  128. #include "DownloadProtos.h"
  129. #include "DownloadDefs.h"
  130. #include "string.h"
  131. #include "WallpaperDefs.h"
  132. #include "ScreenSaverDefs.h"
  133. #include "DebugInitDef.h"
  134. #include "gpioInc.h"
  135. #include "SettingDefs.h"
  136. #include "WPSSProtos.h"
  137. #include "ProfileGprots.h"
  138. #include "PhoneBookGprot.h"
  139. #ifdef __MOD_SMSAL__
  140. #include "MessagesExDcl.h"
  141. #endif
  142. #include "mdi_datatype.h"
  143. #include "mdi_audio.h"
  144. #include "IdleAppDef.h"
  145. #include "SimDetectionGexdcl.h"
  146. /* 
  147. ** Define
  148. */
  149. /* 031705 Calvin modified */
  150. #include "gui.h"
  151. #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  152. #include "ThemeManager.h"
  153. #endif
  154. /* Calvin end */
  155. #define DWNL_FULL_SCR_IMG_NAME "ful"
  156. #define DWNL_FAC_ASS_IMG_NAME "ass"
  157. #define DWNL_FAC_TONE_NAME "mid"
  158. #define DWNL_FAC_IMELODY_NAME "imy"
  159. #define DWNL_IMG_GIF_EXT "gif"
  160. /* 
  161. ** Typedef 
  162. */
  163. /* 
  164. ** Local Variable
  165. */
  166. static DYNAUDIOINFO gDwnlFacToneInfo[MAXIMUM_FACTORY_TONES];
  167. static DYNIMAGEINFO gDwnlFacAssImageInfo[MAXIMUM_ASSOCIATED_FACTORY_IMAGES];
  168. static DYNIMAGEINFO gDwnlFacFullScrImageInfo[MAXIMUM_FULLSCREEN_FACTORY_IMAGES];
  169. #if defined(__MMI_IMELODY_SUPPORT__)
  170. static DYNAUDIOINFO gDwnlFacIMelodyInfo[MAXIMUM_FACTORY_IMELODY];
  171. #endif
  172. static U8 gDwnlImageData[MAX_IMAGE_HEADER_LENGTH + MAX_IMAGE_NAME_PATH_WIDTH + MAX_IMAGE_NAME_WIDTH];
  173. #if defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
  174. DYNAUDIOINFO gDwnlThmToneInfo[MAXIMUM_THEMES_TONES];
  175. #endif
  176. /* 
  177. ** Local Function
  178. */
  179. /* 
  180. ** Global Variable
  181. */
  182. extern CUSTOM_IMAGE nCustImageNames[];
  183. //extern U8 gIsOnIdleScreen;
  184. // extern U8 gIsSimValid;
  185. dwnl_context_struct g_dwnl_cntx;
  186. const S8 wbmpExtn[] = {'.','','w','','b','','m','','p','','',''};
  187. const S8 wbmExtn[] = {'.','','w','','b','','m','','',''};
  188. const S8 bmpExtn[] = {'.','','b','','m','','p','','',''};
  189. /* 
  190. ** Global Function
  191. */
  192. #if defined(__MMI_IMELODY_SUPPORT__)
  193. /*****************************************************************************
  194. * FUNCTION
  195. *  GetFactoryIMelodyInfo
  196. * DESCRIPTION
  197. *   Function to fill Audio Info Data for factory iMelody to Caller Pointer
  198. * PARAMETERS
  199. *   factoryAudioInfo IN address pointer to the table of factory iMelody
  200. * RETURNS
  201. * total number of downloaded factory iMelody
  202. * GLOBALS AFFECTED
  203. *   none
  204. *****************************************************************************/
  205. U8 GetFactoryIMelodyInfo(DYNAUDIOINFO ** factoryAudioInfo)
  206. {
  207. *factoryAudioInfo=gDwnlFacIMelodyInfo;
  208. return g_dwnl_cntx.TotalFacIMelodies;
  209. }
  210. #endif
  211. /*****************************************************************************
  212. * FUNCTION
  213. *  InitDownloadNVRAM
  214. * DESCRIPTION
  215. *   Initilize Download Data from NVRAM at Bootup
  216. * PARAMETERS
  217. * none
  218. * RETURNS
  219. * none
  220. * GLOBALS AFFECTED
  221. *   external_global
  222. *****************************************************************************/
  223. void InitDownloadNVRAM(void)
  224. {
  225. U8 i;
  226. U8 FileNamePath[MAX_IMAGE_HEADER_LENGTH + MAX_IMAGE_NAME_PATH_WIDTH + MAX_IMAGE_NAME_WIDTH];
  227. FILE_HANDLE fileHandle;
  228. S8 tmpFileName[MAX_IMAGE_NAME_WIDTH];
  229. /* factory full screen images */
  230. g_dwnl_cntx.TotalFacFullScrImages = 0;
  231. for(i=1; i<=MAXIMUM_FULLSCREEN_FACTORY_IMAGES; i++)
  232. {
  233. sprintf(tmpFileName,"%s%d.%s",DWNL_FULL_SCR_IMG_NAME,i,DWNL_IMG_GIF_EXT);
  234. AnsiiToUnicodeString((PS8)gDwnlFacFullScrImageInfo[g_dwnl_cntx.TotalFacFullScrImages].ImageName, (PS8)tmpFileName);
  235. AnsiiToUnicodeString((PS8)FileNamePath, FULLSCREEN_FACTORY_IMAGE_PATH);
  236. pfnUnicodeStrcat((PS8)FileNamePath,(PS8)gDwnlFacFullScrImageInfo[g_dwnl_cntx.TotalFacFullScrImages].ImageName);
  237. fileHandle= pfopen(FileNamePath,PFS_READ);
  238. if(fileHandle>0)
  239. {
  240. gDwnlFacFullScrImageInfo[g_dwnl_cntx.TotalFacFullScrImages].ImagesId=FULLSCREEN_FACTORY_IMAGE_BASE + i - 1;
  241. g_dwnl_cntx.TotalFacFullScrImages++;
  242. pfclose(fileHandle);
  243. }
  244. }
  245. /* factory associated images */
  246. g_dwnl_cntx.TotalFacAssoImages=0;
  247. for(i=1; i<=MAXIMUM_ASSOCIATED_FACTORY_IMAGES; i++)
  248. {
  249. sprintf(tmpFileName,"%s%d.%s",DWNL_FAC_ASS_IMG_NAME,i,DWNL_IMG_GIF_EXT);
  250. AnsiiToUnicodeString((PS8)gDwnlFacAssImageInfo[g_dwnl_cntx.TotalFacAssoImages].ImageName, (PS8)tmpFileName);
  251. AnsiiToUnicodeString((PS8)FileNamePath, ASSOCIATE_FACTORY_IMAGE_PATH);
  252. pfnUnicodeStrcat((PS8)FileNamePath,(PS8)gDwnlFacAssImageInfo[g_dwnl_cntx.TotalFacAssoImages].ImageName);
  253. fileHandle= pfopen(FileNamePath,PFS_READ);
  254. if(fileHandle>0)
  255. {
  256. gDwnlFacAssImageInfo[g_dwnl_cntx.TotalFacAssoImages].ImagesId=ASSOCIATED_FACTORY_IMAGE_BASE + i - 1;
  257. g_dwnl_cntx.TotalFacAssoImages++;
  258. pfclose(fileHandle);
  259. }
  260. }
  261. /* factory tones */
  262. g_dwnl_cntx.TotalFacTones = 0;
  263. for(i=1; i<=MAXIMUM_FACTORY_TONES; i++)
  264. {
  265. sprintf(tmpFileName,"%s%d.%s",DWNL_FAC_TONE_NAME,i,DWNL_FAC_TONE_NAME);
  266. AnsiiToUnicodeString((PS8)gDwnlFacToneInfo[g_dwnl_cntx.TotalFacTones].AudioName, (PS8)tmpFileName);
  267. AnsiiToUnicodeString((PS8)FileNamePath, FACTORY_TONE_PATH);
  268. pfnUnicodeStrcat((PS8)FileNamePath,(PS8)gDwnlFacToneInfo[g_dwnl_cntx.TotalFacTones].AudioName);
  269. fileHandle= pfopen(FileNamePath,PFS_READ);
  270. if(fileHandle>0)
  271. {
  272. gDwnlFacToneInfo[g_dwnl_cntx.TotalFacTones].AudioId=FACTORY_TONES_BASE + i - 1;
  273. g_dwnl_cntx.TotalFacTones++;
  274. pfclose(fileHandle);
  275. }
  276. }
  277. #if defined(__MMI_IMELODY_SUPPORT__)
  278. /* factory iMelodies */
  279. g_dwnl_cntx.TotalFacIMelodies=0;
  280. i=0;
  281. for(i=1; i<=MAXIMUM_FACTORY_IMELODY; i++)
  282. {
  283. sprintf(tmpFileName,"%s%d.%s",DWNL_FAC_IMELODY_NAME,i,DWNL_FAC_IMELODY_NAME);
  284. AnsiiToUnicodeString((PS8)gDwnlFacIMelodyInfo[g_dwnl_cntx.TotalFacIMelodies].AudioName, (PS8)tmpFileName);
  285. AnsiiToUnicodeString((PS8)FileNamePath, FACTORY_IMELODY_PATH);
  286. pfnUnicodeStrcat((PS8)FileNamePath,(PS8)gDwnlFacIMelodyInfo[g_dwnl_cntx.TotalFacIMelodies].AudioName);
  287. fileHandle= pfopen(FileNamePath,PFS_READ);
  288. if(fileHandle>0)
  289. {
  290. gDwnlFacIMelodyInfo[g_dwnl_cntx.TotalFacIMelodies].AudioId=FACTORY_IMELODY_BASE + i - 1;
  291. g_dwnl_cntx.TotalFacIMelodies++;
  292. pfclose(fileHandle);
  293. }
  294. }
  295. #endif
  296. }
  297. /*****************************************************************************
  298. * FUNCTION
  299. *  SyncDownloadFileSystem
  300. * DESCRIPTION
  301. *   To sync files between downloaded table and file system.
  302. * Delete files that are not in downloaded table
  303. * PARAMETERS
  304. * a. IN path to be sync
  305. * b. IN table to be sync
  306. * RETURNS
  307. * none
  308. * GLOBALS AFFECTED
  309. *   external_global
  310. *****************************************************************************/
  311. void SyncDownloadFileSystem(S8 *DirPath, DYNAMICINFO* dynInfo)
  312. {
  313. S8 SearchString[MAX_IMAGE_NAME_PATH_WIDTH+MAX_SEARCH_STR_LENGTH];
  314. S8 tempString[MAX_IMAGE_NAME_PATH_WIDTH+MAX_SEARCH_STR_LENGTH];
  315. S8 FileName[MAX_IMAGE_NAME_WIDTH];
  316. FILE_HANDLE fileHandle;
  317. strcpy(tempString, DirPath );
  318. strcat(tempString, AST_SEARCH_STR);
  319. AnsiiToUnicodeString((PS8)SearchString, (PS8)tempString);
  320. if(pfOpenError(fileHandle = pfindfirst(SearchString, 0, 0, NULL, FileName, MAX_IMAGE_NAME_WIDTH)))
  321. return;
  322. else
  323. {
  324. U8 i = 0 ;
  325. do
  326. {
  327. if(dynInfo->DynInfoType == IMAGEINFO)
  328. {
  329. for(i = 0; i<dynInfo->NoOfEntries; i++)
  330. if(pfnUnicodeStrcmp((PS8)dynInfo->DYNINFOUNION.ImageInfo[i].ImageName, FileName) == 0)
  331. break;
  332. }
  333. else if(dynInfo->DynInfoType == AUDIOINFO)
  334. {
  335. for(i = 0; i<dynInfo->NoOfEntries; i++)
  336. if(pfnUnicodeStrcmp((PS8)dynInfo->DYNINFOUNION.AudioInfo[i].AudioName, FileName) == 0)
  337. break;
  338. }
  339. if(i == dynInfo->NoOfEntries) /* could not find any file in the table */
  340. {
  341. strcpy(tempString, DirPath);
  342. AnsiiToUnicodeString((PS8)SearchString, (PS8)tempString);
  343. pfnUnicodeStrcat((PS8)SearchString,(PS8)FileName);
  344. if(pfError(pfdelete(SearchString)))
  345. PRINT_INFORMATION(("Error Deleteing File %s", FileName));
  346. else
  347. PRINT_INFORMATION(("File Deleted %s", FileName));
  348. }
  349. }while(!pfError(pfindnext(fileHandle, NULL, FileName, MAX_IMAGE_NAME_WIDTH)));
  350. }
  351. pfclose(fileHandle);
  352. }
  353. /*****************************************************************************
  354. * FUNCTION
  355. *  GetImageFileSystem
  356. * DESCRIPTION
  357. *   Function to get filename associated with the ImageId
  358. * PARAMETERS
  359. * ImageId IN index of image
  360. * RETURNS
  361. * pointer to filename
  362. * GLOBALS AFFECTED
  363. *   none
  364. *****************************************************************************/
  365. S8* GetImageFileSystem(U16 ImageId)
  366. {
  367. U8 *filename = NULL;
  368. if(ImageId>=FULLSCREEN_FACTORY_IMAGE_BASE && ImageId<=FULLSCREEN_FACTORY_IMAGE_BASE_END)
  369. {
  370. U8 i;
  371. for(i=0;i<g_dwnl_cntx.TotalFacFullScrImages;i++)
  372. {
  373. if(gDwnlFacFullScrImageInfo[i].ImagesId==ImageId) 
  374. {
  375. filename=gDwnlFacFullScrImageInfo[i].ImageName;
  376. }
  377. if(i==g_dwnl_cntx.TotalFacFullScrImages) return (S8*)(nCustImageNames[0].pImage);
  378. }
  379. gDwnlImageData[0] = GetFileExtension((PS8)filename);
  380.  
  381. AnsiiToUnicodeString((PS8)&gDwnlImageData[MAX_IMAGE_HEADER_LENGTH], FULLSCREEN_FACTORY_IMAGE_PATH);
  382. }
  383. else if(ImageId>=ASSOCIATED_FACTORY_IMAGE_BASE && ImageId<=ASSOCIATED_FACTORY_IMAGE_BASE_END)
  384. {
  385. U8 i;
  386. for(i=0;i<g_dwnl_cntx.TotalFacAssoImages;i++)
  387. {
  388. if(gDwnlFacAssImageInfo[i].ImagesId==ImageId) 
  389. {
  390. filename=gDwnlFacAssImageInfo[i].ImageName;
  391. }
  392. }
  393. if(i==g_dwnl_cntx.TotalFacAssoImages) 
  394. return (S8*)(nCustImageNames[0].pImage);
  395. gDwnlImageData[0] = GetFileExtension((PS8)filename);
  396.  
  397. AnsiiToUnicodeString((PS8)&gDwnlImageData[MAX_IMAGE_HEADER_LENGTH], ASSOCIATE_FACTORY_IMAGE_PATH);
  398. }
  399. else
  400. {
  401. /* Default Empty Image */
  402. return (S8*)(nCustImageNames[0].pImage);
  403. }
  404. memset(&gDwnlImageData[1],0xFF,MAX_IMAGE_HEADER_LENGTH-1);
  405. pfnUnicodeStrcat((PS8)gDwnlImageData,(PS8)filename);
  406. return (S8*)(gDwnlImageData);
  407. }
  408. /*****************************************************************************
  409. * FUNCTION
  410. *  GetFileExtension
  411. * DESCRIPTION
  412. *   Function to get extension of filename 
  413. * PARAMETERS
  414. * pFileName IN filename
  415. * RETURNS
  416. * image type
  417. * GLOBALS AFFECTED
  418. *   none
  419. *****************************************************************************/
  420. U8 GetFileExtension(S8* pFileName)
  421. {
  422. S32 nLength;
  423. S8* pFilePtr = NULL;
  424. nLength = pfnUnicodeStrlen(pFileName);
  425. --nLength;
  426. nLength*=ENCODING_LENGTH;
  427. while(nLength && 
  428. (pFileName[nLength] != '.') && (pFileName[nLength-1] == ''))
  429. nLength-=2;
  430. if(nLength)
  431. pFilePtr = pFileName+nLength;
  432. if(pFilePtr &&
  433. (!(pfnUnicodeStrcmp((PS8)pFilePtr,(PS8)wbmpExtn))||
  434. !(pfnUnicodeStrcmp((PS8)pFilePtr,(PS8)wbmExtn)))
  435. )
  436. {
  437. return IMAGE_TYPE_WBMP_FILE;
  438. }
  439. else if (pFilePtr && 
  440. (!pfnUnicodeStrcmp((PS8)pFilePtr,(PS8)bmpExtn)))
  441. {
  442. return IMAGE_TYPE_BMP_FILE;
  443. }
  444. else
  445. {
  446. return IMAGE_TYPE_GIF_FILE;
  447. }
  448. }
  449. /*****************************************************************************
  450. * FUNCTION
  451. *  GetAudioNameWithPathInFileSystem
  452. * DESCRIPTION
  453. *   To Provide Name of Audio With Full Path In File System( Download/Factory)
  454. * PARAMETERS
  455. * AudioId IN index of audio file
  456. * AudioData IN/OUT buffer to store file path+name
  457. * RETURNS
  458. * pointer to the filename
  459. * GLOBALS AFFECTED
  460. *   none
  461. *****************************************************************************/
  462. S8 *GetAudioNameWithPathInFileSystem(U16 AudioId, PS8 AudioData)
  463. {
  464. S8 *filename = NULL;
  465. // static S8 AudioData[MAX_IMAGE_NAME_PATH_WIDTH + MAX_IMAGE_NAME_WIDTH];
  466. if(AudioId>=FACTORY_TONES_BASE && AudioId<=FACTORY_TONES_BASE_END)
  467. {
  468. U8 i;
  469. for(i=0;i<g_dwnl_cntx.TotalFacTones;i++)
  470. {
  471. if(gDwnlFacToneInfo[i].AudioId==AudioId) 
  472. {
  473. filename=(PS8)gDwnlFacToneInfo[i].AudioName;
  474. break;
  475. }
  476. }
  477. if(i==g_dwnl_cntx.TotalFacTones) 
  478. return NULL;
  479. AnsiiToUnicodeString((PS8)AudioData, FACTORY_TONE_PATH);
  480. pfnUnicodeStrcat(AudioData,(PS8)filename);
  481. return AudioData;
  482. }
  483. #if defined(__MMI_IMELODY_SUPPORT__)
  484. else if(AudioId>=FACTORY_IMELODY_BASE && AudioId<=FACTORY_IMELODY_BASE_END)
  485. {
  486. U8 i;
  487. for(i=0;i<g_dwnl_cntx.TotalFacIMelodies;i++)
  488. {
  489. if(gDwnlFacIMelodyInfo[i].AudioId==AudioId) 
  490. {
  491. filename=(PS8)gDwnlFacIMelodyInfo[i].AudioName;
  492. break;
  493. }
  494. }
  495. if(i==g_dwnl_cntx.TotalFacIMelodies) return NULL;
  496. AnsiiToUnicodeString((PS8)AudioData, FACTORY_IMELODY_PATH);
  497. pfnUnicodeStrcat((PS8)AudioData,(PS8)filename);
  498. return AudioData;
  499. }
  500. #endif
  501. #if defined(__MMI_RING_COMPOSER__) && defined(__MMI_IMELODY_SUPPORT__)
  502. else if(AudioId>=COMPOSED_RINGTONE_BASE && AudioId<=COMPOSED_RINGTONE_BASE_END)
  503. {
  504. filename = GetComposedIMelodyNameInFileSystem(AudioId);
  505. if(filename != NULL)
  506. {
  507. AnsiiToUnicodeString((PS8)AudioData, (S8*)RINGCOMPOSER_PATH);
  508. pfnUnicodeStrcat((PS8)AudioData,(PS8)filename);
  509. return AudioData;
  510. }
  511. else
  512. return NULL;
  513. }
  514. #endif
  515. #if defined (__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
  516. else if(AudioId>=THEME_V2_TONE_BASE && AudioId<=THEME_V2_TONE_BASE_END)
  517. {
  518. U8 i;
  519. for(i=0;i<MAXIMUM_THEMES_TONES;i++)
  520. {
  521. if((U16)gDwnlThmToneInfo[i].AudioId==AudioId)
  522. {
  523. /*Changes for virtual tone file*/
  524. pfnUnicodeStrcpy(AudioData, (S8*)mmi_tm_get_audio_filename(i));
  525. return AudioData;
  526. }
  527. }
  528. }
  529. #endif 
  530. return NULL;
  531. }
  532. /*****************************************************************************
  533. * FUNCTION
  534. * GetFactoryTonesInfo
  535. * DESCRIPTION
  536. *   Function to fill Audio Info Factory Data to Caller Pointer
  537. * PARAMETERS
  538. * factoryAudioInfo  IN/OUT address pointer to the table of factory audio
  539. * RETURNS
  540. * total number of factory tones
  541. * GLOBALS AFFECTED
  542. * none
  543. *****************************************************************************/
  544. U8 GetFactoryTonesInfo(DYNAUDIOINFO ** factoryAudioInfo)
  545. {
  546. *factoryAudioInfo=gDwnlFacToneInfo;
  547. return g_dwnl_cntx.TotalFacTones;
  548. }
  549. /*****************************************************************************
  550. * FUNCTION
  551. * GetFullScreenFactoryImagesInfo
  552. * DESCRIPTION
  553. *   Function to get filename & Id associated with the Full Screen Factory Image
  554. * PARAMETERS
  555. * factoryFileInfo  IN/OUT address pointer to table of factory image
  556. * RETURNS
  557. * total number of factory images
  558. * GLOBALS AFFECTED
  559. * none
  560. *****************************************************************************/
  561. U8 GetFullScreenFactoryImagesInfo(DYNIMAGEINFO ** factoryFileInfo)
  562. {
  563. *factoryFileInfo=gDwnlFacFullScrImageInfo;
  564. return g_dwnl_cntx.TotalFacFullScrImages;
  565. }
  566. /*****************************************************************************
  567. * FUNCTION
  568. * GetAssociatedFactoryImagesInfo
  569. * DESCRIPTION
  570. *   Function to get filename & Id associated with the Associated Factory Image
  571. * PARAMETERS
  572. * factoryFileInfo  IN/OUT address pointer to table of associated factory image
  573. * RETURNS
  574. * total number of associated factory images
  575. * GLOBALS AFFECTED
  576. * none
  577. *****************************************************************************/
  578. U8 GetAssociatedFactoryImagesInfo(DYNIMAGEINFO ** factoryFileInfo)
  579. {
  580. *factoryFileInfo=gDwnlFacAssImageInfo;
  581. return g_dwnl_cntx.TotalFacAssoImages;
  582. }
  583. /*****************************************************************************
  584. * FUNCTION
  585. * getFactoryImageRelativeIndex
  586. * DESCRIPTION
  587. *   To get Factory Image Relative Index( Image Id - Base of Factory )
  588. * PARAMETERS
  589. * ImageId  IN file index of image
  590. * RETURNS
  591. * the relative Id correspoding to base for factory image, 
  592. * 0 if image if is not a factory id
  593. * GLOBALS AFFECTED
  594. * none
  595. *****************************************************************************/
  596. U8 getFactoryImageRelativeIndex(U16 ImageId)
  597. {
  598. if(ImageId>=FULLSCREEN_FACTORY_IMAGE_BASE && ImageId<=FULLSCREEN_FACTORY_IMAGE_BASE_END)
  599. return ImageId - FULLSCREEN_FACTORY_IMAGE_BASE + 1;
  600. else 
  601. return 0;
  602. }
  603. /*****************************************************************************
  604. * FUNCTION
  605. * StopAudioFileSystem
  606. * DESCRIPTION
  607. *   To stop Audio file specified by Audio Id
  608. * PARAMETERS
  609. * a  IN file index
  610. * RETURNS
  611. * none
  612. * GLOBALS AFFECTED
  613. * none
  614. *****************************************************************************/
  615. void StopAudioFileSystem(U16 AudioId)
  616. {
  617. // S8 AudioData[MAX_IMAGE_NAME_PATH_WIDTH + MAX_IMAGE_NAME_WIDTH];
  618. // AudioStopIMelodyFile((PU8)GetAudioNameWithPathInFileSystem(AudioId,(PS8)AudioData));
  619. mdi_audio_stop_file();
  620. }
  621. #if defined __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  622. U8 GetThemeV2TonesInfo(DYNAUDIOINFO  **downloadThemeTones)
  623. {
  624.  *downloadThemeTones=gDwnlThmToneInfo;
  625. return MAXIMUM_THEMES_TONES;
  626. }
  627. #endif