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

📄 mmiem.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 2 页
字号:
   	{	data->tim		= tim_create(data->win, EM_UPDATE_RATE, (T_MFW_CB)Mmi_em_tim_cb);
		timStart(data->tim);//start timer
	}


   	/*populate the user data*/
	win                      = ((T_MFW_HDR *)data->win)->data;
	win->user                = (void *)data;
	data->parent_win         = parent_window;

	/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
	/*SPR 1757, removed code for Chinese special case*/
    AUI_edit_SetAttr(&data->editor_attr, EM_CREATE_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT, ED_MODE_READONLY, ED_CURSOR_NONE, ATB_DCS_ASCII, (UBYTE *)data->edtBuffer,EM_EDITOR_SIZE);
   	data->editor = ATB_edit_Create(&data->editor_attr,0);
	/*Clear editor buffer*/
	memset(data->edtBuffer, 0, sizeof(EM_EDITOR_SIZE*2));
	ATB_edit_Init(data->editor);
#else /* NEW_EDITOR */
	 /*SPR 1757, removed code for Chinese special case*/
  	bookSetEditAttributes(EM_CREATE_EDITOR,COLOUR_EDITOR_XX,0,edtCurNone,0,data->edtBuffer,EM_EDITOR_SIZE*2,&data->editor_data);
   	data->edt		= edtCreate(data->win, &data->editor_data, NULL, NULL);
	edtUnhide( data->edt );
	/*Clear editor buffer*/
	memset(data->edtBuffer, 0, sizeof(EM_EDITOR_SIZE*2));
#endif /* NEW_EDITOR */

	/*Make sure we store the kind of window we want to show*/
	data->CurrentWindow = data_type;

	/*bind the MFW event handler to any events from the MFW Eng Mode module*/
	Mfw_em_create(data->win, 0xFF,  (MfwCb)Mmi_em_event_cb);
	Mfw_em_get_data(data_type);/*ask MFW for the required data*/
	win_show(data->win);/*show the screen*/
	return data->win;

}

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

 $Function:    	Mmi_em_event_cb()

 $Description:	Handles events coming from the MFW 
 
 $Returns:		status integer

 $Arguments:	event type, pointer to data
 
*******************************************************************************/
int Mmi_em_event_cb(T_MFW_EVENT event,void* para)
{ 	T_MFW_HND       win  = mfw_parent (mfw_header());
  	T_MFW_WIN     * win_data = ((T_MFW_HDR *)win)->data;
  	tEmData * data = (tEmData *)win_data->user;

	MFW_EM_Mobile_Info* mob_info;
  	MFW_EM_Serving_Cell_Parameters* sc_info;
  	MFW_EM_Neighbour_Cell_Parameters* nc_info;
  	MFW_EM_Location_Parameters* loc_info;
  	MFW_EM_Ciph_hop_DTX_Parameters* ciph_hop_dtx_info;
  	MFW_EM_GPRS_Parameter* gprs_info;
  	char * DTX_Status;
	char	temp_buffer[EM_EDITOR_SIZE];/*SPR 1757 temporary buffer to hold information*/
	#ifdef NEW_EDITOR
	T_ATB_TEXT temp_text;/*SPR 1757*/
  	#endif 
	TRACE_EVENT_P1("Mmi_em_event_cb(), event:%d", event);

	memset(temp_buffer, 0, EM_EDITOR_SIZE);
	
  	/*if event matches current window type*/
	if (event == data->CurrentWindow)
	{	switch (event)
		{
			case EM_MOBILE_INFO:
			{	mob_info = (MFW_EM_Mobile_Info*)para;/*cast parameter to appropriate type*/
				/*copy data to editor buffer*/
				/*MC, SPR 1554 Added all SW versions to editor string*/ 
				sprintf(temp_buffer, "SIM_VERSION:%d CC_VERSION:%d SS_VERSION:%d SMS_VERSION:%d MM_VERSION:%d RR_VERSION:%d DL_VERSION:%d ALR_VERSION:%d  IMEI:%s IMSI:%s TMSI:%u", 
				mob_info->SIM_version, mob_info->CC_version,  mob_info->SS_version,
				mob_info->SMS_version, mob_info->MM_version, mob_info->RR_version,
				mob_info->DL_version, mob_info->ALR_version,mob_info->IMEI, mob_info->IMSI,
				mob_info->TMSI);
	/* SPR#1428 - SH - New Editor - string has changed, update word wrap */
#ifdef NEW_EDITOR
				/*SPR 1757 Insert temp buffer into editor*/
				temp_text.data = (UBYTE*)temp_buffer;
				temp_text.dcs = ATB_DCS_ASCII;
				ATB_string_Length(&temp_text);
				ATB_edit_ResetMode(data->editor, ED_MODE_READONLY);		/* Switch off read only to add text */
				ATB_edit_ClearAll(data->editor);
				ATB_edit_InsertString(data->editor, &temp_text);			/* Insert name string */
				ATB_edit_SetMode(data->editor, ED_MODE_READONLY);		/* Switch on read only again */
				ATB_edit_Refresh(data->editor);
#else /* !NEW_EDITOR */
				strncpy(data->edtBuffer, temp_buffer, EM_EDITOR_SIZE);/*SPR 1757*/
#endif
				win_show(data->win);/*show data*/
			}
			break;
			case EM_SERVING_CELL_PARAMS:
			{	
				sc_info = (MFW_EM_Serving_Cell_Parameters*)para;/*cast parameter to appropriate type*/
				sprintf(temp_buffer, "ARFCN:%d RSSI:%d RXQ:%d RLT:%d", sc_info->arfcn, sc_info->RSSI, sc_info->RXQ, sc_info->RLT);
	/* SPR#1428 - SH - New Editor - string has changed, update word wrap */
#ifdef NEW_EDITOR
				/*SPR 1757 Insert temp buffer into editor*/
				temp_text.data = (UBYTE*)temp_buffer;
				temp_text.dcs = ATB_DCS_ASCII;
				ATB_string_Length(&temp_text);
				ATB_edit_ResetMode(data->editor, ED_MODE_READONLY);		/* Switch off read only to add text */
				ATB_edit_ClearAll(data->editor);
				ATB_edit_InsertString(data->editor, &temp_text);			/* Insert name string */
				ATB_edit_SetMode(data->editor, ED_MODE_READONLY);		/* Switch on read only again */
				ATB_edit_Refresh(data->editor);
#else /* !NEW_EDITOR */
				strncpy(data->edtBuffer, temp_buffer, EM_EDITOR_SIZE);/*SPR 1757*/
#endif
				win_show(data->win);
			}
			break;
			case EM_NEIGHBOURING_CELL_PARAMS:	
			{	nc_info = (MFW_EM_Neighbour_Cell_Parameters*)para;/*cast parameter to appropriate type*/
				/*copy data to editor buffer*/
				sprintf(temp_buffer, "NUM:%d ARFCN:RSSI %d:%d %d:%d %d:%d %d:%d %d:%d %d:%d", nc_info->NUM, nc_info->arfcn[0], nc_info->RSSI[0], nc_info->arfcn[1], nc_info->RSSI[1]
				, nc_info->arfcn[2], nc_info->RSSI[2], nc_info->arfcn[3], nc_info->RSSI[3], nc_info->arfcn[4], nc_info->RSSI[4], nc_info->arfcn[5], nc_info->RSSI[5]);
	/* SPR#1428 - SH - New Editor - string has changed, update word wrap */
#ifdef NEW_EDITOR
				/*SPR 1757 Insert temp buffer into editor*/
				temp_text.data = (UBYTE*)temp_buffer;
				temp_text.dcs = ATB_DCS_ASCII;
				ATB_string_Length(&temp_text);
				ATB_edit_ResetMode(data->editor, ED_MODE_READONLY);		/* Switch off read only to add text */
				ATB_edit_ClearAll(data->editor);
				ATB_edit_InsertString(data->editor, &temp_text);			/* Insert name string */
				ATB_edit_SetMode(data->editor, ED_MODE_READONLY);		/* Switch on read only again */
				ATB_edit_Refresh(data->editor);
#else /* !NEW_EDITOR */
				strncpy(data->edtBuffer, temp_buffer, EM_EDITOR_SIZE);/*SPR 1757*/
#endif			
				/*show the window*/
				win_show(data->win);
			}
			break;
			case EM_LOCATION_PARAMS:
			{	loc_info = (MFW_EM_Location_Parameters*)para;/*cast parameter to appropriate type*/
				/*copy data to editor buffer*/
				/*MC, SPR 1554 Removed Cell id from editor string*/ 
				sprintf(temp_buffer, "LUP:%d MCC:%s MNC:%s LAC:%d ", loc_info->LUP, loc_info->MCC, loc_info->MNC, loc_info->LAC);
	/* SPR#1428 - SH - New Editor - string has changed, update word wrap */
#ifdef NEW_EDITOR
				/*SPR 1757 Insert temp buffer into editor*/
				temp_text.data = (UBYTE*)temp_buffer;
				temp_text.dcs = ATB_DCS_ASCII;
				ATB_string_Length(&temp_text);
				ATB_edit_ResetMode(data->editor, ED_MODE_READONLY);		/* Switch off read only to add text */
				ATB_edit_ClearAll(data->editor);
				ATB_edit_InsertString(data->editor, &temp_text);			/* Insert name string */
				ATB_edit_SetMode(data->editor, ED_MODE_READONLY);		/* Switch on read only again */
				ATB_edit_Refresh(data->editor);
#else /* !NEW_EDITOR */
				strncpy(data->edtBuffer, temp_buffer, EM_EDITOR_SIZE);/*SPR 1757*/
#endif	
				/*show the window*/
				win_show(data->win);
			}
			break;
			case EM_CIPH_HOP_DTX_PARAMS:
			{	ciph_hop_dtx_info = (MFW_EM_Ciph_hop_DTX_Parameters*)para;/*cast parameter to appropriate type*/
				/*convert DTX status to string*/ 
				if (ciph_hop_dtx_info->DTX_status == FALSE)
					DTX_Status = "Off";
				else
					DTX_Status = "On";
				//copy data to editor
				sprintf(temp_buffer, "STATUS:%d ARFCNs:%d HSN:%d DTX:%s", ciph_hop_dtx_info->ciph_status, ciph_hop_dtx_info->hopping_channels, ciph_hop_dtx_info->HSN, DTX_Status);
				/*show the window*/
				/* SPR#1428 - SH - New Editor - string has changed, update word wrap */
#ifdef NEW_EDITOR
				/*SPR 1757 Insert temp buffer into editor*/
				temp_text.data = (UBYTE*)temp_buffer;
				temp_text.dcs = ATB_DCS_ASCII;
				ATB_string_Length(&temp_text);
				ATB_edit_ResetMode(data->editor, ED_MODE_READONLY);		/* Switch off read only to add text */
				ATB_edit_ClearAll(data->editor);
				ATB_edit_InsertString(data->editor, &temp_text);			/* Insert name string */
				ATB_edit_SetMode(data->editor, ED_MODE_READONLY);		/* Switch on read only again */
				ATB_edit_Refresh(data->editor);
#else /* !NEW_EDITOR */
				strncpy(data->edtBuffer, temp_buffer, EM_EDITOR_SIZE);/*SPR 1757*/
#endif
				win_show(data->win);
			}
			break;
			case EM_GPRS_PARAMS:
			{	gprs_info = (MFW_EM_GPRS_Parameter*)para;//cast parameter to appropriate type
				/*MC, SPR 1554 Changed ediotr string to show Network Mode of Operation*/ 
				sprintf(temp_buffer, "NMO:%d", gprs_info->NMO);
				//show the window
				/* SPR#1428 - SH - New Editor - string has changed, update word wrap */
#ifdef NEW_EDITOR
				/*SPR 1757 Insert temp buffer into editor*/
				temp_text.data = (UBYTE*)temp_buffer;
				temp_text.dcs = ATB_DCS_ASCII;
				ATB_string_Length(&temp_text);
				ATB_edit_ResetMode(data->editor, ED_MODE_READONLY);		/* Switch off read only to add text */
				ATB_edit_ClearAll(data->editor);
				ATB_edit_InsertString(data->editor, &temp_text);			/* Insert name string */
				ATB_edit_SetMode(data->editor, ED_MODE_READONLY);		/* Switch on read only again */
				ATB_edit_Refresh(data->editor);
#else /* !NEW_EDITOR */
				strncpy(data->edtBuffer, temp_buffer, EM_EDITOR_SIZE);/*SPR 1757*/
#endif
				win_show(data->win);
			}
			break;
		}
	}

}

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

 $Function:    	Mmi_em_destroy()

 $Description:	Delete the window
 
 $Returns:		none

 $Arguments:	window handle
 
