📄 fax_event_vcdlg.cpp
字号:
}
m_nTotalCh = SsmGetMaxCh(); // get max channels of boards
if(m_nTotalCh == -1)
WriteLog("Fail to call SsmGetMaxCh");
m_SecondDlg.m_cmbFaxCh.InsertString(-1, "None");
m_SecondDlg.m_cmbTrkCh.InsertString(-1, "None");
m_cmbTrkCh.InsertString(-1, "None");
m_cmbTrkChNo.InsertString(-1, "None");
m_cmbFaxChNo.InsertString(-1, "None");
m_cmbFaxCh.InsertString(-1, "None");
for(int i = 0; i < m_nTotalCh; i++)
{
m_TrkCh[i].bEnCalled = FALSE;
nCheck = SsmGetChType(i);
if(nCheck == -1)
WriteLog("Fail to call SsmGetChType");
// fax channel or soft fax
else if(nCheck == FAX_CH || nCheck == SOFTFAX_CH)
{
m_FaxCh[i].pffSCT = (PFAX_FILE_SCT)GlobalAlloc(GMEM_FIXED, sizeof(FAX_FILE_SCT)*50);
strcpy(m_FaxCh[i].szChErrMsg, "");
strcpy(m_FaxCh[i].szRcvPathFile, "");
strcpy(m_FaxCh[i].szSendFile, "");
strcpy(m_FaxCh[i].szSendPath, "");
strcpy(m_FaxCh[i].szPage, "");
strcpy(m_FaxCh[i].szGetID, "");
m_FaxCh[i].nStep = FAX_IDLE;
m_FaxCh[i].bInUse = FALSE;
m_FaxCh[i].nAllBytes = 0;
m_FaxCh[i].nSendBytes = 0;
m_FaxCh[i].nRcvBytes = 0;
m_FaxCh[i].nCheckEnd = 0;
str.Format("%d", i);
m_SecondDlg.m_cmbFaxCh.InsertString(-1, str);
m_cmbFaxChNo.InsertString(-1, str);
m_cmbFaxCh.InsertString(-1, str);
}
else
{
int nDirection;
// get automatic call progress enable flag and call direction
nCheck = SsmGetAutoCallDirection(i, &nDirection);
if(nCheck == -1)
WriteLog("Fail to call SsmGetAutoCallDirection");
// enable automatic call progress
else if(nCheck == 1)
{
m_TrkCh[i].nCallFlag = -1;
m_TrkCh[i].nStep = TRK_IDLE;
m_TrkCh[i].szChErrMsg[0] = '\0';
m_TrkCh[i].bEnCalled = TRUE;
m_TrkCh[i].nAutoOrNot = 0;
m_TrkCh[i].bRecord = TRUE;
m_TrkCh[i].szDtmf[0] = 0;
m_TrkCh[i].szDtmfChose = 0;
m_TrkCh[i].bInUse = FALSE;
m_TrkCh[i].nIndex = 0;
m_TrkCh[i].nTimer = -1;
strcpy(m_TrkCh[i].szCallerId, "");
str.Format("%d", i);
m_SecondDlg.m_cmbTrkCh.InsertString(-1, str);
m_cmbTrkCh.InsertString(-1, str);
m_cmbTrkChNo.InsertString(-1, str);
}
}
}//end of for
m_SecondDlg.m_cmbFaxCh.SetCurSel(0);
m_cmbFaxChNo.SetCurSel(0);
m_cmbFaxCh.SetCurSel(0);
m_cmbTrkCh.SetCurSel(0);
m_cmbTrkChNo.SetCurSel(0);
m_SecondDlg.m_cmbTrkCh.SetCurSel(0);
// load speech data "Step1.voc" and "Step2.voc"
nCheck = SsmLoadIndexData(1, "", 6, "Step1.voc", 0, -1);
nChk = SsmLoadIndexData(2, "", 6, "Step2.voc", 0, -1);
if(nCheck == -1 || nChk == -1)
{
if(g_dwLanguageConversion == g_dwCHINESE_SIMPLIFIED)
AfxMessageBox(_T("加载语音文件失败"));
else
AfxMessageBox(_T("Failed to load speech file"));
if(SsmCloseCti() == -1) //close board drivers
WriteLog("Failed to call SsmCloseCti");
return FALSE;
}
return TRUE;
}
void CFax_Event_VCDlg::OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
int n = m_TabCtrl.GetCurSel();
switch(n)
{
case 0:
m_nTabShow = 0;
m_FirstDlg.ShowWindow(SW_SHOW);
m_SecondDlg.ShowWindow(SW_HIDE);
m_ThirdDlg.ShowWindow(SW_HIDE);
m_FourthDlg.ShowWindow(SW_HIDE);
break;
case 1:
m_nTabShow = 1;
m_FirstDlg.ShowWindow(SW_HIDE);
m_SecondDlg.ShowWindow(SW_SHOW);
m_ThirdDlg.ShowWindow(SW_HIDE);
m_FourthDlg.ShowWindow(SW_HIDE);
break;
case 2:
m_nTabShow = 2;
m_FirstDlg.ShowWindow(SW_HIDE);
m_SecondDlg.ShowWindow(SW_HIDE);
m_ThirdDlg.ShowWindow(SW_SHOW);
m_FourthDlg.ShowWindow(SW_HIDE);
break;
case 3:
m_nTabShow = 3;
m_FirstDlg.ShowWindow(SW_HIDE);
m_SecondDlg.ShowWindow(SW_HIDE);
m_ThirdDlg.ShowWindow(SW_HIDE);
m_FourthDlg.ShowWindow(SW_SHOW);
break;
}
*pResult = 0;
}
void CFax_Event_VCDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
// TODO: Add your message handler code here
CRect tabRect, itemRect,CFaxDlgRect;
int nX, nY, nXc, nYc;
m_TabCtrl.GetClientRect(&tabRect);
m_TabCtrl.GetItemRect(0, &itemRect);
GetClientRect(&CFaxDlgRect);
nX = CFaxDlgRect.right - tabRect.right;
nY = CFaxDlgRect.bottom - (tabRect.bottom - itemRect.bottom + itemRect.top);
nXc = tabRect.right - 15;// - (itemRect.right - itemRect.left); //2006.10.25 pm 12:50
nYc = tabRect.bottom - itemRect.bottom - 12; // pm 3:33
switch (m_nTabShow)
{
case 0:
m_TabCtrl.SetCurSel(0);
m_FirstDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
m_SecondDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
m_ThirdDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
m_FourthDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
break;
case 1:
m_TabCtrl.SetCurSel(1);
m_FirstDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
m_SecondDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
m_ThirdDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
m_FourthDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
break;
case 2:
m_TabCtrl.SetCurSel(2);
m_FirstDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
m_SecondDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
m_ThirdDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
m_FourthDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
break;
case 3:
m_TabCtrl.SetCurSel(3);
m_FirstDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
m_SecondDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
m_ThirdDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
m_FourthDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
break;
}
}
// write log messages
void CFax_Event_VCDlg::WriteLog(char *szLog)
{
if(FALSE == m_bLog)
return;
CString szWriteLog;
SYSTEMTIME st;
GetLocalTime(&st);
szWriteLog.Format("%04d-%02d-%02d %02d:%02d:%02d : %s\n", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, szLog);
fwrite((LPCTSTR)szWriteLog , szWriteLog.GetLength() , 1 , m_LogFile);
fflush(m_LogFile);
}
void CFax_Event_VCDlg::InitFaxChListCtrl()
{
int nCheck;
static int ColumnWidth[10] = {40, 150, 40, 100, 100, 120, 120, 150};
LV_COLUMN lvc;
lvc.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
if(g_dwLanguageConversion == g_dwCHINESE_SIMPLIFIED)
{
lvc.iSubItem = 0;
lvc.pszText = "通道" ;
lvc.cx = ColumnWidth[0];
m_FaxChList.InsertColumn(0, &lvc);
lvc.iSubItem = 1;
lvc.pszText = "通道状态";
lvc.cx = ColumnWidth[1];
m_FaxChList.InsertColumn(1, &lvc);
lvc.iSubItem = 2;
lvc.pszText = "页数";
lvc.cx = ColumnWidth[2];
m_FaxChList.InsertColumn(2, &lvc);
lvc.iSubItem = 3;
lvc.pszText = "对方ID号";
lvc.cx = ColumnWidth[3];
m_FaxChList.InsertColumn(3, &lvc);
lvc.iSubItem = 4;
lvc.pszText = "当前文件名";
lvc.cx = ColumnWidth[4];
m_FaxChList.InsertColumn(4, &lvc);
lvc.iSubItem = 5;
lvc.pszText = "传真字节数";
lvc.cx = ColumnWidth[5];
m_FaxChList.InsertColumn(5, &lvc);
lvc.iSubItem = 6;
lvc.pszText = "传真执行结果";
lvc.cx = ColumnWidth[6];
m_FaxChList.InsertColumn(6, &lvc);
lvc.iSubItem = 7;
lvc.pszText = "出错信息";
lvc.cx = ColumnWidth[7];
m_FaxChList.InsertColumn(7, &lvc);
}
else
{
lvc.iSubItem = 0;
lvc.pszText = "Ch" ;
lvc.cx = ColumnWidth[0];
m_FaxChList.InsertColumn(0, &lvc);
lvc.iSubItem = 1;
lvc.pszText = "Channel state";
lvc.cx = ColumnWidth[1];
m_FaxChList.InsertColumn(1, &lvc);
lvc.iSubItem = 2;
lvc.pszText = "Page number";
lvc.cx = ColumnWidth[2];
m_FaxChList.InsertColumn(2, &lvc);
lvc.iSubItem = 3;
lvc.pszText = "Remote ID";
lvc.cx = ColumnWidth[3];
m_FaxChList.InsertColumn(3, &lvc);
lvc.iSubItem = 4;
lvc.pszText = "Current file name";
lvc.cx = ColumnWidth[4];
m_FaxChList.InsertColumn(4, &lvc);
lvc.iSubItem = 5;
lvc.pszText = "Number of fax bytes";
lvc.cx = ColumnWidth[5];
m_FaxChList.InsertColumn(5, &lvc);
lvc.iSubItem = 6;
lvc.pszText = "Execution result of faxing";
lvc.cx = ColumnWidth[6];
m_FaxChList.InsertColumn(6, &lvc);
lvc.iSubItem = 7;
lvc.pszText = "Error message";
lvc.cx = ColumnWidth[7];
m_FaxChList.InsertColumn(7, &lvc);
}
char dig[3];
for(int i = 0; i < m_nTotalCh; i++)
{
nCheck = SsmGetChType(i);
if(nCheck == -1)
WriteLog("Fail to call SsmGetChType");
else if(nCheck == FAX_CH || nCheck == SOFTFAX_CH)
{
m_FaxChList.InsertItem(i, _itoa(i, dig, 10));
}
}
}
void CFax_Event_VCDlg::InitTrunkChListCtrl()
{
static int ColumnWidth[10] = {40, 80, 90, 100, 150, 150};
LV_COLUMN lvc;
lvc.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
if(g_dwLanguageConversion == g_dwCHINESE_SIMPLIFIED)
{
lvc.iSubItem = 0;
lvc.pszText = "通道" ;
lvc.cx = ColumnWidth[0];
m_TrkChList.InsertColumn(0, &lvc);
lvc.iSubItem = 1;
lvc.pszText = "通道状态";
lvc.cx = ColumnWidth[1];
m_TrkChList.InsertColumn(1, &lvc);
lvc.iSubItem = 2;
lvc.pszText = "传真过程状态";
lvc.cx = ColumnWidth[2];
m_TrkChList.InsertColumn(2, &lvc);
lvc.iSubItem = 3;
lvc.pszText = "主叫号码";
lvc.cx = ColumnWidth[3];
m_TrkChList.InsertColumn(3, &lvc);
lvc.iSubItem = 4;
lvc.pszText = "DTMF按键";
lvc.cx = ColumnWidth[4];
m_TrkChList.InsertColumn(4, &lvc);
lvc.iSubItem = 5;
lvc.pszText = "出错信息";
lvc.cx = ColumnWidth[5];
m_TrkChList.InsertColumn(5, &lvc);
}
else
{
lvc.iSubItem = 0;
lvc.pszText = "Ch" ;
lvc.cx = ColumnWidth[0];
m_TrkChList.InsertColumn(0, &lvc);
lvc.iSubItem = 1;
lvc.pszText = "Channel state";
lvc.cx = ColumnWidth[1];
m_TrkChList.InsertColumn(1, &lvc);
lvc.iSubItem = 2;
lvc.pszText = "Faxing state";
lvc.cx = ColumnWidth[2];
m_TrkChList.InsertColumn(2, &lvc);
lvc.iSubItem = 3;
lvc.pszText = "Calling party number";
lvc.cx = ColumnWidth[3];
m_TrkChList.InsertColumn(3, &lvc);
lvc.iSubItem = 4;
lvc.pszText = "DTMF";
lvc.cx = ColumnWidth[4];
m_TrkChList.InsertColumn(4, &lvc);
lvc.iSubItem = 5;
lvc.pszText = "Error messages";
lvc.cx = ColumnWidth[5];
m_TrkChList.InsertColumn(5, &lvc);
}
char dig[3];
for(int i = 0; i < m_nTotalCh; i++)
{
if(m_TrkCh[i].bEnCalled)
{
m_TrkChList.InsertItem(i, _itoa(i, dig, 10));
}
}
}
void CFax_Event_VCDlg::OnSelchangeComboTrkCh()
{
// TODO: Add your control notification handler code here
char sz[50];
m_cmbTrkCh.GetLBText(m_cmbTrkCh.GetCurSel(), sz);
int n = atoi(sz);
m_bRecord = m_TrkCh[n].bRecord;
UpdateData(FALSE);
}
//recording
void CFax_Event_VCDlg::OnCheckRecord()
{
// TODO: Add your control notification handler code here
char sz[50];
UpdateData(TRUE);
m_cmbTrkCh.GetLBText(m_cmbTrkCh.GetCurSel(), sz);
int n = atoi(sz);
m_TrkCh[n].bRecord = m_bRecord;
}
void CFax_Event_VCDlg::UpdateFaxChListCtrl()
{
char szNewStat[250], szOldStat[250];
CString szTmp;
char szStatemsg[100];
int nIndex = 0;
int nCheck;
for(int i = 0; i < m_nTotalCh; i++)
{
nCheck = SsmGetChType(i); //get channel type
if(nCheck == -1)
WriteLog("Fail to call SsmGetChType");
else if(nCheck != FAX_CH && nCheck != SOFTFAX_CH)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -