⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cfwmanager.cpp

📁 这是法国Kaleido公司提供了一个手机mmi设计平台
💻 CPP
📖 第 1 页 / 共 5 页
字号:
					}	if(!strcmp(propertyName,TAPI_CLIR_STATE))		{			if (forceWrite)			{				// Set CLIR				int status=gContext->findData(propertyName,-1);				if (status!=-1)				{					if (status==0)						sprintf(tmpBuffer,"AT+CLIR=1");					else					if (status==1)						sprintf(tmpBuffer,"AT+CLIR=2");					else					if (status==2)						sprintf(tmpBuffer,"AT+CLIR=0");					requestWriteTSS(tmpBuffer, newMsgOK, newMsgERROR, timeout);				}								return TAPI_PROPERTY_REFRESHING;			}			else			{				// Read CLIR				sprintf(tmpBuffer,"AT+CLIR?");				requestWriteTSS(tmpBuffer, newMsgOK, newMsgERROR, timeout);				return TAPI_PROPERTY_AVAILABLE;			}					}	if(!strcmp(propertyName, TAPI_PIN2_UPDATE)) // TAPI_STATYPE_STRING [W]		{			int rslt = TAPI_PROPERTY_BADPARAM;			char* tmp = getContext()->getTmpBuffer();			char* request = (char*) readGlobalStore(propertyName) ;			/* We remove reference from GC. */			writeGlobalStore(propertyName,NULL,TAPI_STATYPE_INT);			if(!request || !*request)				return rslt;			char* pwd = NULL;			if(getArgValByName(request, PWD_FIELD_PWD,tmp))				pwd = xstrdup(tmp);			if(pwd) // Assign & activate				{				char* npwd = NULL;				if(getArgValByName(request, PWD_FIELD_NPWD,tmp))					npwd = xstrdup(tmp);				if(npwd)					{						if (!strcmp(npwd,"\"\""))						{							SAFE_FREE(npwd);							npwd=xstrdup("");						}						if (!strcmp(pwd,"\"\""))						{							SAFE_FREE(pwd);							pwd=xstrdup("");						}						sprintf(tmp, "AT+CPWD=\"P2\",\"%s\",\"%s\"", pwd, npwd);					requestWriteTSS(tmp, newMsgOK, newMsgERROR);					rslt = TAPI_PROPERTY_REFRESHING;					}				SAFE_FREE(npwd);				}			SAFE_FREE(pwd);			SAFE_FREE(request);			return rslt;		}	if(!strcmp(propertyName, TAPI_CALL_WAITING))		{			Verbose(1, "------------Here is the call waiting module in updateProperty.------------");			int rslt = TAPI_PROPERTY_BADPARAM;			char* tmp = getContext()->getTmpBuffer();		    //setMesssageTranslation(long platformMessage, long krebMessageOK, long krebMessageErr);			if (forceWrite)			{				// try to modify call waiting.				long status=(long) readGlobalStore(propertyName) ;			    setMesssageTranslation(EV_CFW_SS_SET_CALL_WAITING_RSP, newMsgOK, newMsgERROR);				int ret = CFW_SsSetCallWaiting((UINT8)status, (UINT8)11, (UINT16)0);				Verbose(1, "------------Here is the call waiting module in updateProperty, the status is %d, the ret value is %d.------------", status, ret);				if(0 != ret)				{					Verbose(1, "The CFW_SsSetCallWaiting opration is failed, the result value is %d", ret);					return TAPI_PROPERTY_INVALID;				}							return TAPI_PROPERTY_AVAILABLE;			}			else			{			    setMesssageTranslation(EV_CFW_SS_QUERY_CALL_WAITING_RSP, newMsgOK, newMsgERROR);				int ret = CFW_SsQueryCallWaiting((UINT8)11, (UINT16)0);				Verbose(1, "------------Here is the call waiting module in updateProperty(query), the ret value is %d.------------", ret);				if(0 != ret)				{					Verbose(1, "The CFW_SsQueryCallWaiting opration is failed, the result value is %d", ret);					return TAPI_PROPERTY_INVALID;				}				return TAPI_PROPERTY_AVAILABLE;			}		}	if(!strcmp(propertyName, TAPI_CONNECTED_LINE_INDENTIFICATION_PRESENTATION))		{			int rslt = TAPI_PROPERTY_BADPARAM;			char* tmp = getContext()->getTmpBuffer();			if (forceWrite)			{				// try to modify call waiting.				long status=(long) readGlobalStore(propertyName) ;				sprintf(tmp, "AT+COLP=%i",status);				requestWriteTSS(tmp, newMsgOK, newMsgERROR);				//requestWriteTSS("AT+COLP?", newMsgOK, newMsgERROR);				rslt = TAPI_PROPERTY_REFRESHING;							}			else			{				// we ask for status.				requestWriteTSS("AT+COLP?", newMsgOK, newMsgERROR);				rslt = TAPI_PROPERTY_AVAILABLE;			}			return rslt;		}	if(!strcmp(propertyName, TAPI_CONNECTED_LINE_INDENTIFICATION_RESTRICTION))		{			int rslt = TAPI_PROPERTY_BADPARAM;			char* tmp = getContext()->getTmpBuffer();			if (forceWrite)			{				rslt = TAPI_PROPERTY_UNIMPLEMENTED;			}else			{				rslt = TAPI_PROPERTY_UNIMPLEMENTED;			}			return rslt;		}			if(!strcmp(propertyName, TAPI_FIXED_DIALING_NUMBER))		{			int rslt = TAPI_PROPERTY_BADPARAM;			char* tmp = getContext()->getTmpBuffer();						if (forceWrite)			{				// try to modify call waiting.				int mode = 2 ; // 0 = Unlock , 1 = Lock , 2 = Query Status , 10 = full lock.				char* passwd=NULL;				char* request=(char*)getContext()->findData(propertyName);				*tmp=0;				// we get code pin 2				getArgValByName(request,TAPI_FDN_FIELD_PWD,tmp);				if (*tmp)				{					passwd=xstrdup(tmp);				}				*tmp=0;				// we get status				getArgValByName(request,TAPI_FDN_FIELD_STATUS,tmp);				if (*tmp)				{					mode=a2i(tmp);				}				sprintf(tmp, "AT+CLCK=\"FD\",%i,\"%s\",1",mode,passwd); // Voice only !!!				SAFE_FREE(passwd);				requestWriteTSS(tmp,0,newMsgERROR);				rslt = TAPI_PROPERTY_REFRESHING;				requestWriteTSS("AT+CLCK=\"FD\",2", newMsgOK, newMsgERROR);			}else			{				// we ask for status.				currentSSReason=8;				requestWriteTSS("AT+CLCK=\"FD\",2", newMsgOK, newMsgERROR);				rslt = TAPI_PROPERTY_AVAILABLE;			}			return rslt;		}	if(!strcmp(propertyName, TAPI_SMS_ALL)) // TAPI_STATYPE_STRING [R/W]		{		  return TAPI_PROPERTY_UNIMPLEMENTED; // UNDONE ... 			if (!forceWrite)			{				/* Reading Messages. */				if (statusSMSList==AT_COM_SMS_NOTHING_ASKED)				{					// Ask number of SMS.					requestWriteTSS("AT+CPMS?");					/* FV test */					requestWriteTSS("AT+CMGL=\"ALL\"", newMsgOK, newMsgERROR, timeout); // 				//	requestWriteTSS("AT+CMGL=4", newMsgOK, newMsgERROR, timeout); //					statusSMSList=AT_COM_SMS_LIST_ASKED;					SmallArrayList* sms_list=(SmallArrayList*)readGlobalStore(TAPI_SMS_ALL);					if (sms_list)					{						temporarySMSList=sms_list;						/* We clean any previous list.*/						freeLines(&temporarySMSList,true);						/* We remove reference from GC to avoid any one to use it because it is out of date. */						getContext()->replaceIntData(TAPI_SMS_ALL,0);					}					writeGlobalStore(TAPI_SMS_PROGRESSION,(void*)-1,TAPI_STATYPE_INT);				}				return TAPI_PROPERTY_REFRESHING;			}			else			{				Verbose(VERB_LEV_ERROR, "TAPI: Could not write >%s<\n", propertyName) ;				return TAPI_PROPERTY_INVALID;			}		}	if(!strcmp(propertyName, TAPI_SMS_SIZE)) // TAPI_STATYPE_STRING [R/W]		{			if (!forceWrite)			{				/* Ask number of messages .*/				requestWriteTSS("AT+CPMS?", newMsgOK, newMsgERROR, timeout);				return TAPI_PROPERTY_REFRESHING;			}			else			{				Verbose(VERB_LEV_ERROR, "TAPI: Could not write >%s<\n", propertyName) ;				return TAPI_PROPERTY_INVALID;			}		}	if(!strcmp(propertyName, TAPI_SMS_DELETE)) // TAPI_STATYPE_STRING [R/W]		{			if (!forceWrite)			{				Verbose(VERB_LEV_ERROR, "TAPI: Could not read >%s<\n", propertyName) ;				return TAPI_PROPERTY_INVALID;			}			else			{				int index=(int)readGlobalStore(propertyName);				sprintf(tmpBuffer,"AT+CMGD=%i",index);				requestWriteTSS(tmpBuffer, newMsgOK, newMsgERROR, timeout);				return TAPI_PROPERTY_REFRESHING;							}		}		// TAPI_SS_UNSTRUCTURED_SUPP_SERVICE		if(!strcmp(propertyName, TAPI_SS_UNSTRUCTURED_SUPP_SERVICE)) // TAPI_STATYPE_STRING [R/W]		{			if (!forceWrite)			{				return TAPI_PROPERTY_AVAILABLE;			}			else			{				char* ussd_req=(char*)readGlobalStore(propertyName);				sprintf(tmpBuffer,"AT+CUSD=1,\"%s\"",ussd_req);				//getContext()->replaceIntData(propertyName,0);				requestWriteTSS(tmpBuffer, newMsgOK, newMsgERROR, timeout);				//SAFE_FREE(ussd_req);				return TAPI_PROPERTY_REFRESHING;							}		}				// TAPI_AUTO_ANSWER		if(!strcmp(propertyName, TAPI_AUTO_ANSWER)) // TAPI_STATYPE_STRING [R/W]		{			if (!forceWrite)			{				requestWriteTSS("ATS0?", newMsgOK, newMsgERROR, timeout);			}			else			{				int delay=(int)readGlobalStore(propertyName);				sprintf(tmpBuffer,"ATS0=%i",delay);				requestWriteTSS(tmpBuffer, newMsgOK, newMsgERROR, timeout);				return TAPI_PROPERTY_REFRESHING;							}		}		// TAPI_PBK_STORAGE		if (!strcmp(propertyName,TAPI_PBK_STORAGE))		{			if (forceWrite)			{				char* storage=(char*)getContext()->findData(TAPI_PBK_STORAGE);				sprintf(tmpBuffer,"AT+CPBS=%s",storage);				requestWriteTSS(tmpBuffer, newMsgOK, newMsgERROR, timeout);			}else			{				requestWriteTSS("AT+CPBS?", newMsgOK, newMsgERROR, timeout);			}						return TAPI_PROPERTY_AVAILABLE;		}		#ifdef DEV_DEBUG	Verbose(VERB_LEV_ERROR, "TAPI: updating the unknown property to >%s<.\n", propertyName) ;#endif // def DEV_DEBUG	return TAPI_PROPERTY_UNKNOWN;}				//// Changed by SHK 20070607 // Add HAVE_CFW_MGR Macro to support CFW.//void CFWManager::initialize(){	Verbose(VERB_LEV_SESSION, "CFWManager::initialize \n") ;		writeGlobalStore(TAPI_TYPE,xstrdup(GSM_TAPI),TAPI_STATYPE_STRING);	defaultCommandHandler=::msg_ATI;	#if 0 // Don't need in CFW 	// To get MODEM's identification	requestWriteTSS("ATE1") ; // Turns echo on	// BEWARE: the answer to ATI does not include any prefix allowing to know that this is an answer to ATI.	requestWriteTSS("ATI") ;	// IMPORTANT: the answer to "ATI" allows to get the modem's identification.	// From this modem identification, it's possible to perform some specific	#endif		// initializations...		updateProperty(TAPI_PIN1_STATE);	updateProperty(TAPI_NETWORK_NAME);	updateProperty(TAPI_BATTERY_LEVEL);	updateProperty(TAPI_NETWORK_LEVEL);		// To get unsollicited information about incoming calls	#ifdef HAVE_CFW_MGR 	CFW_CfgSetClip(1);	#else	requestWriteTSS("AT+CLIP=1");	#endif		// To receive unsollicited messages regarding the called phone number 	// This notification is mandatory to get a correct flow handling MO calls.	#ifdef HAVE_CFW_MGR 	requestWriteTSS("AT+COLP=1");	#else	CFW_CfgSetColp(1);	#endif		// SMS mode ( 0: PDU mode, 1:Text mode)  // setAndUpdateProperty(TAPI_SMS_MODE, 0); //	setAndUpdateProperty(TAPI_SMS_MODE, 1); // MXC	//CFW_CfgSetSmsFormat(1);  	// To receive current network's references as a short name.	//requestWriteTSS("AT+COPS=3,1");	CFW_NwSetRegistration (NULL, CFW_NW_AUTOMATIC_MODE, CFW_NW_UTI);		//	//requestWriteTSS("AT+CREG=1");	CFW_CfgSetNwStatus(1);#if 1    CFW_CfgSetSmsFormat(1);     CFW_CfgSetSmsShowTextModeParam(1);    CFW_CfgSetSmsStorage(CFW_SMS_STORAGE_ME, CFW_SMS_STORAGE_ME);        //Save New SMS to ME, CB and SR don't store.    CFW_CfgSetNewSmsOption( CFW_SMS_MULTIPART_OPTION_ALL|CFW_SMS_ROUT_DETAIL_INFO,                             CFW_CFG_RECEIVE_STORAGE(CFW_SMS_STORAGE_ME, 0, 0));#endif 	#if 0 	// Cf. SMS'notification doc infra	/* Note : on Virtual phone this command cause an anwser with 2 OK.*/	requestWriteTSS("AT+CNMI=3,2,2") ;		/* This one is trapped on Virtual Phone. */	requestWriteTSS("AT+CNMI=3,2,2") ;	requestWriteTSS("AT+CPMS=\"SM\",\"SM\",\"SM\"");	// CUSD: Enable the result code presentation to the TE	requestWriteTSS("AT+CUSD=1") ;	#endif 		return; }/* * reason: *	0: TAPI_SS_DIVERT_UNCONDITIONAL *	1: TAPI_SS_DIVERT_BUSY *	2: TAPI_SS_DI

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -