⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmimain.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 4 页
字号:

  // toggle the variable
  if(toggle)
  {
    toggle = FALSE;
  }
  else
  {
    toggle = TRUE;
  }


  return 0;
}

/*******************************************************************************

 $Function:  key

 $Description:	 keyboard event handler

 $Returns:    none.

 $Arguments:

*******************************************************************************/
// switching the mobile on
static int key (MfwEvt e, MfwKbd *kc)
{

TRACE_FUNCTION("Initial key");
//---------------start : Mobile On-------------------
    TRACE_EVENT("	      Mobile ON");
    /* set the state of mobile on   */
    globalMobileMode = (globalMobileMode | GlobalMobileOn);


//startExec(PhoneInit,0);	      /* get it rolling 	  */

    return 1;
}
/*******************************************************************************

 $Function:  globalMme

 $Description:	MME event handler

 $Returns:    none.

 $Arguments:

*******************************************************************************/
int globalMme(MfwEvt e, MfwHnd para)
{
    MfwMme* mc = (MfwMme*)para;

    U8	value;
    char buf[40]; //nm test only

	TRACE_FUNCTION("globalMme");
	
    switch(e) {
    case MfwMmeSignal :
	TRACE_EVENT("Mme Event: Signal");
	value = (U8)mc->value;//JVJE
	sprintf (buf, "Event MfwMmeSignal  %d", value); // nm just for testing
	TRACE_EVENT (buf);
	globalSignalUpdate(value); /*Update the value of the fieldstrength  */

	break;

    case MfwMmeBattery:
       TRACE_EVENT("Mme Event: Battery....");
	break;


    case MfwMmeBaState:
	TRACE_EVENT("Mme Event: State....");

	value = (U8)mc->value;




	value = (U8)mc->value;
	switch(value)
	{

	/* External Power Plugged Off */
    case 0:
      TRACE_EVENT("Mme Event:Discharging");
	    globalMobileMode = globalMobileMode & (~GlobalCharging);
	    globalMobileMode = globalMobileMode & (~GlobalBatteryPower);


	break;

	/* Mme Event: External Power Connected or End of Charge */
       case 1:
      TRACE_EVENT("Mme Event:GlobalBatteryPower");
	    globalMobileMode = globalMobileMode & (~GlobalCharging);
	    globalMobileMode = (globalMobileMode | GlobalBatteryPower);

	    /* indicate that the battery is full*/
	  globalBatteryMode = GlobalBatteryFull;
	  TRACE_EVENT("globalBatteryPicNumber = GlobalBatteryFull");
	break;
	/* Mme Event: Start of Charge */
	case 2:
	    TRACE_EVENT("Mme Event:Charging");
	    globalMobileMode = globalMobileMode & (~GlobalBatteryPower);
	    globalMobileMode = (globalMobileMode | GlobalCharging);

	    globalFlashBattery ();



	break;




	default:
	    break;
    }


    break;

    default:
	return 1;
    }
    return 1;
}

/*******************************************************************************

 $Function:  backlight

 $Description:	switch on backlight for certain time

 $Returns:    none.

 $Arguments:

*******************************************************************************/
static void backlight (void)
{


}

/*******************************************************************************

 $Function:  timesEvent

 $Description:	 times event  clock

 $Returns:    none.

 $Arguments:

*******************************************************************************/
static int timesEvent (MfwEvt e, MfwTim *t)
{

		      //RM only for PC testing
  second += 60; 			  /* increase seconds	      */

 
   idleEvent(IdleUpdate);

   /*MC CONQUEST 5999->6007,21/05/02 if CPHS reading didn't work on switch-on, try again*/
   if (CphsPresent() == CPHS_ERR)
		cphs_support_check();
	

  mme_backlightEvent(BL_IDLE_TIMER);
	
  timStart(times);

  return 1;
}


/*******************************************************************************

 $Function:  showCLOCK

 $Description:	display clock

 $Returns:    none.

 $Arguments:

*******************************************************************************/
void showCLOCK(void)
{	/*SPR 1725, use new function to get clock string*/
    dspl_TextOut(30,24,0,(char *)mfw_td_get_clock_str());
}
/*******************************************************************************

 $Function:  setClockFormat

 $Description:	used to switch between 24 hour and 12 hour display format

 $Returns:    none.

 $Arguments:  format enum

*******************************************************************************/
void setClockFormat(UBYTE format)
{/*SPR 1725, use new function to set clock format*/
  if (format == MFW_TIME_FORMAT_12HOUR)
    FFS_flashData.time_format = MFW_TIME_FORMAT_12HOUR;
  else
    FFS_flashData.time_format = MFW_TIME_FORMAT_24HOUR;

  mfw_td_set_time_format(format);
}

/*SPR 1725, removed ClockSet and DateSet functions*/

/*******************************************************************************

 $Function:  showDATE

 $Description:	 display date

 $Returns:

 $Arguments:

*******************************************************************************/
void showDATE(void)
{/*SPR 1725, use new function to get date string*/
    dspl_TextOut(0,10,0,mfw_td_get_date_str());

}


