📄 atrkfaxdlg.cpp
字号:
}
break;
//-----------------------------------------
case TRK_CHECK_FAX_PROCESS:
ch = m_ATrkCh[i].toFaxCh;
if(( m_ATrkCh[i].lineState == S_CALL_PENDING) || m_FaxCh[ch].Step == FAX_IDLE ) //off-line or end of sending/receiving fax
{
SsmStopTalkWith( i, ch );
if(m_ATrkCh[i].lineState == S_CALL_PENDING )
m_FaxCh[ch].OffLine = 1; // inform fax-channel disconnecting of line
m_ATrkCh[i].Step = TRK_HANGUP;
}
break;
case TRK_HANGUP:
SsmHangup(i);
SsmStopRecToFile(i);
m_ATrkCh[i].Step = TRK_IDLE;
break;
}
}
}
void CAtrkFaxDlg::myScanFaxCh()
{
CString strTemp,strName;
CFileFind cff;
int n,m;
CString str;
for( int i=0; i< m_nTotalCh; i++ )
{
if( SsmGetChType(i) != FAX_CH
&& SsmGetChType(i) != SOFTFAX_CH)
continue;
switch(m_FaxCh[i].Step)
{
case FAX_IDLE:
strcpy(m_FaxCh[i].Page,"");
strcpy(m_FaxCh[i].GetID,"");
if( m_FaxCh[i].Go )
{
m_FaxCh[i].Go = 0;
m_FaxCh[i].Step = FAX_START;
}
else
m_FaxCh[i].pChErrMsg[0] = '\0';
break;
case FAX_START:
if(m_FaxCh[i].Direction == C_SEND_FAX) // send a fax file
{
SsmFaxSetSendMode( i, m_AutoFaxMode );
if(m_FaxCh[i].Mode == 0) //0
{
//strcpy(szSendFaxFile , m_firstDlg.szSendPathFile);
m_FaxCh[i].bHaveStartPage = m_firstDlg.bHaveStartPage;
strcpy(m_FaxCh[i].szSendPathFile, m_firstDlg.szSendPathFile);
if(m_FaxCh[i].bHaveStartPage)
{
m_FaxCh[i].nStartPage = m_firstDlg.nStartPage;
m_FaxCh[i].nEndPage = m_firstDlg.nEndPage;
}
}
else if(m_FaxCh[i].Mode == 1) //1
{
m_FaxCh[i].bHaveStartPage = m_secondDlg.m_bHaveStartPage;
if(m_FaxCh[i].bHaveStartPage)
{
m_FaxCh[i].nStartPage = m_secondDlg.m_nStartPage;
m_FaxCh[i].nEndPage = m_secondDlg.m_nEndPage;
}
}
if(m_FaxCh[i].bHaveStartPage)
{
if( SsmFaxStartSendEx(i, m_FaxCh[i].szSendPathFile, m_FaxCh[i].nStartPage,m_FaxCh[i].nEndPage) == -1 ) //start sending fax file
{
SsmGetLastErrMsg(m_FaxCh[i].pChErrMsg);
m_FaxCh[i].Step = FAX_IDLE;
}
else
m_FaxCh[i].Step = FAX_CHECK_END;
}
else
{
if( SsmFaxStartSend(i, m_FaxCh[i].szSendPathFile) == -1 ) //start sending fax file
{
SsmGetLastErrMsg(m_FaxCh[i].pChErrMsg);
m_FaxCh[i].Step = FAX_IDLE;
}
else
m_FaxCh[i].Step = FAX_CHECK_END;
}
}
else // receive a fax file
{
if(m_nTabShow == 0)
{
strcpy(m_FaxCh[i].szRecPathFile,m_firstDlg.m_strRecPath.GetBuffer(m_firstDlg.m_strRecPath.GetLength()));
strcat(m_FaxCh[i].szRecPathFile,"\\");
if(m_bMultiFax) //多通道同时接收,文件名后加通道号
{
strTemp.Format("%s",m_firstDlg.m_strRecFile);
strTemp.TrimRight();
str = strTemp.Right(5);
m = str.GetLength();
n = str.Find('.');
str.Format("%d",i);
n = strTemp.GetLength() - m + n;
for(int jj=0;jj<str.GetLength();jj++)
strTemp.Insert(n+jj,str[jj]);
strcat(m_FaxCh[i].szRecPathFile,strTemp.GetBuffer(strTemp.GetLength()));
}
else
strcat(m_FaxCh[i].szRecPathFile,m_firstDlg.m_strRecFile.GetBuffer(m_firstDlg.m_strRecFile.GetLength()));
//myCreateFileName(m_FaxCh[i].fnRcvFaxFile,
}
else if(m_nTabShow == 2)
{
strcpy(m_FaxCh[i].szRecPathFile, m_thirdDlg.m_strRecPath.GetBuffer(m_thirdDlg.m_strRecPath.GetLength()));
strcat(m_FaxCh[i].szRecPathFile,"\\");
if(m_bMultiFax)
{
strTemp.Format("%s",m_thirdDlg.m_strRecFile);
strTemp.TrimRight();
str = strTemp.Right(5);
m = str.GetLength();
n = str.Find('.');
str.Format("%d",i);
n = strTemp.GetLength() - m + n;
for(int jj=0;jj<str.GetLength();jj++)
strTemp.Insert(n+jj,str[jj]);
strcat(m_FaxCh[i].szRecPathFile,strTemp.GetBuffer(strTemp.GetLength()));
}
else
strcat(m_FaxCh[i].szRecPathFile,m_thirdDlg.m_strRecFile.GetBuffer(m_thirdDlg.m_strRecFile.GetLength()));
//myCreateFileName(m_FaxCh[i].fnRcvFaxFile,
}
if( SsmFaxStartReceive(i, m_FaxCh[i].szRecPathFile) == -1 ) //start receiving fax file
{
SsmGetLastErrMsg(m_FaxCh[i].pChErrMsg);
m_FaxCh[i].Step = FAX_IDLE;
}
else
m_FaxCh[i].Step = FAX_CHECK_END;
}
break;
case FAX_CHECK_END:
_itoa(SsmFaxGetPages(i), m_FaxCh[i].Page, 10);
SsmFaxGetID(i, m_FaxCh[i].GetID);
if( m_FaxCh[i].OffLine ) // remote hangup
{
SsmFaxStop(i);
m_FaxCh[i].Step = FAX_CHECK_STOP;
}
else
{
m_FaxCh[i].ucCheckEnd = SsmFaxCheckEnd(i);
switch( m_FaxCh[i].ucCheckEnd )
{
case 1 :
WriteLog("发送传真成功");
m_FaxCh[i].Step = FAX_CHECK_STOP;
break;
case 2 :
if(SsmFaxGetPages(i) > 0 || SsmFaxGetSendBytes(i) >0)
{
WriteLog("发送传真失败 : 传真在页面阶段失败");
m_FaxCh[i].Step = FAX_CHECK_STOP;
}
else
{
if(m_FaxCh[i].Fax_Answered == 1)
{
WriteLog("发送传真失败 : 传真在握手阶段失败");;
}
else if(m_FaxCh[i].Fax_Answered == 0)
{
WriteLog("发送传真失败 : 对方未按\"开始\"键,发送超时");
}
}
break;
case 0 :
switch( SsmGetToneAnalyzeResult(m_FaxCh[i].nTrunkch) )
{
case 2 :
strcpy(m_FaxCh[i].pChErrMsg , "忙音");
SsmFaxStop(i);
m_FaxCh[i].Step = FAX_CHECK_STOP;
break;
case 8 :
m_FaxCh[i].Fax_Answered = 1;
break;
default :
break;
}
break;
case 3 :
switch( SsmGetToneAnalyzeResult(m_FaxCh[i].nTrunkch) )
{
case 2 :
strcpy(m_FaxCh[i].pChErrMsg , "OK");
SsmFaxStop(i);
m_FaxCh[i].Step = FAX_CHECK_STOP;
default :
break;
}
break;
case -1 :
SsmGetLastErrMsg( m_FaxCh[i].pChErrMsg );
m_FaxCh[i].Step = FAX_IDLE;
break;
}
}
break;
case FAX_CHECK_STOP:
m_FaxCh[i].Step = FAX_IDLE;
break;
}
}
}
void CAtrkFaxDlg::myUpdateChInfoList()
{
char newstat[250], oldstat[250];
char statemsg[100];
int nListIndex = 0;
for(int i=0; i<m_nTotalCh; i++)
{
if( SsmGetChType(i) != FAX_CH
&& SsmGetChType(i) != SOFTFAX_CH) continue;
if(m_AutoFaxMode == 0) strcpy(newstat,"普通");
else strcpy(newstat,"精细");
m_FaxChList.GetItemText( nListIndex, 1, oldstat, 29 );
if(strcmp(newstat,oldstat) != 0)
m_FaxChList.SetItemText( nListIndex, 1, newstat );
switch( m_FaxCh[i].Step )
{
case FAX_IDLE: strcpy(newstat, "空闲"); break;
case FAX_START: strcpy(newstat, "开始传真"); break;
case FAX_CHECK_STOP: strcpy(newstat, "停止传真"); break;
case FAX_CHECK_END:
if(m_FaxCh[i].Direction == 0) strcpy(newstat, "正在发送:");
else strcpy(newstat, "正在接收:");
if( SsmFaxGetChStateMsg(i , statemsg) != -1) strcat( newstat,statemsg);
break;
}
m_FaxChList.GetItemText(nListIndex, 2, oldstat, 29);
if(strcmp(newstat,oldstat) != 0)
m_FaxChList.SetItemText( nListIndex, 2, newstat);
m_FaxChList.GetItemText(nListIndex, 3, oldstat, 29);
if(strcmp(m_FaxCh[i].Page,oldstat) != 0)
m_FaxChList.SetItemText( nListIndex, 3, m_FaxCh[i].Page);
m_FaxChList.GetItemText(nListIndex, 4, oldstat, 50);
if(strcmp(m_FaxCh[i].GetID,oldstat) != 0)
m_FaxChList.SetItemText(nListIndex, 4, m_FaxCh[i].GetID);
if(m_FaxCh[i].Step != FAX_IDLE)
{
if(m_FaxCh[i].Direction ==0)
{
if(m_FaxCh[i].Mode == 0)
strcpy(newstat, m_FaxCh[i].szSendPathFile);
else if(m_FaxCh[i].Mode == 1)
strcpy(newstat , m_strManSendFaxFile);
}
else
strcpy(newstat,m_FaxCh[i].szRecPathFile);
m_FaxChList.GetItemText( nListIndex, 5, oldstat, 250 ); //display phone number
if(strcmp(newstat,oldstat) != 0)
m_FaxChList.SetItemText( nListIndex, 5, newstat );
}
m_FaxChList.GetItemText( nListIndex, 6, oldstat, 60 ); //display phone number
if(strcmp(m_FaxCh[i].pChErrMsg,oldstat) != 0)
m_FaxChList.SetItemText( nListIndex, 6, m_FaxCh[i].pChErrMsg );
m_FaxChList.GetItemText( nListIndex, 7, oldstat, 60 ); //display phone number
sprintf(newstat,"%d",m_FaxCh[i].ucCheckEnd);
if(strcmp(newstat,oldstat) != 0)
m_FaxChList.SetItemText( nListIndex, 7, newstat );
nListIndex++;
}
}
void CAtrkFaxDlg::myUpDateATrunkChListCtrl()
{
char newstat[250], oldstat[100];
int nListIndex = 0;
for(int i=0; i<m_nTotalCh; i++)
{
if( !m_ATrkCh[i].EnCalled ) continue;
switch(SsmGetChState(i))
{
case -1: wsprintf(newstat,"-1"); break;
case S_CALL_STANDBY: wsprintf(newstat,"空闲"); break;
case S_CALL_PICKUPED: wsprintf(newstat,"摘机"); break;
case S_CALL_RINGING: wsprintf(newstat,"振铃"); break;
case S_CALL_TALKING: wsprintf(newstat,"通话"); break;
case S_CALL_ANALOG_WAITDIALTONE: wsprintf(newstat,"WtDT"); break;
case S_CALL_ANALOG_TXPHONUM: wsprintf(newstat,"Dl.."); break;
case S_CALL_ANALOG_WAITDIALRESULT: wsprintf(newstat,"WtDl"); break;
case S_CALL_PENDING: wsprintf(newstat,"挂起"); break;
case S_CALL_OFFLINE: wsprintf(newstat,"断线"); break;
case S_CALL_WAIT_REMOTE_PICKUP: wsprintf(newstat,"回铃"); break;
case S_CALL_UNAVAILABLE: wsprintf(newstat,"不可用"); break;
case S_CALL_LOCKED: wsprintf(newstat,"呼出保留"); break;
case S_CALL_LocalBlock: wsprintf(newstat,"本地闭塞"); break;
case S_CALL_RemoteBlock: wsprintf(newstat,"对端闭塞"); break;
case S_CALL_Ss1InWaitPhoNum : wsprintf(newstat,"接收被叫"); break;
case S_CALL_Ss1InWaitFwdStop : wsprintf(newstat,"等待前向"); break;
case S_CALL_Ss1InWaitCallerID: wsprintf(newstat,"接收主叫"); break;
case S_CALL_Ss1InWaitKD : wsprintf(newstat,"接收KD"); break;
case S_CALL_Ss1InWaitKDStop : wsprintf(newstat,"等KD停发"); break;
case S_CALL_SS1_SAYIDLE : wsprintf(newstat,"发送示闲"); break;
case S_CALL_SS1WaitIdleCAS : wsprintf(newstat,"等待示闲"); break;
case S_CALL_SS1PhoNumHoldup : wsprintf(newstat,"S_CALL_SS1PhoNumHoldup"); break;
case S_CALL_Ss1InWaitStopSendA3p: wsprintf(newstat,"S_CALL_Ss1InWaitStopSendA3p"); break;
case S_CALL_Ss1OutWaitBwdAck : wsprintf(newstat,"等待后向占用证实信令”"); break;
case S_CALL_Ss1OutTxPhoNum : wsprintf(newstat,"发送被叫"); break;
case S_CALL_Ss1OutWaitAppendPhoNum: wsprintf(newstat,"号码不足"); break;
case S_CALL_Ss1OutTxCallerID : wsprintf(newstat,"发送主叫"); break;
case S_CALL_Ss1OutWaitKB : wsprintf(newstat,"等待KB"); break;
case S_FAX_ROUND : wsprintf(newstat,"状态转移过程中"); break;
case S_FAX_PhaseA : wsprintf(newstat,"呼叫建立"); break;
case S_FAX_PhaseB : wsprintf(newstat,"报文前处理"); break;
case S_FAX_SendDCS : wsprintf(newstat,"发送DCS信号"); break;
case S_FAX_Train : wsprintf(newstat,"传输训练"); break;
case S_FAX_PhaseC : wsprintf(newstat,"报文传输"); break;
case S_FAX_PhaseD : wsprintf(newstat,"报文后处理"); break;
case S_FAX_NextPage: wsprintf(newstat,"传输下页"); break;
case S_FAX_AllSent : wsprintf(newstat,"传输结束"); break;
case S_FAX_PhaseE : wsprintf(newstat,"呼叫释放"); break;
case S_FAX_Reset : wsprintf(newstat,"复位猫"); break;
case S_FAX_Init : wsprintf(newstat,"初始化猫"); break;
case S_FAX_RcvDCS : wsprintf(newstat,"接收DCS"); break;
case S_FAX_SendFTT : wsprintf(newstat,"发送训练失败信号FTT"); break;
case S_FAX_SendCFR : wsprintf(newstat,"发送证实信号CFR"); break;
case S_TUP_WaitPcmReset: wsprintf(newstat,"电路复原"); break;
case S_TUP_WaitSAM: wsprintf(newstat,"等待SAM"); break;
case S_TUP_WaitGSM: wsprintf(newstat,"等待GSM"); break;
case S_TUP_WaitCLF: wsprintf(newstat,"等待CLF"); break;
case S_TUP_WaitPrefix: wsprintf(newstat,"接收局号"); break;
case S_TUP_WaitDialAnswer: wsprintf(newstat,"等待应答"); break;
case S_TUP_WaitRLG: wsprintf(newstat,"等待RLG"); break;
case S_ISDN_OUT_WAIT_NET_RESPONSE: wsprintf(newstat, "等待网络响应"); break;
case S_ISDN_OUT_PLS_APPEND_NO: wsprintf(newstat, "等待追加号码"); break;
case S_ISDN_IN_CHK_CALL_IN: wsprintf(newstat, "检测到呼入"); break;
case S_ISDN_IN_RCVING_NO: wsprintf(newstat,"正在接收号码"); break;
case S_ISDN_IN_WAIT_TALK: wsprintf(newstat, "准备进入通话"); break;
case S_ISDN_OUT_WAIT_ALERT: wsprintf(newstat, "等待提醒信号"); break;
case S_ISDN_CALL_BEGIN: wsprintf(newstat, "呼叫起始"); break;
case S_ISDN_WAIT_HUANGUP: wsprintf(newstat, "等待释放"); break;
case S_CALL_SENDRING: wsprintf(newstat, "发送振铃"); break;
default: wsprintf(newstat,"S=%d",i); break;
}
m_TrkChList.GetItemText( nListIndex, 1, oldstat, 29 ) ;
if(strcmp(newstat, oldstat) != 0)
m_TrkChList.SetItemText( nListIndex, 1, newstat);
switch( m_ATrkCh[i].Step )
{
case TRK_IDLE: strcpy(newstat, "空闲"); break ;
case TRK_WAIT_CONNECT: strcpy(newstat, "等待连接"); break ;
case TRK_PLAY_SELECT: strcpy(newstat, "播放提示语1"); break ;
case TRK_CHECK_PLAY_SELECT: strcpy(newstat, "播放提示语1"); break ;
case TRK_CHECK_PLAY_START: strcpy(newstat, "播放提示语2"); break ;
case TRK_CHECK_FAX_PROCESS: strcpy(newstat, "通话..."); break ;
case TRK_HANGUP: strcpy(newstat, "挂机"); break ;
case TRK_CHECK_AUTODIAL: strcpy(newstat, "正在拨号"); break ;
case TRK_PLAY_MANUAL_HINT: strcpy(newstat, "播放提示语"); break ;
case TRK_CHECK_MANUAL_PLAY_START: strcpy(newstat, "检测播放音是否结束"); break ;
case TRK_MANUAL_FAX_START: strcpy(newstat, "传真开始"); break ;
default: strcpy(newstat, "未定义"); break ;
}
m_TrkChList.GetItemText( nListIndex, 2, oldstat, 29 ) ;
if(strcmp(newstat, oldstat) != 0)
m_TrkChList.SetItemText( nListIndex, 2, newstat);
strcpy(newstat,"");
SsmGetDtmfStr( i , newstat);
m_TrkChList.GetItemText( nListIndex, 3, oldstat, 29 );
if(strcmp(newstat, oldstat) != 0)
m_TrkChList.SetItemText( nListIndex, 3, newstat);
m_TrkChList.GetItemText( nListIndex, 4, oldstat, 60 ); //display error messages occured
if(strcmp(m_ATrkCh[i].pChErrMsg, oldstat) != 0)
m_TrkChList.SetItemText( nListIndex, 4, m_ATrkCh[i].pChErrMsg );
nListIndex++;
}
}
void CAtrkFaxDlg::OnDestroy()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -