| /************************************************************************** | |
| * | |
| * Copyright (c) 2013 ZTE Corporation. | |
| * | |
| *************************************************************************** | |
| * Ä£ ¿é Ãû : CC | |
| * ÎÄ ¼þ Ãû : Cc_main.h | |
| * Ïà¹ØÎļþ : | |
| * ʵÏÖ¹¦ÄÜ : ATÃüÁî´¦ÀíÄ£¿éºê¡¢ÀàÐͶ¨Òå | |
| * ×÷ Õß : | |
| * °æ ±¾ : | |
| * Íê³ÉÈÕÆÚ : | |
| * ÆäËü˵Ã÷ : | |
| **************************************************************************/ | |
| /************************************************************************** | |
| * Ð޸ļǼ : | |
| ***************************************************************************/ | |
| /************************************************************************** | |
| * Ð޸ıàºÅ : | |
| * ÐÞ ¸Ä ÈË : | |
| * ÐÞ¸ÄÈÕÆÚ : | |
| * ÐÞ¸ÄÄÚÈÝ : | |
| **************************************************************************/ | |
| #ifndef _CC_MAIN_H | |
| #define _CC_MAIN_H | |
| /************************************************************************** | |
| * #includeÇø | |
| **************************************************************************/ | |
| #include "message.h" | |
| #include "softap_api.h" | |
| #include "cc_proc.h" | |
| #include "slic_type.h" | |
| #include "slic_inf.h" | |
| #include <time.h> | |
| #include "libzte_log.h" | |
| #ifndef TEST_CCAPP | |
| #include "sys/ipc.h" | |
| #include "signal.h" | |
| #endif | |
| #ifdef _OS_TOS | |
| #include "osa_api.h" | |
| #include "oss_api.h" | |
| #endif | |
| /************************************************************************** | |
| * ³£Á¿¶¨ÒåÇø | |
| **************************************************************************/ | |
| typedef enum | |
| { | |
| ZCCAPP_TIMER_HOOKOFF_DETECT, /*Õª»úºóµÈ´ý²¦ºÅ¶¨Ê±Æ÷*/ | |
| ZCCAPP_TIMER_DTMF_DETECT, /*²¦ºÅ¼ä¸ô¶¨Ê±Æ÷*/ | |
| ZCCAPP_TIMER_BUSYTONE_DETECT, /*æÒô¶¨Ê±Æ÷*/ | |
| ZCCAPP_TIMER_TKYTONE_DETECT, /*æÒôºóµÄÐ¥½ÐÒô¶¨Ê±Æ÷*/ | |
| ZCCAPP_TIMER_SSDIALTONE_DETECT, /*²¹³äÒµÎñ²Ù×÷ʱÊÕµ½flashºóÆô²¦ºÅÒô¶¨Ê±Æ÷*/ | |
| ZCCAPP_TIMER_HOOKOFF_IDLE, | |
| }T_zCc_TimerEv; | |
| typedef enum | |
| { | |
| ZCCAPP_ATIND_DSCI, | |
| ZCCAPP_ATIND_ZCPI, | |
| ZCCAPP_ATIND_IMSPLUS, | |
| ZCCAPP_ATIND_MODE | |
| }T_zCc_AtIndEv; | |
| #define ZCCAPP_TIMER_HOOKOFF_INTERVAL 10000 | |
| #define ZCCAPP_TIMER_DTMF_INTERVAL 5000 | |
| #define ZCCAPP_TIMER_BUSYTONE_INTERVAL 7000 | |
| #define ZCCAPP_TIMER_TKYTONE_INTERVAL 60000 | |
| #define ZCCAPP_TIMER_HOOKOFF_IDLE_INTERVAL 500 | |
| /* | |
| * Number of slaves per master. | |
| * Two slaves are required for 3-party calls. | |
| */ | |
| #define ZCC_SLAVES 8 | |
| #define ZCC_MAXCID 7 | |
| #define ZCC_MINCID 1 | |
| #define ZDIAL_NUM_MAX 48 | |
| #define ZCC_AT_CHNL_ID 70 | |
| #define ZCC_FLASH_SIGN ('F') | |
| #define ZCC_TIMEOUT_SIGN ('T') | |
| /* | |
| * Define how focus flag in master state machine is interpreted. | |
| * XXX: Extend this for more than 3-party calls. | |
| */ | |
| #define ZCC_FOCUS_0 (1 << 0) | |
| #define ZCC_FOCUS_1 (1 << 1) | |
| #define ZCC_FOCUS_2 (1 << 2) | |
| #define ZCC_FOCUS_PSTN (1 << 3) | |
| #define ZCC_FOCUS_BOTH (ZCC_FSM_FOCUS_0 + ZCC_FSM_FOCUS_1) | |
| /* | |
| * Various timeouts. | |
| * These timeouts are in units of ZCC_TIMER_E. | |
| */ | |
| #define ZCC_BSYTMO (7000) /* Timeout in busy tone state */ | |
| #define ZCC_TKYTMO (60000) /* Timeout in turkey tone state */ | |
| //#define ZCC_FBSYTMO (40000) /* Timeout in fast busy tone state */ | |
| #define ZCC_DACCMTMO (5000) /* Timeout (interdigit) in daccm state */ | |
| #define ZCC_DTTMO (10000) /* Timeout in dialtone state */ | |
| #define ZCC_RSTTMO (10) /* Timeout in master reset state */ | |
| #define ZCC_RELTMO (10) /* Timeout in master release state */ | |
| #define ZCC_RINGTMO (10) /* Timeout in master ringing state */ | |
| #define ZCC_SEIZETMO (10) /* Timeout in master seize state */ | |
| #define ZCC_RBTMO (40) /* Timeout in ringback state */ | |
| #define ZCC_DIALTMO (30) /* Timeout in dial state */ | |
| #define ZCC_PSTNSWTMO (5) /* Timeout in pstn switching state */ | |
| #define ZCC_INTERDIGITSHORT (5) /* Timeout (interdigit short) in daccm state*/ | |
| #define ZCC_WAIT_RESOURCETMO (8) /* Timeout in waiting for resource state */ | |
| /* Define digits match results. */ | |
| #define ZCC_NO_RESULT (0x00) /* need more digits */ | |
| #define ZCC_CALL (0x01) /* all digits collected */ | |
| #define ZCC_BAOC_REG (0x10) | |
| #define ZCC_BAOC_DEREG (0x11) | |
| #define ZCC_BOIC_REG (0x12) | |
| #define ZCC_BOIC_DEREG (0x13) | |
| #define ZCC_CFU_REG (0x20) | |
| #define ZCC_CFU_DEREG (0x21) | |
| #define ZCC_CFNRY_REG (0x22) | |
| #define ZCC_CFNRY_DEREG (0x23) | |
| #define ZCC_CFB_REG (0x24) | |
| #define ZCC_CFB_DEREG (0x25) | |
| #define ZCC_FLASH_1 (0x30) /* Release all active call and accept the other(held or waiting) call */ | |
| #define ZCC_FLASH_2 (0x31) /* Place all active call on hold and accept the other(held or waiting) call */ | |
| #define ZCC_FLASH_3 (0x32) /* Adds a held call to the conversation */ | |
| #define ZCC_FLASH_4 (0x33) /* call transfer */ | |
| #define ZCC_FLASH_0 (0x34) /* release waiting call */ | |
| #define ZCC_LOCAL_TEST_CALL (0xFF-1) | |
| #define ZCC_MATCHERR (0xFF) /* wrong input */ | |
| /* Define master state machine states. */ | |
| typedef enum { | |
| ZCC_M_RELEASE_S = 0, | |
| ZCC_M_RINGING_S = 1, | |
| ZCC_M_SEIZE_S = 2 | |
| } T_zCc_MasterState; | |
| /* Define slave state machine states.˳Ðò²»¿Éµ÷Õû */ | |
| typedef enum { | |
| ZCC_S_IDLE_S = 0, | |
| ZCC_S_DT_S , | |
| ZCC_S_DACCM_S , | |
| ZCC_S_DIALING_S , | |
| ZCC_S_RINGBACK_S ,// Ö÷½Ð¹ý³ÌÖеÄÕñÁå̬ | |
| ZCC_S_BSYT_S , | |
| ZCC_S_TKYT_S , | |
| ZCC_S_SIL_S , | |
| ZCC_S_TALKING_S , | |
| ZCC_S_TRYING_S , | |
| ZCC_S_WAIT_RESOURCE_S , | |
| } T_zCc_SlaveState, T_zCc_CallState; | |
| /* Define known tone types. */ | |
| typedef enum { | |
| ZCC_TONE_OFF_A = 0, | |
| ZCC_TONE_SIL_A = 1, | |
| ZCC_TONE_RB_A = 2, | |
| ZCC_TONE_BSY_A = 3, | |
| //ZCC_TONE_FBSY_A = 4, | |
| ZCC_TONE_TKY_A = 5, | |
| ZCC_TONE_DIAL_A = 6, | |
| ZCC_TONE_CIDCW_A = 7, | |
| }T_zCc_Tone; | |
| /* Define known messages to SIP. */ | |
| typedef enum { | |
| ZCC_SNO_M = 0, | |
| ZCC_SBUSY_M = 1, /* When this node is busy */ | |
| ZCC_SANS_M = 2, /* When this node answered */ | |
| ZCC_SINV_M = 3, /* When to invite the other node */ | |
| ZCC_SREG_M = 4, /* When to register */ | |
| ZCC_SDISCN_M = 5, /* When this node disconnected */ | |
| ZCC_SRING_M = 6, /* When this node starts ringing */ | |
| ZCC_SRBANS_M = 7, /* When the other node answered */ | |
| ZCC_SHOLD_M = 8, /* When the other node is put on hold */ | |
| ZCC_SREINV_M = 9, /* When the other node is put off hold */ | |
| ZCC_SMEDIA_M = 10, /* When a media message is received */ | |
| ZCC_SDIGITS_M = 18, /* When a digits timeout occurs */ | |
| ZCC_SDTMF_M = 19, /* When a DTMF relay occurs */ | |
| ZCC_SRING_RSRC_READY_M = 119, /* When this mode start ringing for resource ready */ | |
| } T_zCc_SResp; | |
| /************************************************************************** | |
| * Êý¾Ý½á¹¹¶¨ÒåÇø | |
| **************************************************************************/ | |
| typedef struct | |
| { | |
| UINT8 curCmd; | |
| UINT8 curAtCmdSrc; | |
| }T_zCc_CurAtCmdInfo; | |
| /* Slave state machine object. */ | |
| typedef struct { | |
| T_zCc_SlaveState state; /* This slave's state */ | |
| T_zCc_SlaveState old_state; | |
| T_zCc_Tone tone; /* What tone to play */ | |
| T_zCc_SResp sMsg; /* Action for SIP */ | |
| UINT8 heldcall; /* When 1, the call is in held state */ | |
| UINT16 confcall; /* When 1, the call is in conference */ | |
| UINT8 waitDSCI6; /* hookon,wait DSCI6 */ | |
| UINT8 cid; /* call id */ | |
| UINT16 idle_second; /*if hookoff but no key is down, this var show the time for waiting key to input */ | |
| CHAR number[ZDIAL_NUM_MAX]; | |
| UINT8 is_callout; | |
| UINT8 is_cidcw; | |
| } T_zCc_SlaveObj; | |
| /* Master state machine object. */ | |
| typedef struct { | |
| T_zCc_MasterState state; /* This master's state */ | |
| T_zCc_SlaveObj slaveObj[ZCC_SLAVES]; | |
| USHORT evt[ZCC_SLAVES]; | |
| // UINT8 focus; /* Which slave in focus */ | |
| UINT8 mode; /* Current mode */ | |
| UINT8 chupSent; | |
| UINT8 ringCid; /* Ring the phone */ | |
| UINT8 resourceReady; /* ZCPI: x,5 received */ | |
| UINT8 dCount; /* Collected DTMF digits string */ | |
| CHAR digits[ZDIAL_NUM_MAX];// dialled number | |
| CHAR number[ZDIAL_NUM_MAX];// calling number | |
| UINT8 confNum; /* total conference number */ | |
| E_CC_APP_AtReqCmdId curAtCmdId; | |
| UINT8 hookofffg; | |
| UINT8 actCallNum; /* total active call number */ | |
| UINT8 lastTone; | |
| UINT8 waitchldresult; | |
| T_zCc_MasterState old_state; | |
| } T_zCc_MasterObj, T_zCc_CallDetail; | |
| extern T_zCc_CallDetail g_Cc_CallDetail; | |
| extern T_zCc_CurAtCmdInfo *g_Cc_AtIndRspMsg; | |
| //typedef VOID (*zCc_SlicEvFunc)(UINT8 Para); | |
| VOID zCc_SendMsgToSub(MSG_BUF *pMsg); | |
| int zCc_sleep(long ms); | |
| VOID zCc_SendMsgToRspSub(MSG_BUF *pMsg); | |
| #endif | |