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

📄 tapimanager.h

📁 这是法国Kaleido公司提供了一个手机mmi设计平台
💻 H
字号:
/***************************************************************************
						TAPIManager.h  -  
						-------------
				begin                : Mon Aug 8 2004
				copyright            : (C) 2005 by DigitalAirways
				email                : info@digitalairways.com
***************************************************************************/

/*
* Copyright (c) 2003-2005 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.
*/



/*************************************************************
* TODO
**************************************************************


**************************************************************
* HISTORY
**************************************************************

-

**************************************************************
* RELEASE NOTES
**************************************************************


*/

#ifndef __TAPIMANAGER__
#define __TAPIMANAGER__

#define TAPI_VERSION "203"


#include "KEYS_TAPI.h"
#include "EB_Utils.h"

#define MAX_PIN_LEN	11 /* Max size of a PIN code + 1 */
#ifndef COMMAND_DEF_TIMEOUT
#define COMMAND_DEF_TIMEOUT 10000 /* milliseconds */
#endif

#define TAPI_OK							0
#define TAPI_ERROR						-1

#define SIP_TAPI					   "SIP_TAPI"
#define GSM_TAPI					   "GSM_TAPI"

extern const char* commands_list[];

class GContext;
class CommandSerializer;
class SmallArrayList;

class KREBDLIBS_API TAPIManager {
	protected: 
		char *lastError ;
		GContext* gContext;
		CommandSerializer* commandSerializer;
		// This counter is used to create calls' ID
		int lastCallID;
	public:
		/*
		 * The ownership of "value" is transferred to this method.
		 */
		void writeGlobalStore(char* key, void* value, int type);
		void* readGlobalStore(char* key);
		/*
		 * This function creates or resets a SmallArrayList referenced in the globla store under the key [gsKey]
		 * This SmallArrayList is supposed to contain strings that will be freed by SAFE_FREE() if needed.
		 *
		 *
		 */
		SmallArrayList* resetSmallArrayList(char* gsKey);
		/*
		 * This allows to extract a value from a queryString contained in a SmallArrayList containing 
		 * only queryStrings...
		 */
		char* getArgValByName(SmallArrayList*  sla, int strIndex, char* argName, char* bufOut);
		/*
		 * To allow both the previous one and the global one to be used without to bother with the namespace.
		 */
		char* getArgValByName(char* queryString, char* argName, char* bufOut);
		/*
		 * Refresh the current page
		 */
		void refreshCurrentPage();
		
		int getNextCallID();
		
	public:
		virtual void setGContext(GContext* newGContext);
		GContext* getGContext();
		GContext* getContext();
	public:
		DEFINE_NEW(TAPIManager);
		DEFINE_DELETE(TAPIManager) ;		
		TAPIManager(char* /*newPinCode*/, char* /*newServer*/, int /*newPort*/=0);
		virtual ~TAPIManager();

		
		//******************************************
		//**** Pure abstract methods
		//
		virtual void initialize()=0;
		virtual int updateProperty(char* propertyName, boolean forceWrite=false, unsigned long newMsgOK=0l, unsigned long newMsgERROR=0l, KALEIDO_TIME_TYPE timeout=COMMAND_DEF_TIMEOUT)=0;
		//******************************************
		//**** Overridable methods
		//
		virtual CommandSerializer* getCommandSerializer() { return commandSerializer;}
		virtual KALEIDO_TIME_TYPE poll(boolean reset=false, char* inData=NULL, int inLen=0)=0 ;
		virtual char* getLastError();
		virtual void dumpState();
		virtual void test(int /*testNum*/, char* /*message*/);
	protected:
		/* This functions is used to launch sliced functions. */
		virtual void initSlicedFuctions(){/*Do nothing by default*/}
		//******************************************
		//**** Basic helpers
		//
	public:
		int setAndUpdateProperty(char* propertyName, char* value, unsigned long newMsgOK=0l, unsigned long newMsgERROR=0l, KALEIDO_TIME_TYPE timeout=COMMAND_DEF_TIMEOUT);
		int setAndUpdateProperty(char* propertyName, int value, unsigned long newMsgOK=0l, unsigned long newMsgERROR=0l, KALEIDO_TIME_TYPE timeout=COMMAND_DEF_TIMEOUT);
		int setAndUpdateProperty(char* propertyName, SmallArrayList* value, unsigned long newMsgOK=0l, unsigned long newMsgERROR=0l, KALEIDO_TIME_TYPE timeout=COMMAND_DEF_TIMEOUT);


#if defined(DEV_DEBUG) && defined(DEBUG_MODULE_TAPI)

		char* getStateString(char* state);
			
		/*
		 * This function may used to print the details of a call from a descriptive querystring
		 */
		void dumpCallInfo(char* qString);
		/*
		 * This function may used to print the list of the calls currently known by the TAPIManager
		 */
		void dumpCallsList(void);
#endif // def DEV_DEBUG

		/*
		 * This function creates a new call and returns its index in the list. 
		 * If call_ID==CALL_ID_UNKNOWN (-1), the function creates its own ID by incrementing the TAPIManager's counter called lastCallID.
		 * The ownership of the strings that are provided as arguments is not transferred to this function
		 */
			int createNewCall( SmallArrayList* callsList,int call_ID, int call_TID, char* call_STATE, int call_PROTOCOL, char* call_PTYPE, char* call_EXTURI, char* call_EXTNAME, char* call_INTURI, char* call_INTNAME,/*KALEIDO_TIME_TYPE*/ int call_START, int call_INOUT);

		/*
		 * This function allows to get the queryString describing a call by its index
		 * in the SmallArrayList TAPI_CALLS_LIST.
		 * It return the queryString or NULL if the index does not exist
		 */
		char* getCallInfoQByIndex(SmallArrayList* callsList, int index);
		

		/*
		 * This function allows to retrieve in the SmallArrayList TAPI_CALLS_LIST the index 
		 * of queryString describing a call by the presence of 1, 2 or 3 strings.
		 * It returns CALL_ID_UNKNOWN (-1) if at least one of these strings is not found.
		 */
		int getCallInfoIndexByContent(SmallArrayList* callsList,char* pattern1, char* pattern2=NULL, char* pattern3=NULL);
		
		/*
		 * This function allows to retrieve in the SmallArrayList TAPI_CALLS_LIST the index 
		 * of queryString describing a call from the value of one of its fields.
		 * It returns CALL_ID_UNKNOWN (-1) if the field or the value is not found.
		 */
		int getCallInfoIndexByValue(SmallArrayList* callsList,char* keyName, char* keyValue);
		
		/*
		 * This function allows to retrieve the queryString describing a call from the value
		 * of one of its fields..
		 * The ownership of the string that is returned is not transferred to the caller.
		 * Warning : searching a queryString using this method may take time. Try to keep
		 * a reference on the returned string that is supposed to be stable as long as its
		 * content is not modified.
		 * It returns NULL  if the field or the value is not found.
		 */
		char* getCallInfoQStringByValue(SmallArrayList* callsList,char* keyName, char* keyValue);
		/*
		 * This function allows to retrieve in the SmallArrayList TAPI_CALLS_LIST the index 
		 * of queryString describing a call from its ID.
		 * It returns CALL_ID_UNKNOWN (-1) if the ID is not found.
		 */
		int getCallInfoIndexByID(SmallArrayList* callsList,char* call_ID);
		/*
		 * This function allows to retrieve the queryString describing a call from its ID.
		 * The ownership of the string that is returned is not transferred to the caller.
		 * Warning : searching a queryString using this method may take time. Try to keep
		 * a reference on the returned string that is supposed to be stable as long as its
		 * content is not modified.
		 * It returns NULL if the ID is not found.
		 */
		char* getCallInfoQStringByID(SmallArrayList* callsList,char* call_ID);
		/*
		 * This function allows to get any individual field of a call known by its ID.
		 * The value is copied into the buffer tmp.
		 * It returns a pointer to tmp or NULL if the ID is not found or if the field is not defined.
		 */
		char* getCallValueByID(SmallArrayList* callsList, char* call_ID, char* tmp, char* fieldName);
		/*
		 * This function allows to get any individual field of a call known by the value of one of its fields.
		 * The value is copied into the buffer tmp.
		 * It returns a pointer to tmp or NULL if the key's value is not found or if the field is not defined.
		 */
		char* getCallValueByValue(SmallArrayList* callsList, char* keyName, char* keyValue, char* tmp, char* fieldName);
		/*
		 * This function allows to set any individual field of a call description.
		 * It returns a pointer to the newly created qString containing the new values.
		 * NOTES: 
		 *    - the original qString is NOT deleted
		 *    - the ownership of the newly created string is transferred to the caller
		 *    - if the field that is set is not a standard field, it will be created.
		 */
		char* setCallValue( char *qString, char* fieldName, char* fieldValue);

		/*
		 * This function allows to set any individual field of a call description from
		 * its index in TAPI_CALLS_LIST
		 * It returns a pointer to the newly created qString containing the new values.
		 * NOTES: 
		 *    - the original qString is NOT deleted
		 *    - the ownership of the newly created string is transferred to the caller
		 *    - if the field that is set is not a standard field, it will be created.
		 */
		char* setCallValueByIndex(SmallArrayList* callsList, int index, char* fieldName, char* fieldValue);

		/*
		 * This function allows to set any individual field of a call known by its ID.
		 * It returns a pointer to the qString containing the new values or NULL if the ID is not found.
		 * NOTE: if the field that is set is not a standard field, it will be created.
		 */
		char* setCallValueByID(SmallArrayList* callsList, char* inCall_ID, char* fieldName, char* fieldValue);

		/*
		 * This function allows to retrieve the index of the queryString describing an incoming call that
		 * is in the state CALL_STATE_RINGING for the specified protocol.
		 * If iDirection==CALL_INOUT_UNKNOWN, this criteria is not used.
		 * The ownership of the string that is returned is not transferred to the caller.
		 * It returns CALL_ID_UNKNOWN if the value is not found.
		 */
		int getCallInfoIndexByClass(SmallArrayList* callsList,char* sClass, int iProtocol, int iDirection=CALL_INOUT_UNKNOWN);
		} ;
	
extern TAPIManager* TAPIManagerCreator (char* newPinCode, char* newServer, int newPort);

#endif // ndef __TAPIMANAGER__

⌨️ 快捷键说明

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