📄 phb_sap.c
字号:
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* phb_sap.c
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
* This file defines SAP functions.
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
*
* removed!
* removed!
* removed!
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#include <stdio.h>
#include "kal_release.h" /* Basic data type */
#include "stack_common.h"
#include "stack_msgs.h"
#include "app_ltlcom.h" /* Task message communiction */
#include "kal_trace.h"
#include "phb_trc.h"
#include "sim_common_enums.h"
// #include "nvram_editor_data_item.h"
#include "custom_nvram_editor_data_item.h"
#include "l4_common.h"
#include "ps2sim_struct.h"
#include "l4c2phb_enums.h"
#include "l4c2phb_struct.h"
#include "l4_defs.h"
/* Prerequisite of phb_context.h */
#include "phb_defs.h"
#include "phb_control_block.h"
#include "phb_data_desc.h"
#include "phb_data_entry_table.h"
#include "phb_pindex.h"
#include "phb_name_num_index.h"
#include "nvram_data_items.h"
#include "phb_config.h"
#include "phb_context.h"
#include "phb_data_desc.h"
#include "phb_pindex.h"
#include "phb_utils.h"
#include "phb_sap.h"
#undef _FILE_CODE_
#define _FILE_CODE_ _PHB_SAP_C_
static char const *const PHB_AT_CPBS =
"+CPBS: (\"DC\", \"EN\", \"FD\", \"LD\", \"MC\", \"ME\", \"MT\", \"ON\", \"RC\", \"SM\"";
static char PHB_AT_TEST_BUF[32];
/*****************************************************************************
* FUNCTION
* l4cphb_phonebook_status_req
* DESCRIPTION
* This is l4cphb_phonebook_status_req function of PHB module.
* Handles query phonebook memory satus.
* PARAMETERS
* storage [IN]
* total [?]
* available [?]
* ilm_ptr(?) [IN] The primitives
* RETURNS
* void
*****************************************************************************/
phb_errno_enum l4cphb_phonebook_status_req(phb_storage_enum storage, kal_uint16 *total, kal_uint16 *available)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
data_desc_type *data_desc_entry;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* kal_trace(TRACE_FUNC, FUNC_L4CPHB_STATUS_REQ); */
if (storage == PHB_SIM)
{
data_desc_entry = &phb_ptr->data_desc[DATA_DESC_ADN];
}
else if (storage == PHB_NVRAM)
{
data_desc_entry = &phb_ptr->data_desc[DATA_DESC_PHB];
}
else
{
return PHB_ERRNO_FAIL;
}
*total = data_desc_entry->record_num;
*available = data_desc_entry->free_count;
return PHB_ERRNO_SUCCESS;
} /* end of l4cphb_status_req */
/*****************************************************************************
* FUNCTION
* l4cphb_status_req
* DESCRIPTION
* This is phb_approve_handler function of PHB module.
* Handles write request from L4C.
* PARAMETERS
* type [IN]
* total [?]
* available [?]
* ilm_ptr(?) [IN] The primitives
* RETURNS
* void
*****************************************************************************/
phb_errno_enum l4cphb_status_req(phb_type_enum type, kal_uint16 *total, kal_uint16 *available)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
data_desc_type *data_desc_entry;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* kal_trace(TRACE_FUNC, FUNC_L4CPHB_STATUS_REQ); */
switch (type)
{
case PHB_FDN:
data_desc_entry = &phb_ptr->data_desc[DATA_DESC_FDN];
break;
case PHB_MSISDN:
data_desc_entry = &phb_ptr->data_desc[DATA_DESC_MSISDN];
break;
case PHB_SDN:
data_desc_entry = &phb_ptr->data_desc[DATA_DESC_SDN];
break;
default:
*total = 0;
*available = 0;
return PHB_ERRNO_FAIL;
}
*total = data_desc_entry->record_num;
*available = data_desc_entry->free_count;
return PHB_ERRNO_SUCCESS;
} /* end of l4cphb_status_req */
/*****************************************************************************
* FUNCTION
* l4cphb_mode_req
*
* DESCRIPTION
* When dialling mode is switched to SIM by L4C, PHB must be also informed.
* L4C invokes l4c_mode_req() to inform PHB.
*
* Note: This function should only be called after request of SIM_DIAL_MODE_REQ
* is successful.
*
* PARAMETERS
* ilm_ptr IN The primitives
*
* RETURNS
* none.
*
* GLOBALS AFFECTED
* none.
*****************************************************************************/
#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 !*/
/* 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 !*/
/* 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 !*/
/* 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 */
/*****************************************************************************
* FUNCTION
* l4cphb_test_storage
* DESCRIPTION
*
* PARAMETERS
* buffer [IN]
* RETURNS
* void
*****************************************************************************/
kal_bool l4cphb_test_storage(kal_uint8 const **buffer)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
kal_trace(TRACE_FUNC, FUNC_L4CPHB_TEST_STORAGE);
*buffer = (kal_uint8 const*)PHB_AT_CPBS;
return KAL_TRUE;
} /* end of l4cphb_test_storage */
/*****************************************************************************
* FUNCTION
* l4cphb_test_index
* DESCRIPTION
*
* PARAMETERS
* buffer [IN]
* RETURNS
* void
*****************************************************************************/
kal_bool l4cphb_test_index(kal_uint8 const **buffer)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
kal_trace(TRACE_FUNC, FUNC_L4CPHB_TEST_INDEX);
kal_sprintf(PHB_AT_TEST_BUF, "+CPBR: (1-%d), %d, %d", PHB_INDEX_MAX_ENTRIES_COUNT, L4_MAX_ADDR_BCD, L4_MAX_NAME);
*buffer = (kal_uint8 const*)PHB_AT_TEST_BUF;
return KAL_TRUE;
} /* end of l4cphb_test_index */
/*****************************************************************************
* FUNCTION
* l4cphb_test_text
* DESCRIPTION
*
* PARAMETERS
* buffer [IN]
* RETURNS
* void
*****************************************************************************/
kal_bool l4cphb_test_text(kal_uint8 const **buffer)
{
/*----------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -