📄 phb_handler_startup.c
字号:
sizeof(l4cphb_startup_read_anr_ind_struct),
TD_CTRL);
// TODO: anr type
memcpy(
&l4cphb_startup_read_anr_ind->anr_entry[0].tel_number,
&(((phb_entry_struct*) control_block->data)->tel_number),
sizeof(l4_addr_bcd_struct));
l4cphb_startup_read_anr_ind->access_id = control_block->ID;
l4cphb_startup_read_anr_ind->anr_entry[0].record_index =
((phb_entry_struct*) control_block->data)->record_index;
l4cphb_startup_read_anr_ind->anr_entry[0].adn_record_index =
((phb_entry_struct*) control_block->data)->record_index;
l4cphb_startup_read_anr_ind->anr_entry[0].anr_type = 0;
l4cphb_startup_read_anr_ind->num_of_entry = 1;
phb_send_ilm(
MOD_L4C,
MSG_ID_L4CPHB_STARTUP_READ_ANR_IND,
(local_para_struct*) l4cphb_startup_read_anr_ind,
NULL);
#endif /* defined(__MMI_FMI__) */
if (control_block->seg_record_index != (kal_uint8) PHB_INVALID_VALUE)
{
phb_se_ext_index_set(control_block->record_index, control_block->seg_record_index, PHB_ANRA);
}
if (phb_ptr->anra_type == 2)
{
phb_data_desc_mark_free(
phb_data_desc_get_desc_by_ID(control_block->primary_ID),
control_block->record_index,
KAL_FALSE);
}
#if defined(__MMI_FMI__)
return;
#endif
}
/* an invalid record */
else
{
if (phb_ptr->anra_type == 2)
{
phb_data_desc_mark_free(
phb_data_desc_get_desc_by_ID(control_block->primary_ID),
control_block->record_index,
KAL_TRUE);
}
/* Reset control_block->data */
control_block->data = (kal_uint8*) & control_block->temp_entry;
}
// TODO: multiple read
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif /* 0 */
if (++control_block->actual_count >= control_block->total) /* remove it after ANR multiple read is implemented */
{
(*control_block->controller) (NULL, control_block);
/* phb_usim_startup_handler(NULL, control_block); */
}
else
{
++control_block->record_index;
next_record_index = phb_get_next_process_index(control_block->record_index, PHB_ANR);
if (next_record_index == (kal_uint16) PHB_INVALID_VALUE) /* no other ADN */
{
(*control_block->controller) (NULL, control_block);
}
else
{
control_block->actual_count += (next_record_index - control_block->record_index);
control_block->record_index = next_record_index;
phb_issue_IO_read(control_block);
}
}
}
} /* end of phb_build_anr_index function */
/*****************************************************************************
* FUNCTION
* phb_build_email_index
* DESCRIPTION
* This is build_index function of PHB module.
* PARAMETERS
* ilm_ptr [IN] The primitives
* control_block [?]
* RETURNS
* void
*****************************************************************************/
static void phb_build_email_index(ilm_struct *ilm_ptr, control_block_type *control_block)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
kal_uint16 next_record_index;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (ilm_ptr == NULL)
{
next_record_index = phb_get_next_process_index(control_block->record_index, PHB_EMAIL);
if (next_record_index == (kal_uint16) PHB_INVALID_VALUE) /* no other ADN */
{
(*control_block->controller) (NULL, control_block);
}
else
{
control_block->actual_count += (next_record_index - control_block->record_index);
control_block->record_index = next_record_index;
phb_issue_IO_read(control_block);
}
}
else
{
/* Building index for email EF */
phb_email_struct *email_entry = (phb_email_struct*) control_block->data;
/* For valid record, control_block.data must not NULL */
if (email_entry != NULL &&
phb_data_desc_is_free(DATA_DESC_ADN, email_entry->adn_record_index) == RECORD_OCCUPIED)
{
#if defined(__MMI_FMI__)
/* Send out indication for each email entries and wait response to read next. */
l4cphb_startup_read_email_ind_struct *l4cphb_startup_read_email_ind =
(l4cphb_startup_read_email_ind_struct*)
construct_local_para(sizeof(l4cphb_startup_read_email_ind_struct), TD_CTRL);
memcpy(
&l4cphb_startup_read_email_ind->email_entry,
(phb_email_struct*) email_entry,
sizeof(phb_email_struct));
l4cphb_startup_read_email_ind->access_id = control_block->ID;
phb_send_ilm(
MOD_L4C,
MSG_ID_L4CPHB_STARTUP_READ_EMAIL_IND,
(local_para_struct*) l4cphb_startup_read_email_ind,
NULL);
#endif /* defined(__MMI_FMI__) */
if (phb_ptr->email_type == 2)
{
phb_se_iap_index_set(
l4cphb_startup_read_email_ind->email_entry[0].adn_record_index,
(kal_uint8)control_block->record_index,
DATA_DESC_EMAIL);
phb_data_desc_mark_free(
phb_data_desc_get_desc_by_ID(control_block->primary_ID),
control_block->record_index,
KAL_FALSE);
}
#if defined(__MMI_FMI__)
return;
#endif
}
/* an invalid record */
else
{
if (phb_ptr->email_type == 2)
{
phb_data_desc_mark_free(
phb_data_desc_get_desc_by_ID(control_block->primary_ID),
control_block->record_index,
KAL_TRUE);
}
/* Reset control_block->data */
control_block->data = (kal_uint8*) & control_block->temp_email_entry;
}
#if 0 // TODO: multiple read
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif /* 0 */
if (++control_block->actual_count >= control_block->total) /* remove it after multiple read is implemented */
{
(*control_block->controller) (NULL, control_block);
/* phb_usim_startup_handler(NULL, control_block); */
}
else
{
++control_block->record_index;
next_record_index = phb_get_next_process_index(control_block->record_index, PHB_EMAIL);
if (next_record_index == (kal_uint16) PHB_INVALID_VALUE) /* no other ADN */
{
(*control_block->controller) (NULL, control_block);
}
else
{
control_block->actual_count += (next_record_index - control_block->record_index);
control_block->record_index = next_record_index;
phb_issue_IO_read(control_block);
}
}
}
} /* end of phb_build_index function */
/*****************************************************************************
* FUNCTION
* phb_usim_startup_handler
* DESCRIPTION
* This is startup function of PHB module.
* PARAMETERS
* ilm_ptr [IN] The primitives
* control_block [?]
* RETURNS
* void
*****************************************************************************/
void phb_usim_startup_handler(ilm_struct *ilm_ptr, control_block_type *control_block)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* kal_trace(TRACE_FUNC, FUNC_PHB_STARTUP); */
if ((control_block->proc_stage <= startup_build_ext4_index) && (phb_ptr->data_desc[DATA_DESC_ANRA].is_support))
{
control_block->primary_ID = FILE_G_ANR_IDX;
kal_mem_cpy(control_block->path, usim_ef_info[FILE_G_PHONEBOOK_IDX].full_path, 4);
control_block->path[4] = phb_ptr->path[DATA_DESC_ANRA][0];
control_block->path[5] = phb_ptr->path[DATA_DESC_ANRA][1];
control_block->secondary_ID = (kal_uint16) FILE_G_EXT1_IDX;
phb_control_block_set(
control_block,
phb_build_anr_index,
phb_usim_startup_handler,
phb_startup_err_handler,
startup_build_anr_index);
if (phb_ptr->data_desc[DATA_DESC_ANRA].record_num > 0)
{
control_block->record_index = 1;
control_block->data = (void*)&control_block->temp_entry;
control_block->length = phb_ptr->data_desc[DATA_DESC_ANRA].record_size;
phb_control_block_set_IO(
control_block,
PHB_ANR,
control_block->record_index,
phb_ptr->data_desc[DATA_DESC_ANRA].record_num);
control_block->storage = PHB_SIM;
phb_build_anr_index(NULL, control_block);
}
/* This type of phone book data is not supported by storage. Continue next step */
else
{
phb_usim_startup_handler(NULL, control_block);
}
}
else if ((control_block->proc_stage <= startup_build_anr_index) && (phb_ptr->data_desc[DATA_DESC_EMAIL].is_support))
{
control_block->primary_ID = FILE_G_EMAIL_IDX;
kal_mem_cpy(control_block->path, usim_ef_info[FILE_G_PHONEBOOK_IDX].full_path, 4);
control_block->path[4] = phb_ptr->path[DATA_DESC_EMAIL][0];
control_block->path[5] = phb_ptr->path[DATA_DESC_EMAIL][1];
control_block->secondary_ID = (kal_uint16) PHB_INVALID_VALUE;
phb_control_block_set(
control_block,
phb_build_email_index,
phb_usim_startup_handler,
phb_startup_err_handler,
startup_build_email_index);
if (phb_ptr->data_desc[DATA_DESC_EMAIL].record_num > 0)
{
control_block->record_index = 1; // TODO: set to the frist ADN record
control_block->data = (void*)&control_block->temp_email_entry;
control_block->length = phb_ptr->data_desc[DATA_DESC_EMAIL].record_size;
phb_control_block_set_IO(
control_block,
PHB_EMAIL,
control_block->record_index,
phb_ptr->data_desc[DATA_DESC_EMAIL].record_num);
control_block->storage = PHB_SIM;
phb_build_email_index(NULL, control_block);
}
/* This type of phone book data is not supported by storage. Continue next step */
else
{
phb_usim_startup_handler(NULL, control_block);
}
}
#ifdef __MMI_FMI__
/* USIM GAS */
else if ((control_block->proc_stage <= startup_build_email_index) && (phb_ptr->data_desc[DATA_DESC_GAS].is_support))
{
control_block->primary_ID = FILE_G_GAS_IDX;
control_block->secondary_ID = FILE_NONE;
phb_control_block_set(
control_block,
phb_build_gas_index,
phb_usim_startup_handler,
phb_startup_err_handler,
startup_build_gas_index);
if (phb_ptr->data_desc[DATA_DESC_GAS].record_num > 0)
{
control_block->record_index = 1;
control_block->data = (void*)&control_block->temp_entry;
control_block->length = phb_ptr->data_desc[DATA_DESC_GAS].record_size;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -