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

📄 cfwmanager.cpp

📁 这是法国Kaleido公司提供了一个手机mmi设计平台
💻 CPP
📖 第 1 页 / 共 5 页
字号:
												/* This slot is already used we stop the list scanning. */													isFreeSlot=false;													break;												} else isFreeSlot=true;											}										}										/* We have found a new slot we break the loop. */										if (isFreeSlot) break;										/* else we look for next slot. */										slot++;											if (slot>(int)readGlobalStore(TAPI_PBK_SIM_MAX_RECORD)) break;									}								if (isFreeSlot==false)								{									gContext->getQuickQueue()->addMessage(MSG_ACTION,newMsgERROR,0);									return TAPI_PROPERTY_AVAILABLE;								}else								{									/* We set the new record slot. */									i2a(slot,tmp);									index=xstrdup(tmp);								}							}							getArgValByName(qs_contact,PBK_FIELD_STATUS,tmp);							if (*tmp) {stat=xstrdup(tmp);*tmp=0;}							getArgValByName(qs_contact,PBK_FIELD_TOADD,tmp);							if (*tmp) {type=xstrdup(tmp);*tmp=0;}							if (status!=4)							{								getArgValByName(qs_contact,PBK_FIELD_NAME,tmp);								if (*tmp) {name=xstrdup(tmp);*tmp=0;}								getArgValByName(qs_contact,PBK_FIELD_ADDR,tmp);								if (*tmp) {number=xstrdup(tmp);*tmp=0;}  							    sprintf(tmp,"AT+CPBW=%s,\"%s\",%s,\"%s\"",index,number,type,name);															}							else							{								name=xstrdup("");								number=xstrdup("");								sprintf(tmp,"AT+CPBW=%s",index);																							}							//sprintf(tmp,"AT+CPBW=%s,\"%s\",%s,\"%s\"",index,number,type,name);														/* We do not send newMsgOK and newMsgERROR yet. */							requestWriteTSS(tmp,0,0,AT_COMMANDER_DEFAULT_TIMEOUT);							sprintf(tmp, "AT+CPBR=%s",index);							/* We send it when we will receive update from SIM card. */							requestWriteTSS(tmp,newMsgOK,newMsgERROR,AT_COMMANDER_DEFAULT_TIMEOUT);							askPhoneBookList=AT_COM_PHONEBOOK_ASK_CONTACTS;							char* old=(char*)sim_contact_list->remove(i);							SAFE_FREE(old);							SAFE_FREE(index);							SAFE_FREE(stat);							SAFE_FREE(type);							SAFE_FREE(name);							SAFE_FREE(number);							}					}				}			//					requestWriteTSS("AT+?", newMsgOK, newMsgERROR); 			return TAPI_PROPERTY_AVAILABLE;			}		//	requestWriteTSS("AT+CPBR=?");		return TAPI_PROPERTY_AVAILABLE;	}	if(!strcmp(propertyName, TAPI_SMS_MODE)) // TAPI_STATYPE_INT [R/W]	{    //		0: PDU mode    //		1:Text mode		if(!forceWrite)		{      //	requestWriteTSS("AT+?", newMsgOK, newMsgERROR); 			return TAPI_PROPERTY_UNIMPLEMENTED;		}				int request = (int) readGlobalStore(TAPI_SMS_MODE);		#if 0 		sprintf(tmpBuffer, "AT+CMGF=%d", request) ;		requestWriteTSS(tmpBuffer); 		#endif 		CFW_CfgSetSmsFormat(request); // Set SMS Format to send [2007-6-7:shenhankun]				return TAPI_PROPERTY_AVAILABLE;	}	if(!strcmp(propertyName, TAPI_SMS_TOSEND)) // TAPI_STATYPE_STRING [R/W]		{//      This is a queryString defining SMS' parameters://          O=Outgoing I=Incoming//			tosca I: type of service center address (129=national or unknown,145=international, 161=national)//			tooa  I: type of originating address//			tora  I: type of recipient address//			scad  S: service center address//			oadd  S: originating address//			radd  S: recipient address (mandatory for O)//          msg   S: message (mandatory for I/O)//			scts  S: service center time stamp ( "YY/MM/DD HH:MM:SS[-CC]" )		char* request = (char*)readGlobalStore(TAPI_SMS_TOSEND) ;		if(request)		{			char* tmp0=  (char*) xmalloc(1000);			char* tmp1;			char radd[20] ;			char msg[500] ;			tmp1 = getArgValByName(request, SMS_FIELD_RADD, tmp0);			if(!tmp1 || !*tmp1)			{ 			  return TAPI_PROPERTY_BADPARAM; 			}			Verbose(VERB_LEV_SESSION, "SMS_FIELD_RADD = %s \n", tmp1);						strcpy(radd, unquoteString(tmp1));			tmp1 = getArgValByName(request, SMS_FIELD_MSG,tmp0);						if(!tmp1 || !*tmp1)			{			  return TAPI_PROPERTY_BADPARAM; 			}			Verbose(VERB_LEV_SESSION, "SMS_FIELD_MSG = %s \n", tmp1);						strcpy(msg, unquoteString(tmp1));						// Now, we can flush the current message...			gContext->replaceMemData(TAPI_SMS_TOSEND, NULL);						if((int) readGlobalStore(TAPI_SMS_MODE)==1) // Text mode			{			  UINT32 ret = ERR_SUCCESS;			  CFW_DIALNUMBER sNumber;			  UINT8 pBcd[50];			  // TODO, Just for test .....			  Verbose(1, " TAPI_SMS_MODE = TEXT\n");                sNumber.nDialNumberSize = SUL_AsciiToGsmBcd(tmp1, strlen(tmp1), pBcd);        sNumber.pDialNumber     = pBcd; //13911792320 13439513202		sNumber.nType           = CFW_TELNUMBER_TYPE_UNKNOWN;        			  ret = CFW_SmsSendMessage(&sNumber, (UINT8*)"Hello, Coolsand!!!", 18, CFW_SMS_UTI);			  SAFE_FREE(tmp0);			  if(ret != ERR_SUCCESS)			  {			    Verbose(VERB_LEV_SESSION, "Fail to send message \n");			    return TAPI_PROPERTY_INVALID;			  }			  else			  {				  Verbose(VERB_LEV_SESSION, "CFW_SmsSendMessage == ERR_SUCCESS \n");			    return TAPI_PROPERTY_REFRESHING;			  }			  			  #if HAVE_DAW_ORG_VER 				char tmp[1000];				sprintf(tmp, "AT+CMGS=\"%s\"", radd) ;				requestWriteTSS(tmp, 0, newMsgERROR); // Note that OK is not enough but ERR is a show stopper...				sprintf(tmp, "%s\x1a", msg) ;				requestWriteTSS(tmp, newMsgOK, newMsgERROR); // 				return TAPI_PROPERTY_REFRESHING;				#endif 							}			else // PDU mode			{				  Verbose(1, " TAPI_SMS_MODE = PDU\n");#ifdef GSMUTILS_DEACTIVATED				unsigned char tmp[1000];				unsigned char pdu[1000];				encodePDUMessage(NULL/* SMSC */, (unsigned char*) radd /* dst */, (unsigned char*) msg , MESSAGE_ENCODING_7BIT, pdu);				// CG Added PDU len is nudamber of BYTE ! And String is in Hexadecimal chars,				// So strlen(pdu) / 2 !				sprintf((char*) tmp, "AT+CMGS=%d", strlen((char*) pdu)/2) ;				requestWriteTSS(char*) tmp, 0, 0);#ifdef DEV_DEBUG				Verbose(VERB_LEV_DEBUG, "TAPI: Sending SMS-PDU >%s<\n", pdu) ;#endif // def DEV_DEBUG				sprintf((char*) tmp, "%s\x1a", (char*) pdu) ;				requestWriteTSS(char*) tmp, newMsgOK, newMsgERROR, timeout); //#endif				return TAPI_PROPERTY_REFRESHING;				}			}//		return TAPI_PROPERTY_BADPARAM;		}	if(!strcmp(propertyName, TAPI_SMS_TOREAD)) //  TAPI_STATYPE_SMALLARRAYLIST [R]	{		// Writing is a no sens here !!!#ifdef DEV_DEBUG		Verbose(VERB_LEV_ERROR, "TAPI: trying to update TAPI_SMS_TOREAD.\n") ;#endif // def DEV_DEBUG		return TAPI_PROPERTY_BADPARAM;	}		/*	 * SS : FORWARDING , DIVERTING	 */ 	if(!strcmp(propertyName, TAPI_SS_DIVERT_UNCONDITIONAL)) // TAPI_STATYPE_STRING [R/W]	{		// This is a querystring where the possible fields are declared in "INDIVIDUAL FORWARDING's FIELDS"		manageDivert(0, propertyName, forceWrite, newMsgOK, newMsgERROR, timeout) ;		return TAPI_PROPERTY_REFRESHING;	}	if(!strcmp(propertyName, TAPI_SS_DIVERT_BUSY)) // TAPI_STATYPE_STRING [R/W]	{		// This is a querystring where the possible fields are declared in "INDIVIDUAL FORWARDING's FIELDS"		manageDivert(1, propertyName, forceWrite, newMsgOK, newMsgERROR, timeout) ;		return TAPI_PROPERTY_REFRESHING;	}	if(!strcmp(propertyName, TAPI_SS_DIVERT_NO_ANSWER)) // TAPI_STATYPE_STRING [R/W]	{		// This is a querystring where the possible fields are declared in "INDIVIDUAL FORWARDING's FIELDS"		manageDivert(2, propertyName, forceWrite, newMsgOK, newMsgERROR, timeout) ;		return TAPI_PROPERTY_REFRESHING;	}	if(!strcmp(propertyName, TAPI_SS_DIVERT_UNREACHABLE)) // TAPI_STATYPE_STRING [R/W]	{		// This is a querystring where the possible fields are declared in "INDIVIDUAL FORWARDING's FIELDS"		manageDivert(3, propertyName, forceWrite, newMsgOK, newMsgERROR, timeout) ;		return TAPI_PROPERTY_REFRESHING;	}	if(!strcmp(propertyName, TAPI_SS_DIVERT_ALL_CALLS)) // TAPI_STATYPE_STRING [R/W]	{/*		// This is a querystring where the possible fields are declared in "INDIVIDUAL FORWARDING's FIELDS"		if(!forceWrite)			{			// Request to update the status			currentSSReason=4;			// No sens !!!#ifdef DEV_DEBUG			Verbose(VERB_LEV_ERROR, "TAPI: trying to update TAPI_SS_DIVERT_ALL_CALLS' status.\n") ;#endif // def DEV_DEBUG			return TAPI_PROPERTY_BADPARAM;			}		requestWriteTSS("AT+CCFC=4,0", newMsgOK, newMsgERROR, timeout);*/		manageDivert(4, propertyName, forceWrite, newMsgOK, newMsgERROR, timeout) ;		return TAPI_PROPERTY_REFRESHING;	}	if(!strcmp(propertyName, TAPI_SS_DIVERT_ALL_CONDITIONAL)) // TAPI_STATYPE_STRING [R/W]	{/*		// This is a querystring where the possible fields are declared in "INDIVIDUAL BARRING's FIELDS"		if(!forceWrite)			{			// Request to update the status			currentSSReason=5;			// No sens !!!#ifdef DEV_DEBUG			Verbose(VERB_LEV_ERROR, "TAPI: trying to update TAPI_SS_DIVERT_ALLCONDITIONAL's status.\n") ;#endif // def DEV_DEBUG			return TAPI_PROPERTY_BADPARAM;			}BREAKPOINT; // Untested		requestWriteTSS("AT+CCFC=5,0", newMsgOK, newMsgERROR, timeout);*/			manageDivert(5, propertyName, forceWrite, newMsgOK, newMsgERROR, timeout) ;			return TAPI_PROPERTY_REFRESHING;		}	/*	 * SS : BARRING	 */ 	if(!strcmp(propertyName, TAPI_SS_BARRING_OUT)) // TAPI_STATYPE_STRING [R/W]		{		// This is a querystring where the possible fields are declared in "INDIVIDUAL BARRING's FIELDS"		manageBarring(0, propertyName, forceWrite, newMsgOK, newMsgERROR, timeout) ;		return TAPI_PROPERTY_REFRESHING;		}	if(!strcmp(propertyName, TAPI_SS_BARRING_OUT_TO_INTL)) // TAPI_STATYPE_STRING [R/W]		{		// This is a querystring where the possible fields are declared in "INDIVIDUAL BARRING's FIELDS"		manageBarring(1, propertyName, forceWrite, newMsgOK, newMsgERROR, timeout) ;		return TAPI_PROPERTY_REFRESHING;		}	if(!strcmp(propertyName, TAPI_SS_BARRING_OUT_TO_INTL_BUT_HOME)) // TAPI_STATYPE_STRING [R/W]		{		// This is a querystring where the possible fields are declared in "INDIVIDUAL BARRING's FIELDS"		manageBarring(2, propertyName, forceWrite, newMsgOK, newMsgERROR, timeout) ;		return TAPI_PROPERTY_REFRESHING;		}	if(!strcmp(propertyName, TAPI_SS_BARRING_INC)) // TAPI_STATYPE_STRING [R/W]		{		// This is a querystring where the possible fields are declared in "INDIVIDUAL BARRING's FIELDS"		manageBarring(3, propertyName, forceWrite, newMsgOK, newMsgERROR, timeout) ;		return TAPI_PROPERTY_REFRESHING;		}	if(!strcmp(propertyName, TAPI_SS_BARRING_INC_ROAMED)) // TAPI_STATYPE_STRING [R/W]		{		// This is a querystring where the possible fields are declared in "INDIVIDUAL BARRING's FIELDS"		manageBarring(4, propertyName, forceWrite, newMsgOK, newMsgERROR, timeout) ;		return TAPI_PROPERTY_REFRESHING;		}	if(!strcmp(propertyName, TAPI_SS_BARRING_CANCEL_ALL)) // Action only		{/*		// This is a querystring where the possible fields are declared in "INDIVIDUAL BARRING's FIELDS"		currentSSReason=5;		if(!forceWrite)			{			// Request to update the status			// No sens !!!#ifdef DEV_DEBUG			Verbose(VERB_LEV_ERROR, "TAPI: trying to update TAPI_SS_BARRING_CANCEL_ALL's status.\n") ;#endif // def DEV_DEBUG			return TAPI_PROPERTY_BADPARAM;			}		char* tmp = getContext()->getTmpBuffer();		//sprintf(tmp, "AT+CLCK=\"%s\",0", barringCodes[currentSSReason]);		sprintf(tmp, "AT+CLCK=\"AB\",0,\"0000\",1");				requestWriteTSS(tmp, newMsgOK, newMsgERROR, timeout);*/		manageBarring(5, propertyName, forceWrite, newMsgOK, newMsgERROR, timeout) ;		return TAPI_PROPERTY_REFRESHING;		}	if(!strcmp(propertyName, TAPI_SS_BARRING_CANCEL_ALL_OUT)) // Action only		{		// This is a querystring where the possible fields are declared in "INDIVIDUAL BARRING's FIELDS"// 		currentSSReason=6;// 		if(!forceWrite)// 			{// 			// Request to update the status// 			// No sens !!!// #ifdef DEV_DEBUG// 			Verbose(VERB_LEV_ERROR, "TAPI: trying to update TAPI_SS_BARRING_CANCEL_ALL_OUT's status.\n") ;// #endif // def DEV_DEBUG// 			return TAPI_PROPERTY_BADPARAM;// 			}// 		char* tmp = getContext()->getTmpBuffer();// 		//sprintf(tmp, "AT+CLCK=\"%s\",0,\"0000\"", barringCodes[currentSSReason]);// 		sprintf(tmp, "AT+CLCK=\"AO\",0,\"0000\",1");		// 		requestWriteTSS(tmp, newMsgOK, newMsgERROR, timeout);		manageBarring(6, propertyName, forceWrite, newMsgOK, newMsgERROR, timeout) ;		return TAPI_PROPERTY_REFRESHING;		}	if(!strcmp(propertyName, TAPI_SS_BARRING_CANCEL_ALL_INC)) // Action only		{// 		// This is a querystring where the possible fields are declared in "INDIVIDUAL BARRING's FIELDS"// 		currentSSReason=7;// 		if(!forceWrite)// 			{// 			// Request to update the status// 			// No sens !!!// #ifdef DEV_DEBUG// 			Verbose(VERB_LEV_ERROR, "TAPI: trying to update TAPI_SS_BARRING_CANCEL_ALL_INC's status.\n") ;// #endif // def DEV_DEBUG// 			return TAPI_PROPERTY_BADPARAM;// 			}// 		char* tmp = getContext()->getTmpBuffer();// 		//sprintf(tmp, "AT+CLCK=\"%s\",0", barringCodes[currentSSReason]);// 		sprintf(tmp, "AT+CLCK=\"AI\",0,\"0000\",1");		// 		requestWriteTSS(tmp, newMsgOK, newMsgERROR, timeout);		manageBarring(7, propertyName, forceWrite, newMsgOK, newMsgERROR, timeout) ;				return TAPI_PROPERTY_REFRESHING;		}	if(!strcmp(propertyName, TAPI_STK_FROMSIM)) //  TAPI_STATYPE_SMALLARRAYLIST [R]		{		// Writing is a no sens here !!!#ifdef DEV_DEBUG		Verbose(VERB_LEV_ERROR, "TAPI: trying to update TAPI_STK_FROMSIM.\n") ;#endif // def DEV_DEBUG		return TAPI_PROPERTY_BADPARAM;		}	if(!strcmp(propertyName, TAPI_STK_TOSIM)) // TAPI_STATYPE_STRING [W]		{		// This is a querystring where the possible fields are declared in "INDIVIDUAL STK's FIELDS"		if(!forceWrite)			{#ifdef DEV_DEBUG			Verbose(VERB_LEV_ERROR, "TAPI: trying to update TAPI_STK_TOSIM's status.\n") ;#endif // def DEV_DEBUG			return TAPI_PROPERTY_BADPARAM;			}		// As the methods used here are higly platform depedent, they are moved into ATComExternalsxxx.cpp//		return updateSTKProperty(this, propertyName, forceWrite, newMsgOK, newMsgERROR, timeout);		return TAPI_PROPERTY_UNIMPLEMENTED;		}	if(!strcmp(propertyName,TAPI_CLIP_STATE))		{			if (forceWrite)			{				// Set CLIP				int status=gContext->findData(propertyName,-1);				if (status!=-1)				{					sprintf(tmpBuffer,"AT+CLIP=%i",status);					requestWriteTSS(tmpBuffer, newMsgOK, newMsgERROR, timeout);				}								return TAPI_PROPERTY_REFRESHING;			}else			{				// Read CLIP				sprintf(tmpBuffer,"AT+CLIP?");				requestWriteTSS(tmpBuffer, newMsgOK, newMsgERROR, timeout);				return TAPI_PROPERTY_AVAILABLE;			}

⌨️ 快捷键说明

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