MENU_statusBar.c File Reference


Detailed Description

This module manages the status bar.

REVISION

Definition in file MENU_statusBar.c.

#include "menu.h"
#include "menu_assert.h"
#include "../SYSTEM/sys_hardware.h"
#include "../SYSTEM/sys_main.h"
#include "../SYSTEM/sys_hiddenfeature.h"
#include "../AUDIO/audio.h"
#include "../BATTERY/battery.h"

Include dependency graph for MENU_statusBar.c:

Include dependency graph

Go to the source code of this file.

Functions

void MENU_statusBar (STBAR_ACTION eID, USHORT data)
 Function manages the status bar.


Function Documentation

void MENU_statusBar STBAR_ACTION  eID,
USHORT  data
 

Function manages the status bar.

Status bar does not belong to any MENU, since this bar will present all the time.

If there is over-lapped display on status bar, we'll leave the active MENU to handle it.

Parameters:
eID Status bar action ID.
data Status bar action support data.

Definition at line 67 of file MENU_statusBar.c.

References st_FIELD::attr, st_RECT::br, st_BRUSH::clr, battery::CurVoltage, st_FIELD::dptr, GEN_createTimeString(), GEN_int2ASCII(), LCD_drawRect(), LCD_invRect(), LCD_printFld(), LCD_setBrush(), LCD_setFrame(), LCD_setPen(), st_FIELD::rc, RTC_BCD2INT(), RTC_readTime(), st_SYSPARAM::sleepCount, st_SYSPARAM::sleepTimer, st_FIELD::txtattr, st_RECT::ul, st_POINT::x, and st_POINT::y.

