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

📄 cfwmanager.cpp

📁 这是法国Kaleido公司提供了一个手机mmi设计平台
💻 CPP
📖 第 1 页 / 共 5 页
字号:
					freeLines(&callTidList,false);					if(!strcmp(tmp, CALL_STATE_REQINIT)) //					{						if(getArgValByName(qString, CALL_FIELD_EXTURI, tmp))						{						  #if 0 							// This call will induce:							//		- a incoming AT command "+COLP" that will set the state CALL_STATE_ESTABLISHED							//    - a incoming AT command ???? K1Z (if it failed), or if it is refused.							sprintf(tmpBuffer, "ATD%s;", tmp) ;							requestWriteTSS(tmpBuffer, newMsgOK, newMsgERROR,30000);							#else              // MO Call              UINT8 pBcd[40];              INT32 i = 0;              CFW_DIALNUMBER pDialNumber;              SUL_ZeroMemory32(&pDialNumber, SIZEOF(CFW_DIALNUMBER));                            pDialNumber.nDialNumberSize = SUL_AsciiToGsmBcd(tmp, strlen(tmp), pBcd);//strlen(tmp)-1 changed to strlen(tmp)  by zhangcl              pDialNumber.pDialNumber     = (UINT8*)pBcd;              pDialNumber.nType           = CFW_TELNUMBER_TYPE_UNKNOWN;                             Verbose(VERB_LEV_SESSION, TSTXT("Call Number BCD:\n"));              for(i = 0; i<pDialNumber.nDialNumberSize; i++)                  Verbose(VERB_LEV_SESSION, TSTXT("--BCD--0x%02x \n"), pDialNumber.pDialNumber[i]);              Verbose(VERB_LEV_SESSION, TSTXT("\n"));                            Verbose(VERB_LEV_SESSION, "The dialing number is:%s,%d\n", tmp, pDialNumber.nDialNumberSize);              if(CFW_CcInitiateSpeechCall (&pDialNumber, 0) == ERR_SUCCESS)              {                Verbose(VERB_LEV_SESSION, "Start Create speech call OK.\n");  							SmallArrayList* tapi_list=(SmallArrayList*)getContext()->findData(TAPI_CALLS_LIST_STATE);  							createNewCall(tapi_list,CALL_ID_UNKNOWN,CALL_ID_UNKNOWN,(char*)CALL_STATE_REQINIT, CALL_PROTOCOL_GSM,   							             (char*)"" /* Protocol's type */, xstrdup(tmp) /* extURI */ , (char*)"" /* extName */,   							             (char*)"" /* intURI */, (char*)"" /* intName */, 0, CALL_INOUT_OUTGOING) ;              }              else              {                Verbose(VERB_LEV_SESSION, "Fail to create speech call, TODO... \n");              }							#endif						}						else						{#ifdef DEV_DEBUG							Verbose(VERB_LEV_ERROR, "Invalid call request >%s< extURI not found.\n", qString);#endif // def DEV_DEBUG							return TAPI_PROPERTY_BADPARAM;						}					}										else if(!strcmp(tmp, CALL_STATE_REQREFUSE) || !strcmp(tmp, CALL_STATE_REQABORT))					{						SmallArrayList* tapi_list=(SmallArrayList*)getContext()->findData(TAPI_CALLS_LIST_STATE);						/*char* state=xstrdup(tmp);						// We replace status in status list to requesting XXXX.						changeCallStatus(this,tapi_list,i,tid,state)						SAFE_FREE(state);*/						if ((tapi_list)&&(tapi_list->size()==1))						{							// When only one call we close it using ATH.							// sprintf(tmpBuffer, "ATH");							Verbose(VERB_LEV_DEBUG, TSTXT("Start Release Call.\n"));							if(ERR_SUCCESS == CFW_CcReleaseCall()) // You can call CFW_CcRejectCall in other case. [2007-6-8:shenhankun]							{	    						writeGlobalStore(TAPI_CALL_STOP_RINGING,(void*)i,TAPI_STATYPE_INT);	    						updateProperty(TAPI_CALL_STOP_RINGING,TRUE);								}						}						else						{						  // TODO ... 						}											}					else if(!strcmp(tmp, CALL_STATE_REQACCEPT)) //					{													// Unfortunately, ATA does not generate any ack message. For this reason, it is necessary						// to consider that this command actually establish the call.						//						//requestWriteTSS("ATA", newMsgOK, newMsgERROR);						//						//sprintf(tmpBuffer, "AT+CHLD=2%i",tid);						SmallArrayList* current_calls_list_state=(SmallArrayList*)getContext()->findData(TAPI_CALLS_LIST_STATE);						if ((current_calls_list_state)&&(current_calls_list_state->size()==1))						{						  int i = 0; 							// When only one call we close it using ATH.							//sprintf(tmpBuffer, "ATA");							if(CFW_CcAcceptSpeechCall())							{								//if(2 == UINT32 CFW_CcGetCallStatus ())								{						  		// setCallValueByIndex( i, CALL_FIELD_STATE, CALL_STATE_REQACCEPT);								}							}							else							{								writeGlobalStore(TAPI_CALL_STOP_RINGING,(void*)i,TAPI_STATYPE_INT);								updateProperty(TAPI_CALL_STOP_RINGING,TRUE);							}						}						else						{							// Else AT+CHLD method.							sprintf(tmpBuffer, "AT+CHLD=2%i",tid);						}						#if 0 // ???? 						// We ask an update of call list.						requestWriteTSS(tmpBuffer, newMsgOK, newMsgERROR);						//stopRinging(this, i);						writeGlobalStore(TAPI_CALL_STOP_RINGING,(void*)i,TAPI_STATYPE_INT);						updateProperty(TAPI_CALL_STOP_RINGING,TRUE);						#endif 						// CG remove state changer						//setCallValueByIndex( i, CALL_FIELD_STATE, CALL_STATE_ESTABLISHED);						// Normally, this message should be generated by the ack to "ATA"						//sendSlowQueue(gContext, MSG_ACTION, Model__kAction_CallEstablished, 0) ;					}					else if(!strcmp(tmp, CALL_STATE_REQHOLD)) //						{							// Put all call on hold. Cannot put one call							// in particular on hold.							SmallArrayList* current_calls_list_state=(SmallArrayList*)getContext()->findData(TAPI_CALLS_LIST_STATE);							if ((current_calls_list_state)&&(current_calls_list_state->size()==1))							{								sprintf(tmpBuffer, "AT+CHLD=20");							}else							{															sprintf(tmpBuffer, "AT+CHLD=2");							}							// We ask an update of call list.							requestWriteTSS(tmpBuffer, newMsgOK, newMsgERROR,30000);							}					else if(!strcmp(tmp, CALL_STATE_REQRELEASE)) //						{							// Place All calls in Hold on  TAPI list							//sprintf(tmpBuffer, "AT+CHLD=2%i",tid);							SmallArrayList* current_calls_list_state=(SmallArrayList*)getContext()->findData(TAPI_CALLS_LIST_STATE);							if ((current_calls_list_state)&&(current_calls_list_state->size()==1))							{								sprintf(tmpBuffer, "AT+CHLD=2");							}else							{															sprintf(tmpBuffer, "AT+CHLD=2%i",tid);							}							requestWriteTSS(tmpBuffer, newMsgOK, newMsgERROR);						//BREAKPOINT;						}					else if(!strcmp(tmp, CALL_STATE_REQCLOSE)) //						{//BREAKPOINT;						// This call can now be deleted...						sprintf(tmpBuffer, "AT+CHLD=1%i",tid);						requestWriteTSS(tmpBuffer, newMsgOK, newMsgERROR);						// CG :						// AT does not Acknowledge a call close, so we consider IN THIS CASE ONLY						// that when we request a call close, this one is closed.						//setCallValueByIndex( i, CALL_FIELD_STATE, CALL_STATE_CLOSED);						}						else if((!strcmp(tmp, CALL_STATE_CLOSED))||(!strcmp(tmp, CALL_STATE_ABORTED))) //						{						// As we are currently scanning the list, we unfortunately cannot call an external function to delete the call...#ifdef DEV_DEBUG						Verbose(VERB_LEV_ERROR, "Closing call (%d/%d) %s\n", i, callsList->size(), qString) ;#endif // def DEV_DEBUG						}						// We remove string from request list.						SAFE_FREE(qString);						callsList->remove(i--) ;				  }				}			}		return TAPI_PROPERTY_REFRESHING;		}	if(!strcmp(propertyName, TAPI_CALLS_LIST_REMOVE_ENDED_CALLS))	{		if (forceWrite)		{			SmallArrayList* callsList=(SmallArrayList*)getContext()->findData(TAPI_CALLS_LIST_STATE);			char* tmp=getContext()->getTmpBuffer();			char* qString=NULL;								if ((callsList)&&(callsList->size()))			{				int i=0;				while(i<callsList->size())				{					qString=(char*)callsList->get(i);					*tmp=0;					getArgValByName(qString, CALL_FIELD_STATE, tmp);					if((*tmp)&&((!strcmp(tmp,CALL_STATE_CLOSED)||(!strcmp(tmp,CALL_STATE_ABORTED)))))					{						/* We remove current call because it's ended and MMI does not need it anymore.*/						SAFE_FREE(qString);						callsList->remove(i--) ;					}else i++;							}			}		}else		{#ifdef DEV_DEBUG			Verbose(VERB_LEV_ERROR,"TAPI_CALLS_LIST_REMOVE_ENDED_CALLS could not be readed.\n");#endif // def DEV_DEBUG					}		return TAPI_PROPERTY_REFRESHING;	}	if(!strcmp(propertyName, TAPI_CALLS_LIST_STATE))	{		requestWriteTSS("AT+CLCC",newMsgOK,newMsgERROR);		return TAPI_PROPERTY_REFRESHING;	}	if(!strcmp(propertyName, TAPI_RING_LEVEL)) // TAPI_STATYPE_INT [R/W]		{		//      0x000000xx: xx in %		if(!forceWrite)			{//					requestWriteTSS("AT+?", newMsgOK, newMsgERROR); 			return TAPI_PROPERTY_UNIMPLEMENTED;			}		int request = (int) readGlobalStore(TAPI_RING_LEVEL) ;//				requestWriteTSS("AT+?", newMsgOK, newMsgERROR); 		return TAPI_PROPERTY_UNIMPLEMENTED;		}	if(!strcmp(propertyName, TAPI_RING_STYLE)) // TAPI_STATYPE_STRING [W]		{		//      Device dependant...		char* request = (char*) readGlobalStore(TAPI_RING_STYLE) ;//				requestWriteTSS("AT+?", newMsgOK, newMsgERROR); 		return TAPI_PROPERTY_UNIMPLEMENTED;		}				if(!strcmp(propertyName, TAPI_OUT_DTMF)) // TAPI_STATYPE_STRING [W]		{		if(!forceWrite)			{			return TAPI_PROPERTY_INVALID;			}		char* request = (char*) readGlobalStore(TAPI_OUT_DTMF) ;		if(!request || !*request)			return TAPI_PROPERTY_BADPARAM;		char* tmp = getContext()->getTmpBuffer();		sprintf(tmp, "AT+VTS=\"%s\"", request);		writeGlobalStore(TAPI_OUT_DTMF, NULL, TAPI_STATYPE_STRING);		requestWriteTSS(tmp, newMsgOK, newMsgERROR); 		return TAPI_PROPERTY_UNIMPLEMENTED;		}	if(!strcmp(propertyName, TAPI_MICROPHONE_LEVEL)) // TAPI_STATYPE_INT [R/W]		{		//      0x000000xx: xx in %		if(!forceWrite)			{//					requestWriteTSS("AT+?", newMsgOK, newMsgERROR); 			return TAPI_PROPERTY_UNIMPLEMENTED;			}		int request = (int) readGlobalStore(TAPI_MICROPHONE_LEVEL) ;//				requestWriteTSS("AT+?", newMsgOK, newMsgERROR); 		return TAPI_PROPERTY_UNIMPLEMENTED;		}	if(!strcmp(propertyName, TAPI_EARPHONE_LEVEL)) // TAPI_STATYPE_INT [R/W]		{		//      0x000000xx: xx in %		if(!forceWrite)			{//					requestWriteTSS("AT+?", newMsgOK, newMsgERROR); 			return TAPI_PROPERTY_UNIMPLEMENTED;			}		int request = (int) readGlobalStore(TAPI_EARPHONE_LEVEL) ;//				requestWriteTSS("AT+?", newMsgOK, newMsgERROR); 		return TAPI_PROPERTY_UNIMPLEMENTED;		}	if(!strcmp(propertyName, TAPI_SPEAKER_LEVEL)) // TAPI_STATYPE_INT [R/W]		{		//      0x000000xx: xx in %		if(!forceWrite)			{//					requestWriteTSS("AT+?", newMsgOK, newMsgERROR); 			return TAPI_PROPERTY_UNIMPLEMENTED;			}		int request = (int) readGlobalStore(TAPI_SPEAKER_LEVEL) ;//				requestWriteTSS("AT+?", newMsgOK, newMsgERROR); 		return TAPI_PROPERTY_UNIMPLEMENTED;		}	if(!strcmp(propertyName, TAPI_VIBRATOR_LEVEL)) // TAPI_STATYPE_INT [R/W]		{		//      0x000000xx: xx in %		if(!forceWrite)			{//					requestWriteTSS("AT+?", newMsgOK, newMsgERROR); 			return TAPI_PROPERTY_UNIMPLEMENTED;			}		int request = (int) readGlobalStore(TAPI_VIBRATOR_LEVEL) ;//				requestWriteTSS("AT+?", newMsgOK, newMsgERROR); 		return TAPI_PROPERTY_UNIMPLEMENTED;		}	if(!strcmp(propertyName, TAPI_PBK_CONTENT)) // TAPI_STATYPE_SMALLARRAYLIST [R/W]		{		if(forceWrite)			{				/* We get the sim list from gContext */				SmallArrayList* sim_contact_list=(SmallArrayList*)readGlobalStore(propertyName);				/* We remove reference from gContext. */				gContext->replaceIntData(propertyName,0);				temporaryPhoneBookList=sim_contact_list;				/* If not present Error. */				if (!sim_contact_list)					return TAPI_PROPERTY_INVALID;								char* tmp=gContext->getTmpBuffer();				char* qs_contact=NULL;				/* We're going to check all queryString to find a modification to apply to SIM card.*/								for (int i=0;i<sim_contact_list->size();i++)				{					/* We get the status of element i in list. */					*tmp=0;					qs_contact=(char*)sim_contact_list->get(i);					getArgValByName(qs_contact,PBK_FIELD_STATUS,tmp);					if (*tmp)					{						int status=a2i(tmp);						/*		1: obtained from the SIM								2: modified and not yet synchronized with the SIM								3: added and not yet synchronized with the SIM								4: deleted and not yet synchronized with the SIM								5: modified but synchronized with the SIM */						/* If a modification is required */						if ((status==2)||(status==3)||(status==4))						{							char* index=NULL;							char* stat=NULL;							char* type=NULL;							char* name=NULL;							char* number=NULL;														*tmp=0;							/* Not a modification : add operation. */							if (status!=3)							{								getArgValByName(qs_contact,PBK_FIELD_INDEX,tmp);								if (*tmp) {index=xstrdup(tmp);*tmp=0;}							}else							{								/* We look for a free slot.*/								char* tmp_qs_cont=NULL;								int current_index=-1;								int current_status=1;								/* SIM slot start at 1. */								int slot=1;								*tmp=0;								/* Indicate if a free slot has been found. */								boolean isFreeSlot=false;								/* There is only one record in the list								and we would like to add it. */								if (sim_contact_list->size()==1)								{									isFreeSlot=true;									slot=1;								}else									while(isFreeSlot==false)									{										/* We scan the whole list to look if "slot" is free.*/										for (int j=0;j<sim_contact_list->size();j++)										{											tmp_qs_cont=(char*)sim_contact_list->get(j);											/* We get index of current scanned record. */											getArgValByName(tmp_qs_cont,PBK_FIELD_INDEX,tmp);											if (*tmp)											{												current_index=a2i(tmp);												*tmp=0;											}											/* We get its status. */											getArgValByName(tmp_qs_cont,PBK_FIELD_STATUS,tmp);											if (*tmp)											{												current_status=a2i(tmp);												*tmp=0;											}											/* We look if current one is not the one we would like to 											add to SIM. If it's case, we ignore it. */											if (current_status!=3)											{												/* if the slot we look for is the same as the current												SIM record index */												if (current_index==slot)												{

⌨️ 快捷键说明

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