Exemple #1
0
// =============================================================================
// bal_fstraceStart
// -----------------------------------------------------------------------------
/// start tFlash trace recorsing
// =============================================================================
PUBLIC VOID  bal_fstraceStart(VOID)
{
  UINT8 targetTraceName[20] = "/t/fstrace.bin";

  if(g_trace_Data != NULL){
      CSW_TRACE(BASE_BAL_TS_ID, TSTXT("bal_fstraceStart:fs trace already opened!"));        	
      return;
  }

  if((g_tracefileHandle = _fsTraceFileOpen(targetTraceName, FS_O_RDWR | FS_O_CREAT | FS_O_TRUNC, 0)) < 0){
        CSW_TRACE(BASE_BAL_TS_ID, TSTXT("bal_fstraceStart:file %s open fail, ret %x"),targetTraceName,  g_tracefileHandle);    
        return;
    }

  if((g_trace_Data = CSW_Malloc(MAX_TRACE_LEN)) == NULL){
        CSW_TRACE(BASE_BAL_TS_ID, TSTXT("bal_fstraceStart:malloc fail!"));      	
  	_fsTraceFileClose(g_tracefileHandle);
	return;
  }
  
  _fsTraceSetLevel();  
  
  fstraces_Open();

  COS_SetTimerEX(BAL_TH(BAL_DEV_MONITOR_TASK_PRIORITY) ,PRV_CFW_TRACE_TO_FLASH_TIMER_ID, COS_TIMER_MODE_SINGLE,FS_TRACE_TIMER_CNT); 
  
}
Exemple #2
0
VOID CFW_PppTermProcess(VOID)
{
  CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("   in CFW_PppTermProcess "));	
  if(ppp_Gprs_state.PPP_Act == TRUE)//active in ppp
  { 
    
    CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("   in CFW_PppTermProcess active TRUE "));	
    #if 1
#if 0 
    UINT8 nSimID= 0;
    CFW_GprsAct(CFW_GPRS_DEACTIVED, ppp_Gprs_state.PPP_Cid, 3,nSimID);

    CFW_GprsAct(CFW_GPRS_DEACTIVED, ppp_Gprs_state.PPP_Cid, 3);
#endif
    #else
    UINT8 uTi;
    if(ERR_SUCCESS == CFW_GetFreeUTI(CFW_GPRS_SRV_ID, &uTi))
       CFW_GprsAct(CFW_GPRS_DEACTIVED, ppp_Gprs_state.PPP_Cid, uTi);
    else
      CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("   no free uTi "));	
    #endif
 
  }else{ //no active in PPP,
    CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("   in CFW_PppTermProcess "));	
    CFW_PppTermInd();//send terminate to ATE
  }
}
Exemple #3
0
// =============================================================================
// _fsTraceSetLevel
// -----------------------------------------------------------------------------
/// set trace level
// =============================================================================
PRIVATE VOID _fsTraceSetLevel(void)
{
	UINT16 traceLevel[SXS_NB_ID] = {0, };

	UINT16 cnt                         = 0;
	UINT8 targetTraceLevelFileName[30] = "/t/csd_fstracelevel.tfg";

	INT32 iResult                      = -1;
	INT32 fhd;
	UINT8 tmpTransfer = 0,*tmpTransfer1;
	traceLevel[__MMI] = 0xffff;
	traceLevel[__CSW] = 0xffff;

	CSW_TRACE(BASE_BAL_TS_ID, TSTXT("fsTrace_setTraceLevel OK.%d,%d\n"), __MMI, SXS_NB_ID);

	if((fhd =_fsTraceFileOpen(targetTraceLevelFileName, FS_O_RDONLY, 0)) >= 0)
	{
		iResult = FS_Read(fhd, (UINT8*)(traceLevel), SXS_NB_ID* 2);

		CSW_TRACE(BASE_BAL_TS_ID, TSTXT("fsTrace_setTraceLevel read result is %d\n"), iResult);

		cnt = 0;
		while (cnt < SXS_NB_ID)
		{

			/******CONVERT H8 AND L8,START ****/
			tmpTransfer1 = (UINT8*)(&traceLevel[cnt]);
			tmpTransfer =*tmpTransfer1;
			*tmpTransfer1 = *(tmpTransfer1+1);
			*(tmpTransfer1+1) = tmpTransfer;
			/******CONVERT H8 AND L8, END ****/

			CSW_TRACE(BASE_BAL_TS_ID, TSTXT("fstraces_setLevel(0x%x 0x%x"), TID(cnt), traceLevel[cnt]);
			fstraces_setLevel(TID(cnt), traceLevel[cnt]);
			++cnt;
		}

		iResult = _fsTraceFileClose(fhd);
		CSW_TRACE(BASE_BAL_TS_ID, TSTXT("fsTrace_setTraceLevel close result is %d\n"), iResult);

	}
	else  // set default level
	{
		while (cnt < SXS_NB_ID)
		{
			fstraces_setLevel(TID(cnt), traceLevel[cnt]);
			++cnt;
		}
	}

}
/**************************************************************

	FUNCTION NAME		: EntrySECSETFDNDetails(void)
  	PURPOSE				: Entry screen to add FDL entry.
	INPUT PARAMETERS	: nil
	OUTPUT PARAMETERS	: nil
	RETURNS				: void
  	Author				: Vanita Jain
 

**************************************************************/
void EntrySECSETFDNDetails(void)
{
	U16 nNumofItem;      /* Stores no of children in the submenu*/
//micha1229
//	U16 nDispAttribute;  /* Stores display attribue */
	U8* guiBuffer;       /* Buffer holding history data */
	U16	ItemIcons[2];
	U8* inputBuffer;                       //added for inline edit history
	U16 inputBufferSize;                //added for inline edit history
	mmi_trace(1, TSTXT("EntrySECSETFDNDetails"));
	if((gpFDLBDLContext->FDNBDNCount == (U16)gpFDLBDLContext->MaxFDL ||gpFDLBDLContext->FDNBDNCount == MAX_SIM_ENTRIES)  &&( gpFDLBDLContext->FDNBDNEdit == FALSE))
	{
		DisplayPopup((U8*)GetString(STR_SETTING_STORAGE_FULL),IMG_GLOBAL_WARNING,0,ST_NOTIFYDURATION,(U8)WARNING_TONE);
	}
	else
	{
		EntryNewScreen(SCR_ID_SECSET_FDN_DETAILS, ExitSECSETFDNDetails, NULL, NULL);

		guiBuffer = GetCurrGuiBuffer(SCR_ID_SECSET_FDN_DETAILS);
		inputBuffer = GetCurrNInputBuffer ( SCR_ID_SECSET_FDN_DETAILS, &inputBufferSize );    //added for inline edit history

		nNumofItem = GetNumOfChild(MENU8234_FDL_VIEW_OPTIONS_ADD);
		
//		nDispAttribute = GetDispAttributeOfItem(MENU8234_FDL_VIEW_OPTIONS_ADD);

		GetSequenceImageIds(MENU8234_FDL_VIEW_OPTIONS_ADD,ItemIcons);

		InitializeCategory57Screen();
		RegisterHighlightHandler(mmi_EntrySECSETFDNDetails_hdlr);

		FillFdlInlineEditStruct();

		if(inputBuffer!=NULL)                                            //added for inline edit history
			SetCategory57Data(gpFDLBDLContext->FDLBDLInlineDisplay, nNumofItem, inputBuffer);//sets the data 

		ShowCategory57Screen(STR_SETTING_FDL_EDIT_ENTRY,MAIN_MENU_TITLE_SETTINGS_ICON,
							STR_EDIT,IMG_GLOBAL_OK,
							STR_DONE, IMG_GLOBAL_BACK,
							nNumofItem,ItemIcons,gpFDLBDLContext->FDLBDLInlineDisplay,
							0,guiBuffer);
	#if defined(__MMI_GB__)
		mmi_frm_set_highlight_handler();
		GBSetInputboxLSKFunction(EntryScrForInputMethodAndDone); 
	#endif
		SetCategory57RightSoftkeyFunctions( PreNewFdlEntryReq, GoBackHistory);
		mmi_trace(1, TSTXT("SCR_ID_SECSET_FDN_DETAILS"));
	}
}
Exemple #5
0
/**************************************************************
	FUNCTION NAME		: Msg_Adaption_PHB_startup_begin
	PURPOSE			       : send startup begin ind
	INPUT PARAMETERS	: void
	OUTPUT PARAMETERS	: void
	RETURNS			       : void
	REMARKS			:
**************************************************************/
void Msg_Adaption_PHB_startup_begin(void)
{
  ilm_struct ilm_ptr;

#ifdef __ADP_MULTI_SIM__
	U8 i;
	for(i = 0; i < ADP_SIM_NUMBER; i++)
	{
		g_PHBSIMStartInd[i] = FALSE;
		g_PHBSIMStartFinish[i] = FALSE;
		adp_gPHBContex[i].nSIMusedSlot = 0;
	}
#endif


	ilm_ptr.dest_mod_id = MOD_MMI;
	ilm_ptr.src_mod_id = MOD_L4C;

	ilm_ptr.msg_id = MSG_ID_MMI_PHB_STARTUP_BEGIN_IND;
	/*wangrui add for prevent free error*/
	ilm_ptr.local_para_ptr = NULL;
	/*wangrui add end*/
	OslMsgSendExtQueue(&ilm_ptr);
	mmi_trace(g_sw_ADP_PHB, TSTXT("PHB Init MSG_ID_MMI_PHB_STARTUP_BEGIN_IND.  \n"));

	flag_init_ok = FALSE;
}
void SECSETGetFdlEntriesReq()
{
	MSG_PHB_GET_ENTRY_BY_INDEX_REQ_STRUCT *pMsgIndexReq = NULL ;
	MYQUEUE	Message;
	module_type dest_mod_id = MOD_L4C + gSecSetupMenuSimID;

	gpFDLBDLContext = &gFDLBDLContext[gSecSetupMenuSimID];
	
	mmi_trace(1, TSTXT("SECSETGetFdlEntriesReq = %d"),gpFDLBDLContext->FDNBDNCount);
	pMsgIndexReq = (MSG_PHB_GET_ENTRY_BY_INDEX_REQ_STRUCT*) OslConstructDataPtr(sizeof(MSG_PHB_GET_ENTRY_BY_INDEX_REQ_STRUCT));
	pMsgIndexReq->index=gpFDLBDLContext->FDNBDNCount + 1;
	pMsgIndexReq->record_index=0xFFFF;
	pMsgIndexReq->storage=MMI_SIM ;
	pMsgIndexReq->type=MMI_PHB_FDN ;
	pMsgIndexReq->no_data=MAX_ENTRIES_IN_LIST;
	
	Message.oslSrcId=MOD_MMI;
	Message.oslDestId=dest_mod_id;

	Message.oslMsgId = PRT_PHB_GET_ENTRY_BY_INDEX_REQ;
	Message.oslDataPtr = (oslParaType *)pMsgIndexReq;
	Message.oslPeerBuffPtr= NULL;

	SetProtocolEventHandlerExt(SECSETGetFdlEntriesRsp, PRT_PHB_GET_ENTRY_BY_INDEX_RSP,gSecSetupMenuSimID);

	OslMsgSendExtQueue(&Message);

}
void* socketdata_get(INT32 sockfd)
{
 CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("socketdata_get!\n"));
	struct socket_data *p = &socketid[sockfd];
	void* buf = NULL;
	if(p->index[p->front])
	{
		buf = p->index[p->front];	
		p->index[p->front] = NULL;	
		p->front = INDEX_MOD(p->front + 1) ;
	}
	else
	{
	  CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("get too fast!\n"));
	}
	return buf;
}
Exemple #8
0
void MMIMessageNameCheck()
{
	int ret =  0;
	int i,j = 0;
	char MesNameCheck[][MMIMesLong]=
		{	
			#define ADD_MAG(name)  #name
			CheckMessage
			#undef ADD_MAG

		};

	int msg_id_check[]=
		{
			#define ADD_MAG(name)  name
			CheckMessage
			#undef ADD_MAG
		};


	int k = (int)((sizeof(MesNameCheck))/MMIMesLong);
	
	mmi_trace(g_sw_trace_check, TSTXT("########## elisa MMI_MESSAGE trace check code begin: k = %d \n"),k);
	 
   	for (i = 0; i < k; i++ )
	{	
		 ret = strcmp(MesNameCheck[i], GetMEGName(msg_id_check[i]));
		 if (ret !=0)  
	 	 {     
	 		j++;
	 		mmi_trace(g_sw_trace_check, TSTXT("####### elisa error!!!!!!!!!ret = %d    there are some things error with message id , do not take it for reference\n"), ret);
			mmi_trace(g_sw_trace_check,TSTXT("###### message id :%d   right message: %s:, returned message: %s "),msg_id_check[i], MesNameCheck[i],GetMEGName(msg_id_check[i]));
	 	 }
		 
	}
	if (j ==0)    
	{
		mmi_trace(g_sw_trace_check,TSTXT("###### elisa MMi_MESSAGE_TRACE check passed! "));
	}
	mmi_trace(g_sw_trace_check, TSTXT("############ elisa MMI_MESSAGE trace check code end: \n"));

	return ;
}
Exemple #9
0
VOID CFW_PppTermInd(VOID)
{
  COS_EVENT sEvt ;
  CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("   in CFW_PppTermInd "));	
  
	sEvt.nEventId = EV_CFW_PPP_TERMINATE_IND;
	sEvt.nParam1 = 0;
	sEvt.nParam2 = 0;
  
  Gprs_SetAppCng(TRUE,  Pre_Task);
	COS_SendEvent(COS_GetDefaultMmiTaskHandle(), &sEvt, COS_WAIT_FOREVER, COS_EVENT_PRI_NORMAL);
}
Exemple #10
0
/**************************************************************

	FUNCTION NAME		: Msg_Adaption_PHB_Init_Ready

	PURPOSE				: Init First about the PHB of Adaption

	INPUT PARAMETERS	: void

	OUTPUT PARAMETERS	: nil

	RETURNS				: void

	REMARKS			:

**************************************************************/
void  Msg_Adaption_PHB_Init_Ready(void)
{
  
	UINT16 error = 0;
	INT32 index = 0;
	INT32 ret = 0;

	TBM_ENTRY(0x29e5);

	nMEusedSlot = 0;
	memset(pb_coolsand, 0x00, sizeof(CFW_PBK_ENTRY_INFO) * MAX_PB_PHONE_ENTRIES);
	
	ret = ReadRecord(NVRAM_PHB_NVRAM_LID, 1, 
		(void *)&pb_coolsand[1], sizeof(CFW_PBK_ENTRY_INFO) * MAX_PB_PHONE_ENTRIES, &error); 

	if (ret < 0)
	{
		mmi_trace(g_sw_ADP_PHB, TSTXT("PHB Init Msg_Adaption_PHB_Init_Ready FS_read error!\n"));
	}
	else
	{
		for (index = 1; index <= MAX_PB_PHONE_ENTRIES; index++)
		{
			if (pb_coolsand[index].nAppIndex != 0)
			{
				/* record total used index */
				MEUsedIndex[nMEusedSlot] = index;

				/* record total count */
				nMEusedSlot++;
			}
		}
		mmi_trace(g_sw_ADP_PHB, TSTXT("PHB Init Msg_Adaption_PHB_Init_Ready()***PhoneUsed:%d!\n"), nMEusedSlot);

	}

	TBM_EXIT(0x29e5);
}
Exemple #11
0
void Msg_Adaption_PHB_Finish_Init(void)
{
	ilm_struct ilm_ptr;
	U8 i;
	mmi_phb_startup_finish_ind_struct *localPtr = OslMalloc(sizeof(mmi_phb_startup_finish_ind_struct));
	ASSERT(localPtr != NULL);
	memset(localPtr, 0, sizeof(mmi_phb_startup_finish_ind_struct));

	localPtr->phb_len = MAX_ABBREVIATED_DIAL_NUMBER_LEN;
	localPtr->fdn_len = MAX_FIX_DIALLING_NUMBER_LEN;
	localPtr->bdn_len = MAX_ABBREVIATED_DIAL_NUMBER_LEN;
	localPtr->owner_len = MAX_OWNER_NUMBER_LEN;
	localPtr->phb_max_num = MAX_PB_PHONE_ENTRIES;

	for(i = 0; i < ADP_SIM_NUMBER; i++)
	{
		localPtr->sim_max_num[i] = adp_gPHBContex[i].nSIMTotalSlot;
	}
		
	ilm_ptr.dest_mod_id = MOD_MMI;
	ilm_ptr.src_mod_id = MOD_L4C;
	ilm_ptr.msg_id = MSG_ID_MMI_PHB_STARTUP_FINISH_IND;
	ilm_ptr.local_para_ptr = (local_para_struct *)localPtr;
	OslMsgSendExtQueue(&ilm_ptr);
	mmi_trace(g_sw_ADP_PHB, TSTXT("PHB MSG_ID_MMI_PHB_STARTUP_READ_NEXT_REQ STARTUP_FINISH_IND.  \n"));

	flag_init_ok = TRUE;

	{
		U8 nSimIndex;
		for(nSimIndex = 0; nSimIndex< ADP_SIM_NUMBER;nSimIndex++)
		{
			if(bNeedInit[nSimIndex])
			{
				#ifdef __ADP_MULTI_SIM__
				mmi_trace(g_sw_ADP_SS, "SS Init Call Forwarding Start for sim%d", nSimIndex);
				AdpInitCallFwowardingStart(nSimIndex);
				#else
				AdpInitCallFwowardingStart();
				#endif
				break;
			}
		}
	}

#ifdef ADP_DUALSIM_MODE_CLOSE_NOSIM
	ADP_CloseNoSIM();
#endif
	
}
Exemple #12
0
PCSTR GetMEGName(UINT32 nEvId)
{
	uint32  i ;
	for(i = 0;  i < NumSapFile;i++)
	{
		if (nEvId >=sap[i].MesIDBegin && nEvId <= sap[i].MesIDEnd)
		{
			mmi_trace(g_sw_trace_check, TSTXT("##### fun:GetMEGName : Message begin:%s [ID : %d], this sap file begin:%d, current [ID: %d]\n"),
	                 	MEGIDName[(sap[i].MAPBegin)], sap[i].MesIDBegin, sap[i].MAPBegin, nEvId );
			return MEGIDName[nEvId-sap[i].MesIDBegin  + sap[i].MAPBegin];
		}
	}
	return "unknow message id name";
}
Exemple #13
0
/**************************************************************

	FUNCTION NAME		: Msg_Adaption_PHB_Init

	PURPOSE				: Init about the PHB of Adaption

	INPUT PARAMETERS	: void

	OUTPUT PARAMETERS	: nil

	RETURNS				: void

	REMARKS			:

**************************************************************/
void  Msg_Adaption_PHB_Init(void)
{
    U8 i = 0;
    
	if (nMEusedSlot > 0)
	{

		/* induct init procedure */
		ilm_struct  ilm_ptr;
		CFW_PBK_ENTRY_INFO *entryInfo = NULL;
		mmi_phb_startup_read_ind_struct *phb = OslMalloc(sizeof(mmi_phb_startup_read_ind_struct));
		ASSERT(phb != NULL);
		memset(phb, 0x00, sizeof(mmi_phb_startup_read_ind_struct));

		/* start from the first index */
		entryInfo = &(pb_coolsand[MEUsedIndex[0]]);
        #ifdef __ADP_MULTI_SIM__
		phb->access_id = 1;
		for(i = 0; i < ADP_SIM_NUMBER; i++)
		{
			if(g_PHBSIMStartFinish[i])
			{
				phb->access_id += adp_gPHBContex[i].nSIMTotalSlot;
			}
		}
        #else
		phb->access_id = nCurAccess;  //entryInfo->nAppIndex + 1;// 1;
        #endif	
		phb->phb_entry.storage = MMI_NVRAM;
		phb->phb_entry.record_index = entryInfo->nAppIndex;

		memcpy(&(phb->phb_entry.alpha_id), &(entryInfo->alpha_id), sizeof(l4_name_struct));
		memcpy(&(phb->phb_entry.tel), &(entryInfo->tel), sizeof(l4_addr_bcd_struct));

		//vivian add for bug 10769
		phb->phb_entry.tel.addr_length = entryInfo->tel.addr_length + 1;
		ilm_ptr.dest_mod_id = MOD_MMI;
		ilm_ptr.src_mod_id = MOD_L4C;
		ilm_ptr.msg_id = MSG_ID_MMI_PHB_STARTUP_READ_IND;
		ilm_ptr.local_para_ptr = (local_para_struct *)phb;
		OslMsgSendExtQueue(&ilm_ptr);
		mmi_trace(g_sw_ADP_PHB, TSTXT("PHB Init Func: %s***access_id:%d******nAppIndex:%d*** MEUsedIndex[0] = %d"), __FUNCTION__, phb->access_id, entryInfo->nAppIndex, MEUsedIndex[0]);
	}
	else
	{
		Msg_Adaption_PHB_Finish_Init();
	}
}
Exemple #14
0
BOOL socketdata_store(INT32 sockfd, void* rec_data)
{
    struct socket_data *p = &socketid[sockfd];
	if(!rec_data)
	{
	  return TRUE;
	}
	if(p->index[p->rear])
	{
	    CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("store too fast!\n"));
	     return FALSE;
	}
	else
	{
		p->index[p->rear] = rec_data;	
		p->rear = INDEX_MOD(p->rear + 1);
		return TRUE;
	}
}
Exemple #15
0
BOOL socketdata_store(INT32 sockfd, void* rec_data)
{
  COS_WaitForSemaphore(Tcp_receive_buf_sem, COS_WAIT_FOREVER);
  
  struct socket_data *p = &socketid[sockfd];
	if(!rec_data)
	{
         COS_ReleaseSemaphore(Tcp_receive_buf_sem);
	  return TRUE;
	}
	if(p->index[p->rear])
	{
	    CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("store too fast!\n"));
            COS_ReleaseSemaphore(Tcp_receive_buf_sem);
	     return FALSE;
	}
	else
	{
		p->index[p->rear] = rec_data;	
		p->rear = INDEX_MOD(p->rear + 1);
              COS_ReleaseSemaphore(Tcp_receive_buf_sem);
		return TRUE;
	}
}
Exemple #16
0
//added by guojian :get the fdn list to gFDLBDLContext, not PhoneBook[]. for our fdn process, not the same with previous one
void GetFDLToContext(void *info)
{
	MSG_PHB_GET_ENTRY_BY_INDEX_RSP_STRUCT* localPtr;
	U8 i= 0,j=0;
//micha0317
	U8 TempBuff[(MAX_PB_NUMBER_LENGTH+2)*ENCODING_LENGTH];
	U8 *tmpConvertBuf = NULL;
	U16 convertOutLen = 0;
	U8 name_dcs;//Renwy add 2008/06/25 for '$' error 
	U8 nSimId = 0;

	#ifdef __MMI_MULTI_SIM__
	nSimId = gSecSetupMenuSimID;
	#endif
	
	 mmi_trace(1, TSTXT("GetFDLToContext"));

	localPtr = (MSG_PHB_GET_ENTRY_BY_INDEX_RSP_STRUCT *)info;

	if (localPtr->result.flag == 0 /*OK*/) 
	{
		 mmi_trace(1, TSTXT("if GetFDLToContext (localPtr->result.flag == 0 /*OK*/) "));
		i =  gFDLBDLContext[nSimId].FDNBDNCount;
		gFDLBDLContext[nSimId].FDNBDNCount =  localPtr->no_list;	//Add number of new entries in current list length.

		mmi_trace(TRUE," Func: %s gpFDLBDLContext->FDNBDNCount=%d", __FUNCTION__,gFDLBDLContext[nSimId].FDNBDNCount);
		if (gFDLBDLContext[nSimId].FDNBDNCount > MAX_SIM_ENTRIES)
			gFDLBDLContext[nSimId].FDNBDNCount = MAX_SIM_ENTRIES;

		for (; i < gFDLBDLContext[nSimId].FDNBDNCount; i++, j++) 
		{
			gFDLBDLContext[nSimId].FDLBDLEntries[i].storage = localPtr->list[j].storage;
			gFDLBDLContext[nSimId].FDLBDLEntries[i].index = localPtr->list[j].index;
			gFDLBDLContext[nSimId].FDLBDLEntries[i].record_index = localPtr->list[j].record_index;

			memset(gFDLBDLContext[nSimId].FDLBDLEntries[i].alpha_id.name, 0, MAX_NAME_LEN_FSB_LIST*ENCODING_LENGTH);
			memset(gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.number, 0, MAX_NUMBER_LEN_FSB_LIST*ENCODING_LENGTH);
			gFDLBDLContext[nSimId].FDLBDLEntries[i].alpha_id.name_length = localPtr->list[j].alpha_id.name_length;
			gFDLBDLContext[nSimId].FDLBDLEntries[i].alpha_id.name_dcs = localPtr->list[j].alpha_id.name_dcs;

			
			{//Renwy add begine 2008/06/25 for '$' error 

				name_dcs = gFDLBDLContext[0].FDLBDLEntries[i].alpha_id.name_dcs;
				
				if (MMI_PHB_ASCII == gFDLBDLContext[0].FDLBDLEntries[i].alpha_id.name_dcs)
				{
					name_dcs = MMI_8BIT_DCS;
				}
				
			}//Renwy add end 2008/06/25 for '$' error 
			tmpConvertBuf = CovertStringForPlatform(localPtr->list[j].alpha_id.name, gFDLBDLContext[nSimId].FDLBDLEntries[i].alpha_id.name_length,name_dcs,&convertOutLen);//Renwy modify 2008/06/25
			//tmpConvertBuf = CovertStringForPlatform(localPtr->list[j].alpha_id.name, gFDLBDLContext.FDLBDLEntries[i].alpha_id.name_length,gFDLBDLContext.FDLBDLEntries[i].alpha_id.name_dcs,&convertOutLen);

			gFDLBDLContext[nSimId].FDLBDLEntries[i].alpha_id.name_length = (U8) convertOutLen;

			if (pfnUnicodeStrlen((PS8) tmpConvertBuf) <= MAX_PB_NAME_LENGTH) {
				pfnUnicodeStrcpy((PS8) gFDLBDLContext[nSimId].FDLBDLEntries[i].alpha_id.name, (PS8) tmpConvertBuf);
			}
			else {
				pfnUnicodeStrncpy((PS8) gFDLBDLContext[nSimId].FDLBDLEntries[i].alpha_id.name, (PS8) tmpConvertBuf, MAX_PB_NAME_LENGTH);
			}

			if (tmpConvertBuf!=NULL)
				OslMfree(tmpConvertBuf);

			if (localPtr->list[j].tel.type == MMI_CSMCC_INTERNATIONAL_ADDR) 
			{
				gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.type = localPtr->list[j].tel.type;
				gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.number[0] = '+';//insert '+' before the number.
				gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.length = localPtr->list[j].tel.length;
				AnsiiToUnicodeString((PS8)TempBuff, (PS8)localPtr->list[j].tel.number);
				memcpy(gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.number + ENCODING_LENGTH, TempBuff, (localPtr->list[j].tel.length)*ENCODING_LENGTH);
			} 
			else 
			{
				gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.type = localPtr->list[j].tel.type;
				gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.length = localPtr->list[j].tel.length;
				AnsiiToUnicodeString((PS8)TempBuff, (PS8)localPtr->list[j].tel.number);
				memcpy(gFDLBDLContext[nSimId].FDLBDLEntries[i].tel.number, (PS8)TempBuff, (localPtr->list[j].tel.length)*ENCODING_LENGTH);
			}

		}
	}
}
Exemple #17
0
/**************************************************************

	FUNCTION NAME		: SECSETGetFdlEntriesRsp(void)
  	PURPOSE				: getting all entries rsp
	INPUT PARAMETERS	: nil
	OUTPUT PARAMETERS	: nil
	RETURNS				: void
  	Author				: Vanita Jain
 

**************************************************************/
void SECSETGetFdlEntriesRsp(void *info)
{
	MSG_PHB_GET_ENTRY_BY_INDEX_RSP_STRUCT* localPtr;
	U8 i= 0,j=0;
//micha0317
	U8 TempBuff[(MAX_PB_NUMBER_LENGTH+2)*ENCODING_LENGTH];
	U8 *tmpConvertBuf = NULL;
	U16 convertOutLen = 0;
	U8 name_dcs;//Renwy add 2008/06/25 for '$' error 
	U8 nSimID;

	nSimID = MTPNP_AD_get_protocol_event_src_mode();
	
	mmi_trace(1, TSTXT("SECSETGetFdlEntriesRsp"));
	SetProtocolEventHandlerExt(NULL, PRT_PHB_GET_ENTRY_BY_INDEX_RSP,nSimID);

	localPtr = (MSG_PHB_GET_ENTRY_BY_INDEX_RSP_STRUCT *)info;

	if (localPtr->result.flag == 0 /*OK*/) 
	{
		 mmi_trace(1, TSTXT("if (localPtr->result.flag == 0 /*OK*/) "));
		i =  gpFDLBDLContext->FDNBDNCount;
		gpFDLBDLContext->FDNBDNCount +=  localPtr->no_list;	//Add number of new entries in current list length.

		if (gpFDLBDLContext->FDNBDNCount > MAX_SIM_ENTRIES)
			gpFDLBDLContext->FDNBDNCount = MAX_SIM_ENTRIES;

		for (; i < gpFDLBDLContext->FDNBDNCount; i++, j++) 
		{
			gpFDLBDLContext->FDLBDLEntries[i].storage = localPtr->list[j].storage;
			gpFDLBDLContext->FDLBDLEntries[i].index = localPtr->list[j].index;
			gpFDLBDLContext->FDLBDLEntries[i].record_index = localPtr->list[j].record_index;

			memset(gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name, 0, MAX_NAME_LEN_FSB_LIST*ENCODING_LENGTH);
			memset(gpFDLBDLContext->FDLBDLEntries[i].tel.number, 0, MAX_NUMBER_LEN_FSB_LIST*ENCODING_LENGTH);
			gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name_length = localPtr->list[j].alpha_id.name_length;
			gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name_dcs = localPtr->list[j].alpha_id.name_dcs;

			
			{//Renwy add begine 2008/06/25 for '$' error 

				name_dcs = gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name_dcs;
				
				if (MMI_PHB_ASCII == gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name_dcs)
				{
					name_dcs = MMI_8BIT_DCS;
				}
				
			}//Renwy add end 2008/06/25 for '$' error 
			tmpConvertBuf = CovertStringForPlatform(localPtr->list[j].alpha_id.name, gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name_length,name_dcs,&convertOutLen);//Renwy modify 2008/06/25
			//tmpConvertBuf = CovertStringForPlatform(localPtr->list[j].alpha_id.name, gFDLBDLContext.FDLBDLEntries[i].alpha_id.name_length,gFDLBDLContext.FDLBDLEntries[i].alpha_id.name_dcs,&convertOutLen);

			gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name_length = (U8) convertOutLen;

			if (pfnUnicodeStrlen((PS8) tmpConvertBuf) <= MAX_PB_NAME_LENGTH) {
				pfnUnicodeStrcpy((PS8) gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name, (PS8) tmpConvertBuf);
			}
			else {
				pfnUnicodeStrncpy((PS8) gpFDLBDLContext->FDLBDLEntries[i].alpha_id.name, (PS8) tmpConvertBuf, MAX_PB_NAME_LENGTH);
			}

			if (tmpConvertBuf!=NULL)
				OslMfree(tmpConvertBuf);

			if (localPtr->list[j].tel.type == MMI_CSMCC_INTERNATIONAL_ADDR) 
			{
				gpFDLBDLContext->FDLBDLEntries[i].tel.type = localPtr->list[j].tel.type;
				gpFDLBDLContext->FDLBDLEntries[i].tel.number[0] = '+';//insert '+' before the number.
				gpFDLBDLContext->FDLBDLEntries[i].tel.length = localPtr->list[j].tel.length;
				AnsiiToUnicodeString((PS8)TempBuff, (PS8)localPtr->list[j].tel.number);
				memcpy(gpFDLBDLContext->FDLBDLEntries[i].tel.number + ENCODING_LENGTH, TempBuff, (localPtr->list[j].tel.length)*ENCODING_LENGTH);
			} 
			else 
			{
				gpFDLBDLContext->FDLBDLEntries[i].tel.type = localPtr->list[j].tel.type;
				gpFDLBDLContext->FDLBDLEntries[i].tel.length = localPtr->list[j].tel.length;
				AnsiiToUnicodeString((PS8)TempBuff, (PS8)localPtr->list[j].tel.number);
				memcpy(gpFDLBDLContext->FDLBDLEntries[i].tel.number, (PS8)TempBuff, (localPtr->list[j].tel.length)*ENCODING_LENGTH);
			}

		}
		if (localPtr->no_list == MAX_ENTRIES_IN_LIST)
		{
			 mmi_trace(1, TSTXT("	if (localPtr->no_list == MAX_ENTRIES_IN_LIST) "));
			SECSETGetFdlEntriesReq();
		}
		else 
		{
			 mmi_trace(1, TSTXT("	ViewFDList "));
		 	if(g_FixedInit[nSimID] != TRUE)////man for fdn
		 	{
				ViewFDList();
			}
			gSimReady[nSimID] = TRUE;
			
			/*
			*    Retrieve FDN list to ADN buffer when FDN is enable.
			*    Because ADN will not read when FDN is on, so use ADN's buffer to store FDN temporarily
			*    This is for call lookup FDN number usage.
			*/   
		//	if(g_SecuritySetupContext.FdlStatus)
		//		mmi_phb_fdn_get_list_to_ram();
		}
	}
	else if (localPtr->result.flag == 1 && localPtr->result.cause == 5) 
	{
//		gFDLBDLContext.FDNBDNCount = 0;

		gSimReady[nSimID] = TRUE;
		ViewFDList();
	}
	else 
	{
		DisplayPopup((PU8)GetString(STR_GLOBAL_UNFINISHED) ,IMG_GLOBAL_UNFINISHED, 1,ST_NOTIFYDURATION,ERROR_TONE);
		DeleteUptoScrID(SCR_ID_SECSET_FIX_DIAL);
	}
}
Exemple #18
0
VOID Aps_PppProc( COS_EVENT* pEvent )
{

 
  CFW_EVENT pCfwEvent;

  PPP_CP_ENTRY(CPID_Aps_PppProc);  
   
  pCfwEvent.nType = HIUINT8(pEvent->nParam3);
  
  if(pEvent->nEventId == EV_CFW_GPRS_DATA_IND)
  {
    CFW_GPRS_DATA * Msg;
    Msg = (CFW_GPRS_DATA *)pEvent->nParam2;
    CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS receive EV_CFW_GPRS_DATA_IND. data length: %d\n"),Msg->nDataLength);
    
    ppp_OnReceiveIpPacket(Msg->pData, Msg->nDataLength);
    
    if(Msg != NULL)
      CSW_TCPIP_FREE(Msg);
    
  }else if(pEvent->nEventId == EV_CFW_GPRS_ATT_RSP)
  {
       
    CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS receive EV_CFW_GPRS_ATT_RSP.pCfwEvent.nType  : %d\n"),pCfwEvent.nType);
    if(pCfwEvent.nType == CFW_GPRS_ATTACHED)//attach success
    {
      ppp_Gprs_state.PPP_Act = TRUE;
      ppp_Gprs_state.PPP_Cid = 1;
      
      // if not set the PDP context, do it
      
      if(PdpContList[0] == NULL)
      {
        CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS set PDP context.\n"));
       
        CFW_GPRS_QOS qos;
        qos.nDelay = 4;
        qos.nMean = 16;
        qos.nPeak = 4;
        qos.nPrecedence = 3;
        qos.nReliability = 3;
#if 0

        CFW_GprsSetReqQos(1, &qos);
#endif
       
        CFW_GPRS_PDPCONT_INFO pdp_cont;
        pdp_cont.nApnSize = 5;
        pdp_cont.pApn = "CMNET";
            
        pdp_cont.nApnUserSize = 3;
        pdp_cont.pApnUser = "******";
        pdp_cont.nApnPwdSize = 3;
        pdp_cont.pApnPwd= "wap";

        
        pdp_cont.nPdpAddrSize = 0;
        pdp_cont.pPdpAddr = NULL;
        pdp_cont.nDComp = 0; 
        pdp_cont.nHComp = 0;
        pdp_cont.nPdpType = CFW_GPRS_PDP_TYPE_IP;
#if 0

        CFW_GprsSetPdpCxt(ppp_Gprs_state.PPP_Cid, &pdp_cont);
#endif
      }
     
      #if 1
#if 0

#endif


      #else
      UINT8 uTi;
      if(ERR_SUCCESS == CFW_GetFreeUTI(CFW_GPRS_SRV_ID, &uTi))
      {
        CFW_GprsAct(CFW_GPRS_ACTIVED, ppp_Gprs_state.PPP_Cid, uTi);
      }else
        CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("   no free uTi "));	
      #endif
    }else if(pCfwEvent.nType == CFW_GPRS_DETACHED)//if Detached ,sent ternminate to AT
    {
      CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS eceive CFW_GPRS_DETACHED,APS send terminate ppp.\n"));
      ppp_Gprs_state.PPP_Att = FALSE;

      CFW_PppTermInd();
      
    }else{
      CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS attach failure. error :0x%x\n"),pEvent->nParam1);
    }
  }else if(pEvent->nEventId == EV_CFW_GPRS_ACT_RSP)
  {
    CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS eceive EV_CFW_GPRS_ACT_RSP.\n"));
    
    //if PDP context actived, and  the ppp state is PPP_STATUS_NCP_START, begin handle NCP packet
    if(pCfwEvent.nType == CFW_GPRS_ACTIVED)// active success
    {
      g_Pdp_Acting = FALSE;
      ppp_Gprs_state.PPP_Cid = 1;
      
      if(ppp_Data.Status == PPP_STATUS_NCP_START)
      {
        ppp_ProcessNcpPacket();
        
      }else if(ppp_Data.Status ==PPP_STATUS_PPP_NULL)
      {
        //TODO
      }
    }else if(pCfwEvent.nType == CFW_GPRS_DEACTIVED)//deactive success
    {
      CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS eceive CFW_GPRS_DEACTIVED.\n"));
      ppp_Gprs_state.PPP_Cid = 0;
      ppp_Gprs_state.PPP_Act = FALSE;
      
      if(ppp_Gprs_state.PPP_Att == TRUE)
      {
        
        #if 1

        #else
          UINT8 uTi;
        if(ERR_SUCCESS == CFW_GetFreeUTI(CFW_NW_SRV_ID, &uTi))
        {
          CFW_GprsAtt(CFW_GPRS_DETACHED, uTi);
        }else
             CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("   no free uTi "));	
        #endif
        
        PPP_CP_EXIT(CPID_Aps_PppProc);        
        
        return;
      }else{
        CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS send terminate ppp.\n"));

        CFW_PppTermInd();
      }
    }else{
        CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS active failure.\n"));

    }
    
  
 }else if(pEvent->nEventId == EV_APS_PPP_DATA_REQ)
 {
    CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("Process ppp data from AT.\n"));

    if(Aps_APP == APS_TCP)
      Aps_APP = APS_PPP;
    
    UINT16 packet_head =0 ;
    UINT16 elem = 0;
    CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("Process ppp data from AT. data length: %d\n"),pEvent->nParam2);

    //SXS_DUMP(_MMI, 0, ppp_Buffer, pEvent->nParam2);

    UINT8* tmp = (UINT8*)(pEvent->nParam1);
   
    while (elem < pEvent->nParam2)
    {
      elem++;
      while(( tmp[elem] !=0x7E)&&(elem < pEvent->nParam2))
      {
        elem ++;
      }
      elem ++;
      CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("PPP handle a packet : %d\n"),elem - packet_head);

      ppp_ProcessPPP(tmp + packet_head, elem - packet_head);
      packet_head = elem;
    }
    
  }else{
     CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("PPP receive  unknow event : 0x%x\n"),pEvent->nEventId);

  }
      
  PPP_CP_EXIT(CPID_Aps_PppProc); 
}
Exemple #19
0
VOID socketdata_initial(INT32 sockfd, UINT8 type)
{

 CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("start socketdata_initial socketid: 0x%x, type: 0x%x !\n"),sockfd,type);

  COS_WaitForSemaphore(Tcp_receive_buf_sem, COS_WAIT_FOREVER);
 // void* buf = NULL;

  if(0xFF==sockfd)
  {
       INT32 sid=0;
       for(sid = 0; sid<MEMP_NUM_NETCONN; sid++)
       {
  	    SUL_MemSet8(&socketid[sid], 0, sizeof(struct socket_data));
           socketid[sid].type = type;
       }
	CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("socketdata_initial in TCP init!\n"));

	COS_ReleaseSemaphore(Tcp_receive_buf_sem);

       return;
  }
  if((sockfd < 0) && (sockfd>=MEMP_NUM_NETCONN))
  {
        COS_ReleaseSemaphore(Tcp_receive_buf_sem);
	 CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("socketdata_initial socket error!\n"));


  	return;
 }
  struct socket_data *p = &socketid[sockfd];

  switch(p->type)
  {
	 case NETCONN_UDPLITE:
        case NETCONN_UDPNOCHKSUM:
        case NETCONN_UDP:
           while(p->index[p->front])
           {
              
		netbuf_delete(p->index[p->front]);
	
	       p->index[p->front] = NULL;	
	       p->front = INDEX_MOD(p->front + 1) ;
	   }
           break;		   
        case NETCONN_TCP:
	    while(p->index[p->front])
           {
		pbuf_free(p->index[p->front]);
	       p->index[p->front] = NULL;	
	       p->front = INDEX_MOD(p->front + 1) ;
	   }
           break;
        default:
	    break;
		
	
  }

  
	
  SUL_MemSet8(&socketid[sockfd], 0, sizeof(struct socket_data));
  socketid[sockfd].type = type;
 CSW_TRACE(CFW_TCPIP_TS_ID_SXS, TSTXT("end socketdata_initial socketid: 0x%x, type: 0x%x !\n"),sockfd,type);

  COS_ReleaseSemaphore(Tcp_receive_buf_sem);
  return;
}
Exemple #20
0
BOOL BAL_TaskInit()
{
    UINT8 i = 0;
    INT32 err_code = 0x00;
    UINT32 fs_dev_count = 0;
    FS_DEV_INFO* fs_dev_info = NULL;
    UINT32 fs_root_dev_count = 0;

    
#if ( CHIP_ASIC_ID != CHIP_ASIC_ID_JADE)
    csw_RegisterYourself();
#else
    DM_CheckPowerOnCause();
#endif

  // hal_fastOSTimInit();

  BAL_DevHandlerInit();
  TS_Init_Inner();

  // TS_SetOutputMask(CSW_TS_ID, 1);           
  // TS_SetOutputMask(CFW_SIM_TS_ID, 1);    
  // TS_SetOutputMask(CFW_NW_TS_ID, 1);    
  // TS_SetOutputMask(CFW_SMS_TS_ID, 1);  
  // TS_SetOutputMask(CFW_CC_TS_ID, 1);   
  // TS_SetOutputMask(CFW_SS_TS_ID, 1);    
  // TS_SetOutputMask(CFW_PM_TS_ID, 1);    
  // TS_SetOutputMask(BASE_FFS_TS_ID, 1);    
  // TS_SetOutputMask(BASE_TM_TS_ID, 1);    
  // TS_SetOutputMask(CFW_SHELL_TS_ID, 1);    
  // TS_SetOutputMask(CFW_AOM_TS_ID, 1);   

// open 1,2,3,4
  // sxs_IoCtx.TraceBitMap [TGET_ID(_CSW)] =  1|(1 << 1) | (1 << 2)|(1<<3);

  // open shell trace
  sxs_IoCtx.TraceBitMap[TGET_ID(_CSW)] = (1 << 1);

  // 
  // sxs_IoCtx.TraceBitMap [TGET_ID(_MMI)] = 0;
  // sxs_IoCtx.TraceBitMap [TGET_ID(_MM)] = 0;

  BAL_SetMMIDefaultValue();

// CSW_CheckMMIDefaultValue() ;
  CSW_CheckMMIDefaultValue(); // add wys 2007-06-20

  csw_MemIint();
  PM_CheckValidPowerOnVoltage(3000);

/*
    if(0x00 ==  CFW_GetValidMarker())//0x00 表示非生产模式
    {
        	CSW_TRACE(100, TSTXT("norm modle"));

        if(!PM_CheckValidPowerOnVoltage(g_MMI_Default_Value.nMinVol))
        {
            hal_ShutDown();
        }
    }
    else
    {
                	CSW_TRACE(100, TSTXT("e modle"));

    }

  //deleted by mabo to power on at low power voltage,20070829
  //add wys 2007-06-20
    if(0x00 ==  CFW_GetValidMarker())//0x00 表示非生产模式
    {
        	CSW_TRACE(BASE_BAL_TS_ID, TSTXT("BAL_TaskInit norm modle"));

        if(!PM_CheckValidPowerOnVoltage(g_MMI_Default_Value.nMinVol))
        {
            hal_ShutDown();
        }
    }
    else
    {
           CSW_TRACE(BASE_BAL_TS_ID, TSTXT("BAL_TaskInit e modle"));

    }
//add end
*/
	
    CSW_TRACE(BASE_BAL_TS_ID, TSTXT("\nBAL_TaskInit Start. \n"));

    DRV_FlashPowerUp();
    //mabo deleted,20070813
    //DRV_FlashInit(CSW_DVR_FLASH_INIT_PARA) ;
    //romuald added 20080425
#if (CHIP_ASIC_ID != CHIP_ASIC_ID_JADE)
    DRV_FlashInit();
#endif
    //Modify for memory overflow bug at 20090724
    //for(i = 0; i< SIZEOF(g_BalTasks); i++) 
    for(i = 0; i< MAX_BAL_TASK_NUM; i++) 
        g_BalTasks[i] = HNULL;
    
    g_BalTasks[BAL_TASK_NUM(BAL_SYS_TASK_PRIORITY)] = COS_CreateTask_Prv(BAL_SysTask, NULL, NULL, 
        BAL_SYS_TASK_STACK_SIZE, BAL_SYS_TASK_PRIORITY, COS_CREATE_DEFAULT, 0, "BAL_SysTask");
#ifdef CFW_TCPIP_SUPPORT

    g_BalTasks[BAL_TASK_NUM(BAL_CFW_ADV_TASK_PRIORITY)] = COS_CreateTask_Prv(BAL_CFWApsTask, NULL, NULL, 
        BAL_CFW_ADV_TASK_STACK_SIZE, BAL_CFW_ADV_TASK_PRIORITY, COS_CREATE_DEFAULT, 0, "BAL_CFWApsTask");
#endif    
    g_BalTasks[BAL_TASK_NUM(BAL_DEV_MONITOR_TASK_PRIORITY)] = COS_CreateTask_Prv(BAL_DevMonitorTask, NULL, NULL, 
        BAL_DEV_MONITOR_TASK_STACK_SIZE, BAL_DEV_MONITOR_TASK_PRIORITY, COS_CREATE_DEFAULT, 0, "BAL_DevMonitorTask");
    
    g_BalTasks[3] = COS_CreateTask_Prv(BAL_BackgroundTask, NULL, NULL, 
        BAL_BG_TASK_STACK_SIZE, COS_BK_TASK_PRI, COS_CREATE_DEFAULT, 0, "BAL_BackgroundTask");
    

//Add by lixp at 20080201
//
#ifdef ML_SUPPORT
    ML_Init();
    ML_SetCodePage(ML_ISO8859_1);
#elif defined(NEW_ML_SUPPORT)
#endif	
    BAL_ApplicationInit();

    err_code = VDS_Init();   // Initialize VDS. added bye nie. 20070322
    if(ERR_SUCCESS == err_code)
    {
        CSW_TRACE(BASE_BAL_TS_ID,"VDS_Init() OK.\n");        
    }
    else
    {
        CSW_TRACE(BASE_BAL_TS_ID,"VDS_Init() ERROR, Error code: %d.\n", err_code);
    }
     err_code = DSM_DevInit();
    if(ERR_SUCCESS == err_code)
    {
        CSW_TRACE(BASE_BAL_TS_ID,"DSM_DevInit OK.\n");
    }
    else
    {
        CSW_TRACE(BASE_BAL_TS_ID,"DSM_DevInit ERROR, Error code: %d. \n",err_code);
    }

    err_code = REG_Init();
    if(ERR_SUCCESS == err_code)
    {
        CSW_TRACE(BASE_BAL_TS_ID, TSTXT("REG_Init() OK.\n"));
    }
    else
    {
        CSW_TRACE(BASE_BAL_TS_ID, TSTXT("REG_Init() Fail!Error code:%d.\n"),err_code);
    }
        
	
    err_code = CFW_CfgInit();
    if(ERR_SUCCESS == err_code)
    {
        CSW_TRACE(BASE_BAL_TS_ID, TSTXT("CFW_CfgInit OK.\n"));
    }
    else
    {
        CSW_TRACE(BASE_BAL_TS_ID, TSTXT("CFW_CfgInit ERROR, Error code: 0x%08x \n"), err_code);
    }

    err_code = SMS_DM_Init();
    if(ERR_SUCCESS == err_code)
    {
        CSW_TRACE(BASE_BAL_TS_ID, TSTXT("SMS_DM_Init OK.\n"));
    }
    else
    {
        CSW_TRACE(BASE_BAL_TS_ID, TSTXT("SMS_DM_Init ERROR, Error code: %d.\n"), err_code);
    }

   

    err_code = FS_PowerOn();
    if(ERR_SUCCESS == err_code)
    {
        CSW_TRACE(BASE_BAL_TS_ID,"FS Power On Check OK.\n");
    }
    else
    {
        CSW_TRACE(BASE_BAL_TS_ID,"FS Power On Check ERROR, Error code: %d. \n",err_code);
    }

   // Get FS device table.
   err_code = FS_GetDeviceInfo(&fs_dev_count, &fs_dev_info);
   if(err_code != ERR_SUCCESS)
   {
        CSW_TRACE(BASE_BAL_TS_ID,"Device not register.\n");
        fs_dev_count = 0;
    }

    // Check the state of root device ,if not format, format it.
    // Mount root device.
    for(i = 0; i < fs_dev_count; i++)
    {
        // format the flash device.
        if(fs_dev_info[i].dev_type == FS_DEV_TYPE_FLASH && fs_dev_info[i].is_root == TRUE)
        {
            err_code = FS_HasFormatted(fs_dev_info[i].dev_name,FS_TYPE_FAT);

            if(ERR_FS_HAS_FORMATED == err_code)
            {
                CSW_TRACE(BASE_BAL_TS_ID,"The flash device %s has formated.\n",fs_dev_info[i].dev_name);
            }
            else if(ERR_FS_NOT_FORMAT == err_code)
            {        

                CSW_TRACE(BASE_BAL_TS_ID,"The flash device %s not format.\n",fs_dev_info[i].dev_name);
                err_code = FS_Format(fs_dev_info[i].dev_name,FS_TYPE_FAT,0);
                if(ERR_SUCCESS == err_code)
                {
                    CSW_TRACE(BASE_BAL_TS_ID,"The flash device %s format ok.\n",fs_dev_info[i].dev_name);
                }
                else if(ERR_FS_NOT_FORMAT == err_code)
                {
                    CSW_TRACE(BASE_BAL_TS_ID,"The flash device %s format error.Error code:%d.\n",fs_dev_info[i].dev_name,err_code);            
                }    
            }
            else 
            {
                CSW_TRACE(BASE_BAL_TS_ID,"The flash device %s has formated error.Error code:%d.\n",fs_dev_info[i].dev_name,err_code);
                
            }
             
            // Mount root device.
            if(fs_root_dev_count > 0)
            {
              CSW_TRACE(BASE_BAL_TS_ID,"The FS root device too more:%d.\n",fs_root_dev_count);
            }
            else
            {
                err_code = FS_MountRoot(NULL);
                if(ERR_SUCCESS == err_code)
                {
                    CSW_TRACE(BASE_BAL_TS_ID,"FS MountRoot(%s) OK.\n",fs_dev_info[i].dev_name);
                }
                else
                {
                    CSW_TRACE(BASE_BAL_TS_ID,"FS MountRoot(%s) ERROR, Error code: %d. \n",fs_dev_info[i].dev_name,err_code);
                }
            }
            fs_root_dev_count ++;
                       
        }
    }


//#ifdef SIM_SWITCH_ENABLE
#if 0
    //
    //Add by lixp at 070407
    //SimSwitch(UINT8 SimNum)
    //#define SIM_1 1 //simcard 1
    //#define SIM_2 2 //simcard 2
    //
    UINT8 nSIMCARD_INDEX = 0x00;
    err_code = CFW_CfgGetSimSwitch(&nSIMCARD_INDEX);
    if(ERR_SUCCESS == err_code)
    {
        CSW_TRACE(BASE_BAL_TS_ID, TSTXT("CFW_CfgGetSimSwitch OK.\n"));
    }
    else
    {
        CSW_TRACE(BASE_BAL_TS_ID, TSTXT("CFW_CfgGetSimSwitch ERROR, Error code: 0x%08x \n"), err_code);
    }
    
    SimSwitch(nSIMCARD_INDEX);
    CSW_TRACE(BASE_BAL_TS_ID, TSTXT("nSIMCARD_INDEX is %d\n"),nSIMCARD_INDEX);
#endif
#ifdef FSTRACE_SUPPORT
    fsTace_task_create();
#endif
    #if defined(USER_DATA_CACHE_SUPPORT) && !defined(_T_UPGRADE_PROGRAMMER) 
    err_code = VDS_InitCache();   // Initialize VDS Cache.
    if(ERR_SUCCESS == err_code)
    {
        CSW_TRACE(BASE_BAL_TS_ID,"VDS_InitCache() OK.\n");        
    }
    else
    {
        CSW_TRACE(BASE_BAL_TS_ID,"VDS_InitCache() ERROR, Error code: %d.\n", err_code);
    }    
    #endif
    return TRUE;
}
Exemple #21
0
/**************************************************************
	FUNCTION NAME		: ADP_DispatchPhbReqMsg
	PURPOSE			       : Message Adaption for Phonebook REQ.
	INPUT PARAMETERS	: COS_EVENT *pCosEvent
	OUTPUT PARAMETERS	: nil
	RETURNS			       : void
	REMARKS			:
**************************************************************/
static BOOL ADP_DispatchPhbReqMsg(COS_EVENT *pCosEvent)
{

	UINT32  ValueSimGetPbkEntry = ERR_SUCCESS;
 	 UINT16 error = 0;
	ASSERT(pCosEvent != NULL);
 	TBM_ENTRY(0x29e3);

#ifdef __ADP_MULTI_SIM__
	adp_ConfigureContext(ADP_MODULE_PHB, adp_GetMMISimID(ADP_GET_MMI_DEST_MOD(pCosEvent->nParam3)));
#endif
	
	switch (pCosEvent->nEventId)
	{
		/* init item by item */
		case MSG_ID_MMI_PHB_STARTUP_READ_NEXT_REQ:
		{
			CFW_PBK_ENTRY_INFO *entryInfo = NULL;
			U16 nSimTotalSlot = 0;
			U8 i;
			ilm_struct *oslMessage = (ilm_struct *) pCosEvent->nParam1;
			mmi_phb_startup_read_next_req_struct *local_para_ptr = (mmi_phb_startup_read_next_req_struct *)oslMessage->local_para_ptr;

		#ifdef __ADP_MULTI_SIM__
			mmi_trace(g_sw_ADP_PHB,"PHB Init read req , simid = %d, access_id = %d, simindex = %d", adp_pPHBContext->nSimId, local_para_ptr->access_id, adp_pPHBContext->nSimIndex);

			for(i = 0; i < ADP_SIM_NUMBER; i++)
			{
				mmi_trace(g_sw_ADP_PHB, "PHB g_PHBSIMStartFinish[%d] is %d,adp_gPHBContex->nSimId is %d,adp_gPHBContex[%d].nSIMTotalSlot is %d", i, g_PHBSIMStartFinish[i],adp_pPHBContext->nSimId, i, adp_gPHBContex[i].nSIMTotalSlot);
				if(i != adp_pPHBContext->nSimId && g_PHBSIMStartFinish[i])
				{
					mmi_trace(g_sw_ADP_PHB, "PHB nSimTotalSlot before = %d", nSimTotalSlot);
					mmi_trace(g_sw_ADP_PHB, "PHB adp_pPHBContext[i].nSIMTotalSlot = %d", adp_gPHBContex[i].nSIMTotalSlot);
					nSimTotalSlot += adp_gPHBContex[i].nSIMTotalSlot;
					mmi_trace(g_sw_ADP_PHB, "PHB nSimTotalSlot after = %d", nSimTotalSlot);
				}
			}
			nSimTotalSlot += adp_pPHBContext->nSIMTotalSlot;
			
			mmi_trace(g_sw_ADP_PHB, "PHB nSimTotalSlot = %d",nSimTotalSlot);
			
			if(local_para_ptr->access_id == nSimTotalSlot)
			{
				ADP_PhbInitFinishOneCardStartAnother(adp_pPHBContext->nSimId);
				return TRUE;
			}
		#endif 
			
		#ifdef __ADP_MULTI_SIM__
			if (local_para_ptr->access_id < nSimTotalSlot)
		#else
			if (local_para_ptr->access_id < adp_pPHBContext->nSIMusedSlot)
		#endif
			{	
				//nCurAccess = local_para_ptr->access_id + 1;
		#ifdef __ADP_MULTI_SIM__
			#ifdef ADP_CFW_DUALSIM_SIMULATOR_SUPPORT
				ValueSimGetPbkEntry = UT_CFW_SimGetPbkEntry(SimStorageID, adp_pPHBContext->nSimIndex, FREE_UTI, adp_pPHBContext->nSimId);
			#else
				U8 nUTI = FREE_UTI;
				#ifdef ADP_SIMU_FOUR_CARDS_WITH_TWO_CARDS
				Simu_Rsp_Marker_Struct simuRspMarker;
				simuRspMarker.msgID = EV_CFW_SIM_GET_PBK_ENTRY_RSP;
				simuRspMarker.nSimID = adp_pPHBContext->nSimId;
				simuRspMarker.Uti = nUTI;
				simuRspMarker.pNext = NULL;
				adp_simu_add_Rsp_Marker(&simuRspMarker);
				#endif
				ValueSimGetPbkEntry = CFW_SimGetPbkEntry(SimStorageID, adp_pPHBContext->nSimIndex, nUTI, gPHBCurrentSimID);
			#endif
		#else
				ValueSimGetPbkEntry = CFW_SimGetPbkEntry(SimStorageID, adp_pPHBContext->nSimIndex, FREE_UTI);
		#endif
				mmi_trace(g_sw_ADP_PHB,"PHB Init Func: %s ValueSimGetPbkEntry=0x%x", __FUNCTION__, ValueSimGetPbkEntry);
				if(ValueSimGetPbkEntry != ERR_SUCCESS)
				{
				#ifdef __ADP_MULTI_SIM__
					ADP_PhbInitFinishOneCardStartAnother(adp_pPHBContext->nSimId);
				#endif					
					switch (ValueSimGetPbkEntry)
					{
					case ERR_SUCCESS:
						mmi_trace(g_sw_ADP_PHB, TSTXT("the function succeeds !\n"));
						break;

					case ERR_CFW_INVALID_PARAMETER:
						mmi_trace(g_sw_ADP_PHB, TSTXT("The input parameter(nIndex) is invalid !\n"));
						break;

					case ERR_CFW_NOT_EXIST_FREE_UTI:
						mmi_trace(g_sw_ADP_PHB, TSTXT("No any available free UTI in the system !\n"));
						break;

					case ERR_CFW_UTI_IS_BUSY:
						mmi_trace(g_sw_ADP_PHB, TSTXT("The UTI is busy, maybe the UTI is used by other instance !\n"));
						break;

					case ERR_CME_MEMORY_FULL:
						mmi_trace(g_sw_ADP_PHB, TSTXT("No any more memory to allocate !\n"));
						break;

					default:
						break;
				}

				}
			}
		#ifdef __ADP_MULTI_SIM__
			else if(local_para_ptr->access_id < nSimTotalSlot + nMEusedSlot)
		#else
			else if (local_para_ptr->access_id < adp_pPHBContext->nSIMusedSlot + nMEusedSlot)
		#endif
			{			
				ilm_struct  ilm_ptr;
				mmi_phb_startup_read_ind_struct *phb = OslMalloc(sizeof(mmi_phb_startup_read_ind_struct));
				ASSERT(phb != NULL);
				memset(phb, 0x00, sizeof(mmi_phb_startup_read_ind_struct));
 		#ifdef __ADP_MULTI_SIM__
				entryInfo = &(pb_coolsand[MEUsedIndex[local_para_ptr->access_id - nSimTotalSlot]]);
		#else
				entryInfo = &(pb_coolsand[MEUsedIndex[local_para_ptr->access_id - adp_pPHBContext->nSIMusedSlot]]);
		#endif
				/* init next assess_id */
				phb->access_id = local_para_ptr->access_id + 1;
				phb->phb_entry.storage = MMI_NVRAM;

				/* physical index */
				phb->phb_entry.record_index = entryInfo->nAppIndex;

				memcpy(&(phb->phb_entry.alpha_id), &(entryInfo->alpha_id), sizeof(l4_name_struct));
				memcpy(&(phb->phb_entry.tel), &(entryInfo->tel), sizeof(l4_addr_bcd_struct));

				//vivian add for bug 10769
				phb->phb_entry.tel.addr_length = entryInfo->tel.addr_length + 1;
				ilm_ptr.dest_mod_id = MOD_MMI;
				ilm_ptr.src_mod_id = MOD_L4C;
				ilm_ptr.msg_id = MSG_ID_MMI_PHB_STARTUP_READ_IND;
				ilm_ptr.local_para_ptr = (local_para_struct *)phb;
				OslMsgSendExtQueue(&ilm_ptr);
				mmi_trace(g_sw_ADP_PHB, TSTXT("PHB Init startup_read_next_req, new access_id:%d, record_index:%d\n"), phb->access_id, phb->phb_entry.record_index);
			}
			else
			{		

			#ifdef __ADP_MULTI_SIM__
				BOOL bAllInitDone = TRUE;
				for(i = 0; i < ADP_SIM_NUMBER; i++)
				{
					if(!gSIMIsNotExist[i] && !g_PHBSIMStartFinish[i])
					{
						bAllInitDone = FALSE;
					}
				}
				if(bAllInitDone)
			#endif		
				{
					Msg_Adaption_PHB_Finish_Init();
				}
			}
		}

			break;

		case MSG_ID_MMI_PHB_DEL_ENTRY_REQ:
		{
			UINT32 ValueSimDelPbkEntry;
			ilm_struct *oslMessage = (ilm_struct *) pCosEvent->nParam1;
			mmi_phb_del_entry_req_struct *local_para_ptr = (mmi_phb_del_entry_req_struct *)oslMessage->local_para_ptr;
      		mmi_trace(g_sw_ADP_PHB, "PHB Delete MSG_ID_MMI_PHB_DEL_ENTRY_REQ");
			if (local_para_ptr->storage == MMI_NVRAM)
			{
				if (local_para_ptr->type == MMI_PHB_PHONEBOOK)
				{
					/* check if me used index exist */
					ASSERT(nMEusedSlot > 0);
					ASSERT(local_para_ptr->index <= MAX_PB_PHONE_ENTRIES);
						/* set nAppIndex as 0 value when delete item */
						pb_coolsand[local_para_ptr->index].nAppIndex = 0;
	  					memset(&pb_coolsand[local_para_ptr->index], 0, sizeof(CFW_PBK_ENTRY_INFO));
	  					//2007-06-20, Han ShiLin, add handler for offset when write record
 						//if (WriteRecord(NVRAM_PHB_NVRAM_LID, 1, (void *)&(pb_coolsand[local_para_ptr->index]), sizeof(CFW_PBK_ENTRY_INFO), &error) == sizeof(CFW_PBK_ENTRY_INFO))
 						if (WriteRecord(NVRAM_PHB_NVRAM_LID, 1, (void *)&(pb_coolsand[local_para_ptr->index]), (local_para_ptr->index - 1) * sizeof(CFW_PBK_ENTRY_INFO), &error) == sizeof(CFW_PBK_ENTRY_INFO))
						{
							/* decrease one from total count */
	 						nMEusedSlot--;
 							adp_phb_del_entry_ok_rsp();
						}
						else
							adp_phb_del_entry_error_rsp();
				}
			}
			else
			{
				SetSimStorageID(local_para_ptr->type);
		#ifdef __ADP_MULTI_SIM__
			#ifdef ADP_CFW_DUALSIM_SIMULATOR_SUPPORT
				if (local_para_ptr->type == MMI_PHB_PHONEBOOK)
					ValueSimDelPbkEntry = UT_CFW_SimDeletePbkEntry(CFW_PBK_SIM, local_para_ptr->index, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_MSISDN)
					ValueSimDelPbkEntry = UT_CFW_SimDeletePbkEntry(CFW_PBK_ON, local_para_ptr->index, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_FDN)
					ValueSimDelPbkEntry = UT_CFW_SimDeletePbkEntry(CFW_PBK_SIM_FIX_DIALLING, local_para_ptr->index, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_BDN)
					ValueSimDelPbkEntry = UT_CFW_SimDeletePbkEntry(CFW_PBK_SIM_FIX_DIALLING, local_para_ptr->index, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_SDN)
					ValueSimDelPbkEntry = UT_CFW_SimDeletePbkEntry(CFW_PBK_SIM_FIX_DIALLING, local_para_ptr->index, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_ECC)
					ValueSimDelPbkEntry = UT_CFW_SimDeletePbkEntry(CFW_PBK_SIM_FIX_DIALLING, local_para_ptr->index, FREE_UTI, adp_pPHBContext->nSimId);
				else	
					ValueSimDelPbkEntry = ERR_CME_UNKNOWN;
			#else//ADP_CFW_DUALSIM_SIMULATOR_SUPPORT
				if (local_para_ptr->type == MMI_PHB_PHONEBOOK)
					ValueSimDelPbkEntry = CFW_SimDeletePbkEntry(CFW_PBK_SIM, local_para_ptr->index, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_MSISDN)
					ValueSimDelPbkEntry = CFW_SimDeletePbkEntry(CFW_PBK_ON, local_para_ptr->index, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_FDN)
					ValueSimDelPbkEntry = CFW_SimDeletePbkEntry(CFW_PBK_SIM_FIX_DIALLING, local_para_ptr->index, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_BDN)
					ValueSimDelPbkEntry = CFW_SimDeletePbkEntry(CFW_PBK_SIM_FIX_DIALLING, local_para_ptr->index, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_SDN)
					ValueSimDelPbkEntry = CFW_SimDeletePbkEntry(CFW_PBK_SIM_FIX_DIALLING, local_para_ptr->index, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_ECC)
					ValueSimDelPbkEntry = CFW_SimDeletePbkEntry(CFW_PBK_SIM_FIX_DIALLING, local_para_ptr->index, FREE_UTI, adp_pPHBContext->nSimId);
				else	
					ValueSimDelPbkEntry = ERR_CME_UNKNOWN;
			#endif//ADP_CFW_DUALSIM_SIMULATOR_SUPPORT
		#else//__ADP_MULTI_SIM__
				if (local_para_ptr->type == MMI_PHB_PHONEBOOK)
					ValueSimDelPbkEntry = CFW_SimDeletePbkEntry(CFW_PBK_SIM, local_para_ptr->index, FREE_UTI);
				else if (local_para_ptr->type == MMI_PHB_MSISDN)
					ValueSimDelPbkEntry = CFW_SimDeletePbkEntry(CFW_PBK_ON, local_para_ptr->index, FREE_UTI);
				else if (local_para_ptr->type == MMI_PHB_FDN)
					ValueSimDelPbkEntry = CFW_SimDeletePbkEntry(CFW_PBK_SIM_FIX_DIALLING, local_para_ptr->index, FREE_UTI);
				else if (local_para_ptr->type == MMI_PHB_BDN)
					ValueSimDelPbkEntry = CFW_SimDeletePbkEntry(CFW_PBK_SIM_FIX_DIALLING, local_para_ptr->index, FREE_UTI);
				else if (local_para_ptr->type == MMI_PHB_SDN)
					ValueSimDelPbkEntry = CFW_SimDeletePbkEntry(CFW_PBK_SIM_FIX_DIALLING, local_para_ptr->index, FREE_UTI);
				else if (local_para_ptr->type == MMI_PHB_ECC)
					ValueSimDelPbkEntry = CFW_SimDeletePbkEntry(CFW_PBK_SIM_FIX_DIALLING, local_para_ptr->index, FREE_UTI);
				else	
					ValueSimDelPbkEntry = ERR_CME_UNKNOWN;			
		#endif//__ADP_MULTI_SIM__
		mmi_trace(g_sw_ADP_PHB,"PHB del req  CFW_SimDeletePbkEntry = %d",ValueSimGetPbkEntry);
//add by chenq for bug 5889 and 5800, 20070803 B        
       switch (ValueSimDelPbkEntry)
				{
					case ERR_SUCCESS:
			            COS_KillTimerEX(GetMmiTaskHandle(MOD_ADP),PHBLIST_COPY_OR_DELETE_TIMEROUTID );
			            COS_SetTimerEX(GetMmiTaskHandle(MOD_ADP), PHBLIST_COPY_OR_DELETE_TIMEROUTID, 0, (PHB_TIMEROUT_HANDWRITING_CONFIRM)MILLI_SECOND);
			            PHBListCopyOrDeleteTimerOutErrorFUN = adp_phb_del_entry_error_rsp;
			      				
			            if (local_para_ptr->type == MMI_PHB_PHONEBOOK)
			            {
			              MMI_PHB_PHONEBOOK_TYPE = TRUE;
			            }
			              mmi_trace(g_sw_ADP_PHB, "local_para_ptr->index = %d",local_para_ptr->index);
						mmi_trace(g_sw_ADP_PHB, "the function succeeds !\n");
						break;

					case ERR_CFW_INVALID_PARAMETER:
						mmi_trace(g_sw_ADP_PHB, "The input parameter(nIndex) is invalid !\n");
						break;

					case ERR_CFW_NOT_EXIST_FREE_UTI:
						mmi_trace(g_sw_ADP_PHB, "No any available free UTI in the system !\n");
						break;

					case ERR_CFW_UTI_IS_BUSY:
						mmi_trace(g_sw_ADP_PHB, "The UTI is busy, maybe the UTI is used by other instance !\n");
						break;

					case ERR_CME_MEMORY_FULL:
						mmi_trace(g_sw_ADP_PHB, "No any more memory to allocate !\n");
						break;

					default:
						break;
				}
//add by chenq for bug 5889 and 5800, 20070803 E

				/* send msg to MMI: result = error */
				if (ValueSimDelPbkEntry != ERR_SUCCESS)
					adp_phb_del_entry_error_rsp();
			}
		}
			break;

		case MSG_ID_MMI_PHB_SET_ENTRY_REQ:
		{
			UINT32 ValueSimAddPbkEntry = 0;
			U8  length = 0;
			S32 ret = 0;
			
			ilm_struct *oslMessage = (ilm_struct *) pCosEvent->nParam1;
			mmi_phb_set_entry_req_struct *local_para_ptr = (mmi_phb_set_entry_req_struct *)oslMessage->local_para_ptr;
			mmi_trace(g_sw_ADP_PHB, "PHB SET ENTRY REQ storage = %d\n", local_para_ptr->list.storage);

			if (local_para_ptr->list.storage == MMI_NVRAM)
			{
				if (local_para_ptr->type == MMI_PHB_PHONEBOOK)
				{
					/* the flag of for circle sentence */
					INT32 index = 1;

					/* add new item */
					if (local_para_ptr->list.record_index == 0xFFFF)
					{
						if(nMEusedSlot >= MAX_PB_PHONE_ENTRIES)
						{
							adp_phb_set_entry_capacity_exceeded_rsp();
							TBM_EXIT(0x29e3);
							return TRUE;
						}
						
						for (index = 1; index <= MAX_PB_PHONE_ENTRIES; index++)
						{
							/* search the unused phisical index */
							if (pb_coolsand[index].nAppIndex == 0)
								break;
						}
						nMEusedSlot++;
					}
					else
					{
						ASSERT(local_para_ptr->list.record_index <= MAX_PB_PHONE_ENTRIES);
						index = local_para_ptr->list.record_index;
					}

					pb_coolsand[index].nAppIndex = index;
					mmi_trace(g_sw_ADP_PHB, "PHB FUNC:%s MSG_ID_MMI_PHB_SET_ENTRY_REQ, nAppIndex = %d", __FUNCTION__, index);
					memcpy(&(pb_coolsand[index].alpha_id), &(local_para_ptr->list.alpha_id), sizeof(l4_name_struct));

					/* check if international number and so on */
					pb_coolsand[index].tel.addr_bcd[0] = local_para_ptr->list.tel.type;
					

					/* save as bcd format */
         				 {
					  	extern U8 mmi_phb_convert_to_bcd (U8 *dest, U8 *source,  U8 max_dest_len );
					 	length = mmi_phb_convert_to_bcd(&(pb_coolsand[index].tel.addr_bcd[1]), local_para_ptr->list.tel.number, (MAX_PB_NUMBER_LENGTH + 1) / 2);
         				 }
					pb_coolsand[index].tel.addr_length = length;
					//hFile = pfopen("c:/phonebook.dat", FS_O_CREAT|FS_O_RDWR, 0);

					//if (hFile != NULL)
				//	{
						/* orient to be write index */
						ret = WriteRecord(NVRAM_PHB_NVRAM_LID, 1, (void *)&(pb_coolsand[index]), (index-1)*sizeof(CFW_PBK_ENTRY_INFO), &error);
						mmi_trace(g_sw_ADP_PHB, "ADP_PHB: FUNC:%s,MMI_PHB_SET_ENTRY_REQ WriteRecord ret = %x", __FUNCTION__, ret);
					
						if (ret == sizeof(CFW_PBK_ENTRY_INFO))
						{
							ilm_struct  ilm_ptr;
							mmi_phb_set_entry_rsp_struct *phb = OslMalloc(sizeof(mmi_phb_set_entry_rsp_struct));
							ASSERT(phb != NULL);
							memset(phb, 0x00, sizeof(mmi_phb_set_entry_rsp_struct));

							phb->result.flag = L4C_OK;
							phb->no_list = 1;
							phb->list[0].storage = MMI_NVRAM;
							phb->list[0].record_index = index;

							memcpy(&(phb->list[0].tel), &(local_para_ptr->list.tel), sizeof(l4c_number_struct));
							memcpy(&(phb->list[0].alpha_id), &(local_para_ptr->list.alpha_id), sizeof(l4_name_struct));

							ilm_ptr.dest_mod_id = MOD_MMI;
							ilm_ptr.src_mod_id = MOD_L4C;
							ilm_ptr.msg_id = PRT_PHB_SET_ENTRY_RSP;
							ilm_ptr.local_para_ptr = (local_para_struct *)phb;
							OslMsgSendExtQueue(&ilm_ptr);
						}
						else if(ret == ERR_FS_DISK_FULL)
						{
							adp_phb_set_entry_capacity_exceeded_rsp();				
						}
						else
						{
							adp_phb_set_entry_error_rsp();
            					}

					//	pfclose(hFile);
					}
				//	else
				//	{
						/* send response to MMI: set entry error*/
				//		adp_phb_set_entry_error_rsp();
				//	}
				//	mmi_trace(g_sw_ADP_PHB, TSTXT("mmi_phb_set_entry_rsp***index:%d******************************\n"), index);
			}
			else
			{
				INT32 index = 1;	//2007-07-11, Li Tao
				UINT8 number_bcd[32] = {0};
				UINT8 name_ucs2[(MAX_PB_NAME_LENGTH + 1) * ENCODING_LENGTH] = {0};

				CFW_SIM_PBK_ENTRY_INFO local_para_ptr2;
				memset(&local_para_ptr2, 0, sizeof(CFW_SIM_PBK_ENTRY_INFO));

				if (local_para_ptr->list.alpha_id.name_dcs == MMI_PHB_ASCII)
				{
					memcpy(name_ucs2, local_para_ptr->list.alpha_id.name, local_para_ptr->list.alpha_id.name_length);
					name_ucs2[local_para_ptr->list.alpha_id.name_length] = '\0';
					local_para_ptr2.iFullNameSize = local_para_ptr->list.alpha_id.name_length;
				}
				else
				{
					name_ucs2[0] = 0x80;
					memcpy(name_ucs2 + 1, local_para_ptr->list.alpha_id.name, local_para_ptr->list.alpha_id.name_length);
					local_para_ptr2.iFullNameSize = local_para_ptr->list.alpha_id.name_length + 1;
					name_ucs2[local_para_ptr2.iFullNameSize] = '\0';
					name_ucs2[local_para_ptr2.iFullNameSize + 1] = '\0';
				}
				local_para_ptr2.pFullName = name_ucs2;
				local_para_ptr2.nNumberSize = SUL_AsciiToGsmBcd(local_para_ptr->list.tel.number, local_para_ptr->list.tel.length, number_bcd);
				local_para_ptr2.pNumber = number_bcd;

				if (local_para_ptr->list.tel.type == MMI_CSMCC_INTERNATIONAL_ADDR)
					local_para_ptr2.nType = CFW_TELNUMBER_TYPE_INTERNATIONAL;
				else
					local_para_ptr2.nType = CFW_TELNUMBER_TYPE_NATIONAL;

// modify by chenq for PBK, 20070807 B
        		SetSimStorageID(local_para_ptr->type);
        
				if (local_para_ptr->list.record_index == 0xFFFF)
				{
					//2007-07-11, Li Tao,查找映射表,物理地址从1开始
					//local_para_ptr2->phoneIndex = 0;
					if (local_para_ptr->type == MMI_PHB_PHONEBOOK) 
					{
					for (index = 1; index <= adp_pPHBContext->nSIMTotalSlot; index++)
					{
						/* search the unused phisical index in SIM*/
						if (adp_pPHBContext->PB_SIM_RECORDID[index] == 0)
						{
							local_para_ptr2.phoneIndex = index;
							break;
						}
					}
					}
				}
				else
				{
					local_para_ptr2.phoneIndex = LOUINT8(local_para_ptr->list.record_index);
				}
// modify by chenq for PBK, 20070807 E
		#ifdef __ADP_MULTI_SIM__
		        mmi_trace(g_sw_ADP_PHB, "PHB SET ENTRY REQ nParamsimid = %d, phoneIndex = %d reqtype = %d",ADP_GET_MMI_DEST_MOD(pCosEvent->nParam3), local_para_ptr2.phoneIndex, local_para_ptr->type);
			#ifdef ADP_CFW_DUALSIM_SIMULATOR_SUPPORT
				if (local_para_ptr->type == MMI_PHB_PHONEBOOK)
					ValueSimAddPbkEntry = UT_CFW_SimAddPbkEntry(CFW_PBK_SIM, &local_para_ptr2, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_FDN)
					ValueSimAddPbkEntry = UT_CFW_SimAddPbkEntry(CFW_PBK_SIM_FIX_DIALLING, &local_para_ptr2, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_MSISDN)
					ValueSimAddPbkEntry = UT_CFW_SimAddPbkEntry(CFW_PBK_ON, &local_para_ptr2, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_BDN)
					ValueSimAddPbkEntry = UT_CFW_SimAddPbkEntry(CFW_PBK_SIM_BARRED_DIALLING, &local_para_ptr2, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_SDN)
					ValueSimAddPbkEntry = UT_CFW_SimAddPbkEntry(CFW_PBK_SIM_SERVICE_DIALLING, &local_para_ptr2, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_ECC)
					ValueSimAddPbkEntry = UT_CFW_SimAddPbkEntry(CFW_PBK_EN, &local_para_ptr2, FREE_UTI, adp_pPHBContext->nSimId);
				else	
					ValueSimAddPbkEntry = ERR_CME_UNKNOWN;
			#else//ADP_CFW_DUALSIM_SIMULATOR_SUPPORT
				if (local_para_ptr->type == MMI_PHB_PHONEBOOK)
					ValueSimAddPbkEntry = CFW_SimAddPbkEntry(CFW_PBK_SIM, &local_para_ptr2, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_FDN)
					ValueSimAddPbkEntry = CFW_SimAddPbkEntry(CFW_PBK_SIM_FIX_DIALLING, &local_para_ptr2, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_MSISDN)
					ValueSimAddPbkEntry = CFW_SimAddPbkEntry(CFW_PBK_ON, &local_para_ptr2, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_BDN)
					ValueSimAddPbkEntry = CFW_SimAddPbkEntry(CFW_PBK_SIM_BARRED_DIALLING, &local_para_ptr2, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_SDN)
					ValueSimAddPbkEntry = CFW_SimAddPbkEntry(CFW_PBK_SIM_SERVICE_DIALLING, &local_para_ptr2, FREE_UTI, adp_pPHBContext->nSimId);
				else if (local_para_ptr->type == MMI_PHB_ECC)
					ValueSimAddPbkEntry = CFW_SimAddPbkEntry(CFW_PBK_EN, &local_para_ptr2, FREE_UTI, adp_pPHBContext->nSimId);
				else	
					ValueSimAddPbkEntry = ERR_CME_UNKNOWN;
			#endif //ADP_CFW_DUALSIM_SIMULATOR_SUPPORT	
		#else//__ADP_MULTI_SIM__
				if (local_para_ptr->type == MMI_PHB_PHONEBOOK)
					ValueSimAddPbkEntry = CFW_SimAddPbkEntry(CFW_PBK_SIM, &local_para_ptr2, FREE_UTI);
				else if (local_para_ptr->type == MMI_PHB_FDN)
					ValueSimAddPbkEntry = CFW_SimAddPbkEntry(CFW_PBK_SIM_FIX_DIALLING, &local_para_ptr2, FREE_UTI);
				else if (local_para_ptr->type == MMI_PHB_MSISDN)
					ValueSimAddPbkEntry = CFW_SimAddPbkEntry(CFW_PBK_ON, &local_para_ptr2, FREE_UTI);
				else if (local_para_ptr->type == MMI_PHB_BDN)
					ValueSimAddPbkEntry = CFW_SimAddPbkEntry(CFW_PBK_SIM_BARRED_DIALLING, &local_para_ptr2, FREE_UTI);
				else if (local_para_ptr->type == MMI_PHB_SDN)
					ValueSimAddPbkEntry = CFW_SimAddPbkEntry(CFW_PBK_SIM_SERVICE_DIALLING, &local_para_ptr2, FREE_UTI);
				else if (local_para_ptr->type == MMI_PHB_ECC)
					ValueSimAddPbkEntry = CFW_SimAddPbkEntry(CFW_PBK_EN, &local_para_ptr2, FREE_UTI);
				else	
					ValueSimAddPbkEntry = ERR_CME_UNKNOWN;		
		#endif//__ADP_MULTI_SIM__
 //add by chenq for bug 5889 and 5800, 20070803 B      
 		mmi_trace(g_sw_ADP_PHB,"PHB set entry req  CFW_SimAddPbkEntry = %d",ValueSimGetPbkEntry);
        switch (ValueSimAddPbkEntry)
				{
					case ERR_SUCCESS:
            COS_KillTimerEX(GetMmiTaskHandle(MOD_ADP),PHBLIST_COPY_OR_DELETE_TIMEROUTID );
            COS_SetTimerEX(GetMmiTaskHandle(MOD_ADP), PHBLIST_COPY_OR_DELETE_TIMEROUTID, 0, (PHB_TIMEROUT_HANDWRITING_CONFIRM)MILLI_SECOND); 
            PHBListCopyOrDeleteTimerOutErrorFUN = adp_phb_set_entry_error_rsp;
						mmi_trace(g_sw_ADP_PHB, "the function succeeds !\n");
						break;

					case ERR_CFW_INVALID_PARAMETER:
						mmi_trace(g_sw_ADP_PHB, "The input parameter(nIndex) is invalid !\n");
						break;

					case ERR_CFW_NOT_EXIST_FREE_UTI:
						mmi_trace(g_sw_ADP_PHB, "No any available free UTI in the system !\n");
						break;

					case ERR_CFW_UTI_IS_BUSY:
						mmi_trace(g_sw_ADP_PHB, "The UTI is busy, maybe the UTI is used by other instance !\n");
						break;

					case ERR_CME_MEMORY_FULL:
						mmi_trace(g_sw_ADP_PHB, "No any more memory to allocate !\n");
						break;

					default:
						break;
				}
 //add by chenq for bug 5889 and 5800, 20070803 E
 
				if (ERR_SUCCESS != ValueSimAddPbkEntry)
				{
					adp_phb_set_entry_error_rsp();
				}
			}
		}
			break;

		case MSG_ID_MMI_PHB_GET_ENTRY_BY_INDEX_REQ:
		{
			ilm_struct *oslMessage = (ilm_struct *) pCosEvent->nParam1;
			mmi_phb_get_entry_by_index_req_struct *local_para_ptr = (mmi_phb_get_entry_by_index_req_struct *)oslMessage->local_para_ptr;

#ifdef __ADP_MULTI_SIM__
			mmi_trace(g_sw_ADP_PHB, "PHB GET ENTRY by index REQ simid = %d, local_para_ptr->type = %d", adp_pPHBContext->nSimId, local_para_ptr->type);
#endif /* __ADP_MULTI_SIM__ */

			switch (local_para_ptr->type)
			{
				case MMI_PHB_ECC:
			#ifdef __ADP_MULTI_SIM__
				#ifdef ADP_CFW_DUALSIM_SIMULATOR_SUPPORT
					ValueSimGetPbkEntry = UT_CFW_SimGetPbkStorage(CFW_PBK_EN, FREE_UTI, adp_pPHBContext->nSimId);
				#else
					ValueSimGetPbkEntry = CFW_SimGetPbkStorage(CFW_PBK_EN, FREE_UTI, adp_pPHBContext->nSimId);
				#endif
			#else
					ValueSimGetPbkEntry = CFW_SimGetPbkStorage(CFW_PBK_EN, FREE_UTI);
			#endif					
					break;

				case MMI_PHB_FDN:
					adp_pPHBContext->flag_list_FDN = TRUE;
			#ifdef __ADP_MULTI_SIM__
				#ifdef ADP_CFW_DUALSIM_SIMULATOR_SUPPORT
					ValueSimGetPbkEntry = UT_CFW_SimGetPbkStorage(CFW_PBK_SIM_FIX_DIALLING, FREE_UTI, adp_pPHBContext->nSimId);
				#else
					ValueSimGetPbkEntry = CFW_SimGetPbkStorage(CFW_PBK_SIM_FIX_DIALLING, FREE_UTI, adp_pPHBContext->nSimId);
				#endif
			#else
					ValueSimGetPbkEntry = CFW_SimGetPbkStorage(CFW_PBK_SIM_FIX_DIALLING, FREE_UTI);
			#endif
					break;

				case MMI_PHB_BDN:
			#ifdef __ADP_MULTI_SIM__
				#ifdef ADP_CFW_DUALSIM_SIMULATOR_SUPPORT
					ValueSimGetPbkEntry = UT_CFW_SimGetPbkStorage(CFW_PBK_SIM_BARRED_DIALLING, FREE_UTI, adp_pPHBContext->nSimId);
				#else
					ValueSimGetPbkEntry = CFW_SimGetPbkStorage(CFW_PBK_SIM_BARRED_DIALLING, FREE_UTI, adp_pPHBContext->nSimId);		
				#endif
			#else
					ValueSimGetPbkEntry = CFW_SimGetPbkStorage(CFW_PBK_SIM_BARRED_DIALLING, FREE_UTI);
			#endif
					break;

				case MMI_PHB_MSISDN:
			#ifdef __ADP_MULTI_SIM__		
				#ifdef ADP_CFW_DUALSIM_SIMULATOR_SUPPORT
					ValueSimGetPbkEntry = UT_CFW_SimGetPbkStorage(CFW_PBK_ON, FREE_UTI, adp_pPHBContext->nSimId);
				#else
					ValueSimGetPbkEntry = CFW_SimGetPbkStorage(CFW_PBK_ON, FREE_UTI, adp_pPHBContext->nSimId);				
				#endif
			#else
					ValueSimGetPbkEntry = CFW_SimGetPbkStorage(CFW_PBK_ON, FREE_UTI);
			#endif
					break;

				case MMI_PHB_SDN:
			#ifdef __ADP_MULTI_SIM__		
				#ifdef ADP_CFW_DUALSIM_SIMULATOR_SUPPORT
					ValueSimGetPbkEntry = UT_CFW_SimGetPbkStorage(CFW_PBK_SIM_SERVICE_DIALLING, FREE_UTI, adp_pPHBContext->nSimId);
				#else
					ValueSimGetPbkEntry = CFW_SimGetPbkStorage(CFW_PBK_SIM_SERVICE_DIALLING, FREE_UTI, adp_pPHBContext->nSimId);
				#endif
			#else
					ValueSimGetPbkEntry = CFW_SimGetPbkStorage(CFW_PBK_SIM_SERVICE_DIALLING, FREE_UTI);
			#endif					
					break;

				default:
					break;
			}
			 mmi_trace(g_sw_ADP_PHB,"PHB get entry by index req  CFW_SimGetPbkStorage = %d",ValueSimGetPbkEntry);
			if (ValueSimGetPbkEntry != ERR_SUCCESS)
				adp_phb_get_extra_number_rsp(0, 0, 0);
		}
			break;

		default:
			TBM_EXIT(0x29e3);
			return FALSE;
	}
	
	TBM_EXIT(0x29e3);
	return TRUE;
}
Exemple #22
0
BOOL BAL_ApsEvtParse (COS_EVENT* pEvent)
{
  //          SXS_TRACE(_MMI, TSTXT("-----------APS parse ID:%d------\n"),pEvent->nEventId);
  //  CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("-----------APS parse ID:   0x%x, Aps_APP: 0x%x\n"),pEvent->nEventId, Aps_APP);

    switch (pEvent->nEventId)
    {
    	case EV_INTER_APS_TCPIP_REQ:
        if(Aps_APP != APS_TCP)
        {
          //ppp_Init();
          Cfw_SetApsApp(APS_TCP);
          Pre_Task = Gprs_GetAppCng();
          Gprs_SetAppCng(TRUE,  CFW_bal_GetTaskHandle(CSW_TASK_ID_APS));
        }
    		BAL_ApsTaskTcpipProc( pEvent );
    		break;
        
    	case EV_INTER_APS_SMTP_REQ:	
    		
    	//	SXS_TRACE(_MMI, TSTXT("!!!!!!!!EV_INTER_APS_SMTP_REQ\n"));
    		//BAL_ApsTaskSmtpProc( pEvent );
    	//	mime_parse_main();
    		break;
    
    	case EV_INTER_APS_POP3_REQ:	
    		BAL_ApsTaskPop3Proc( pEvent );
    		break;
        
    	case EV_CFW_GPRS_DATA_IND: 
      case EV_CFW_GPRS_ACT_RSP:
      case EV_CFW_GPRS_ATT_RSP:	
      //case EV_INTER_APS_ACT_REQ:
      case EV_CFW_GPRS_CXT_DEACTIVE_IND:
        if(Aps_APP == APS_TCP)
          BAL_ApsTaskTcpipProc( pEvent );
        else if(Aps_APP == APS_PPP)
          Aps_PppProc( pEvent );
        break;
        
      case EV_TIMER:	
    		BAL_ApsTaskTimerProc( pEvent );
        break;
        
      case EV_APS_PPP_DATA_REQ:
        if(Aps_APP != APS_PPP)
        {
          ppp_Init();
          Cfw_SetApsApp(APS_PPP);
          Pre_Task = Gprs_GetAppCng();
          Gprs_SetAppCng(TRUE,  CFW_bal_GetTaskHandle(CSW_TASK_ID_APS));
        }
        CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("APS receive ppp data from AT.\n"));
        Aps_PppProc( pEvent );
        break;
        
    	default:
    		break;
    }
//	COS_FREE(pEvent->nParam1);
	return TRUE;
}
Exemple #23
0
VOID Cfw_SetApsApp(UINT8 ApsApp)
{
        CSW_TRACE(CFW_GPRS_TS_ID, TSTXT("!!!!!!!!!Cfw_SetApsApp. 0x%x\n"),ApsApp);

  Aps_APP = ApsApp;
}