*******************************************************************************/
void Mmi_em_destroy(T_MFW_HND own_window)
{
  T_MFW_WIN     * win  = ((T_MFW_HDR *)own_window)->data;
  tEmData * data = (tEmData *)win->user;

  TRACE_EVENT ("Mmi_em_destroy()");

  if (own_window == NULL)
  {
	TRACE_EVENT ("Error :- Called with NULL Pointer");
	return;
  }

  if (data)
  {
    /*
     * Exit TIMER & KEYBOARD Handle
     */
    kbd_delete (data->kbd);
    tim_delete (data->tim);
    /* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
	ATB_edit_Destroy(data->editor);
#else
	edt_delete(data->edt);
#endif
    /*
     * Delete WIN Handler
     */
    win_delete (data->win);
    /*
     * Free Memory
     */
    FREE_MEMORY ((void *)data, sizeof (tEmData));
  }
  TRACE_EVENT_P1("MMiEm END, Memory left:%d", mfwCheckMemoryLeft());
}

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

 $Function:    	Mmi_em_kbd_cb()

 $Description:	Keyboard handler
 
 $Returns:		status int

 $Arguments:	event, keyboard data
 
*******************************************************************************/
int Mmi_em_kbd_cb(T_MFW_EVENT event,T_MFW_KBD *  kc )
{	T_MFW_HND       win  = mfw_parent (mfw_header());
  	T_MFW_WIN     * win_data = ((T_MFW_HDR *)win)->data;
  	tEmData * data = (tEmData *)win_data->user;
  	
 	TRACE_EVENT_P2("Mmi_em_kbd_cb, key:%d, win;%d", kc->code, data->win);
  
	switch(kc->code)
	{
		
		case KCD_MNUUP:/*scroll up */
		/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
			ATB_edit_MoveCursor(data->editor, ctrlUp, TRUE);
#else /* NEW_EDITOR */
        	edtChar(data->edt,ecUp);
#endif /* NEW_EDITOR */
   
        break;
        
        case KCD_MNUDOWN:/*scroll down*/
        /* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
			ATB_edit_Char(data->editor,ctrlDown, TRUE);
#else /* NEW_EDITOR */
        	edtChar(data->edt,ecDown);
#endif /* NEW_EDITOR */
 
        break;
        case KCD_HUP:	/*destroy window*/
		case KCD_RIGHT:
			Mmi_em_destroy(data->win);
		break;
		default:
		break;
	}	
	return MFW_EVENT_CONSUMED;
}

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

 $Function:    	Mmi_em_win_cb()

 $Description:	Display handler
 
 $Returns:		status int

 $Arguments:	event, window handle
 
*******************************************************************************/
int Mmi_em_win_cb(T_MFW_EVENT event,T_MFW_WIN * win )
{	
  	tEmData * data = (tEmData *)win->user;
  	


	TRACE_EVENT_P1("EM window: %d", win);
	TRACE_EVENT_P1("Mmi_em_win_cb(), data->CurrentWindow %d", data->CurrentWindow);
  	
	switch( event )
    {
        case MfwWinVisible:
		/*clear screen*/
        dspl_ClearAll();

       /*Show editor content*/
       /* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
		ATB_edit_Show(data->editor);
#else /* NEW_EDITOR */
		edtShow(data->edt);
#endif /* NEW_EDITOR */

        displaySoftKeys(TxtNull, TxtSoftBack); /*show the softkeys*/
		break;
        default:
        	return MFW_EVENT_PASSED;
        break;
	}

	return MFW_EVENT_CONSUMED;

}

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

 $Function:    	Mmi_em_tim_cb()

 $Description:	Timer handler (every second)
 
 $Returns:		none

 $Arguments:	event, timer data
 
*******************************************************************************/
void Mmi_em_tim_cb(T_MFW_EVENT event,T_MFW_TIM * t)
{	T_MFW_HND       win  = mfw_parent (mfw_header());
  	T_MFW_WIN     * win_data = ((T_MFW_HDR *)win)->data;
  	tEmData * data = (tEmData *)win_data->user;
  	TRACE_EVENT_P1("Mmi_em_tim_cb(), win:%d", data->win);
  	/*Request the data from MFW again*/
	Mfw_em_get_data(data->CurrentWindow);
  	/*restart timer*/
	timStart(data->tim);
}

⌨️ 快捷键说明

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