/*******************************************************************************

 $Function:  displayAlignedText

 $Description:	Display text horizontally aligned [left|right|center] in specified row.


 $Returns:    none.

 $Arguments:

*******************************************************************************/
void displayAlignedText( T_MMI_ALIGN x_alignment, USHORT y_lineNum, UBYTE attrib, char* string )
{
    int stringLength = 0;
    USHORT startXPos = 0;      // starting X pos for display

    dspl_DevCaps deviceCaps;

    dspl_GetDeviceCaps(&deviceCaps);

	/* SPR#1983 - SH - Shouldn't use strlen for unicode string.
	 * 0 means whole string will be used. */
	 
    stringLength = (int)dspl_GetTextExtent(string, 0);

	TRACE_EVENT_P2("aligned %d, extent = %d", x_alignment, stringLength);
	
    switch ( x_alignment )
    {
	case LEFT:

	break;

	case RIGHT:
	    startXPos = (USHORT) deviceCaps.Width - stringLength /*- OneCharLen*/ ;
	break;

	case CENTER:
	    startXPos = (USHORT) (deviceCaps.Width - stringLength) / 2;
	break;

    }

  dspl_TextOut(startXPos, y_lineNum, attrib, (char*)string );
}
/*******************************************************************************

 $Function:  displayAlignedPrompt

 $Description:	Display prompt horizontally aligned [left|right|center] in specified row.

 $Returns:

 $Arguments:

*******************************************************************************/
void displayAlignedPrompt( T_MMI_ALIGN x_alignment, USHORT y_lineNum, UBYTE attrib, int string_id )
{
    int stringLength = 0;
    USHORT startXPos = 0;      // starting X pos for display

    dspl_DevCaps deviceCaps;

    dspl_GetDeviceCaps(&deviceCaps);


    /* Marcus: Issue 1123: 12/09/2002: Replaced use of strlen with dspl_str_length for Unicode */
    stringLength=dspl_str_length((char*)MmiRsrcGetText( string_id ));
     switch ( x_alignment )
    {
        case LEFT:

        break;

        case RIGHT:
            startXPos = (USHORT) deviceCaps.Width - stringLength /*- OneCharLen*/ ;
        break;

        case CENTER:
            startXPos = (USHORT) (deviceCaps.Width - stringLength) / 2;
        break;

    }

	PROMPT(startXPos, y_lineNum, attrib, string_id );
}
/*******************************************************************************

 $Function:  mainShutdown  

 $Description:	 

 $Returns:		none.

 $Arguments:	
 
*******************************************************************************/
void mainShutdown(void)
{

    TRACE_FUNCTION("mainShutdown ()");

    if(deregis)
    {
   //---------------start: Mobile OFF-------------------
	TRACE_EVENT("		     Mobile OFF");
	/* delete the state of mobile on   */
	globalMobileMode = globalMobileMode & (~GlobalMobileOn);

	deregis = FALSE;

    mmiExit();/* RM 20-07 */
    SIM_PowerOff();
#ifndef _SIMULATION_
    AI_Power(0);
#endif

    }
}
/*******************************************************************************

 $Function:  globalBatteryUpdate

 $Description:	Update the value of the battery after the MME event

 $Returns:

 $Arguments:

*******************************************************************************/
int globalBatteryUpdate (U8 value)
{

    MmiModuleDel (ModuleBattLow);  /* delete the state */

    globalBatteryMode = GlobalBatteryGreater5;



  switch (value)
  {
    case 0:	      /* battery low */
	  globalBatteryPicNumber = 0;
	  globalBatteryMode = GlobalBatteryLesser5;

	  /* is just a global status */
	  MmiModuleSet (ModuleBattLow);  /* set the state */


    break;

    case 1:
	  globalBatteryPicNumber = 1;
    break;

    case 2:
	  globalBatteryPicNumber = 2;
    break;

    case 3:
	  globalBatteryPicNumber = 3;
    break;

    case 4:
	  globalBatteryPicNumber = 4;
    break;

    default:
	  globalBatteryPicNumber = 2;
    break;
  }

    idleEvent(IdleUpdate);

    return 0;
}


/*******************************************************************************

 $Function:  globalSignalUpdate

 $Description:Update the value of the fieldstrength after the MME event

 $Returns:

 $Arguments:

*******************************************************************************/
int globalSignalUpdate (U8 value)
{

  globalSignalPicNumber = value;
  
  idleEvent(IdleUpdate);
  return 0;
}



/*******************************************************************************

 $Function:  globalFlashBattery

 $Description:	 exit MMI main module

 $Returns:    none.

 $Arguments:

*******************************************************************************/
void globalFlashBattery (void)
{
    TRACE_EVENT(" globalFlashBattery ");

    globalBatteryPicNumber++;

    if(globalBatteryPicNumber > 4)
	globalBatteryPicNumber = 0;

  idleEvent(IdleUpdate);
    TRACE_EVENT(" start the timer for Blink ");


}

/* SPR#1428 - SH - New Editor: this is all obsolete with new editor.  Equivalent
 * functionality can be found in AUITextEntry.c */
 
#ifndef NEW_EDITOR
/*******************************************************************************

 $Function:  editShowHeader

 $Description:	 displays the new character over the cursor

 $Returns:    none.

 $Arguments:

*******************************************************************************/
/*MC SPR 1242 merged in b-sample version of this function */
static void editShowHeader (void)
{
	int	alphachar;
	MfwEdt *edit = ((MfwHdr *) myHandle)->data;

	TRACE_FUNCTION("editShowHeader");

	edtChar(myHandle,ecDel);
    if (upCase)
    	alphachar = editAlphaU[editAlphaKey][editAlphaLevel];
    else
        alphachar = editAlpha[editAlphaKey][editAlphaLevel];

    if (!(editAlphaMode && editAlphaKey != KCD_MAX))
    	alphachar= ' ';
    else if (editHiddenMode)													// SH - in hidden mode...
    	tmpBuf[edit->cp] = alphachar;											// store character in buffer

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -