fieldtest.c
来自「是一个手机功能的模拟程序」· C语言 代码 · 共 2,278 行 · 第 1/5 页
C
2,278 行
dialog_info_init(&display_info);//gdy add
display_info.KeyEvents = KEY_CLEAR;
display_info.TextId = 0;
display_info.TextId2 = 0;
display_info.TextString = ver;
display_info.TextString2 = date;
display_info.LeftSoftKey = TxtNull;
display_info.RightSoftKey = TxtSoftBack;
display_info.Time =ONE_SECS;//
display_info.Callback = NULL;
display_info.iconindex=REMIND_REQUIRE;
info_dialog( win, &display_info );
}
break;
default:
{
TRACE_EVENT("ShowVersion_DialogCB(): Unknown Event");
}
break;
}
}
#if 0
/*******************************************************************************
$Function: ShowVersionSetEditor
$Description: Set the editor up
$Returns:
$Arguments:
*******************************************************************************/
void ShowVersionSetEditor(T_MFW_HND win)
{
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
tSpecialMode* data = (tSpecialMode*) win_data->user;
editor_attr_init(&((data->editor_data).editor_attr), NULL, edtCurNone, 0, 0, 0);
data->editor_data.editor_attr.win.py=16; //ganchh 2002/8/27 set editor area
data->editor_data.hide = FALSE;
data->editor_data.min_enter = 1; // Avoid returning empty strings
data->editor_data.Identifier = 0;
data->editor_data.TextString = NULL;
data->editor_data.timeout = FOREVER; // Avoid returning empty strings
data->editor_data.destroyEditor = TRUE;
data->editor_data.editor_attr.text = (char *)data->buffer;
data->editor_data.editor_attr.size = 35;
data->editor_data.TextId = '\0';
data->editor_data.LeftSoftKey = TxtSoftBack;
data->editor_data.AlternateLeftSoftKey = TxtNull;
data->editor_data.RightSoftKey = TxtNull;
data->editor_data.mode = READ_ONLY_MODE;
}
#endif
/*******************************************************************************
$Function: ShowVerionCB
$Description: Callback
$Returns:
$Arguments:
*******************************************************************************/
static void ShowVerionCB (MfwEvt e, MfwKbd *k)
{
T_MFW_HND win = mfw_parent (mfw_header());
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
tSpecialMode*data = (tSpecialMode*) win_data->user;
TRACE_FUNCTION("ShowVerionCB()");
showVersion_destroy(data->win); //ganchh modified
}
/*******************************************************************************
$Function: showVersion_destroy
$Description: Destroys the editor
$Returns:
$Arguments:
*******************************************************************************/
void showVersion_destroy(MfwHnd own_window)
{
T_MFW_WIN * win_data;
tSpecialMode* data = NULL;
if( own_window )
win_data = ((T_MFW_HDR *)own_window)->data;
if( win_data != NULL )
data = (tSpecialMode*)win_data->user;
if( data )
{
TRACE_EVENT ("showVersion_destroy()");
win_delete (data->win);
// Free Memory
FREE_MEMORY ((void *)data, sizeof (tSpecialMode));
}
else
{
TRACE_EVENT ("showVersion_destroy() called twice");
}
}
int LayeronePara(MfwMnu* m, MfwMnuItem* i)
{
T_MFW_HND parent_window = mfwParent( mfw_header() );
T_MFW_HND win = LayeronePara_create(parent_window);
TRACE_FUNCTION("LayeronePara()");
//#ifdef _DAIENABLE_
// DAIsignalEnable(); //enable the DAI
//#endif
if( win NEQ NULL )
{
SEND_EVENT (win, LAYERONEPARA_INIT, 0, 0);
}
return 0;
}
static T_MFW_HND LayeronePara_create(MfwHnd parent_window)
{
tSpecialMode* data = (tSpecialMode*)ALLOC_MEMORY (sizeof (tSpecialMode));
T_MFW_WIN * win;
if( data EQ NULL )
{
return NULL;
}
// Create window handler
data->win = win_create (parent_window, 0, E_WIN_VISIBLE, NULL);
if( data->win EQ NULL )
{
FREE_MEMORY( (void *) data, sizeof( tSpecialMode ) );
return NULL;
}
// connect the dialog data to the MFW-window
data->mmi_control.dialog = (T_DIALOG_FUNC)LayeronePara_DialogCB;
data->mmi_control.data = data;
win = ((T_MFW_HDR *)data->win)->data;
win->user = (void *)data;
data->parent_win = parent_window;
//if(!show_timer)
// show_timer=timCreate(data->win,2000,(MfwCb)showRssi_timercb);
//timStart(show_timer);
return data->win;
}
static void LayeronePara_DialogCB(T_MFW_HND win, USHORT e, SHORT identifier,
void *parameter)
{
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
tSpecialMode* data = (tSpecialMode*) win_data->user;
T_EDITOR_DATA editor_data;
WORD32 a,b,c,d,f;
TRACE_FUNCTION("LayeronePara_DialogCB()");
if( !show_timer )
{
show_timer=timCreate(data->win,2000,(MfwCb)showRssi_timercb);
timStart(show_timer);
}
switch( e )
{ //when window first created
case LAYERONEPARA_INIT:
{
/* 2004/03/02 sunsj modify for lcd display area */
layer1_em_get_rxlevqual(&a,&b,&c,&d);
layer1_em_get_mode(&f);
dspl_Clear(0, 0, SCREEN_SIZE_X, SCREEN_SIZE_Y);
sprintf(data->buffer,"lev_scell\n%d\n",a/2);
dspl_TextOut(0, 0, 0, (char*)data->buffer);
sprintf(data->buffer,"lev_dedic_sub\n%d\n",b);
dspl_TextOut(0, 14, 0, (char*)data->buffer);
sprintf(data->buffer,"qual_dedic\n%d\n",c);
dspl_TextOut(0, 28, 0, (char*)data->buffer);
sprintf(data->buffer,"qual_dedic_sub\n%d\n",d);
dspl_TextOut(0, 42, 0, (char*)data->buffer);
sprintf(data->buffer,"mode:%d",f);
dspl_TextOut(0, 66, 0, (char*)data->buffer);
data->kbd=kbd_create(data->win,KEY_ALL,(T_MFW_CB)LayeronePara_kbd_cb);
}
break;
case LAYERONEPARA_UPDATA:
{
if( !winIsFocussed(win) )
{
LayeronePara_destroy(win);
//StopVmRecord(VmRecordCB);
//needback=1;
return;
}
layer1_em_get_rxlevqual(&a,&b,&c,&d);
layer1_em_get_mode(&f);
/* 2004/03/02 sunsj modify for lcd display area */
dspl_Clear(0, 0, SCREEN_SIZE_X, 14);
sprintf(data->buffer,"%d",a/2);
dspl_TextOut(0, 0, 0, (char*)data->buffer);
dspl_Clear(0, 14, SCREEN_SIZE_X, 28);
sprintf(data->buffer,"%d",b);
dspl_TextOut(0, 14, 0, (char*)data->buffer);
dspl_Clear(0, 28, SCREEN_SIZE_X, 42);
sprintf(data->buffer,"%d",c);
dspl_TextOut(0, 28, 0, (char*)data->buffer);
dspl_Clear(0, 42, SCREEN_SIZE_X, 66);
sprintf(data->buffer,"%d",d);
dspl_TextOut(0, 42, 0, (char*)data->buffer);
dspl_Clear(0, 66, SCREEN_SIZE_X, 80);
sprintf(data->buffer,"mode:%d",f);
dspl_TextOut(0, 66, 0, (char*)data->buffer);
timStart(show_timer);
}
break;
case LAYERONEPARA_EXIT:
{
LayeronePara_destroy(win);
break;
}
default:
{
TRACE_EVENT("LayeronePara_DialogCB(): Unknown Event");
}
break;
}
}
#if 0
static int LayeronePara_winCB (T_MFW_EVENT event, T_MFW_WIN * win)
{
tSpecialMode* data = (tSpecialMode *)win->user;
int i;
TRACE_EVENT ("iconselect_win_cb");
if( data EQ 0 )
return 1;
switch( event )
{
case E_WIN_VISIBLE:
if( win->flags & E_WIN_VISIBLE )
{
}
}
}
void LayeroneParaSetEditor(T_MFW_HND win)
{
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
tSpecialMode* data = (tSpecialMode*) win_data->user;
editor_attr_init(&((data->editor_data).editor_attr), NULL, edtCurNone, 0, 0, 0);
data->editor_data.editor_attr.win.py=16; //ganchh 2002/8/27 set editor area
data->editor_data.hide = FALSE;
data->editor_data.min_enter = 1; // Avoid returning empty strings
data->editor_data.Identifier = 0;
data->editor_data.TextString = NULL;
data->editor_data.timeout = FOREVER; // Avoid returning empty strings
data->editor_data.destroyEditor = TRUE;
data->editor_data.editor_attr.text = (char *)data->buffer;
data->editor_data.editor_attr.size = 35;
data->editor_data.TextId = '\0';
data->editor_data.LeftSoftKey = TxtSoftBack;
data->editor_data.AlternateLeftSoftKey = TxtNull;
data->editor_data.RightSoftKey = TxtNull;
data->editor_data.mode = READ_ONLY_MODE;
}
static void LayeroneParaCB( T_MFW_HND win, USHORT Identifier,UBYTE reason)
{
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
tSpecialMode*data = (tSpecialMode*) win_data->user;
TRACE_FUNCTION("LayeroneParaCB()");
switch( reason )
{
case INFO_KCD_LEFT:
case INFO_KCD_HUP:
case INFO_KCD_RIGHT:
case INFO_KCD_CALL: //xsf add 12.13
LayeronePara_destroy(data->win); //ganchh modified
break;
default:
break;
}
}
#endif
void LayeronePara_destroy(MfwHnd own_window)
{
T_MFW_WIN * win_data;
tSpecialMode* data = NULL;
if( own_window )
win_data = ((T_MFW_HDR *)own_window)->data;
if( win_data != NULL )
data = (tSpecialMode*)win_data->user;
if( data )
{
TRACE_EVENT ("LayeronePara_destroy()");
timDelete(show_timer);
show_timer=0;
win_delete (data->win);
// Free Memory
FREE_MEMORY ((void *)data, sizeof (tSpecialMode));
}
else
{
TRACE_EVENT ("LayeronePara_destroy() called twice");
}
}
static T_MFW_CB showRssi_timercb (T_MFW_EVENT event, T_MFW_TIM *tc)
{
T_MFW_HND parent_window = mfwParent( mfw_header() );
timStop(show_timer);
refresh_flag=1;
TRACE_EVENT("new we show the Rssi");
SEND_EVENT (parent_window, LAYERONEPARA_UPDATA, 0, 0);
return 0;
}
static int LayeronePara_kbd_cb(T_MFW_EVENT event, T_MFW_KBD *keyboard)
{
T_MFW_HND win = mfw_parent (mfw_header());
switch( keyboard->code )
{
case KCD_RIGHT:
case KCD_HUP:
LayeronePara_destroy(win);
break;
}
return MFW_EVENT_CONSUMED;
}
//end of xzy add for special test mode 2002/12/30;
int LayeroneParaTwoStart(MfwMnu* m, MfwMnuItem* i)
{
T_MFW_HND parent_window = mfwParent( mfw_header() );
T_MFW_HND win = LayeroneParaTwo_create(parent_window);
TRACE_FUNCTION("LayeroneParaTwoStart()");
//#ifdef _DAIENABLE_
// DAIsignalEnable(); //enable the DAI
//#endif
if( win NEQ NULL )
{
SEND_EVENT (win, LAYERONEPARATWO_INIT, 0, 0);
}
return 0;
}
static T_MFW_HND LayeroneParaTwo_create(MfwHnd parent_window)
{
tSpecialMode* data = (tSpecialMode*)ALLOC_MEMORY (sizeof (tSpecialMode));
T_MFW_WIN * win;
if( data EQ NULL )
{
return NULL;
}
// Create window handler
data->win = win_create (parent_window, 0, E_WIN_VISIBLE, NULL);
if( data->win EQ NULL )
{
FREE_MEMORY( (void *) data, sizeof( tSpecialMode ) );
return NULL;
}
// connect the dialog data to the MFW-window
data->mmi_control.dialog = (T_DIALOG_FUNC)LayeroneParaTwo_DialogCB;
data->mmi_control.data = data;
win = ((T_MFW_HDR *)data->win)->data;
win->user = (void *)data;
data->parent_win = parent_window;
data->kbd=kbdCreate(data->win,KEY_ALL,(MfwCb)LayeroneParaTwoCB);
return data->win;
}
/*******************************************************************************
$Function: LayeroneParaTwo_DialogCB
$Description: CallBack Function
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?