00068 {
00069     static USHORT   counter = 0;
00070     st_RECT         rect;
00071     st_BRUSH        brush;
00072     st_FIELD        fld;
00073     ULONG           status[2] = {   (ULONG)graf_icon_status1,
00074                                     (ULONG)graf_icon_status2 };
00075     if( SYS_isBatteryAnimation() )
00076     {
00077         if(eID == STBAR_BATTERY)
00078         {
00079             // Code to do full screeen battery animation.
00080             ULONG batteryIcon[4] ={ (ULONG)graf_icon_anim_batteryNull,
00081                                     (ULONG)graf_icon_anim_batteryLevel1,
00082                                     (ULONG)graf_icon_anim_batteryLevel2,
00083                                     (ULONG)graf_icon_anim_batteryFull};
00084             
00085             /* Clear previous display. */
00086             fld.rc.ul.x = 0;
00087             fld.rc.ul.y = 0;
00088             fld.rc.br.x = 127;
00089             fld.rc.br.y = 127;  
00090                 
00091             LCD_setBrush(NULL);
00092             LCD_setPen(NULL);
00093             LCD_drawRect(&fld.rc);
00094             
00095             if(0x1234 == data)
00096             {
00097                 char strVoltage[8];
00098                 
00099                 fld.rc.ul.x = 15;
00100                 fld.rc.ul.y = 30;   
00101                 fld.dptr = (ULONG)graf_icon_anim_batteryClear;
00102                 fld.attr = 0;
00103                 LCD_printFld(&fld, NULL);
00104                     
00105                 fld.rc.ul.x = 55;
00106                 fld.rc.ul.y = 70;       
00107                 fld.rc.br.x = 90;
00108                 fld.rc.br.y = 90;   
00109                     
00110                 // Display voltage.         
00111                 fld.txtattr = ALIGN_LEFT | WRAP_OFF | ALIGN_VCENT | TXT_ATTR_PARTDSP;
00112                 fld.attr = FLD_ATTR_TXTFLD | FONT_BR17;     
00113                 fld.dptr = (ULONG)strVoltage;
00114                 GEN_int2ASCII((ULONG)BatteryData.CurVoltage*100/4096, strVoltage, FALSE, 0);
00115             }
00116             else
00117             {                   
00118                 fld.rc.ul.x = 15;
00119                 fld.rc.ul.y = 30;                       
00120         
00121                 if(DONTCARE == data)
00122                 {
00123                     //LCD_setPen(NULL);
00124                     //LCD_setBrush(NULL);
00125                     //LCD_drawRect(&fld.rc);
00126                     fld.dptr = (ULONG)graf_icon_anim_batteryClear;
00127                     fld.attr = 0;
00128                 }
00129                 else
00130                 {
00131                     data = (data>3)? 3: data;
00132                     fld.dptr = batteryIcon[data];
00133                     fld.attr = 0;                   
00134                 }
00135             }               
00136             LCD_printFld(&fld, NULL);       
00137             mMSG_send(lcdMsgQ, LCD_MSG_ID, 0x0000, 0x7F7F, 0);
00138         }
00139         return;
00140     }
00141 
00142 
00143     switch ( eID ) 
00144     {   
00145     case STBAR_CREATE: /* Create the status bar frame work. */      
00146         rect.ul.x = STBAR_DLMT_LEFTx;       
00147         rect.ul.y = STBAR_DLMT_LEFTy;       
00148         rect.br.x = STBAR_DLMT_RIGHTx;      
00149         rect.br.y = 127;        
00150         LCD_setBrush(NULL);
00151         LCD_drawRect(&rect);
00152         
00153         /* Draw delimiter line. */
00154         rect.ul.x = STBAR_DLMT_LEFTx;       
00155         rect.ul.y = STBAR_DLMT_LEFTy;       
00156         rect.br.x = STBAR_DLMT_RIGHTx;      
00157         rect.br.y = STBAR_DLMT_RIGHTy;
00158         brush.clr = STBAR_DLMT_BRUSHCLR;
00159         LCD_setBrush(&brush);
00160         LCD_drawRect(&rect);
00161         
00162         /* Display MEM. */      
00163         fld.txtattr = ALIGN_LEFT | WRAP_OFF | ALIGN_VCENT | TXT_ATTR_PARTDSP;       
00164         fld.attr = FLD_ATTR_TXTFLD | FONT_MODE6;                
00165         fld.rc.ul.x = 0;        
00166         fld.rc.ul.y = 121;      
00167         fld.rc.br.x = 18;       
00168         fld.rc.br.y = 127;      
00169         fld.dptr = (ULONG)text_mem; 
00170         LCD_printFld(&fld, NULL);
00171         
00172         // Draw full membar.
00173         /* Draw memory bar envelope. */     
00174         //rect.ul.x = MEMBAR_ULx;
00175         //rect.ul.y = MEMBAR_ULy;
00176         //rect.br.x = MEMBAR_BRx;
00177         rect.ul.x = MEMBAR_ULx-2;
00178         rect.ul.y = MEMBAR_ULy-3;
00179         rect.br.x = MEMBAR_BRx+2;
00180         rect.br.y = MEMBAR_BRy;
00181         LCD_setFrame(&rect);
00182         LCD_loadGraph(&rect.ul, (ULONG)graf_icon_membar);
00183 
00184         return;
00185         
00186     case STBAR_MEMORY: /* Memory bar control. */        
00187     {
00188         // data contains the memory percentage in a format of XXYY.
00189         // XX: memory percentage after potential sync.
00190         // YY: current memory percentage.
00191         MENU_assert(((data>>8)&0x0ff)<=100, MENU_STATUSBAR);
00192         MENU_assert((data&0x0ff)<=100, MENU_STATUSBAR2);
00193         
00194         /* Draw memory bar envelope. */     
00195         //rect.ul.x = MEMBAR_ULx;
00196         //rect.ul.y = MEMBAR_ULy;
00197         //rect.br.x = MEMBAR_BRx;
00198         rect.ul.x = MEMBAR_ULx-2;
00199         rect.ul.y = MEMBAR_ULy-3;
00200         rect.br.x = MEMBAR_BRx+2;
00201         rect.br.y = MEMBAR_BRy;
00202         LCD_setFrame(&rect);
00203         LCD_loadGraph(&rect.ul, (ULONG)graf_icon_membar);
00204         
00205         rect.ul.x = MEMBAR_ULx-2+(MEMBAR_BRx-MEMBAR_ULx-1)*(100-((data>>8)&0x0ff))/100;
00206         LCD_loadGraph(&rect.ul, (ULONG)graf_icon_memindicator);
00207         
00208         rect.ul.y += 4;
00209         rect.ul.x += 3;
00210         rect.br.y--;
00211         rect.br.x-= 4;
00212         if(rect.ul.x <= rect.br.x )
00213         {
00214             LCD_setBrush(NULL);
00215             LCD_setPen(NULL);
00216             LCD_drawRect(&rect);
00217         }
00218         
00219         rect.ul.x = MEMBAR_ULx;
00220         rect.br.x = MEMBAR_ULx+(MEMBAR_BRx-MEMBAR_ULx-1)*(100-(data&0x0ff))/100;
00221         if(rect.ul.x < rect.br.x )
00222         {
00223             st_BRUSH brush;
00224             brush.clr = 3;
00225             LCD_setBrush(&brush);
00226             LCD_setPen(NULL);
00227             LCD_drawRect(&rect);
00228         }
00229 
00230         break;
00231     }
00232     case STBAR_TIME:    /* Load current time. */
00233     {
00234         USHORT  minutes;
00235         st_TIME Time;
00236         char    strTime[8];
00237         
00238         if(SYS_HF_sleepTimer())
00239         {
00240             if(sysParam.sleepCount)
00241             {
00242                 static int odd = 0;
00243                 odd ^= 1;
00244                 if((0 == odd)&&(0 != data) ) sysParam.sleepCount--;
00245                 minutes = sysParam.sleepCount;
00246             }
00247             else
00248             {
00249                 sysParam.sleepCount = sysParam.sleepTimer;
00250                 mMSG_send(sysMsgQ, TMR_MSG_ID, TSHUTDOWN, DONTCARE, SYS_FOREVER);
00251             }           
00252         }
00253         else
00254         {
00255             RTC_readTime(&Time);
00256             Time.Hour = RTC_BCD2INT(HOUR, Time.Hour);
00257 //DeepB
00258 //          if(Time.Hour > 12) Time.Hour -= 12;
00259             
00260             // 00:00 in 24 hr is 12:00am in 12 hr
00261 //          if ( Time.Hour == 0 ) Time.Hour = 12;
00262                 
00263             Time.Minute = RTC_BCD2INT(MINUTE, Time.Minute);
00264             minutes = Time.Hour*60 + Time.Minute;
00265         }
00266         GEN_createTimeString(minutes, strTime);
00267         
00268         /* Display time string. */      
00269         fld.txtattr = ALIGN_HCENT | WRAP_OFF | ALIGN_VCENT | TXT_ATTR_PARTDSP;
00270         fld.attr = FLD_ATTR_TXTFLD | FONT_CLOCK8;       
00271         fld.rc.ul.x = 70;
00272         fld.rc.ul.y = 118;
00273         fld.rc.br.x = 98;
00274         fld.rc.br.y = 127;  
00275         fld.dptr = (ULONG)strTime;
00276     
00277         /* Clear previous display. */
00278         LCD_setBrush(NULL);
00279         LCD_setPen(NULL);
00280         LCD_drawRect(&fld.rc);
00281         fld.rc.ul.y = 119;
00282         if(SYS_HF_sleepTimer()) fld.rc.br.y = 126;
00283         LCD_printFld(&fld, NULL);
00284         
00285         if(SYS_HF_sleepTimer())
00286         {
00287             fld.rc.ul.x = 73;
00288             fld.rc.ul.y = 118;
00289             fld.rc.br.x = 95;
00290             fld.rc.br.y = 127;  
00291             LCD_invRect(&fld.rc);
00292         }
00293         break;
00294     }
00295     
00296     case STBAR_MYFI:    /* MyFi icon control. */
00297     {
00298         fld.rc.ul.x = 100;
00299         fld.rc.ul.y = 117;
00300         fld.rc.br.x = 110;
00301         fld.rc.br.y = 127;
00302         fld.dptr = (ULONG)graf_icon_myfi;
00303         fld.attr = 0;
00304         LCD_printFld(&fld, NULL);       
00305         break;
00306     }
00307         
00308     case STBAR_BATTERY: /* Battery icon control. */
00309     {
00310         ULONG batteryIcon[4] ={ (ULONG)graf_icon_batteryNull,
00311                                 (ULONG)graf_icon_batteryLevel1,
00312                                 (ULONG)graf_icon_batteryLevel2,
00313                                 (ULONG)graf_icon_batteryFull};
00314             
00315         /* Clear previous display. */
00316         fld.rc.ul.x = 110;
00317         fld.rc.ul.y = 118;
00318         fld.rc.br.x = 127;
00319         fld.rc.br.y = 127;  
00320     
00321         LCD_setBrush(NULL);
00322         LCD_setPen(NULL);
00323         LCD_drawRect(&fld.rc);
00324             
00325         if(0x1234 == data)
00326         {
00327             char strVoltage[8];
00328                 
00329             // Display voltage.         
00330             fld.txtattr = ALIGN_RIGHT | WRAP_OFF | ALIGN_VCENT | TXT_ATTR_PARTDSP;
00331             fld.attr = FLD_ATTR_TXTFLD | FONT_CLOCK8;       
00332             fld.dptr = (ULONG)strVoltage;
00333             GEN_int2ASCII((ULONG)BatteryData.CurVoltage*100/4096, strVoltage, FALSE, 0);
00334             LCD_printFld(&fld, NULL);
00335             break;
00336         }
00337             
00338         fld.rc.ul.x = 114;      
00339 
00340         if(DONTCARE == data)
00341         {
00342             //LCD_setPen(NULL);
00343             //LCD_setBrush(NULL);
00344             //LCD_drawRect(&fld.rc);
00345         }
00346         else
00347         {
00348             data = (data>3)? 3: data;
00349             fld.dptr = batteryIcon[data];
00350             fld.attr = 0;
00351             LCD_printFld(&fld, NULL);       
00352         }
00353         break;
00354     }
00355     case STBAR_SYSBUSY:
00356         fld.rc.ul.x = 100;      
00357         fld.rc.ul.y = 117;      
00358         fld.rc.br.x = 110;      
00359         fld.rc.br.y = 127;
00360         counter ^= 1;
00361         fld.dptr = status[counter];
00362         fld.attr = 0;
00363         LCD_printFld(&fld, NULL);       
00364         break;
00365         
00366     case STBAR_SYSIDLE:
00367         if(SYS_isPlayActive()&&AUDIO_isMyfiActive())
00368         {
00369             fld.rc.ul.x = 100;
00370             fld.rc.ul.y = 117;
00371             fld.rc.br.x = 110;
00372             fld.rc.br.y = 127;
00373             fld.dptr = (ULONG)graf_icon_myfi;
00374             fld.attr = 0;
00375             LCD_printFld(&fld, NULL);       
00376         }
00377         else
00378         {
00379             rect.ul.x = 100;        
00380             rect.ul.y = 117;        
00381             rect.br.x = 110;        
00382             rect.br.y = 127;
00383             LCD_setPen(NULL);
00384             LCD_setBrush(NULL);
00385             LCD_drawRect(&rect);
00386         }
00387         break;
00388     }
00389     
00390     mMSG_send(  lcdMsgQ, LCD_MSG_ID, 
00391                 STBAR_DLMT_LEFTx<<8|STBAR_DLMT_LEFTy, 
00392                 STBAR_DLMT_RIGHTx<<8|127, 
00393                 0);
00394 }

Here is the call graph for this function:


Generated on Wed Jan 19 01:13:11 2005 for neuros-firmware by  doxygen 1.3.9.1