vmstatusbar.c
64.3 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
/*****************************************************************************
* 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) 2008
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*******************************************************************************
* Filename:
* ---------
* vmstatusbar.c
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
* MRE status bar implement file
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*==============================================================================
*******************************************************************************/
/*
* include vmswitch.h in order to check whether __MRE_SAL_STATUS__ is defined.
*/
#include "vmswitch.h"
#ifdef __MRE_SAL_STATUS__
#include "GeneralDeviceGprot.h"
#include "mdi_audio.h"
#include "UcmSrvGprot.h"
#include "gui_typedef.h"
#include "vmsys.h"
#include "vmpromng.h"
#include "vmresmng.h"
#include "vmdl.h"
#include "vmmod.h"
#include "vmmem.h"
#include "vmlog.h"
#include "vmchset.h"
#include "vmstdlib.h"
#include "vmstatusbar.h"
#include "MREAppMgrSrvGprot.h" // use for startup
#include "mredef.h"
#include "vmgraph.h"
#include "gpiosrvgprot.h"
#include "vmmm.h"
#ifndef SRV_MRE_APP_LOGO
#define SRV_MRE_APP_LOGO "_MREApplogo30.img"
#endif
/*
* the maxmium number of MRE apps which run at the same time is 10.
* so we prepare 10 icon IDs for them, when search icon IDs, the index should
* be in the range of [1, 11)
*/
#define VM_STATUSBAR_START_INDEX 1
#define VM_STATUSBAR_MAX_COUNT 11
#ifndef vm_push_receiver_context_t
typedef struct vm_push_receiver_context_t
{
int app_id;
int app_handle;
mmi_proc_func call_back;
} vm_push_receiver_context_t;
#endif /* vm_push_receiver_context_t */
typedef struct
{
VMINT icon_id;
VMINT handle;
VMINT is_used;
FuncPtr cb;
VMINT new_message_index;
} vm_statusbar_icon_state_t;
/*
* we preserved 10 icon id for MRE app.
* since there are 10 apps at most at them same time, so 10 icon id is enough.
* if app gets the VM_STATUS_ICON_MRE_DEFAULT, that means all other icon IDs
* have been used. That is, VM_STATUS_ICON_MRE_DEFAULT is an invalid icon id.
*/
VMINT VM_STATUS_ICON_MRE_DEFAULT = STATUS_ICON_MRE_DEFAULT;
VMINT VM_STATUS_ICON_MRE_1 = STATUS_ICON_MRE_DEFAULT + 1;
VMINT VM_STATUS_ICON_MRE_2 = STATUS_ICON_MRE_DEFAULT + 2;
VMINT VM_STATUS_ICON_MRE_3 = STATUS_ICON_MRE_DEFAULT + 3;
VMINT VM_STATUS_ICON_MRE_4 = STATUS_ICON_MRE_DEFAULT + 4;
VMINT VM_STATUS_ICON_MRE_5 = STATUS_ICON_MRE_DEFAULT + 5;
VMINT VM_STATUS_ICON_MRE_6 = STATUS_ICON_MRE_DEFAULT + 6;
VMINT VM_STATUS_ICON_MRE_7 = STATUS_ICON_MRE_DEFAULT + 7;
VMINT VM_STATUS_ICON_MRE_8 = STATUS_ICON_MRE_DEFAULT + 8;
VMINT VM_STATUS_ICON_MRE_9 = STATUS_ICON_MRE_DEFAULT + 9;
VMINT VM_STATUS_ICON_MRE_10 = STATUS_ICON_MRE_DEFAULT + 10;
/* 10 icon IDs reserved for MRE apps, and a default icon id is reserved too. */
static vm_statusbar_icon_state_t g_icon_table[] =
{
/*
* the format is :
* icon_id, handle, is_used, cb, new_message_index
*/
{STATUS_ICON_MRE_DEFAULT, 0, FALSE, NULL, 0},
{STATUS_ICON_MRE_DEFAULT + 1, 0, FALSE, NULL, 0},
{STATUS_ICON_MRE_DEFAULT + 2, 0, FALSE, NULL, 0},
{STATUS_ICON_MRE_DEFAULT + 3, 0, FALSE, NULL, 0},
{STATUS_ICON_MRE_DEFAULT + 4, 0, FALSE, NULL, 0},
{STATUS_ICON_MRE_DEFAULT + 5, 0, FALSE, NULL, 0},
{STATUS_ICON_MRE_DEFAULT + 6, 0, FALSE, NULL, 0},
{STATUS_ICON_MRE_DEFAULT + 7, 0, FALSE, NULL, 0},
{STATUS_ICON_MRE_DEFAULT + 8, 0, FALSE, NULL, 0},
{STATUS_ICON_MRE_DEFAULT + 9, 0, FALSE, NULL, 0},
{STATUS_ICON_MRE_DEFAULT + 10, 0, FALSE, NULL, 0},
};
/*
* This is a list, and it stores all icons that have been shown on statusbar.
*/
static vm_status_bar_icon_t *statusbar_image_queue = NULL;
/*
* This is the data of midi, when show or hide icons on statusbar by calling
* vm_statusbar_set_image, this sound will be played.
*/
const __align(2) static VMUINT8 vm_notify_midi_data[] =
{
0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01,
0x01, 0xE0, 0x4D, 0x54, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x98, 0x00, 0xFF,
0x51, 0x03, 0x05, 0x16, 0x15, 0x00, 0xFF, 0x58, 0x04, 0x04, 0x02, 0x18,
0x08, 0x00, 0xF0, 0x07, 0x7F, 0x7F, 0x04, 0x01, 0x00, 0x7F, 0xF7, 0x01,
0xB0, 0x00, 0x00, 0x01, 0xB0, 0x20, 0x00, 0x01, 0xC0, 0x0B, 0x01, 0xB0,
0x07, 0x7F, 0x02, 0x90, 0x3D, 0x61, 0x00, 0x90, 0x36, 0x3F, 0x3C, 0x90,
0x36, 0x00, 0x00, 0x90, 0x3D, 0x00, 0x00, 0x90, 0x42, 0x68, 0x00, 0x90,
0x3B, 0x46, 0x3C, 0x90, 0x3B, 0x00, 0x00, 0x90, 0x42, 0x00, 0x00, 0x90,
0x49, 0x70, 0x00, 0x90, 0x42, 0x4E, 0x3C, 0x90, 0x42, 0x00, 0x00, 0x90,
0x49, 0x00, 0x00, 0x90, 0x4E, 0x78, 0x00, 0x90, 0x47, 0x56, 0x3C, 0x90,
0x47, 0x00, 0x00, 0x90, 0x4E, 0x00, 0x00, 0x90, 0x55, 0x7F, 0x00, 0x90,
0x4E, 0x5D, 0x3C, 0x90, 0x4E, 0x00, 0x00, 0x90, 0x55, 0x00, 0x85, 0x0E,
0x90, 0x24, 0x15, 0x78, 0x90, 0x24, 0x00, 0x86, 0x48, 0xFF, 0x07, 0x05,
0x53, 0x54, 0x41, 0x52, 0x54, 0x83, 0x60, 0xFF, 0x07, 0x04, 0x53, 0x54,
0x4F, 0x50, 0x00, 0xFF, 0x2F, 0x00
};
/* APIs only can be used in this file. */
static vm_status_bar_icon_t* vm_statusbar_get_status_bar_image_byhandle(
VM_P_HANDLE pHandle);
static VMWCHAR* vm_get_fullfilename_by_iconid(VMINT icon_id);
static VMWCHAR* vm_get_fullfilename_by_queue_iconid(
vm_status_bar_icon_t *image_queue,
VMINT icon_id);
static vm_status_bar_icon_t* vm_get_statusbar_byiconid(
vm_status_bar_icon_t *image_queue,
VMINT icon_id);
static void vm_status_bar_status_notify_callback(
VM_P_HANDLE pHandle,
VMINT status);
static VMINT vm_statusbar_mod_evt_proc(MRE_MOD_LIFECIRCLE_EVT event);
static void vm_status_icon_cb(VMINT tid);
static void vm_statusbar_process_icon(VMINT icon_id);
static VMINT vm_statusbar_check_handle(VMINT unknow_handle);
static VMINT vm_statusbar_get_icon_id_by_handle(VM_P_HANDLE Handle);
static void vm_statusbar_play_midi_callback(
kal_int32 handle,
kal_int32 result,
void *user_data);
static U8* vm_statusbar_add_8byte_image_header(
U8 identifier,
S32 n_frames,
U32 file_size,
U32 width,
U32 height,
VMUINT8 *img_buf);
static VMINT vm_statusbar_get_current_app_path(VMWCHAR *FullFilePath);
static VMWCHAR* vm_statusbar_get_current_app_name(VMWCHAR *FullFilePath);
#ifdef __MMI_NCENTER_SUPPORT__
static void vm_statusbar_release_notification_members_memory(
mmi_mre_data *ncenter_cell_buf);
static void vm_statusbar_release_notification_memory(
mmi_mre_data *ncenter_cell_buf);
static VMINT vm_statusbar_construct_notification(
vm_status_bar_icon_t *icon,
VM_NEW_MESSAGE_INFO *new_message);
#endif /* __MMI_NCENTER_SUPPORT__ */
/* APIs can be used in other files. */
VMINT vm_statusbar_get_unused_iconid(void);
MMI_BOOL vm_statusbar_set_handle(VMINT icon_id, VMINT handle);
MMI_BOOL vm_statusbar_unset_handle(VMINT icon_id, VMINT icon_handle);
vm_status_bar_icon_t* vm_statusbar_list_node_create(VM_P_HANDLE pHandle);
void vm_process_status_icon_mre_0(void);
void vm_process_status_icon_mre_1(void);
void vm_process_status_icon_mre_2(void);
void vm_process_status_icon_mre_3(void);
void vm_process_status_icon_mre_4(void);
void vm_process_status_icon_mre_5(void);
void vm_process_status_icon_mre_6(void);
void vm_process_status_icon_mre_7(void);
void vm_process_status_icon_mre_8(void);
void vm_process_status_icon_mre_9(void);
void vm_process_status_icon_mre_10(void);
void vm_process_status_icon(void);
VMINT _vm_reg_statusbar_module(void);
VMINT vm_pmng_apply_to_run_in_fg(VMINT notify_type);
VMINT vm_statusbar_set_image(
VM_ICON_STATUS_TYPE status_type,
VM_ICON_STATUS_ICON_IMAGE_INFO *image_info);
/* APIs implemented in other files. */
extern VMUINT8* vm_load_resource_from_file(
VMWSTR filename,
char *res_name,
VMINT *res_size);
extern void wgui_status_icon_bar_change_icon_image_ex(
S32 icon_id,
PU8 image_data);
extern void wgui_status_icon_bar_blink_icon(S32 icon_id);
extern void wgui_status_icon_bar_show_icon(S32 icon_id);
extern MMI_BOOL srv_mre_get_app_image(U16 *app_path, U8 *p_img, U32 *img_size);
extern void wgui_status_icon_bar_update(void);
extern void wgui_status_icon_bar_hide_icon(S32 icon_id);
extern void srv_mre_push_receiver_stdlib_list_callback_delete(
VM_P_HANDLE Handle);
extern void srv_mre_push_receiver_stdlib_list_callback_reset(void);
extern void vm_graphic_async_blt_stop(void);
extern void vm_graphic_async_blt_start(void);
#ifdef __MMI_NCENTER_SUPPORT__
extern void vm_ncenter_close_notification(void*);
#endif /* __MMI_NCENTER_SUPPORT__ */
void vm_reset_status_icon_pen_event(void);
void vm_register_status_icon_pen_event(void);
#ifdef __MRE_SAL_PN__
void vm_push_new_message(U32 AppID);
#endif
#if defined(__MMI_TOUCH_SCREEN__) && defined(VM_STATUSBARICON_PRE09B) && !defined(__MMI_VUI_HOMESCREEN__)
/*
* we use this array to simplize the implementation of
* vm_register_status_icon_pen_event.
*/
typedef void (*func_ptr)(void);
static func_ptr vm_process_status_icon_mre_cb[] = {
vm_process_status_icon_mre_0,
vm_process_status_icon_mre_1,
vm_process_status_icon_mre_2,
vm_process_status_icon_mre_3,
vm_process_status_icon_mre_4,
vm_process_status_icon_mre_5,
vm_process_status_icon_mre_6,
vm_process_status_icon_mre_7,
vm_process_status_icon_mre_8,
vm_process_status_icon_mre_9,
vm_process_status_icon_mre_10
};
#endif
/*****************************************************************************
* FUNCTION
* vm_check_if_appcalling
* DESCRIPTION
*
* PARAMETERS
*
* RETURNS
* void
*****************************************************************************/
VMINT vm_check_if_appcalling(void)
{
#if defined(VM_STATUSBARICON_PRE09B)
if ((mmi_ucm_app_incoming_call(MMI_UCM_CALL_TYPE_ALL)
+ mmi_ucm_app_outgoing_call(MMI_UCM_CALL_TYPE_ALL)
+ mmi_ucm_app_total_call(MMI_UCM_CALL_TYPE_NO_CSD)) > 0 )
{
return TRUE;
}
#else /* VM_STATUSBARICON_PRE09B */
if (srv_ucm_query_call_count(
SRV_UCM_CALL_STATE_ALL,
SRV_UCM_CALL_TYPE_ALL,
NULL) > 0)
{
return TRUE;
}
#endif /* VM_STATUSBARICON_PRE09B */
return FALSE;
}
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
/******************************************************************************
* FUNCTION
* vm_statusbar_release_icon_memory_internal
* DESCRIPTION
* free memory that used by icon on statusbar and ncenter notification.
* This function is for internal use, and it is called only in
* vm_statusbar_list_node_deinit.
* PARAMETERS
* icon : [IN] the icon shown on statusbar and ncenter notification.
* RETURNS
* void.
*****************************************************************************/
static void vm_statusbar_release_icon_memory_internal(
vm_status_bar_icon_t *icon)
{
if (icon != NULL)
{
/* we are going to release this icon, so we need change some flags in
* g_icon_table[].
* 1. set b_used to be FALSE, it means this icon is unused now.
* 2. set handle to be 0, it means no app associated with it now.
*/
vm_statusbar_unset_handle(icon->icon_id, 0);
/* release the memory used for image buffer on statusbar. */
if (icon->image_buffer_show != NULL)
{
_vm_kernel_free(icon->image_buffer_show);
}
if (icon->image_buffer_blink != NULL)
{
_vm_kernel_free(icon->image_buffer_blink);
}
/* release the memory used by ncenter. */
#ifdef __MMI_NCENTER_SUPPORT__
vm_statusbar_release_notification_memory(icon->ncenter_cell_buf);
#endif /* __MMI_NCENTER_SUPPORT__ */
/*
* set all members of icon to be 0 (or NULL), because we don't need to
* use the icon any more.
*/
memset(icon, 0, sizeof(vm_status_bar_icon_t));
/* release all memory used by icon. */
_vm_kernel_free(icon);
}
}
/*****************************************************************************
* FUNCTION
* vm_status_bar_status_notify_callback
* DESCRIPTION
* status bar system event handler ,status bar is one kind resource £¬
* when app status change.resource
* manager will sent notify to each kind of resource
* PARAMETERS
*
* RETURNS
* void
*****************************************************************************/
void vm_statusbar_list_node_deinit(vm_status_bar_icon_t *node)
{
VMINT resHandle = VM_RES_NOT_FIND;
// if the icon is blinking ,we will hide it
wgui_status_icon_bar_hide_icon(node->icon_id);
#ifdef __MMI_NCENTER_SUPPORT__
if (node->ncenter_cell_buf != NULL)
{
vm_ncenter_close_notification((void*) node);
}
#endif /* __MMI_NCENTER_SUPPORT__ */
// deinit all the res.
while ((resHandle = vm_res_findfirst(node->pHandle,VM_RES_TYPE_STATUS_BAR))
!= VM_RES_NOT_FIND)
{
vm_res_release_data(VM_RES_TYPE_STATUS_BAR, resHandle);
vm_res_findclose(VM_RES_TYPE_STATUS_BAR);
}
vm_statusbar_release_icon_memory_internal(node);
}
static void vm_status_bar_status_notify_callback(
VM_P_HANDLE pHandle,
VMINT status)
{
switch (status)
{
case VM_PMNG_FOREGROUND:
{
vm_status_bar_icon_t *temp_node
= vm_statusbar_get_status_bar_image_byhandle(pHandle);
if (NULL != temp_node)
{
wgui_status_icon_bar_hide_icon(temp_node->icon_id);
}
}
break;
case VM_PMNG_UNLOAD:
if (NULL != statusbar_image_queue)
{
vm_status_bar_icon_t *cursor = statusbar_image_queue;
vm_status_bar_icon_t *current = statusbar_image_queue;
while (NULL != cursor)
{
// use cursor to find the value
if(pHandle == cursor->pHandle)
{
// finded
if(cursor == current)
{
// header node
current->pNext = cursor->pNext;
statusbar_image_queue = current->pNext;
vm_statusbar_list_node_deinit(current);
return ;
}
else
{
// not header node
do{
if(cursor == current->pNext)
{
current->pNext = cursor->pNext;
vm_statusbar_list_node_deinit(cursor);
return ;
}
current = current->pNext;
} while(cursor != current);
}
}
else
{
cursor = cursor->pNext; // not finded
}
}
}
break;
case VM_PMNG_BACKGROUND: /* background running.*/
{
if (vm_pmng_is_support_bg(pHandle))
{
vm_status_bar_icon_t *temp_node
= vm_statusbar_get_status_bar_image_byhandle(pHandle);
// first time in BackGround we should be init the image ID to app.
if (NULL == temp_node)
{
temp_node = vm_statusbar_list_node_create(pHandle);
if (NULL != temp_node)
{
wgui_status_icon_bar_show_icon(temp_node->icon_id);
}
}
else
{
wgui_status_icon_bar_hide_icon(temp_node->icon_id);
wgui_status_icon_bar_show_icon(temp_node->icon_id);
}
}
}
break;
default:
break;
}
}
/*****************************************************************************
* FUNCTION
* vm_statusbar_mod_evt_proc
* DESCRIPTION
* statusbar is one kind of Resource .so We must register a Handler with
* RESOURCE MANAGEMENT
* PARAMETERS
*
* RETURNS
* void
*****************************************************************************/
static VMINT vm_statusbar_mod_evt_proc(MRE_MOD_LIFECIRCLE_EVT event)
{
VMINT resHandle = 0;
vm_status_bar_icon_t *icon_node = NULL;
switch(event)
{
case EVT_MOD_INIT:
statusbar_image_queue = NULL;
if (vm_res_type_set_notify_callback(
VM_RES_TYPE_STATUS_BAR,
vm_status_bar_status_notify_callback) != 0)
{
return -1;
}
break;
case EVT_MOD_RELEASE:
/* release queue */
while ((icon_node = statusbar_image_queue) != NULL)
{
statusbar_image_queue = statusbar_image_queue->pNext;
/*
* hide icon from statusbar and delete notification in ncenter.
* then release the memory for it.
*/
vm_statusbar_list_node_deinit(icon_node);
}
statusbar_image_queue = NULL;
/* release resource */
while ((resHandle = vm_res_findfirst(-1, VM_RES_TYPE_STATUS_BAR))
!= VM_RES_NOT_FIND)
{
vm_res_release_data(VM_RES_TYPE_STATUS_BAR, resHandle);
vm_res_findclose(VM_RES_TYPE_STATUS_BAR);
}
// reset call back
vm_res_type_set_notify_callback(VM_RES_TYPE_STATUS_BAR, NULL);
break;
}
return 0;
}
/*****************************************************************************
* FUNCTION
* _vm_reg_statusbar_module
* DESCRIPTION
* handler which register with resource manager
* PARAMETERS
* void
* RETURNS
* REG_MRE_MODULE_SUCCESS if success
* Error code if fail
*****************************************************************************/
VMINT _vm_reg_statusbar_module(void)
{
return _vm_reg_module(
"STATUSBAR MODULE",
(MOD_EVT_PROCESS) vm_statusbar_mod_evt_proc);
}
#ifdef __MMI_MRE_PUSH_RECEIVER__
static void vm_push_receiver_status_notify_callback(
VM_P_HANDLE pHandle,
VMINT status)
{
VMINT resHandle = 0;
if (status == VM_PMNG_UNLOAD)
{
/* release all resource */
while ((resHandle = vm_res_findfirst(-1, VM_RES_TYPE_PUSH_RECEIVER))
!= VM_RES_NOT_FIND)
{
/*
* TODO: here should be scan MIC to find the registered callback
* and delete it
*/
srv_mre_push_receiver_stdlib_list_callback_delete(pHandle);
vm_res_release_data(VM_RES_TYPE_PUSH_RECEIVER, resHandle);
}
}
}
static VMINT vm_push_receiver_mod_evt_proc(MRE_MOD_LIFECIRCLE_EVT event)
{
VMINT resHandle = 0;
vm_status_bar_icon_t* icon_node = NULL;
switch(event)
{
case EVT_MOD_INIT:
{
if (vm_res_type_set_notify_callback(
VM_RES_TYPE_PUSH_RECEIVER,
vm_push_receiver_status_notify_callback) != 0)
{
return 0;
}
}
break;
case EVT_MOD_RELEASE:
{
/* release all resource */
while ((resHandle = vm_res_findfirst(-1, VM_RES_TYPE_PUSH_RECEIVER))
!= VM_RES_NOT_FIND)
{
// TODO: /* here should be scan MIC to find the registered call back and delete it */
vm_res_release_data(VM_RES_TYPE_PUSH_RECEIVER, resHandle);
vm_res_findclose(VM_RES_TYPE_PUSH_RECEIVER);
}
// TODO: /* clear all callback function in MIC */
#ifdef __MMI_MRE_PUSH_RECEIVER__
srv_mre_push_receiver_stdlib_list_callback_reset();
#endif
// reset call back
vm_res_type_set_notify_callback(VM_RES_TYPE_PUSH_RECEIVER, NULL);
}
break;
}
return 0;
}
VMINT _vm_reg_push_receiver_module(void)
{
return _vm_reg_module(
"PUSH RECEIVER",
(MOD_EVT_PROCESS) vm_push_receiver_mod_evt_proc);
}
#endif /* __MMI_MRE_PUSH_RECEIVER__ */
extern VMINT vm_pmng_apply_to_run_in_fg_1(VMINT notify_type);
/*****************************************************************************
* FUNCTION
* vm_pmng_apply_to_run_in_fg
* DESCRIPTION
* app apply to run in foreground .
* call this funciton MRE will try let app running in foreground .
* call only when app running in background
* PARAMETERS
*
* RETURNS
* void
*****************************************************************************/
VMINT vm_pmng_apply_to_run_in_fg(VMINT notify_type)
{
VMINT retVal = MMI_FALSE;
vm_log_debug("vm_pmng_apply_to_run_in_fg() notify_type = %d", notify_type);
vm_pmng_apply_to_run_in_fg_1(notify_type);
return retVal;
}
static VMINT vm_statusbar_get_icon_id_by_handle(VM_P_HANDLE handle)
{
VMINT i = VM_STATUSBAR_START_INDEX;
for (; i < VM_STATUSBAR_MAX_COUNT; ++i)
{
if (handle == g_icon_table[i].handle)
{
return g_icon_table[i].icon_id;
}
}
return 0;
}
VMINT vm_statusbar_get_by_handle_icon_id(VM_P_HANDLE icon_id)
{
VMINT i = VM_STATUSBAR_START_INDEX;
for (; i < VM_STATUSBAR_MAX_COUNT; ++i)
{
if (icon_id == g_icon_table[i].icon_id)
{
return g_icon_table[i].handle;
}
}
return 0;
}
/*****************************************************************************
* FUNCTION
* vm_statusbar_play_midi_callback
* DESCRIPTION
* STOP play mma audio file and close file
* PARAMETERS
*
*
* RETURNS
* void
*****************************************************************************/
static void vm_statusbar_play_midi_callback(
kal_int32 handle,
kal_int32 result,
void *user_data)
{
mdi_audio_mma_stop(handle);
mdi_audio_mma_close(handle);
/* resume background play after play notify sound */
vm_audio_resume_bg_play();
}
static void vm_statusbar_play_vibration(VMINT notify_type)
{
// vibration
if (VM_NOTIFY_TYPE_VIBRATILITY
== (notify_type & VM_NOTIFY_TYPE_VIBRATILITY))
{
srv_vibrator_play_once();
}
}
static VMINT vm_statusbar_play_music(VMINT notify_type)
{
// check
if (srv_ucm_query_call_count(
SRV_UCM_CALL_STATE_ALL,
SRV_UCM_CALL_TYPE_ALL,
NULL) > 0)
{
return MMI_FALSE;
}
// play music
if (VM_NOTIFY_TYPE_SOUND == (notify_type & VM_NOTIFY_TYPE_SOUND))
{
mdi_mma_open_struct mma_open;
mdi_handle handle = 0;
memset((void*) &mma_open, 0, sizeof(mdi_mma_open_struct));
mma_open.data = (void*)vm_notify_midi_data;
mma_open.data_len = sizeof(vm_notify_midi_data);
mma_open.mdi_format = MDI_FORMAT_SMF;
mma_open.repeats = 1;
mma_open.output_path = MDI_DEVICE_SPEAKER2;
mma_open.callback = vm_statusbar_play_midi_callback;
mma_open.handle_p = (mdi_handle*)(&handle);
/* suspend background play before play notify sound */
vm_audio_suspend_bg_play();
mdi_audio_mma_open(&mma_open);
if (*mma_open.handle_p != 0) // open success
{
VMINT ret= 0;
ret = mdi_audio_mma_play(*mma_open.handle_p);
if (MDI_AUDIO_SUCCESS != ret) // play failed
{
mdi_audio_mma_close(handle);
/* resume background play if play notify sound failed */
vm_audio_resume_bg_play();
}
/*
* play notify sound successfully, after this, a callback
* function : vm_statusbar_play_midi_callback will be called.
*/
}
else
{
/* resume background play if can't open the file of notify sound */
vm_audio_resume_bg_play();
}
}
return MMI_TRUE;
}
static VMINT vm_statusbar_get_current_app_path(VMWCHAR *FullFilePath)
{
if (NULL == FullFilePath)
{
return MMI_FALSE;
}
if (0 != vm_get_exec_filename(FullFilePath) )
{
vm_free(FullFilePath);
return MMI_FALSE;
}
return MMI_TRUE;
}
static VMWCHAR* vm_statusbar_get_current_app_name(VMWCHAR *FullFilePath)
{
VMWCHAR *FileName;
// FullFilePath + vm_wstrlen(FullFilePath) - 1
// <here must be -1, otherwise will be have a error>
for (FileName = FullFilePath + vm_wstrlen(FullFilePath) - 1;
FileName > FullFilePath;
--FileName)
{
if ((*FileName) == (VMWCHAR) L'\\')
{
if (FileName == (FullFilePath + vm_wstrlen(FullFilePath) - 1))
{
FileName = FullFilePath;
}
else
{
++FileName;
}
break;
}
}
return FileName;
}
static void vm_statusbar_list_insert(vm_status_bar_icon_t *insert_node)
{
if (NULL == insert_node)
{
return;
}
insert_node->pNext = statusbar_image_queue;
statusbar_image_queue = insert_node;
}
/*
* must be use handle to init node
*/
static void vm_statusbar_list_node_init(
vm_status_bar_icon_t *node,
VM_P_HANDLE pHandle)
{
if( NULL != node)
{
VMINT b_used = node->b_used;
memset(node, 0, sizeof(vm_status_bar_icon_t));
node->b_used = b_used;
node->pHandle = pHandle;
node->icon_id = vm_statusbar_get_unused_iconid();
vm_statusbar_set_handle(node->icon_id, pHandle);
}
}
static vm_status_bar_icon_t* vm_statusbar_list_node_create(VM_P_HANDLE pHandle)
{
vm_status_bar_icon_t *node = NULL;
VMWCHAR* fullFilename = NULL;
if ((fullFilename = _vm_kernel_malloc(
(MAX_APP_NAME_LEN + 1) * sizeof(VMWCHAR))) == NULL)
{
return NULL;
}
vm_statusbar_get_current_app_path(fullFilename);
vm_statusbar_get_current_app_name(fullFilename);
if ((node = _vm_kernel_malloc(sizeof(vm_status_bar_icon_t))) != NULL)
{
memset(node, 0, sizeof(vm_status_bar_icon_t));
if (vm_res_save_data(VM_RES_TYPE_STATUS_BAR, NULL, 0, NULL, pHandle)
>= 0)
{
// init node
vm_statusbar_list_node_init(node, pHandle);
// set full path
wstrcpy(node->fullFilename, fullFilename);
// set blink buffer
if (NULL != node->image_buffer_blink)
{
wgui_status_icon_bar_change_icon_image_ex(
node->icon_id,
node->image_buffer_blink);
}
// insert list
vm_statusbar_list_insert(node);
}
else
{
_vm_kernel_free(node);
}
}
_vm_kernel_free(fullFilename);
return node;
}
static VMINT vm_pmng_apply_to_run_in_fg_1(VMINT notify_type)
{
VMINT check_ret = 0;
VMINT icon_id_applyed = 0;
VM_P_HANDLE pHandle = vm_pmng_get_current_handle();
check_ret= vm_statusbar_check_handle(pHandle);
if (check_ret != 0)
{
icon_id_applyed = vm_statusbar_get_icon_id_by_handle(pHandle);
if(icon_id_applyed != 0)
{
wgui_status_icon_bar_blink_icon(icon_id_applyed);
vm_statusbar_play_music(notify_type);
vm_statusbar_play_vibration(notify_type);
}
return TRUE;
}
if (vm_pmng_state(pHandle) != VM_PMNG_BACKGROUND)
{
return VM_PMNG_NO_OP_IN_STATUS;
}
if (vm_res_get_data_list_count_by_proecss(pHandle, VM_RES_TYPE_STATUS_BAR)
> 0)
{
return VM_PMNG_OP_OK;
}
else
{
vm_status_bar_icon_t *node = NULL;
node = vm_statusbar_list_node_create(pHandle);
if (NULL != node)
{
wgui_status_icon_bar_blink_icon(node->icon_id);
}
vm_statusbar_play_music( notify_type);
vm_statusbar_play_vibration(notify_type);
return VM_PMNG_OP_OK;
}
}
/*****************************************************************************
* FUNCTION
* vm_statusbar_add_8byte_image_header
* DESCRIPTION
* when we pass a raw data to GDI,we should add 8 byte file header
* to tell GDI some information otherwise GDI can NOT draw image to LCD.
* PARAMETERS
* identifier : file
* n_frames :
* file_size :
* width :
* height :
* img_buf :
* RETURNS
* pointer to image which include 8byte file head
* NULL if fail
*****************************************************************************/
static U8* vm_statusbar_add_8byte_image_header(
U8 identifier,
S32 n_frames,
U32 file_size,
U32 width,
U32 height,
VMUINT8 *img_buf)
{
S8 header_buffer[8] = {0};
S8* image_buffer = NULL;
U32 width_height = 0;
S32 data_size = file_size ;
if((image_buffer = (S8*) _vm_kernel_malloc(sizeof(S8) * (8 + file_size)))
== NULL)
{
return NULL;
}
if (identifier == IMAGE_TYPE_BMP
|| identifier == IMAGE_TYPE_GIF
|| identifier == IMAGE_TYPE_JPG
|| identifier == IMAGE_TYPE_PNG)
{
if ((file_size >> 24) > 0)
{
// if file too big return NULL;
return NULL;
}
}
if(width > 50 || height > 50)
{
return NULL;
}
// set width and height.
width_height = ((width & 0XFFF) << 12) | (height & 0XFFF);
// set frames
if(n_frames==0)
{
n_frames = 1;
}
// construct 8 byte file header.
header_buffer[0] = identifier;
header_buffer[1] = n_frames;
header_buffer[2] = (data_size & 0xff);
header_buffer[3] = ((data_size & 0xff00) >> 8);
header_buffer[4] = ((data_size & 0xff0000) >> 16);
header_buffer[5] = (width_height & 0xff);
header_buffer[6] = ((width_height & 0xff00) >> 8);
header_buffer[7] = ((width_height & 0xff0000) >> 16);
memcpy(image_buffer, header_buffer, 8);
memcpy(image_buffer + 8, img_buf, file_size);
return (U8*) image_buffer;
}
/*****************************************************************************
* FUNCTION
* vm_statusbar_set_image
* DESCRIPTION
* show an icon on statusbar. Caller must give a valid icon image, otherwise
* this function will do nothing.
* PARAMETERS
* status_type : [IN] the behavior of the icon. Please refer to
* VM_ICON_STATUS_TYPE for detail information.
* Notice that VM_ICON_NCENTER_CELL and
* VM_ICON_HIDE are not supported now.
* image_info : [IN] the image of icon that you want to show on
* statusbar. Please refer to
* VM_ICON_STATUS_ICON_IMAGE_INFO for detail
* information.
* RETURNS
* TRUE means show icon or change icon successfully,
* FALSE means fail to do that.
*****************************************************************************/
VMINT vm_statusbar_set_image(
VM_ICON_STATUS_TYPE status_type,
VM_ICON_STATUS_ICON_IMAGE_INFO *image_info)
{
return vm_statusbar_set_image_ex(
status_type,
image_info,
VM_NOTIFY_TYPE_SOUND);
}
/*****************************************************************************
* FUNCTION
* vm_statusbar_set_image_ex
* DESCRIPTION
* show an icon on statusbar. Caller must give a valid icon image, otherwise
* this function will do nothing.
* PARAMETERS
* status_type : [IN] the behavior of the icon. Please refer to
* VM_ICON_STATUS_TYPE for detail information.
* Notice that VM_ICON_NCENTER_CELL and
* VM_ICON_HIDE are not supported now.
* image_info : [IN] the image of icon that you want to show on
* statusbar. Please refer to
* VM_ICON_STATUS_ICON_IMAGE_INFO for detail
* information.
* notify_type : [IN] how to notify users that your icon on statusbar
* is changed (play a sound, vibrate, or do nothing
* ). Please refer to VM_FG_NOTIFY_TYPE for detail
* information.
* RETURNS
* TRUE means show icon or change icon successfully,
* FALSE means fail to do that.
*****************************************************************************/
VMINT vm_statusbar_set_image_ex(
VM_ICON_STATUS_TYPE status_type,
VM_ICON_STATUS_ICON_IMAGE_INFO *image_info,
VMINT notify_type)
{
VM_P_HANDLE app_handle = 0;
vm_status_bar_icon_t* icon = NULL;
vm_pmng_apply_to_run_in_fg_1(notify_type);
/*
* only VM_ICON_SHOW, VM_ICON_BLINK, VM_ICON_NCENTER_CELL, VM_ICON_HIDE
* can be handled. And the image of icon must be valid, otherwise we will do
* nothing but return directly.
*/
if (VM_ICON_SHOW > status_type || status_type > VM_ICON_HIDE
|| image_info == NULL)
{
return FALSE;
}
/* get current app's handle. */
if ((app_handle = vm_pmng_get_current_handle()) == 0)
{
return FALSE;
}
/*
* get an icon by app's handle.
* If the app doesn't have an icon, then we will create one for it.
*/
if ((icon = vm_statusbar_get_status_bar_image_byhandle(app_handle)) == NULL)
{
icon = vm_statusbar_list_node_create(app_handle);
if (icon == NULL)
{
return FALSE;
}
}
/*
* update the image buffer for icon on statusbar.
* We will free the memory of image buffer firstly, because when we call
* vm_statusbar_add_8byte_image_header, a new block of memory is allocated,
* so the older memory should be released.
*/
switch(status_type)
{
case VM_ICON_SHOW:
if (icon->image_buffer_show != NULL)
{
_vm_kernel_free(icon->image_buffer_show);
}
icon->image_buffer_show =
(VMUSTR)vm_statusbar_add_8byte_image_header(
image_info->image_type,
image_info->image_frame_num,
image_info->image_size,
image_info->image_width,
image_info->image_height,
image_info->image_data_buf);
break;
case VM_ICON_BLINK:
if (icon->image_buffer_blink != NULL)
{
_vm_kernel_free(icon->image_buffer_blink);
}
icon->image_buffer_blink =
(VMUSTR)vm_statusbar_add_8byte_image_header(
image_info->image_type,
image_info->image_frame_num,
image_info->image_size,
image_info->image_width,
image_info->image_height,
image_info->image_data_buf);
break;
/* TODO: we didn't handle VM_ICON_HIDE and VM_ICON_NCENTER_CELL. */
default:
break;
}
/* update all icons on statusbar. */
{
vm_status_bar_icon_t *temp = statusbar_image_queue;
while(NULL != temp)
{
if(NULL != temp->image_buffer_blink)
{
wgui_status_icon_bar_change_icon_image_ex(
(S32) temp->icon_id,
(PU8) temp->image_buffer_blink );
wgui_status_icon_bar_blink_icon((S32) temp->icon_id );
}
if(NULL != temp->image_buffer_show)
{
wgui_status_icon_bar_change_icon_image_ex(
(S32) temp->icon_id,
(PU8) temp->image_buffer_show );
wgui_status_icon_bar_show_icon((S32) temp->icon_id );
}
temp = temp->pNext;
}
}
/* TRUE means show icon or change icon on statusbar successfully. */
return TRUE;
}
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
/******************************************************************************
* FUNCTION
* vm_statusbar_release_notification_members_memory
* DESCRIPTION
* release the memory that the notification's members used.
* the members here means:
* ncenter_cell_buf->subText
* ncenter_cell_buf->timeText
* ncenter_cell_buf->imageBuffer
* PARAMETERS
* ncenter_cell_buf : [IN] a pointer to the memory that notifation used.
* RETURNS
* void.
*****************************************************************************/
#ifdef __MMI_NCENTER_SUPPORT__
static void vm_statusbar_release_notification_members_memory(
mmi_mre_data *ncenter_cell_buf)
{
if (ncenter_cell_buf != NULL)
{
/*
* we don't need to check whether the pointer(subText, timeText and
* imageBuffer) is NULL, because _vm_kernel_free will check it
* automatically.
*/
_vm_kernel_free(ncenter_cell_buf->subText);
_vm_kernel_free(ncenter_cell_buf->timeText);
_vm_kernel_free(ncenter_cell_buf->imageBuffer);
/*
* ncenter_cell_buf->subText = NULL;
* ncenter_cell_buf->timeText = NULL;
* ncenter_cell_buf->imageBuffer = NULL;
*/
memset(ncenter_cell_buf, 0, sizeof(mmi_mre_data));
}
}
#endif /* __MMI_NCENTER_SUPPORT__ */
/******************************************************************************
* FUNCTION
* vm_statusbar_release_notification_memory
* DESCRIPTION
* release the memory used by notification in ncenter.
* Please notice that, this function will only release the memory, but will
* NOT set the pointer to be NULL. If you need to do so, please do it
* manually after calling this function.
* PARAMETERS
* ncenter_cell_buf : [IN] a pointer to the memory used by notification in
* ncenter.
* RETURNS
* void.
*****************************************************************************/
#ifdef __MMI_NCENTER_SUPPORT__
static void vm_statusbar_release_notification_memory(
mmi_mre_data *ncenter_cell_buf)
{
/*
* each one of ncenter_cell_buf->subText, ncenter_cell_buf->timeText and
* ncenter_cell_buf->imageBuffer points to a block of memory, here we need
* to release the memory.
*/
vm_statusbar_release_notification_members_memory(ncenter_cell_buf);
/*
* release the memory of ncenter_cell_buf.
* please notice that, we just release the memory that ncenter_cell_buf
* points to, but don't set ncenter_cell_buf's value to be NULL, if you
* need this pointer to be set to NULL, please do it manually after
* calling this function.
*/
_vm_kernel_free(ncenter_cell_buf);
}
#endif /* __MMI_NCENTER_SUPPORT__ */
/******************************************************************************
* FUNCTION
* vm_statusbar_construct_notification
* DESCRIPTION
* allocate memory for icon->ncenter_cell_buf->subText,
* icon->ncenter_cell_buf->timeText, icon->ncenter_cell_buf->imageBuffer.
* then fill these buffers with correct value.
* PARAMETERS
* icon : [IN] a pointer to vm_status_bar_icon_t, which contains all
* information to display an image icon on statusbar and
* display a notification item in ncenter.
* new_message : [IN] it contains the new value of subText, timeText and
* imageBuffer to display a notification item in ncenter.
* RETURNS
* TRUE means success.
* FALSE means FAIL.
*****************************************************************************/
#ifdef __MMI_NCENTER_SUPPORT__
static VMINT vm_statusbar_construct_notification(
vm_status_bar_icon_t *icon,
VM_NEW_MESSAGE_INFO *new_message)
{
VM_ICON_STATUS_ICON_IMAGE_INFO *para_image_buffer;
mmi_mre_data *ncenter_cell_buffer = icon->ncenter_cell_buf;
VMUINT8 *res_buf = NULL;
VMINT appLogoSize = 0;
MMI_BOOL ret = MMI_FALSE;
/*
* allocate memory for subText, then copy the value from parameter to
* ncenter_cell_buffer.
*/
if (new_message->us_subText != NULL
&& (ncenter_cell_buffer->subText = (U16*) _vm_kernel_malloc(
vm_wstrlen((VMWSTR) new_message->us_subText) * 2 + 2)) != NULL)
{
wstrcpy(
(VMWSTR) ncenter_cell_buffer->subText,
(VMWSTR) new_message->us_subText);
}
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
/*
* allocate memory for imageBuffer, then copy image data into
* ncenter_cell_buffer.
* if user have provided image data by parameter, then we will use it
* directly, otherwise, we will use the app logo image.
*/
para_image_buffer = new_message->uc_imageBuffer;
if (para_image_buffer != NULL) /* user provided image data. */
{
if (para_image_buffer->image_size != 0)
{
ncenter_cell_buffer->imageBuffer
= (VMUSTR) vm_statusbar_add_8byte_image_header(
para_image_buffer->image_type,
para_image_buffer->image_frame_num,
para_image_buffer->image_size,
para_image_buffer->image_width,
para_image_buffer->image_height,
para_image_buffer->image_data_buf);
}
}
else /* user didn't provide image data. */
{
ret = srv_mre_get_app_image(
(U16*) icon->fullFilename,
NULL,
(U32*) &appLogoSize);
if (appLogoSize != 0 && ret == MMI_TRUE)
{
if((res_buf = (VMUINT8*) _vm_kernel_malloc(
sizeof(VMUINT8) * appLogoSize)) == NULL)
{
return MMI_FALSE;
}
/*
* if res_buf is not NULL here,
* please remember to release the memory.
*/
}
/* get app image. */
srv_mre_get_app_image(
(U16*) icon->fullFilename,
res_buf,
(U32 *) &appLogoSize);
if (appLogoSize != 0)
{
ncenter_cell_buffer->imageBuffer
= (VMUSTR) vm_statusbar_add_8byte_image_header(
IMAGE_TYPE_GIF,
1,
appLogoSize,
45,
45,
res_buf);
}
_vm_kernel_free(res_buf);
}
/*
if (ncenter_cell_buffer->imageBuffer == NULL)
{
return MMI_FALSE;
}
*/
/*
* we have allocated memory for notification item in ncenter, and set the
* correct value. so MMI_TRUE means everything is done successfully here.
*/
return MMI_TRUE;
}
#endif /* __MMI_NCENTER_SUPPORT__ */
/******************************************************************************
* FUNCTION
* vm_statusbar_new_message
* DESCRIPTION
* show icon on statusbar, and show one notification in ncenter. If one app
* calls this function for more times, then the older notification will be
* replaced by the latest one.
* PARAMETERS
* new_message : [IN] the notification that you want to show in
* ncenter. It includes a sub text, a time text,
* and an icon image.
* RETURNS
* TRUE means show notification item successfully.
* FALSE means failure.
*****************************************************************************/
VMINT vm_statusbar_new_message(VM_NEW_MESSAGE_INFO* new_message)
{
VM_P_HANDLE app_handle;
vm_status_bar_icon_t *icon = NULL;
mmi_event_struct event_data;
mmi_mre_data *ncenter_cell_buffer = NULL;
/* only valid when __MMI_NCENTER_SUPPORT__ is defined. */
#ifdef __MMI_NCENTER_SUPPORT__
/* the text length must less than 50 characters. */
if (new_message == NULL
|| new_message->subText_lenth > 50
|| new_message->timeText_lenth > 50)
{
return MMI_FALSE;
}
/* get current app's handle. */
if ((app_handle = vm_pmng_get_current_handle()) == 0)
{
return MMI_FALSE;
}
/*
* get icon by app's handle, if the app doesn't have an icon, then create
* one for it.
*/
if ((icon = vm_statusbar_get_status_bar_image_byhandle(app_handle)) == NULL)
{
icon = vm_statusbar_list_node_create(app_handle);
if (icon == NULL)
{
return MMI_FALSE;
}
}
/* show icon on statusbar. */
if (icon->icon_id)
{
wgui_status_icon_bar_show_icon(icon->icon_id);
}
/*
* init new message
* NOTE:this macro will memset "event_data" so do NOT set any event data
* before the macro.
*/
MMI_FRM_INIT_EVENT(&event_data, EVT_ID_MRE_NOTIFICATION_MESSAGE);
ncenter_cell_buffer = (mmi_mre_data*) icon->ncenter_cell_buf;
/*
* if current app has shown one notification in ncenter, then we will delete
* it from ncenter firstly, and release all the memory used for this
* notification (and we will re-allocate memory for it in the later).
*/
if (ncenter_cell_buffer != NULL)
{
/* close the notification from ncenter. */
vm_ncenter_close_notification((void*) icon);
/*
* release memory which is pointed to by ncenter_cell_buffer->subText,
* ncenter_cell_buffer->timeText and ncenter_cell_buffer->imageBuffer.
*
* The reason is : suppose original subText's length is 10, now we want
* to set a new subText, and the new length is 20. so the original
* buffer is not enough, and we need to release it firstly, then
* allocate a new block of memory for the new subText.
*/
vm_statusbar_release_notification_members_memory(ncenter_cell_buffer);
}
/*
* if current app doesn't have a notification shown in ncenter, then we will
* allocate a block of memory for the notification.
*/
if (NULL == ncenter_cell_buffer)
{
if ((ncenter_cell_buffer = (mmi_mre_data* ) _vm_kernel_malloc(
sizeof(mmi_mre_data))) != NULL)
{
icon->ncenter_cell_buf = ncenter_cell_buffer;
/*
* ncenter_cell_buffer->subText = NULL;
* ncenter_cell_buffer->timeText = NULL;
* ncenter_cell_buffer->imageBuffer = NULL;
*/
memset(ncenter_cell_buffer, 0, sizeof(mmi_mre_data));
}
else
{
return MMI_FALSE;
}
}
/*
* now we have a block of memory for ncenter_cell_buffer, but we still need
* to allocate memory for its members: subText, timeText, and imageBuffer.
*/
if (vm_statusbar_construct_notification(icon, new_message) == MMI_TRUE)
{
event_data.user_data = icon;
MMI_FRM_CB_EMIT_EVENT(&event_data);
/* show notification item successfully. */
return MMI_TRUE;
}
else
{
/*
* we can NOT construct the notification, the reason may be memory is
* not enough or something else. Then we should release the memory and
* return FALSE to tell user : we can NOT show notification in ncenter.
*/
vm_statusbar_release_notification_memory(ncenter_cell_buffer);
icon->ncenter_cell_buf = NULL;
return MMI_FALSE;
}
#else /* __MMI_NCENTER_SUPPORT__ */
/* if __MMI_NCENTER_SUPPORT__ is not defined, we just return FALSE. */
return MMI_FALSE;
#endif /* __MMI_NCENTER_SUPPORT__ */
}
#ifdef __MRE_SAL_PN__
S32 vapp_mre_push_new_message(U32 app_id);
void vm_push_new_message(U32 AppID)
{
/* TODO: */
}
#endif /* __MRE_SAL_PN__ */
vm_status_bar_icon_t* vm_statusbar_get_status_bar_image_byhandle(
VM_P_HANDLE pHandle)
{
vm_status_bar_icon_t *tmp = statusbar_image_queue;
while (tmp != NULL)
{
if (tmp->pHandle == pHandle)
{
return tmp;
}
tmp = tmp->pNext;
}
return NULL;
}
MMI_BOOL vm_statusbar_set_handle(VMINT icon_id, VMINT icon_handle)
{
VMINT i = VM_STATUSBAR_START_INDEX;
for (; i < VM_STATUSBAR_MAX_COUNT; ++i)
{
if (icon_id == g_icon_table[i].icon_id)
{
g_icon_table[i].handle = icon_handle;
g_icon_table[i].is_used = MMI_TRUE;
return MMI_TRUE;
}
}
return MMI_FALSE;
}
MMI_BOOL vm_statusbar_unset_handle(VMINT icon_id, VMINT icon_handle)
{
VMINT i = VM_STATUSBAR_START_INDEX;
for (; i < VM_STATUSBAR_MAX_COUNT; ++i)
{
if (icon_id == g_icon_table[i].icon_id)
{
g_icon_table[i].handle = icon_handle;
g_icon_table[i].is_used = MMI_FALSE;
return MMI_TRUE;
}
}
return MMI_FALSE;
}
static VMINT vm_statusbar_check_handle(VMINT unknow_handle)
{
VMINT i = VM_STATUSBAR_START_INDEX;
for (; i < VM_STATUSBAR_MAX_COUNT; ++i)
{
if (unknow_handle == g_icon_table[i].handle)
{
return g_icon_table[i].handle;
}
}
return 0;
}
/*****************************************************************************
* FUNCTION
* vm_statusbar_get_unused_iconid
* DESCRIPTION
* get current not used IconID
* PARAMETERS
*
* RETURNS
* void
*****************************************************************************/
VMINT vm_statusbar_get_unused_iconid(void)
{
VMINT i = VM_STATUSBAR_START_INDEX;
for (; i < VM_STATUSBAR_MAX_COUNT; ++i)
{
if (!g_icon_table[i].is_used) // unused
{
g_icon_table[i].is_used = TRUE;
return g_icon_table[i].icon_id;
}
}
/*
* if all icon IDs have been used, then we will return the default icon id,
* and user must know that, the default icon id means invalid icon id.
*/
return VM_STATUS_ICON_MRE_DEFAULT;
}
/*****************************************************************************
* FUNCTION
* vm_register_status_icon_pen_event
* DESCRIPTION
* get current not used IconID
* PARAMETERS
*
* RETURNS
* void
*****************************************************************************/
#if defined(__MMI_TOUCH_SCREEN__) && !defined(__MMI_VUI_HOMESCREEN__)
void vm_register_status_icon_pen_event(void)
{
VMINT i;
#if defined(VM_STATUSBARICON_PRE09B)
for (i = 0; i < 11; ++i)
{
wgui_register_status_icon_pen_event_hdlr(
VM_STATUS_ICON_MRE_DEFAULT + i,
WGUI_STATUS_ICON_BAR_PEN_SELECT_ICON,
vm_process_status_icon_mre_cb[i]);
}
#else /* VM_STATUSBARICON_PRE09B */
for (i = 0; i < 11; ++i)
{
wgui_status_icon_bar_register_pen_event_handler(
VM_STATUS_ICON_MRE_DEFAULT + i,
WGUI_STATUS_ICON_BAR_PEN_SELECT_ICON,
vm_process_status_icon_mre_0);
}
#endif /* VM_STATUSBARICON_PRE09B */
}
#else /* (__MMI_TOUCH_SCREEN__) && !defined(__MMI_VUI_HOMESCREEN__) */
void vm_register_status_icon_pen_event(void)
{
/* do nothing. */
}
#endif /* (__MMI_TOUCH_SCREEN__) && !defined(__MMI_VUI_HOMESCREEN__) */
/*****************************************************************************
* FUNCTION
* vm_process_status_icon
* DESCRIPTION
* when app running in background,IconID was be clicked,
* this function will be call
* PARAMETERS
*
* RETURNS
* void
*****************************************************************************/
void vm_status_icon_cb(VMINT icon_id)
{
if (VM_STATUS_ICON_MRE_1 >= icon_id && icon_id <= VM_STATUS_ICON_MRE_10)
{
vm_statusbar_process_icon(icon_id);
}
}
void vm_statusbar_process_icon(VMINT icon_id)
{
{
// try to running app in foreground
VMWCHAR *app_name = vm_get_fullfilename_by_iconid(icon_id);
srv_mre_appmgr_launch_by_filepath((U16*) app_name);
}
}
void vm_process_status_icon_mre_0(void)
{
vm_status_icon_cb(VM_STATUS_ICON_MRE_DEFAULT);
}
void vm_process_status_icon_mre_1(void)
{
vm_status_icon_cb(VM_STATUS_ICON_MRE_1);
}
void vm_process_status_icon_mre_2(void)
{
vm_status_icon_cb(VM_STATUS_ICON_MRE_2);
}
void vm_process_status_icon_mre_3(void)
{
vm_status_icon_cb(VM_STATUS_ICON_MRE_3);
}
void vm_process_status_icon_mre_4(void)
{
vm_status_icon_cb(VM_STATUS_ICON_MRE_4);
}
void vm_process_status_icon_mre_5(void)
{
vm_status_icon_cb(VM_STATUS_ICON_MRE_5);
}
void vm_process_status_icon_mre_6(void)
{
vm_status_icon_cb(VM_STATUS_ICON_MRE_6);
}
void vm_process_status_icon_mre_7(void)
{
vm_status_icon_cb(VM_STATUS_ICON_MRE_7);
}
void vm_process_status_icon_mre_8(void)
{
vm_status_icon_cb(VM_STATUS_ICON_MRE_8);
}
void vm_process_status_icon_mre_9(void)
{
vm_status_icon_cb(VM_STATUS_ICON_MRE_9);
}
void vm_process_status_icon_mre_10(void)
{
vm_status_icon_cb(VM_STATUS_ICON_MRE_10);
}
/*****************************************************************************
* FUNCTION
* vm_get_fullfilename_by_queue_iconid
* DESCRIPTION
* find the process full file name include path by icon_id
* PARAMETERS
* [IN] image_queue :
* [IN] icon_id : ICON ID
* RETURNS
* [OUT] SUCCESS : full file name
* [OUT] FAIL : NULL
*****************************************************************************/
static VMWCHAR* vm_get_fullfilename_by_iconid(VMINT icon_id)
{
VMWCHAR *app_name = vm_get_fullfilename_by_queue_iconid(
statusbar_image_queue,
icon_id);
return app_name;
}
/*****************************************************************************
* FUNCTION
* vm_get_fullfilename_by_queue_iconid
* DESCRIPTION
* find the process full file name include path by icon_id
* PARAMETERS
* [IN] image_queue : special icon queue
* [IN] icon_id : ICON ID
* RETURNS
* [OUT] SUCCESS : full file name
* [OUT] FAIL : NULL
*****************************************************************************/
static VMWCHAR* vm_get_fullfilename_by_queue_iconid(
vm_status_bar_icon_t *image_queue,
VMINT icon_id)
{
vm_status_bar_icon_t *tmp = vm_get_statusbar_byiconid(image_queue, icon_id);
if (tmp)
{
return tmp->fullFilename; // full file name include path
}
return NULL;
}
/*****************************************************************************
* FUNCTION
* vm_get_statusbar_byiconid
* DESCRIPTION
* find icon by icon_id
* PARAMETERS
* [IN] image_queue :
* [IN] icon_id : ICON ID
* RETURNS
* [OUT] SUCCESS : pointer which point to icon node.
* [OUT] FAIL : NULL
*****************************************************************************/
static vm_status_bar_icon_t* vm_get_statusbar_byiconid(
vm_status_bar_icon_t *image_queue,
VMINT icon_id)
{
vm_status_bar_icon_t *tmp = image_queue;
// search the linked-list
while (tmp != NULL)
{
if (tmp->icon_id== icon_id)
{
return tmp;
}
tmp = tmp->pNext;
}
return NULL;
}
/*******************************************************************************
* FUNCTION
* vm_statusbar_get_height
* DESCRIPTION
* get the height of statusbar.
* PARAMETER
* void
* RETURNS
* the height (in pixels) of statusbar.
******************************************************************************/
VMINT vm_statusbar_get_height(void)
{
return MMI_STATUS_BAR_HEIGHT;
}
#if defined(__MMI_TOUCH_SCREEN__) && !defined(__MMI_VUI_HOMESCREEN__)
void vm_reset_status_icon_pen_event(void)
{
VMINT i;
#if defined(VM_STATUSBARICON_PRE09B)
for (i = VM_STATUS_ICON_MRE_DEFAULT; i <= VM_STATUS_ICON_MRE_10; ++i)
{
wgui_register_status_icon_pen_event_hdlr(
i,
WGUI_STATUS_ICON_BAR_PEN_SELECT_ICON,
NULL);
}
#else
for (i = VM_STATUS_ICON_MRE_DEFAULT; i <= VM_STATUS_ICON_MRE_10; ++i)
{
wgui_status_icon_bar_register_pen_event_handler(
i,
WGUI_STATUS_ICON_BAR_PEN_SELECT_ICON,
NULL);
}
#endif
}
#else /* (__MMI_TOUCH_SCREEN__) && !(__MMI_VUI_HOMESCREEN__) */
void vm_reset_status_icon_pen_event(void)
{
/* do nothing. */
}
#endif /* (__MMI_TOUCH_SCREEN__) && !(__MMI_VUI_HOMESCREEN__) */
// Zhibo.Tong (mtk80982) add start (cut from vmgraph.c)
#ifndef MRE_GRAPHIC_FUNC_FOR_MTK_VERSION_09B
#define MRE_GRAPHIC_FUNC_FOR_MTK_VERSION_09B
void vm_graphic_status_icon_bar_hide_callback(void)
{
S32 x1, y1, x2, y2;
BOOL source_key_enable;
gdi_color source_key_value;
/* set clip region */
gdi_layer_push_clip();
/* get the clip values of bar_id */
#ifndef MRE_GRAPHIC_FUNC_FOR_MTK_VERSION_09B
wgui_status_icon_get_status_icon_bar_clip(0, &x1, &y1, &x2, &y2);
#else /* MRE_GRAPHIC_FUNC_FOR_MTK_VERSION_09B */
wgui_status_icon_bar_get_clip(
WGUI_STATUS_ICON_BAR_H_BAR, &x1, &y1, &x2, &y2);
#endif /* MRE_GRAPHIC_FUNC_FOR_MTK_VERSION_09B */
gdi_layer_set_clip(x1, y1, x2, y2);
gdi_layer_get_source_key(&source_key_enable, &source_key_value);
gdi_draw_solid_rect(x1, y1, x2, y2, source_key_value);
gdi_layer_pop_clip();
}
void vm_graphic_show_status_icon_bar(void)
{
gdi_handle cur_active_layer = 0;
gdi_handle cur_alpha_layer = 0;
/*
if(vm_pmng_state(VM_PMNG_CUR_HANDLE) != VM_PMNG_FOREGROUND)
{
return;
};
*/
vm_graphic_async_blt_stop();
gdi_layer_get_active(&cur_active_layer);
gdi_get_alpha_blending_source_layer(&cur_alpha_layer);
#ifndef MRE_GRAPHIC_FUNC_FOR_MTK_VERSION_09B
wgui_status_icon_set_status_icon_bar_layer(0, cur_active_layer);
wgui_status_icon_register_hide_status_icon_bar(
0,
vm_graphic_status_icon_bar_hide_callback);
wgui_status_icon_show_status_icon_bar(0);
wgui_status_icon_update_status_icons();
#else /* MRE_GRAPHIC_FUNC_FOR_MTK_VERSION_09B */
wgui_status_icon_bar_set_target_layer(
WGUI_STATUS_ICON_BAR_H_BAR,
(gdi_handle) cur_active_layer);
if(cur_alpha_layer != 0)
{
wgui_status_icon_bar_set_alpha_blend_layer(
WGUI_STATUS_ICON_BAR_H_BAR,
(gdi_handle) cur_alpha_layer);
}
else
{
wgui_status_icon_bar_set_alpha_blend_layer(
WGUI_STATUS_ICON_BAR_H_BAR,
(gdi_handle) cur_active_layer);
}
/*
* if we register a hide_callback to statusbar, then the callback will
* be called to draw statusbar's background, instead of using default
* background image.
*
* here, we want the statusbar to use its default background image, so
* the statement below is commented out.
*/
//wgui_status_icon_bar_register_hide_callback(
// WGUI_STATUS_ICON_BAR_H_BAR,
// vm_graphic_status_icon_bar_hide_callback);
if(vm_pmng_state(VM_PMNG_CUR_HANDLE) == VM_PMNG_FOREGROUND)
{
wgui_status_icon_bar_set_display(WGUI_STATUS_ICON_BAR_H_BAR);
}
gdi_layer_lock_frame_buffer();
wgui_status_icon_bar_update();
gdi_layer_unlock_frame_buffer();
#endif /* MRE_GRAPHIC_FUNC_FOR_MTK_VERSION_09B */
}
/* This api is not in the sandbox, so it will be called by other api */
void vm_graphic_reset_status_icon_bar(void)
{
VM_PROCESS_STATUS state = vm_pmng_state(VM_PMNG_CUR_HANDLE);
#ifndef MRE_GRAPHIC_FUNC_FOR_MTK_VERSION_09B
wgui_status_icon_reset_status_icon_bar_layer(0);
wgui_status_icon_reset_all_status_icon_bar_layer();
#else
wgui_status_icon_bar_reset_target_layer(WGUI_STATUS_ICON_BAR_H_BAR);
wgui_status_icon_bar_reset();
#endif
vm_graphic_async_blt_start();
}
#endif /* MRE_GRAPHIC_FUNC_FOR_MTK_VERSION_09B */
#endif /* __MRE_SAL_STATUS__ */