📄 mmibookservices.c
字号:
}
void bookPromptInformation( MfwHnd parent, int txtId, char *text, T_VOID_FUNC cb_function )
{
T_DISPLAY_DATA display_info;
//TRACE_FUNCTION( "bookShowInformation()" );
dialog_info_init(&display_info);//gdy add
display_info.KeyEvents = KEY_OK |KEY_CLEAR;
display_info.TextId = txtId;
display_info.TextId2 = 0;
display_info.TextString = text;
display_info.TextString2 = '\0';
display_info.LeftSoftKey = TxtSoftOK;
display_info.RightSoftKey = TxtSoftBack;
//display_info.Time = 0;
display_info.Callback = (T_VOID_FUNC) cb_function;
/* Call Info Screen
*/
info_dialog( parent, &display_info );
}
/* 2004/05/13 sunsj modify */
/*******************************************************************************
$Function: bookShowInformationWithIcon
$Description: general information dialog routine
$Returns: none
$Arguments: parent, window,
text, to be displayed,
cb_function, call back on completion of window
zy Mobile Innovation add the function with Icon
*******************************************************************************/
void bookShowCallInformation( MfwHnd parent, int txtId, char *text, T_VOID_FUNC cb_function ,USHORT identify)
{
T_DISPLAY_DATA display_info;
T_MFW_HND redialwin;/*2003/12/16, wangyan modify*/
TRACE_FUNCTION( "bookShowCallInformation()" );
dialog_info_init(&display_info);//gdy add
display_info.Identifier = identify;
display_info.KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT|KEY_HUP;
display_info.TextId = txtId;
display_info.TextId2 = 0;
display_info.TextString = text;
display_info.TextString2 = '\0';
display_info.LeftSoftKey = TxtNull;
display_info.RightSoftKey = TxtNull;
display_info.Time = 1000;
display_info.Callback = (T_VOID_FUNC) cb_function;
// Call Info Screen
redialwin= info_dialog( parent, &display_info );
/*2003/12/16, wangyan modify*/
//if( txtId==TxtNetUselessCallAgain )
// mmi_dialogs_insert_fixmov_animation(redialwin,500,CALLREDIALANIM);
/*
if(txtId==TxtNetUselessCallAgain)
mmi_dialogs_insert_fixmov_animation(redialwin,500,CALLREDIALANIM);
else if(txtId==TxtCallTimeout)
mmi_dialogs_insert_fixmov_animation(redialwin,500,CALLFAILANIM);
else
mmi_dialogs_insert_fixmov_animation(redialwin,500,CALLNOTCONNECTANIM);
*/
}
/*******************************************************************************
$Function: bookFindNameInPhonebook
$Description: Locates the name in a specified phone book
$Returns: 0 if error, 1 if successful
$Arguments: p_pszNumber, pointer to pattern to match, p_pEntry, pointer
to buffer into which to store result.
*******************************************************************************/
int bookFindNameInPhonebook( const char *p_pszNumber, T_MFW_PHB_ENTRY *p_pEntry )
{
#ifdef NO_ASCIIZ
T_MFW_PHB_TEXT p_pszNumberText;
#endif
T_MFW_PHB_LIST phb_list, new_list;
//glowing,2004-04-09, compatible with the new version
#if TCS20_VER
SHORT phb_index;
#else
UBYTE phb_index;
#endif
UBYTE l_name[PHB_name_len+3];
T_MFW_PHB_ENTRY temp_pEntry[4];
int i;
int j;
char debug[50];
//TRACE_FUNCTION( "bookFindNameInPhonebook()" );
if( p_pszNumber == 0 || p_pEntry == 0 )
return 0;
memset( p_pEntry, 0, sizeof(T_MFW_PHB_ENTRY) );
memset( &phb_list, 0, sizeof(phb_list) );
phb_list.entry = temp_pEntry;
phb_list.num_entries = 4;
//search phonebook for up to 4 entries with thr last 6 digits matching number
#ifdef WIN32
phb_find_entries(
bookActiveBook(READ), /* phonebook */
&phb_index, /* returns index in phb */
MFW_PHB_NUMBER, /* searching for number */
4, /* return max. one entry */
(UBYTE *) p_pszNumber, /* search this pattern */
0,
&phb_list /* return structure */
);
#else
#ifdef NO_ASCIIZ
//GW Set up data structure for NO_ASCIIZ
p_pszNumberText.dcs = MFW_DCS_7bits;
p_pszNumberText.len = strlen(p_pszNumber);
strcpy((char*)p_pszNumberText.data, p_pszNumber);
phb_find_entries(
bookActiveBook(READ), /* phonebook */
&phb_index, /* returns index in phb */
MFW_PHB_NUMBER, /* searching for number */
4, /* return max. one entry */
&p_pszNumberText, /* search this pattern */
&phb_list /* return structure */
);
#else
phb_find_entries(
bookActiveBook(READ), /* phonebook */
&phb_index, /* returns index in phb */
MFW_PHB_NUMBER, /* searching for number */
4, /* return max. one entry */
(char *)p_pszNumber, /* search this pattern */
&phb_list /* return structure */
);
#endif //NO_ASCIIZ
#endif //WIN32
memset( p_pEntry, 0, sizeof(T_MFW_PHB_ENTRY) );
for( i=0; i<phb_list.num_entries; i++ ) //for each entry
{
//if number strings match completely
if( !strncmp((char*)temp_pEntry[i].number, (char*)p_pszNumber, strlen((char*)p_pszNumber)) )
{
memcpy( p_pEntry, &temp_pEntry[i] , sizeof(T_MFW_PHB_ENTRY) );
//convert name into appropriate format
#ifdef NO_ASCIIZ
mfw_SIM2GsmStr( p_pEntry->name.len,
p_pEntry->name.data,
PHB_name_len,
l_name );
memcpy( p_pEntry->name.data, l_name, PHB_name_len );
#else
bookGsm2Alpha( (UBYTE *) p_pEntry->name );
#endif
return 1;
}
}
return 0;
}
/*******************************************************************************
$Function: bookFindNumberByPosition
$Description: locate a number given the index
$Returns: 0 if failure, 1 otherwise
$Arguments: index of the number to find, p_pentry, return structure
*******************************************************************************/
UBYTE bookFindNumberByPosition (UBYTE index,T_MFW_PHB_ENTRY* p_pEntry)
{
T_MFW_PHB_LIST phb_list;
UBYTE l_name[PHB_name_len];
//TRACE_FUNCTION( "bookFindNumberByPosition()" );
/* only search if we have valid input information
*/
if( index == 0 || p_pEntry == 0 )
return 0;
/* Clear the output buffers
*/
memset( p_pEntry, 0, sizeof( T_MFW_PHB_ENTRY ) );
memset( &phb_list, 0, sizeof( phb_list ) );
/* searc for the selected entry
*/
phb_list.entry = p_pEntry;
phb_list.num_entries = 1;
phb_read_entries( bookActiveBook(READ), index, MFW_PHB_INDEX, 1, &phb_list );
/* if we haven't found the entry return 0
*/
if( phb_list.result == MFW_ENTRY_EXIST )
return 0;
/* otherwise copy the located information to the output structure
*/
#ifdef NO_ASCIIZ
mfw_SIM2GsmStr( p_pEntry->name.len, p_pEntry->name.data, PHB_name_len, l_name );
memcpy( p_pEntry->name.data, l_name, PHB_name_len );
#else
bookGsm2Alpha( (UBYTE *) p_pEntry->name );
#endif
/* successful return status
*/
return 1;
}
/*******************************************************************************
$Function: bookCallIndex
$Description: Calls the number in the physical index
$Returns: status from the phb_read_entries routine
$Arguments: index, of the number to call
*******************************************************************************/
int bookCallIndex( UBYTE index )
{
T_MFW_PHB_LIST phb_list;
T_MFW_PHB_ENTRY entry;
UBYTE status;
//TRACE_FUNCTION( "bookCallIndex()" );
memset( &entry, 0, sizeof( T_MFW_PHB_ENTRY ) );
memset( &phb_list, 0, sizeof( phb_list ) );
phb_list.entry = &entry;
phb_list.num_entries = 1;
if( ( status = phb_read_entries( bookActiveBook(READ), index, MFW_PHB_PHYSICAL, 1, &phb_list ) ) == MFW_PHB_OK )
callNumber( entry.number );
return status;
}
/*******************************************************************************
$Function: bookGsm2Alpha
$Description: Convert a string from it's GSM to alpha characters
$Returns: none
$Arguments: alpha, pointer to string to be converted (Must be null
terminated string)
*******************************************************************************/
void bookGsm2Alpha( UBYTE *alpha )
{
int index, length;
length = wstrlen( (char *) alpha );
for( index = 0; index < length; index++ )
alpha[index] = alpha[index] & 0x7F;
}
/*******************************************************************************
$Function: bookActiveBook
$Description: Determine if the current active book is restricted or not
$Returns: PHB_FDN if restricted, PHB_ADN otherwise
$Arguments: None
*******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -