CLI_Icon.c
5.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* CLI_Icon.c
*
* Project:
* --------
* Nokia Smart Messaging
*
* Description:
* ------------
* This file implements Nokia Smart CLI Icon.
*
* Date :
* ------
* 18th May 2005
*
* Author:
* --------
* -------
*
*****************************************************************************/
/**************** START : INCLUDE SECTION *************************/
#include "MMI_include.h"
#ifdef __MMI_CLI_ICON__
#include "ems.h"
#include "CLI_Icon.h"
/**************** END : INCLUDE SECTION *************************/
/*************** START : DEFINE SECTION *************************/
#define CLI_ICON_HEADER_SIZE (sizeof(CLI_ICON_HEADER_STRUCT))
/**************** END : DEFINE SECTION *************************/
/**************** START : TYPEDEFS SECTION *************************/
/**************** END : TYPEDEFS SECTION ***************************/
/**************** START : GLOBAL VARIABLES *************************/
extern U8 gPictureMessageError;
extern U16 RemoveZerosInBetween(U8 *pOutBuffer, U8 *pInBuffer, U16 size);
extern EMSData *GetEMSDataForView(EMSData **p, U8 force);
extern void EntryNsmPicturemsg(void);
/**************** END : GLOBAL VARIABLES *************************/
/**************** START : LOCAL FUNCTIONS DECLARATION *************************/
static void mmi_cli_icon_get_header_info(CLI_ICON_HEADER_STRUCT *ota_bmp_header, OTA_DATA_STRUCT *cli_icon_ota_data);
/**************** END : LOCAL FUNCTIONS DECLARATION *************************/
/*****************************************************************************
* FUNCTION
* mmi_cli_icon_parse_ota_data
* DESCRIPTION
* Parse CLI Icon OTA data into bmp header and bmp buffer
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
extern void mmi_cli_icon_parse_ota_data(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
EMSData *pEms = NULL;
OTA_DATA_STRUCT cli_icon_ota_data = {NULL, 0};
CLI_ICON_HEADER_STRUCT cli_icon_header = {0};
U32 temp;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
GetEMSDataForView(&pEms, 0);
cli_icon_ota_data.OTA_data = (U8*) OslMalloc((pEms->textLength >> 1) + 1);
ASSERT(cli_icon_ota_data.OTA_data != NULL);
memset(cli_icon_ota_data.OTA_data, 0x00, ((pEms->textLength >> 1) + 1));
temp = RemoveZerosInBetween(cli_icon_ota_data.OTA_data, pEms->textBuffer, pEms->textLength);
/* Get OTA ver and BMP header info */
mmi_cli_icon_get_header_info(&cli_icon_header, &cli_icon_ota_data);
/* Get BMP Image data */
mmi_nsm_create_bmp_buffer(&cli_icon_ota_data, &(cli_icon_header.cli_icon_ota_bmp_header));
gPictureMessageError = 0; /* Hack : MMI_NSM_PIC_SUCCESS */
if (cli_icon_ota_data.OTA_data != NULL)
{
OslMfree(cli_icon_ota_data.OTA_data);
}
/* Hack : CLI Icon is treated as picture message */
EntryNsmPicturemsg();
}
/*****************************************************************************
* FUNCTION
* mmi_cli_icon_get_header_info
* DESCRIPTION
* Get header info for bmp image
* PARAMETERS
* ota_bmp_header [IN] BMP header structure
* cli_icon_ota_data [IN] Operator logo OTA data structure
* RETURNS
* void
*****************************************************************************/
static void mmi_cli_icon_get_header_info(CLI_ICON_HEADER_STRUCT *ota_bmp_header, OTA_DATA_STRUCT *cli_icon_ota_data)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Get OTA version */
mmi_nsm_get_ver_no(&(ota_bmp_header->cli_icon_ota_ver), cli_icon_ota_data);
/* Get BMP Image header info */
mmi_nsm_get_ota_bmp_header(&(ota_bmp_header->cli_icon_ota_bmp_header), cli_icon_ota_data);
}
#endif /* __MMI_CLI_ICON__ */