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

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.  * Filename:
  37.  * ---------
  38.  * ThemeManager.h
  39.  *
  40.  * Project:
  41.  * --------
  42.  *   MAUI
  43.  *
  44.  * Description:
  45.  * ------------
  46.  *   This is the header file for Theme Manager
  47.  *
  48.  * Author:
  49.  * -------
  50.  * -------
  51.  *
  52.  *==============================================================================
  53.  *             HISTORY
  54.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  55.  *------------------------------------------------------------------------------
  56.  * removed!
  57.  *
  58.  * removed!
  59.  * removed!
  60.  * removed!
  61.  *
  62.  * removed!
  63.  * removed!
  64.  * removed!
  65.  *
  66.  * removed!
  67.  * removed!
  68.  * removed!
  69.  *
  70.  * removed!
  71.  * removed!
  72.  * removed!
  73.  *
  74.  *
  75.  *------------------------------------------------------------------------------
  76.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  77.  *==============================================================================
  78.  *******************************************************************************/
  79. #ifndef _THEME_MANAGER_H
  80. #define _THEME_MANAGER_H
  81. #include "CustThemesRes.h"
  82. #include "ThemeManager.h"
  83. #include "FileSystemDef.h"
  84. #include "FileMgr.h"
  85. /***************************************************************************** 
  86. * Define
  87. *****************************************************************************/
  88. #define     THEME_IMAGE_INFO_HEADER       (8)
  89. #define     THEME_IMAGE_OFFSET            (4)
  90. #define     THEME_FILE_HANDLE          (4)
  91. #define     MAX_MMI_IMAGEID_IMAGES        (1393)        /* temp */
  92. #define     MAX_SYSTEM_THEMES          (3)
  93. #define     MAX_DOWNLOADED_THEMES         (20)
  94. #define     TOTAL_THEMES_COUNT            (MAX_SYSTEM_THEMES+MAX_DOWNLOADED_THEMES)
  95. #define     MAX_THEME_NAME_LENGTH         (FMGR_MAX_FILE_LEN)
  96. #define     MAX_THEME_IMAGE_HEADER_LENGTH (THEME_IMAGE_INFO_HEADER+THEME_IMAGE_OFFSET+THEME_FILE_HANDLE)
  97. #define     MAX_THEME_IMAGEID_IMAGES      (150)
  98. #define     MAX_THEME_NON_IMAGEID_IMAGES  (50)
  99. #define     MAX_DWNL_THM_PATH_LEN         (30)
  100. #define     MAX_THEME_SEARCH_STR_LEN      (10)
  101. #define     DOWNLOADED_THEMES_PATH        ":\Themes\"
  102. #define     THEME_SEARCH_STR           "*.med"
  103. #define     THEME_AUDIO_FILE           "ThemeAud.wav"
  104. #define     THEME_AUDIO_MID_FILE       "ThemeAud.mid"
  105. #define     THEME_AUDIO_MP3_FILE       "ThemeAud.mp3"
  106. #define     THEME_AUDIO_FILE_PATH         "c:\Audio\"
  107. #define     THEME_CHECKSUM_HEADER_SIZE    (4)
  108. #define THEME_FILE_SIZE_HEADER (4)
  109. #define THEME_NO_OF_BYTE_TO_CHECK_FOR_CRC (512000)      /* 0x80000 Bytes => 512 * 1024 = 524288 Bytes */
  110. /* Added by TK on 20060325 */
  111. #define     THEME_AUDIO_FOLDER_PATH       "c:\Audio"
  112. /* End */
  113. #define THEME_AUDIO                    0        /* ritesh */
  114. #define THEME_MIDI                     1        /* ritesh */
  115. #define THEME_MP3                      2
  116. #define THEME_ID                    U32
  117. #define MAX_SUPPORTED_VERSION_NUM         1
  118. /***************************************************************************** 
  119. * Typedef 
  120. *****************************************************************************/
  121. typedef enum
  122. {
  123.     THEME_TYPE_SYSTEM = 1,
  124.     THEME_TYPE_DOWNLOADED_PHONE,
  125.     THEME_TYPE_DOWNLOADED_CARD
  126. } tm_theme_type_enum;
  127. typedef enum
  128. {
  129.     THEME_ERROR_SUCCESS,
  130.     THEME_ERROR_SPACE_NOT_AVAILABLE,
  131.     THEME_ERROR_THEME_NOT_AVAILABLE,
  132.     THEME_ERROR_FILE_FORMAT_BAD,
  133.     THEME_ERROR_DELETE_FAILURE,
  134.     THEME_ERROR_FAILURE,
  135.     THEME_ERROR_ALREADY_ACTIVATED,
  136.     THEME_ERROR_MAX_COUNT_REACHED,
  137.     THEME_ERROR_INCOMING_CALL,
  138.     THEME_ERROR_PROCESS_QUEUE_SUCESS,
  139.     THEME_ERROR_VERSION_FAILURE,
  140.     THEME_ERROR_LCD_SIZE_MISMATCH,
  141.     THEME_ERROR_FILENAME_INCORRECT,
  142.     THEME_ERROR_USB_MODE_ON,
  143.     THEME_ERROR_PHONE_MODEL_MISMATCH
  144. } tm_theme_error_enum;
  145. typedef enum
  146. {
  147.     CHECKSUM_NOT_VERIFIED,
  148.     CHECKSUM_VERIFIED_OK,
  149.     CHECKSUM_VERIFIED_BAD
  150. } tm_theme_checksum_enum;
  151. typedef struct
  152. {
  153.     U8 theme_name[MAX_THEME_NAME_LENGTH *ENCODING_LENGTH];
  154.     U32 theme_id;
  155.     U8 theme_checksum_verified;
  156.     U8 theme_type;
  157. } tm_theme_list_struct;
  158. typedef enum
  159. {
  160.     THEME_IMG_LOAD_NEVER,
  161.     THEME_IMG_LOAD_ALWAYS,
  162.     THEME_IMG_LOAD_ONDEMAND
  163. } tm_image_load_type_enum;
  164. /*
  165.  * typedef struct 
  166.  * {
  167.  * U16   image_id;
  168.  * U32 image_offset;
  169.  * } theme_image_detail_struct;
  170.  * 
  171.  * typedef struct 
  172.  * {
  173.  * MMI_theme*              theme;
  174.  * theme_image_detail_struct* theme_image_details_list;
  175.  * U8**                 system_image_list;
  176.  * } theme_details_struct;
  177.  */
  178. typedef struct
  179. {
  180.     U8 *mempool_p;
  181.     U32 current_offset;
  182.     U32 total_pool_size;
  183.     U16 unit_size;
  184. } tm_theme_image_header_struct;
  185. typedef struct
  186. {
  187.     S16 nOffset;
  188. } tm_theme_image_cache_struct;
  189. typedef struct
  190. {
  191.     U8 imageid_images_headers_pool[MAX_THEME_IMAGE_HEADER_LENGTH *MAX_THEME_IMAGEID_IMAGES];
  192.     U8 non_imageid_images_headers_pool[MAX_THEME_IMAGE_HEADER_LENGTH *MAX_THEME_NON_IMAGEID_IMAGES];
  193.     U8 theme_imageid_image_count;
  194.     U8 total_thm_cnt;
  195.     U8 sys_thm_cnt;
  196.     U32 curr_activated_theme_id;
  197.     U8 curr_activated_theme_type;
  198.     U8 theme_has_wallpaper;
  199.     U8 theme_has_screensaver;
  200.     U8 theme_has_ringtone;
  201.     U8 theme_has_alternate_image;
  202.     S32 theme_file_handle;
  203.     tm_theme_image_header_struct imageid_images_headers;
  204.     tm_theme_image_header_struct non_imageid_images_headers;
  205.     theme_image_detail_struct theme_image_list[MAX_THEME_IMAGEID_IMAGES];       /* theme_image_detail defined in custThemeRes.c */
  206.     tm_theme_image_cache_struct image_cache[MAX_THEME_IMAGEID_IMAGES];
  207. } tm_context_struct;
  208. /***************************************************************************** 
  209. * Extern Global Variable
  210. *****************************************************************************/
  211. /***************************************************************************** 
  212. * Extern Global Function
  213. *****************************************************************************/
  214. #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  215. #ifdef __MMI_DLT_CACHE_SUPPORT__
  216. extern void mmi_tm_clear_ondemand_cache(void);
  217. extern tm_image_load_type_enum mmi_tm_get_image_load_type(U32 img_list_index);
  218. extern PU8 mmi_tm_find_img_in_cache(U32 img_list_index, tm_image_load_type_enum type);
  219. extern PU8 mmi_tm_add_img_id_to_cache(U32 img_list_index, U32 image_offset, tm_image_load_type_enum type);
  220. extern PU8 mmi_tm_add_to_DLT_img_cache(U32 image_offset, tm_image_load_type_enum type);
  221. #endif /* __MMI_DLT_CACHE_SUPPORT__ */ 
  222. extern void mmi_tm_handle_file_access_failed(void);
  223. extern U8 mmi_tm_get_downloaded_themes(tm_theme_type_enum theme_type);
  224. extern void mmi_tm_set_imageid(U16 image_id, U32 image_offset, tm_image_load_type_enum type);
  225. extern PU8 mmi_tm_create_non_imageid_image(U32 image_offset, tm_image_load_type_enum type);
  226. extern tm_theme_error_enum mmi_tm_activate_theme(THEME_ID theme_id);
  227. extern tm_theme_error_enum mmi_tm_activate_downloaded_theme(tm_theme_list_struct *theme_struct_p);
  228. extern tm_theme_error_enum mmi_tm_activate_theme_from_fmgr(tm_theme_type_enum theme_type, U8 *theme_name_p);
  229. extern tm_theme_error_enum mmi_tm_delete_theme(THEME_ID theme_id, PS32 error_type);
  230. extern void mmi_tm_reset_imageid_image_header_pool(void);
  231. extern void mmi_tm_reset_non_imageid_image_header_pool(void);
  232. extern void mmi_tm_create_image_header_pool(
  233.                 tm_theme_image_header_struct *ds_p,
  234.                 void *mempool_p,
  235.                 U16 unit_size,
  236.                 U32 total_pool_size);
  237. extern void *mmi_tm_add_image_header_to_pool(tm_theme_image_header_struct *ds_p, void *buff_p);
  238. extern void mmi_tm_reset_image_header_pool(tm_theme_image_header_struct *ds_p);
  239. extern void *mmi_tm_get_downloaded_theme_image(U32 image_offset, S32);
  240. extern BOOL mmi_tm_get_usb_mode(void);
  241. extern tm_theme_error_enum mmi_tm_delete_theme_from_fmgr(
  242.                             tm_theme_type_enum theme_type,
  243.                             U8 *theme_name_p,
  244.                             PS32 error_type);
  245. extern U8 mmi_tm_is_theme_dirty_bit_set(U16 image_index);
  246. extern U32 mmi_tm_get_theme_image_offset_or_index(U16 image_id, S32 *nArrayIndex_p);
  247. extern const FLOAT *mmi_tm_get_theme_version_table(void);
  248. extern void mmi_tm_handle_theme_activation_error_status(U16 status);
  249. extern pBOOL mmi_tm_get_current_theme_ringtone(void);
  250. extern MMI_BOOL mmi_tm_checkfile_exists(PS16);
  251. #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */ 
  252. extern void mmi_theme_manager_init(void);   /* Theme Manager intialization */
  253. extern void *mmi_tm_get_system_theme_image(U32 image_index);
  254. extern void mmi_tm_handle_audio(U32 audio_offset, U32 audio_size);
  255. extern void mmi_tm_sort_theme_image_table(void);
  256. extern void mmi_tm_image_table_quick_sort(U16, U16);
  257. extern void mmi_tm_image_table_insertion_sort(U16, U16);
  258. extern void mmi_tm_image_table_swap_node(U16, U16);
  259. extern U8 mmi_tm_get_themes(tm_theme_list_struct **theme_list_p);
  260. extern tm_theme_error_enum mmi_tm_verify_theme_checksum(U8 *file_name_p);      /* temp */
  261. extern U32 mmi_tm_get_current_theme_id(void);
  262. extern U8 mmi_tm_get_curr_theme_type(void);
  263. extern U8 mmi_tm_get_total_themes_count(void);
  264. extern void mmi_tm_activate_theme_at_bootup(void);
  265. extern pBOOL mmi_tm_get_current_theme_wallapaper(void);
  266. extern pBOOL mmi_tm_get_current_theme_screensaver(void);
  267. extern U8 mmi_tm_does_theme_have_alt_image(void);
  268. extern tm_theme_error_enum mmi_tm_activate_system_theme(tm_theme_list_struct *theme_struct_p);
  269. extern S8 *mmi_tm_get_audio_filename(U8 index);
  270. extern void mmi_tm_set_was_theme_alarm_cb(void);
  271. #ifdef __DLT_ENABLE_PROCESS_QUEUE__
  272. extern theme_error_enum mmi_tm_theme_process_queue(void);
  273. #endif 
  274. extern BOOL mmi_tm_theme_version_and_deviceinfo_check(tm_theme_list_struct *theme_struct_p);
  275. #endif /* _THEME_MANAGER_H */