?? cfwmanager.h
字號:
/***************************************************************************
CFWManager.h -
-------------
begin : Tue Mar 3 2004
copyright : (C) 2004 by DigitalAirways
email : info@digitalairways.com
***************************************************************************/
/*
* Copyright (c) 2003-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 licence.txt file included
* in this software package.
*
* $Id: CFWManager.h,v 1.53 2007-04-24 15:04:33 charles.gorand Exp $
*
**************************************************************
* TODO
**************************************************************
**************************************************************
* HISTORY
**************************************************************
-
**************************************************************
* RELEASE NOTES
**************************************************************
*/
#ifndef __CFWManager__
#define __CFWManager__
#define CFWManager_BUILD "48-HEAD"
#define CFWManager_DEV "0"
extern "C"
{
#include "CFW.h"#include "EVENT.h"
#include "cswtype.h"
#include "sul.h"
}
#include <stdio.h> // For sprintf...
#include "KIDEfines.h"
#include "EB_Utils.h"
#include "EB_GContext.h"
#include "KR_Messages.h"
#include "EB_Layout.h"
#include "EB_Slicer.h"
#include "EBO_Services.h"
class CFWManager ;
#define CFW_NW_UTI 0
#define CFW_SIM_UTI 1
#define CFW_SMS_UTI 2
#define HAVE_CFW_MGR 1
/* K1Z to make dynamic */
#define TMP_COMMAND_BUFFER 5000
#define MAX_PARSE_PHONE_INFO 100
/* Default Timeout at 10 secondes. */
// #define AT_COMMANDER_DEFAULT_TIMEOUT 3000
// CG : only one timeout !!!
#define AT_COMMANDER_DEFAULT_TIMEOUT COMMAND_DEF_TIMEOUT
#define POLL_FREQUENCY 500 /* Polling frequency for the sliced function */
#include "TAPIManager.h"
// Width and Height of command_list tab.
#define TAPI_COMMAND_LIST_WIDTH 5
#define TAPI_COMMAND_LIST_HEIGHT 10
// K1Z: please document these symbols
#define COMMAND_LIST_ENUM 0
#define COMMAND_LIST_CODE 1
#define COMMAND_LIST_PARAM 2
#define COMMAND_LIST_AT_COM 3
#define COMMAND_LIST_USER 4
#define AT_INMSG_OK 0
#define AT_INMSG_UNKNOWNTYPE 1
#define AT_INMSG_UNKNOWNFORMAT 2
#define AT_INMSG_UNIMPLEMENTED 3
static const char* barringCodes[] = {
"AO", // TAPI_SS_BARRING_OUT
"OI", // TAPI_SS_BARRING_OUT_TO_INTL
"OX", // TAPI_SS_BARRING_OUT_TO_INTL_BUT_HOME
"AI", // TAPI_SS_BARRING_INC
"IR", // TAPI_SS_BARRING_INC_ROAMED
"AB", // TAPI_SS_BARRING_CANCEL_ALL
"AG", // TAPI_SS_BARRING_CANCEL_ALL_OUT
"AC" // TAPI_SS_BARRING_CANCEL_ALL_INC
} ;
#define AT_COM_PHONEBOOK_NOTHING_ASKED 0
#define AT_COM_PHONEBOOK_ASK_NUMBER_OF_CONTACTS 1
#define AT_COM_PHONEBOOK_ASK_CONTACTS 2
#define AT_COM_PHONEBOOK_RECEIVING_CONTACT 3
#define AT_COM_SMS_NOTHING_ASKED 0
#define AT_COM_SMS_LIST_ASKED 1
#define AT_COM_SMS_LIST_RECEIVING 2
void CFWManager_sliced_poller(EBSliceMsgs* slicer,GContext* gContext,void* context,int msgComplete,int actComplete, unsigned long option);
typedef int (*commandFMHandler)(CFWManager*, char**) ;
struct commandDescriptor {
int commandID;
char* commandString;
char commandFormat;
} ;
struct commandFMDescriptor {
char* commandString;
commandFMHandler commandHandler;
} ;
class ModemManager;
class CFWManager : public TAPIManager {
public:
int modemManuf; // Modem manufacturer. This allows to define some modem's specific behaviours.
char* tmpBuffer;
int currentBufferLen;
// These attributes may be used to manage multiple lines unsollicited command
// They may be both resetted by ack'ing commands (OK, ERROR,...)
int waitedLines; // Total number of lines to wait
int lastLine ; // Number of the last line read
KALEIDO_TIME_TYPE lastGeneralStatusRefresh; // Time of the last request to refresh the general status
// Check private data
// Used to store the SS' reason of the current call.
// This is unfortunately necessary because the answers to status requests do not contain the reason specified in the request.
int currentSSReason ;
private:
ModemManager* modem;
EBSliceMsgs* slicer;
char deviceS[20]; // This string is used to
char initialPIN[MAX_PIN_LEN]; // This is the PIN code declared at instanciation
// This default command handler is the one that is
// called when there is no more specific handler.
commandFMHandler defaultCommandHandler;
/* Contain the list of SIM contact during receiption. */
SmallArrayList* temporaryPhoneBookList;
/* This boolean is set to true when temporaryPhoneBookList->size() > 0
and message OK is recceived from Modem. */
boolean isPhoneBookListReceived;
/* This int allows to know if there is no contact in sim. When it
sets to 1, it's mean we have ask the list. If msgOK is catch it is set to 2, or 0 on
msgERROR. If msgOK is catch instead of msgCPBR, and askPhoneBookList=2,
that's mean there is no contact in SIM.*/
int askPhoneBookList;
/* This int allow to know the status of getting all SMS process. */
int statusSMSList;
SmallArrayList* temporarySMSList;
SmallArrayList* messagesTranslations; /* each entry is composed by 3 long : plateformMessage, krebMessageOK and krebMessageError */
public:
SmallArrayList* callTidList;
int newCallId;
int newCalltId;
private:
boolean extractLineFromCurrentBuffer(char* commandData, int* commandLen);
void processFMData(char* inData, int inLen, boolean reset=false) ;
boolean fetchPDU_SMS(char* status, char* alpha, char* msglen, char* buffer);
void addUnreadSMS(char* queryString) ;
void setDivert(int reason, int action, char* number, int delay, int classX ,unsigned long newMsgOK, unsigned long newMsgERROR, KALEIDO_TIME_TYPE timeout);
void manageDivert(int reason, char* propertyName, boolean forceWrite, unsigned long newMsgOK, unsigned long newMsgERROR, KALEIDO_TIME_TYPE timeout);
void setBarring(int reason, int action, char* password, char* newPassword,int classX, unsigned long newMsgOK, unsigned long newMsgERROR, KALEIDO_TIME_TYPE timeout);
void manageBarring(int reason, char* propertyName, boolean forceWrite, unsigned long newMsgOK, unsigned long newMsgERROR, KALEIDO_TIME_TYPE timeout);
int setMesssageTranslation(long platformMessage, long krebMessageOK, long krebMessageErr);
int notifyMMI(long platformMessage, boolean ok);
/* allow process specials actions */
void ackCurrentCommand(int status);
/**
* Allow to handle updateProperty depending on module
* @return the same things as updateProperty. If it returns not implemented it means that
* the function is not available in this function.
*/
int update_call_property(char* propertyName, boolean forceWrite=false, unsigned long newMsgOK=0l, unsigned long newMsgERROR=0l,KALEIDO_TIME_TYPE timeout=COMMAND_DEF_TIMEOUT);
// This is used to define the type of current STK request.
// The possible value are STK_TYP_***
int stkCurrentType ;
public:
DEFINE_NEW(CFWManager);
DEFINE_DELETE(CFWManager) ;
CFWManager(char* newPinCode, char* newServer, int newPort=0);
virtual ~CFWManager() ;
void setGContext(GContext* newGContext);
//******************************************
//***** B: public TAPIManager's methods
//******************************************
/*
* This function allows to request the update of a property. This update induces a synchronisation between the modem (or any equivalent device)
* and the values known in the global store.
* propertyName : a string containing the name of the concerned property. Please use the TAPI_** constants defined in TAPIManager.h
* forceWrite : ==false -> the value currently used by the device must update the one known in the global store
* !=false -> the value currently known in the global store must update the one used in the device
* newMsgOK : !=0 -> if the update is correctly processed, this action will be sent
* newMsgERROR : !=0 -> if the update is NOT correctly processed, this action will be sent
* timeout : the update must be processed in a maximum delay of "timeout" milliseconds. When this delay is reached, the update is considered as failed.
* BEWARE: in this case, there is no guaranty that the value known in the global store is synchronized with the one used by the modem
*
* This function may return:
* TAPI_PROPERTY_AVAILABLE : The property is available and accurate
* TAPI_PROPERTY_REFRESHING : The property is being refreshed
* TAPI_PROPERTY_UNIMPLEMENTED : The property is not yet implemented
* TAPI_PROPERTY_UNKNOWN : The property is unknown
*
*/
virtual int updateProperty(char* propertyName, boolean forceWrite=false, unsigned long newMsgOK=0l, unsigned long newMsgERROR=0l,KALEIDO_TIME_TYPE timeout=COMMAND_DEF_TIMEOUT);
virtual void initialize();
//******************************************
//**** Generale purpose methods
virtual KALEIDO_TIME_TYPE poll(boolean reset=false, char* inData=NULL, int inLen=0);
virtual void test(int testNum, char* message) ;
//******************************************
//**** Access to internal states
//******************************************
//***** E: public TAPIManager's methods
//******************************************
public: // These method are supposed to be used only by xxManagers sub-classes
//**** Access to managers sub-classes
ModemManager* getModemManager() { return modem; }
//**** Main AT commands encapsulation ******
int testATCommand();
private:
/*
* Returns an array of char*. The first one that is NULL may be used to know
* the array's size.
*/
char** parsePhoneInfo(char* curScan) ;
/*
* This method is used to parse the messages and to update the status variables.
*/
void processMessage(char* msg);
public:
/*
* Returns the number of strings contained in the array rslt, considering the fact
* that the first empty element is the end of the array.
*/
int stringArrayLength(char** rslt);
int getCurrentSTKType() { return stkCurrentType; }
void setCurrentSTKType(int val) {stkCurrentType=val;getContext()->replaceIntData(TAPI_STK_STATUS,val); }
/********************************
****** FM commands processing **
**********$*********************/
// Final result codes
int msg_ATI(char** args); // Receive the modem's identification. BEWARE: this command is not prefixed
int msgOK(char** args); // Acknowledges correct execution of a command line
int msgPrompt(char** args); // More data needed...
int msgERROR(char** args); // Command not accepted
int msgCME_ERROR(char** args); // Error from GSM 07.05 commands
int msgCMS_ERROR(char** args); // Error from SMS commands (07.07).
int msgBUSY(char** args); // Busy signal detected
int msgNO_ANSWER(char** args); // Connection completion timeout
int msgNO_CARRIER(char** args); // Connection terminated
int msgCONNECT_SPEECH(char** args); // Outgoing call accepted
// Unsolicited result codes
int msgRING(char** args); // Incoming call signal from network
int msgCMTI(char** args); // Incoming message stored in <mem> ("SM") at location <index>
int msgCMT(char** args); // Incoming message directly displayed
int msgCDS(char** args); // SMS status report after sending a SMS
int msgCCCM(char** args); // Current Call Meter value
int msgCKEV(char** args); // Key press or release
int DoCallWaiting(CFW_EVENT * pCFW); // Call Waiting number
int DoCallForwarding(CFW_EVENT * pCFW);
int msgCLIP(char** args); // Incoming Call Presentation
int msgCLIR(char** args); // Outgoing Call Presentation
int msgCREG(char** args); // Network registration indication
int msgCRING(char** args); // Incoming call type (VOICE, FAX ...)
#ifdef MODEM_TYPE_WAVECOM
int msgWIND(char** args); // (specific) Specific unsolicited indication (SIM Insert/Remove, End of init, Reset, Alerting, Call creation/release)
#endif // def MODEM_TYPE_WAVECOM
int msgCSQ(char** args); //
int msgCSSI(char** args); // Supplementary service notification during a call setup
// Intermediate result codes
int msgCOLP(char** args); // Outgoing Call Presentation
int msgCR(char** args); // Outgoing Call report control
int msgILRR(char** args); // Local TA-TE data rate
int msgCONNECT(char** args);// Data connection at xxxxx bauds
int msgCSSU(char** args); // Supplementary service notification during a call
// Request result codes
int msgCBC(char** args); //
int msgCPAS(char** args); //
int msgCPIN(char** args); //
int msgCPBR(char** args); //
int msgCRTC(char** args); //
int msgCMGR(char** args); //
int msgCMGL(char** args); //
int msgCPMS(char** args); //
int msgCMGF(char** args); //
int msgCOPS(char** args); //
// For USSD manager
int msgCUSD(char** args);
int msgCCFC(char** args);
int msgCLCK(char** args);
int msgCOLR(char** args);
int msgCLCC(char** args);
int msgCPBS(char** args);
// For STK manager
#ifdef MODEM_TYPE_SE /* This is a Sony Ericsson modem */
int msgSTKM(char** args);
int msgSTKL(char** args);
int msgSTKI(char** args);
int msgSTKTO(char** args);
int msgSTKC(char** args);
int msgSTKE(char** args);
#endif // def MODEM_TYPE_SE /* This is a Sony Ericsson modem */
#ifdef MODEM_TYPE_MXC /* This is a MXC modem */
// int MXC_STKphase;
// boolean MXC_getAlphaText(char* inText, char* gsKey, int requestType);
// boolean MXC_getOptionText(char* inText, char* gsKey);
// int msgGSTK(char** args);
#endif // def MODEM_TYPE_MXC /* This is a MXC modem */
private:
virtual UINT32 DispatchEvent(COS_EVENT *pEvent){ return 0;};
UINT32 DoCfwInit(CFW_EVENT* pEvent);
UINT32 DispatchCfwEvent(CFW_EVENT* pEvent);
UINT32 DispatchPMEvent(COS_EVENT* pEvent);
UINT32 DoCallEventProc(CFW_EVENT* pEvent);
UINT32 DoSpeechCallInd(CFW_EVENT* pEvent);
UINT32 DoSmsEventProc(CFW_EVENT* pEvent);
VOID OperatorId2Plmn(UINT8 *OperatorId, UINT32 *plmn);
UINT32 DoSsEventProc(CFW_EVENT* pEvent);
} ;
#endif
// ndef __CFWManager__
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -