📄 mfw_nm.c
字号:
/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) $Workfile:: mfw_nm.c $|
| $Author: root $Revision: 1.1.1.1 $|
| CREATED: 07.10.98 $Modtime:: 2.03.00 16:28 $|
| STATE : code |
+--------------------------------------------------------------------+
MODULE : MFW_NM
PURPOSE : This modul contains the functions for network management.
$History:: mfw_nm.c $
*
* ***************** Version 39 *****************
* User: Es Date: 2.03.00 Time: 16:31
* Updated in $/GSM/Condat/MS/SRC/MFW
* use 'aci_delete()' to clear the primitive routing for mfw_nm.
*
* ***************** Version 38 *****************
* User: Vo Date: 16.02.00 Time: 14:22
* Updated in $/GSM/Condat/MS/SRC/MFW
*
* ***************** Version 37 *****************
* User: Vo Date: 11.02.00 Time: 12:57
* Updated in $/GSM/Condat/MS/SRC/MFW
* Bug fix: limited service
*
* ***************** Version 36 *****************
* User: Vo Date: 11.02.00 Time: 11:01
* Updated in $/GSM/Condat/MS/SRC/MFW
* add limited service indication
*
* ***************** Version 35 *****************
* User: Vo Date: 28.01.00 Time: 12:48
* Updated in $/GSM/Condat/MS/SRC/MFW
* Limited service
*
* ***************** Version 34 *****************
* User: Vo Date: 20.01.00 Time: 13:17
* Updated in $/GSM/Condat/MS/SRC/MFW
* Add new methodes to save preferred PLMN entry (change interface
* function nm_change_pref_plmn())
*
* ***************** Version 33 *****************
* User: Vo Date: 22.12.99 Time: 15:59
* Updated in $/GSM/Condat/MS/SRC/MFW
* New: Request of preferred PLMN memory of SIM card
*
* ***************** Version 32 *****************
* User: Vo Date: 3.12.99 Time: 12:16
* Updated in $/GSM/Condat/MS/SRC/MFW
* remove the request of maximum/used preferred PLMN list
*
* ***************** Version 31 *****************
* User: Vo Date: 2.12.99 Time: 13:28
* Updated in $/GSM/Condat/MS/SRC/MFW
*
* ***************** Version 30 *****************
* User: Vo Date: 2.12.99 Time: 13:25
* Updated in $/GSM/Condat/MS/SRC/MFW
* New: request of max/used perferred PLMN list
*
* ***************** Version 29 *****************
* User: Vo Date: 21.10.99 Time: 13:24
* Updated in $/GSM/Condat/MS/SRC/MFW
* changed of read/change perferred PLMN list
* add event for successful de-registration
|
| ***************** Version 28 *****************
| User: Le Date: 8.10.99 Time: 13:38
| Updated in $/GSM/Condat/MS/SRC/MFW
*
* ***************** Version 27 *****************
* User: Es Date: 16.09.99 Time: 16:56
* Updated in $/GSM/DEV/MS/SRC/MFW
* reordered include statements due to addons in mfw_phb.h
*
* ***************** Version 26 *****************
* User: Vo Date: 13.09.99 Time: 11:39
* Updated in $/GSM/DEV/MS/SRC/MFW
* Bug fix: registration with numeric network format
*
* ***************** Version 25 *****************
* User: Vo Date: 30.08.99 Time: 14:03
* Updated in $/GSM/DEV/MS/SRC/MFW
* bug fix
* new function
*
* ***************** Version 24 *****************
* User: Vo Date: 2.07.99 Time: 18:16
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 23 *****************
* User: Vo Date: 20.05.99 Time: 17:39
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 22 *****************
* User: Vo Date: 28.04.99 Time: 16:11
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 21 *****************
* User: Vo Date: 31.03.99 Time: 14:09
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 20 *****************
* User: Es Date: 15.03.99 Time: 18:21
* Updated in $/GSM/DEV/MS/SRC/MFW
* recode
*
* ***************** Version 19 *****************
* User: Vo Date: 17.02.99 Time: 19:03
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 18 *****************
* User: Vo Date: 12.02.99 Time: 18:59
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 17 *****************
* User: Vo Date: 9.02.99 Time: 14:54
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 16 *****************
* User: Vo Date: 12.01.99 Time: 14:55
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 15 *****************
* User: Es Date: 23.12.98 Time: 15:47
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 14 *****************
* User: Es Date: 18.12.98 Time: 13:04
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 13 *****************
* User: Es Date: 8.12.98 Time: 16:53
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 11 *****************
* User: Vo Date: 1.12.98 Time: 15:43
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 10 *****************
* User: Vo Date: 30.11.98 Time: 17:49
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 9 *****************
* User: Vo Date: 24.11.98 Time: 21:40
* Updated in $/GSM/DEV/MS/SRC/MFW
* first successful compilation of MFW
*
* ***************** Version 8 *****************
* User: Vo Date: 13.11.98 Time: 16:21
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 7 *****************
* User: Es Date: 12.11.98 Time: 13:50
* Updated in $/GSM/DEV/MS/SRC/MFW
|
| ***************** Version 6 *****************
| User: Le Date: 11.11.98 Time: 13:35
| Updated in $/GSM/DEV/MS/SRC/MFW
|
| ***************** Version 5 *****************
| User: Le Date: 10.11.98 Time: 16:07
| Updated in $/GSM/DEV/MS/SRC/MFW
|
| ***************** Version 4 *****************
| User: Le Date: 10.11.98 Time: 11:08
| Updated in $/GSM/DEV/MS/SRC/MFW
|
| ***************** Version 3 *****************
| User: Le Date: 27.10.98 Time: 15:59
| Updated in $/GSM/DEV/MS/SRC/MFW
|
| ***************** Version 2 *****************
| User: Le Date: 21.10.98 Time: 16:20
| Updated in $/GSM/DEV/MS/SRC/MFW
|
| ***************** Version 1 *****************
| User: Le Date: 21.10.98 Time: 10:33
| Created in $/GSM/DEV/MS/SRC/MFW
*/
#define ENTITY_MFW
#ifdef _INNOVATION_EMULATOR_
#define CMH_MMF_C
#endif
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#if defined (NEW_FRAME)
#include "typedefs.h"
#include "vsi.h"
#include "pei.h"
#include "custom.h"
#include "gsm.h"
#else
#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"
#endif
#include "p_sim.h"
#include "mfw_mfw.h"
#include "mfw_nm.h"
#include "mfw_sim.h"
#include "mfw_sima.h"
#include "mfw_nmi.h"
#include "mfw_simi.h"
#include "mfw_nma.h"
#include "mfw_acie.h"
#include "mfw_phb.h"
#include "mfw_cm.h"
#include "mfw_sms.h"
#include "mfw_win.h"
#include "ksd.h"
#include "psa.h"
#include "mfw_ss.h"
#include "mfw_ssi.h"
#if defined (FAX_AND_DATA)
#include "aci_fd.h"
#endif
#include "mfw_ffs.h"
#include "message.h"
#include "prim.h"
#include "aci_cmh.h" //GW 22-11-01 - Added
#include "p_sim.h" //GW 22/11/01 - Added
#ifdef SIM_TOOLKIT
#include "mfw_sat.h"
#endif
extern const T_OPER_NTRY operList[];
EXTERN MfwHdr * current_mfw_elem;
U8 mfw_IMSI [LONG_NAME]; /* expanded IMSI (ASCIIZ) */
static U8 last_selected_mode = NOT_PRESENT_8BIT;
static U8 reg_stat;
static U8 reg_flag;
#ifdef NO_ASCIIZ
static T_MFW_SP_NAME service_provider_name;
#else
static U8 service_provider_name [LONG_NAME];
#endif
static U8 display_condition;
static T_MFW_PLMN_LIST plmn_list;
static T_MFW_PREF_PLMN_LIST pplmn_list;
static T_MFW_NET_IND net_ind;
static T_MFW_TIME_IND tim_ind;
static UBYTE mfwPplmnReq;
static BOOL sat_update = FALSE;
/*SPR#2122 - DS - Commented out. Now operator list is dynamically allocated in nm_avail_plmn_list()
*static T_ACI_COPS_OPDESC oper_list [MAX_OPER];
*/
static int nmCommand (U32 cmd, void *h); /* handle window commands */
static void nm_search_reg_status(void);
U8 pplmnCnt;
U8 pplmnCmd;
static int pSlot; /* primitive handler slot */
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_NM |
| STATE : code ROUTINE : nm_init |
+--------------------------------------------------------------------+
PURPOSE : Initialize network manager
*/
int nm_init (void)
{
TRACE_FUNCTION("nm_init()");
if (last_selected_mode == NOT_PRESENT_8BIT)
{
last_selected_mode = FFS_flashData.PLMN_selection_mode;
}
/* install prim handler */
pSlot = aci_create(nma_response_cb,NULL);
reg_flag = 0;
mfwPplmnReq = 0;
reg_stat = NOT_PRESENT_8BIT;
sat_update = FALSE;
mfwCommand[MfwTypNm] = (MfwCb) nmCommand;
return last_selected_mode;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_NM |
| STATE : code ROUTINE : nm_exit |
+--------------------------------------------------------------------+
PURPOSE : Finalize network manager
*/
void nm_exit (void)
{
/* remove prim handler */
aci_delete(pSlot);
last_selected_mode = NOT_PRESENT_8BIT;
reg_stat = NOT_PRESENT_8BIT;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_NM |
| STATE : code ROUTINE : nm_create |
+--------------------------------------------------------------------+
PURPOSE : Create network manager
*/
MfwHnd nm_create (MfwHnd hWin, MfwEvt event, MfwCb cbfunc)
{
MfwHdr *hdr;
T_MFW_NM *nm_para;
MfwHdr *insert_status =0;
TRACE_FUNCTION("nm_create()");
hdr = (MfwHdr *) mfwAlloc(sizeof(MfwHdr));
nm_para = (T_MFW_NM *) mfwAlloc(sizeof(T_MFW_NM));
if (!hdr || !nm_para)
{
TRACE_ERROR("ERROR: nm_create() Mem Alloc Failed.");
if(hdr)
mfwFree((U8*)hdr,sizeof(MfwHdr));
if(nm_para)
mfwFree((U8*)nm_para,sizeof(T_MFW_NM));
return FALSE;
}
nm_para->emask = event;
nm_para->handler = cbfunc;
hdr->data = nm_para; /* store parameter in node */
hdr->type = MfwTypNm; /* type of event handler */
insert_status = mfwInsert((MfwHdr *) hWin,hdr);
if(!insert_status)
{
TRACE_ERROR("ERROR: nm_create() Failed to Install Handler. ");
mfwFree((U8*)hdr,sizeof(MfwHdr));
mfwFree((U8*)nm_para ,sizeof(T_MFW_NM));
return 0;
}
return insert_status;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_NM |
| STATE : code ROUTINE : nm_delete |
+--------------------------------------------------------------------+
PURPOSE : delete network manager
*/
MfwRes nm_delete (MfwHnd h)
{
TRACE_FUNCTION("nm_delete()");
if (!h || !((MfwHdr *) h)->data)
return MfwResIllHnd;
if (!mfwRemove((MfwHdr *) h))
return MfwResIllHnd;
mfwFree(((MfwHdr *) h)->data,sizeof(T_MFW_NM));
mfwFree(h,sizeof(MfwHdr));
return MfwResOk;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_NM |
| STATE : code ROUTINE : nm_sign_exec |
+--------------------------------------------------------------------+
PURPOSE : dispatch network management signal
*/
static int nm_sign_exec (MfwHdr *cur_elem, MfwEvt event,
T_MFW_NM_PARA * para)
{
TRACE_FUNCTION("nm_sign_exec()");
while (cur_elem)
{
if (cur_elem->type == MfwTypNm)
{
T_MFW_NM *nm_data;
nm_data = (T_MFW_NM *) cur_elem->data;
if (nm_data->emask & event)
{
nm_data->event = event;
switch (event)
{
case E_NM_FULL_SERVICE:
memcpy(&nm_data->para.ident,para,
sizeof(T_MFW_NETWORK_STRUCT));
break;
case E_NM_PLMN_LIST:
memcpy(&nm_data->para.plmns,para,
sizeof(T_MFW_PLMN_LIST));
break;
case E_NM_PREF_PLMN_LIST:
memcpy(&nm_data->para.pplmns,para,
sizeof(T_MFW_PREF_PLMN_LIST));
break;
case E_NM_PPLMN_MEM:
memcpy(&nm_data->para.pplmn_mem,para,
sizeof(T_MFW_PPLMN_MEM));
break;
case E_NM_CELL_SELECT:
memcpy(&nm_data->para.cell_info,para,
sizeof(T_MFW_CELL_STRUCT));
break;
case E_MFW_NET_IND:
memcpy(&nm_data->para.net_info,para,
sizeof(T_MFW_NET_IND));
break;
case E_MFW_TIME_IND:
memcpy(&nm_data->para.tim_info,para,
sizeof(T_MFW_TIME_IND));
break;
}
if (nm_data->handler)
{
// PATCH LE 06.06.00
// store current mfw elem
current_mfw_elem = cur_elem;
// END PATCH LE 06.06.00
if ((*(nm_data->handler)) (nm_data->event,
(void *) &nm_data->para))
return TRUE;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -