?? cfwmanager.cpp
字號:
/*************************************************************************** CFWManager.cpp - --------------- begin : Tue Mar 3 2004 copyright : (C) 2004 by DigitalAirways email : info@digitalairways.com ***************************************************************************//* * Copyright (c) 2004-2006 DigitalAirways, sarl. All Rights Reserved. * * This software is the confidential and proprietary information of * DigitalAirways, sarl. ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with DigitalAirways. * A copy of this license is included in the framework.cpp file included * on this software package. * * $Id: CFWManager.cpp,v 1.62 2007-05-09 14:06:13 charles.gorand Exp $ **//**************************************************************** TODO************************************************************** *************************************************************** HISTORY************************************************************** -*/#include "EB_Utils.h"#include "CFWManager.h"#include "CommandSerializer.h"extern "C"{#include "pm.h"}// // For Verbose test [6/7/2007 shenhankun] // Need to change in offical release or non-demo development.//#undef TSTXT #define TSTXT(x) x // When DONTPROCESS_RING is defined, the message RING is not processed and only CLIP// is used to handle incoming calls.//#define DONTPROCESS_RING#define IDLE_LAYOUT "idle.bin"/****************************** ****** AT events processing ** ******************************/#define FUNCTION_METHOD_CFWManager(F) int F(CFWManager* atc, char** args) { return atc->F(args);} // Final result codesFUNCTION_METHOD_CFWManager(msg_ATI); // This answer is not prefixedFUNCTION_METHOD_CFWManager(msgOK);FUNCTION_METHOD_CFWManager(msgPrompt);FUNCTION_METHOD_CFWManager(msgERROR);FUNCTION_METHOD_CFWManager(msgCME_ERROR);FUNCTION_METHOD_CFWManager(msgCMS_ERROR);FUNCTION_METHOD_CFWManager(msgBUSY);FUNCTION_METHOD_CFWManager(msgNO_ANSWER);FUNCTION_METHOD_CFWManager(msgNO_CARRIER);FUNCTION_METHOD_CFWManager(msgCONNECT_SPEECH);// Unsolicited result codesFUNCTION_METHOD_CFWManager(msgRING);FUNCTION_METHOD_CFWManager(msgCMTI);FUNCTION_METHOD_CFWManager(msgCMT);FUNCTION_METHOD_CFWManager(msgCDS);FUNCTION_METHOD_CFWManager(msgCCCM);FUNCTION_METHOD_CFWManager(msgCKEV);//FUNCTION_METHOD_CFWManager(msgCCWA);//FUNCTION_METHOD_CFWManager(DoCallWaiting);FUNCTION_METHOD_CFWManager(msgCLIP);FUNCTION_METHOD_CFWManager(msgCLIR);//FUNCTION_METHOD_CFWManager(msgCREG);FUNCTION_METHOD_CFWManager(msgCRING);#ifdef MODEM_MANUF_WAVECOMFUNCTION_METHOD_CFWManager(msgWIND);#endif // def MODEM_MANUF_WAVECOMFUNCTION_METHOD_CFWManager(msgCSQ);FUNCTION_METHOD_CFWManager(msgCSSI);FUNCTION_METHOD_CFWManager(msgCOLP);FUNCTION_METHOD_CFWManager(msgCR);FUNCTION_METHOD_CFWManager(msgILRR);FUNCTION_METHOD_CFWManager(msgCONNECT);FUNCTION_METHOD_CFWManager(msgCSSU);FUNCTION_METHOD_CFWManager(msgCBC);FUNCTION_METHOD_CFWManager(msgCPIN);FUNCTION_METHOD_CFWManager(msgCPBR);FUNCTION_METHOD_CFWManager(msgCRTC);FUNCTION_METHOD_CFWManager(msgCMGR);FUNCTION_METHOD_CFWManager(msgCMGL);FUNCTION_METHOD_CFWManager(msgCPMS);FUNCTION_METHOD_CFWManager(msgCMGF);FUNCTION_METHOD_CFWManager(msgCOPS);FUNCTION_METHOD_CFWManager(msgCUSD); //FUNCTION_METHOD_CFWManager(msgCCFC); //FUNCTION_METHOD_CFWManager(msgCLCK); //FUNCTION_METHOD_CFWManager(msgCOLR); //FUNCTION_METHOD_CFWManager(msgCLCC);FUNCTION_METHOD_CFWManager(msgCPBS);//*** B: SIM TOOLKIT MGT ****#ifdef MODEM_MANUF_SE /* This is a Sony Ericsson modem */FUNCTION_METHOD_CFWManager(msgSTKM);FUNCTION_METHOD_CFWManager(msgSTKL); // list FUNCTION_METHOD_CFWManager(msgSTKI); // input FUNCTION_METHOD_CFWManager(msgSTKTO);// timeoutFUNCTION_METHOD_CFWManager(msgSTKC); // callFUNCTION_METHOD_CFWManager(msgSTKE); // sms#endif // def MODEM_MANUF_SE /* This is a Sony Ericsson modem *///*** E: SIM TOOLKIT MGT ****const commandFMDescriptor supportedFMCommands[] = { { "OK", msgOK }, { ">", msgPrompt }, { "ERROR", msgERROR }, { "+CME ERROR", msgCME_ERROR }, { "+CMS ERROR", msgCMS_ERROR }, { "BUSY", msgBUSY }, { "NO ANSWER", msgNO_ANSWER }, { "NO CARRIER", msgNO_CARRIER }, { "CONNECT SPEECH", msgCONNECT_SPEECH }, { "RING", msgRING }, { "+CMTI", msgCMTI }, { "+CMT", msgCMT }, { "+CDS", msgCDS }, { "+CCCM", msgCCCM }, { "+CKEV", msgCKEV }, //{ "+CCWA", msgCCWA },// { "+CCWA", DoCallWaiting }, { "+CLIP", msgCLIP }, { "+CLIR", msgCLIR },// { "+CREG", msgCREG }, { "+CRING",msgCRING },#ifdef MODEM_MANUF_WAVECOM { "+WIND", msgWIND },#endif // def MODEM_MANUF_WAVECOM { "+CSQ", msgCSQ }, { "+CSSI", msgCSSI }, { "+COLP", msgCOLP }, { "+CR", msgCR }, { "+ILRR", msgILRR }, { "CONNECT", msgCONNECT }, { "+CSSU", msgCSSU }, { "+CBC" , msgCBC }, { "+CPIN", msgCPIN }, { "+CPBR", msgCPBR }, { "RTC", msgCRTC }, { "+CMGR", msgCMGR }, { "+CMGL", msgCMGL }, { "+CPMS", msgCPMS }, { "+CMGF", msgCMGF }, { "+COPS", msgCOPS }, // USSD { "+CUSD" , msgCUSD }, { "+CCFC" , msgCCFC }, { "+CLCK" , msgCLCK }, { "+CLCC" , msgCLCC }, { "+CPBS" , msgCPBS }, { "+CLCK" , msgCOLR },#ifdef MODEM_MANUF_SE /* This is a Sony Ericsson modem */ { "*E2STKM" , msgSTKM }, { "*E2STKL" , msgSTKL }, { "*E2STKI" , msgSTKI }, { "*E2STKTO", msgSTKTO }, { "*E2STKC" , msgSTKC }, { "*E2STKE" , msgSTKE },#endif // def MODEM_MANUF_SE /* This is a Sony Ericsson modem */ { NULL, NULL } } ;/* This function translate BSG code to classX code. */int convert_BSG_to_classX(int value){ switch(value) { case 10: case 11: return 1; case 12: return 2; case 13: case 21: return 4; case 16: return 8; case 22: case 24: return 16; case 25: return 32; default: return -1; };}const char* ERR_msgs[] = { (char*) 1, "Unassigned (unallocated) number", (char*) 3, "No route to destination", (char*) 6, "Channel unacceptable", (char*) 8, "Operator determined barring", (char*) 16, "Normal call clearing", (char*) 17, "User busy", (char*) 18, "No user responding", (char*) 19, "User alerting, no answer", (char*) 21, "Call rejected", (char*) 22, "Number changed", (char*) 26, "Non selected user clearing", (char*) 27, "Destination out of order", (char*) 28, "Invalid number format (incomplete number)", (char*) 29, "Facility rejected", (char*) 30, "Response to STATUS ENQUIRY", (char*) 31, "Normal, unspecified", (char*) 34, "No circuit/channel available", (char*) 38, "Network out of order", (char*) 41, "Temporary failure", (char*) 42, "Switching equipment congestion", (char*) 43, "Access information discarded", (char*) 44, "Requested circuit/channel not available", (char*) 47, "Resources unavailable, unspecified", (char*) 49, "Quality of service unavailable", (char*) 50, "Requested facility not subscribed", (char*) 55, "Incoming calls barred with in the CUG", (char*) 57, "Bearer capability not authorized", (char*) 58, "Bearer capability not presently available", (char*) 63, "Service or option not available, unspecified", (char*) 65, "Bearer service not implemented", (char*) 68, "ACM equal to or greater than ACMmax", (char*) 69, "Requested facility not implemented", (char*) 70, "Only restricted digital information bearer capability is", (char*) 79, "Service or option not implemented, unspecified", (char*) 81, "Invalid transaction identifier value", (char*) 87, "User not member of CUG", (char*) 88, "Incompatible destination", (char*) 91, "Invalid transit network selection", (char*) 95, "Semantically incorrect message", (char*) 96, "Invalid mandatory information", (char*) 97, "Message type non-existent or not implemented", (char*) 98, "Message type not compatible with protocol state", (char*) 99, "Information element non-existent or not implemented", (char*) 100, "Conditional IE error.", (char*) 101, "Message not compatible with protocol state", (char*) 102, "Recovery on timer expiry", (char*) 111, "Protocol error, unspecified", (char*) 127, "Interworking, unspecified", NULL, NULL } ;const char* CME_msgs[] = { (char*) 3, "Operation not allowed", (char*) 4, "Operation not supported", (char*) 5, "PH-SIM PIN required (SIM lock)", (char*) 10, "SIM not inserted", (char*) 11, "SIM PIN required", (char*) 12, "SIM PUK required", (char*) 13, "SIM failure", (char*) 16, "Incorrect password", (char*) 17, "SIM PIN2 required", (char*) 18, "SIM PUK2 required", (char*) 20, "Memory full", (char*) 21, "Invalid index", (char*) 22, "Not found", (char*) 24, "Text string too long", (char*) 26, "Dial string too long", (char*) 30, "No network service", (char*) 32, "Network not allowed emergency calls only", (char*) 40, "Network personalisation PIN required (Network lock)", (char*) 41, "Network personalization PUK required", (char*) 42, "Network subset personalization PIN required", (char*) 43, "Network subset personalization PUK required", (char*) 44, "Service provider personalization PIN required", (char*) 45, "Service provider personalization PUK required", (char*) 46, "Corporate personalization PIN required", (char*) 47, "Corporate personalization PUK required", (char*) 100, "Unknown error", NULL, NULL } ;const char* CMS_msgs[] = { (char*) 301, "SMS service of ME reserved", (char*) 302, "Operation not allowed All SMS commands", (char*) 303, "Operation not supported All SMS commands", (char*) 304, "Invalid PDU mode parameter", (char*) 305, "Invalid text mode parameter", (char*) 310, "SIM not inserted All SMS commands", (char*) 311, "SIM PIN required All SMS commands", (char*) 312, "PH-SIM PIN required All SMS commands", (char*) 313, "SIM failure All SMS commands", (char*) 316, "SIM PUK required All SMS commands", (char*) 317, "SIM PIN2 required All SMS commands", (char*) 318, "SIM PUK2 required All SMS commands", (char*) 321, "Invalid memory index", (char*) 322, "SIM memory full", (char*) 330, "SC address unknown", NULL, NULL } ;int requestWriteTSS(char*, unsigned long newMsgOK=0, unsigned long newMsgERROR=0,KALEIDO_TIME_TYPE timeout=0){ return 0;}void sendSlowQueue(GContext* gCtx, int message, int action, int arg){ gCtx->getSlowQueue()->addMessage(message|MFG_UNFLUSHABLE, action, arg, 0) ;}void showInvalidAction(TAPIManager* tapiMgr, char* propertyName, char* message, unsigned long newMsgERROR){#ifdef DEV_DEBUG Verbose(VERB_LEV_ERROR, "%s: property >%s< %s\n", "TAPI", propertyName, message);#endif // def DEV_DEBUG if(newMsgERROR) sendSlowQueue(tapiMgr->getContext(),MSG_ACTION, newMsgERROR, 0) ; return;}void changeCallStatus(CFWManager* atCom,SmallArrayList* tapi_list,int i,int tid,char* state){ // We replace status in status list to requesting XXXX. char* tmp=atCom->getContext()->getTmpBuffer(); for (int j=0;j<tapi_list->size();j++) { char* call=atCom->getCallInfoQByIndex(tapi_list,j); int _tid=CALL_ID_UNKNOWN; *tmp=0; getArgValByName(call,CALL_FIELD_TID,tmp); if (*tmp) { _tid=a2i(tmp); } if (tid==_tid) { atCom->setCallValueByIndex(tapi_list,i, CALL_FIELD_STATE,state); break; } }} CFWManager::CFWManager(char* newPinCode, char* newServer, int newPort) : TAPIManager(newPinCode, newServer, newPort) { // we xmalloc'ed tmpBuffer for CFWManager. tmpBuffer=(char*)xmalloc(TMP_COMMAND_BUFFER*sizeof(char)); stkCurrentType = STK_TYP_SETUP_MENU; currentBufferLen=0 ; waitedLines=0; lastLine=0 ; lastGeneralStatusRefresh = 0; defaultCommandHandler=NULL; temporaryPhoneBookList=NULL; temporarySMSList=NULL; isPhoneBookListReceived=false; askPhoneBookList=AT_COM_PHONEBOOK_NOTHING_ASKED; statusSMSList=AT_COM_SMS_NOTHING_ASKED; lastError=0 ; #if defined(DEV_DEBUG) && defined(DEBUG_MODULE_TAPI) Verbose( VERB_LEV_DEBUG, "%s: New CFWManager successfully created for >%s<\n",DEBUG_MODULE_TAPI, deviceS) ; else Verbose( VERB_LEV_DEBUG, "%s: New CFWManager creation failed for >%s<\n",DEBUG_MODULE_TAPI, deviceS) ;#else // ifdef DEV_DEBUG ;#endif // def DEV_DEBUG // Set some initial values newCallId=CALL_ID_UNKNOWN; newCalltId=CALL_ID_UNKNOWN; callTidList=XNEW(SmallArrayList)(5); messagesTranslations = XNEW(SmallArrayList)(30); }void CFWManager::setGContext(GContext* newGContext)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -