📄 shr_stateevent_vcdlg.cpp
字号:
case E_CHG_ChState:
switch(nEChState)
{
case S_CALL_STANDBY:
break;
case S_CALL_RINGING:
ChannelState[ch].Dir = DOWN;
ChannelState[ch].WorkState = CH_RING;
break;
case S_DTRC_ACTIVE:
_snprintf(recFile, 256, "Test%d", ch);
if(SsmRecToFile(ch, recFile, -1, 0L, 0xffffffff, 0, 0) == -1)
{
SsmGetLastErrMsg(ChannelState[ch].pErrMsg);
WriteLog(ChannelState[ch].pErrMsg);
}
if(DTRGetLCDStr(ch, ChannelState[ch].Lcd) == -1)
{
SsmGetLastErrMsg(ChannelState[ch].pErrMsg);
WriteLog(ChannelState[ch].pErrMsg);
}
ChannelState[ch].WorkState = CH_ACTIVE;
ChannelState[ch].IsRecord = RECORD;
ChannelState[ch].Dir = UP;
break;
case S_CALL_OFFLINE:
ChannelState[ch].WorkState = CH_OUTLINE;
break;
default:
break;
}
break;
default:
break;
}
break;
case CH_RING:
switch(nEvent)
{
case E_CHG_ChState:
switch(nEChState)
{
case S_CALL_STANDBY:
ChannelState[ch].WorkState = CH_IDLE;
break;
case S_CALL_RINGING:
break;
case S_DTRC_ACTIVE:
ChannelState[ch].WorkState = CH_ACTIVE;
_snprintf(recFile, 256, "Test%d", ch);
if(SsmRecToFile(ch, recFile, -1, 0L, 0xffffffff, 0, 0) == -1)
{
SsmGetLastErrMsg(ChannelState[ch].pErrMsg);
WriteLog(ChannelState[ch].pErrMsg);
}
ChannelState[ch].IsRecord = RECORD;
if(DTRGetLCDStr(ch, ChannelState[ch].Lcd) == -1)
{
SsmGetLastErrMsg(ChannelState[ch].pErrMsg);
WriteLog(ChannelState[ch].pErrMsg);
}
break;
case S_CALL_OFFLINE:
ChannelState[ch].WorkState = CH_OUTLINE;
break;
default:
break;
}
break;
default:
break;
}
break;
case CH_ACTIVE:
switch(nEvent)
{
case E_CHG_ChState:
switch(nEChState)
{
case S_CALL_STANDBY:
ChannelState[ch].WorkState = CH_IDLE;
ChannelState[ch].IsRecord = UNRECORD;
reChkRecToFile = SsmChkRecToFile(ch);
if(reChkRecToFile == -1)
{
SsmGetLastErrMsg(ChannelState[ch].pErrMsg);
WriteLog(ChannelState[ch].pErrMsg);
}
if(reChkRecToFile == 1)
{
if(SsmStopRecToFile(ch) == -1)
{
SsmGetLastErrMsg(ChannelState[ch].pErrMsg);
WriteLog(ChannelState[ch].pErrMsg);
}
}
if(ChannelState[ch].Dir == DOWN)
{
if(SsmGetCallerId(ch, ChannelState[ch].pCallerId) == -1)
{
SsmGetLastErrMsg(ChannelState[ch].pErrMsg);
WriteLog(ChannelState[ch].pErrMsg);
}
}
else if(ChannelState[ch].Dir == UP)
{
if(SsmGetPhoNumStr(ch, ChannelState[ch].pCallerId) == -1)
{
SsmGetLastErrMsg(ChannelState[ch].pErrMsg);
WriteLog(ChannelState[ch].pErrMsg);
}
}
break;
case S_CALL_RINGING:
break;
case S_DTRC_ACTIVE:
break;
case S_CALL_OFFLINE:
ChannelState[ch].WorkState = CH_OUTLINE;
ChannelState[ch].IsRecord = UNRECORD;
reChkRecToFile = SsmChkRecToFile(ch);
if(reChkRecToFile == -1)
{
SsmGetLastErrMsg(ChannelState[ch].pErrMsg);
WriteLog(ChannelState[ch].pErrMsg);
}
if(reChkRecToFile == 1)
{
if(SsmStopRecToFile(ch) == -1)
{
SsmGetLastErrMsg(ChannelState[ch].pErrMsg);
WriteLog(ChannelState[ch].pErrMsg);
}
}
break;
default:
break;
}
break;
case E_RCV_DTR_DISPLAY:
if(DTRGetLCDStr(ch, ChannelState[ch].Lcd) == -1)
{
SsmGetLastErrMsg(ChannelState[ch].pErrMsg);
WriteLog(ChannelState[ch].pErrMsg);
}
break;
default:
break;
}
break;
case CH_OUTLINE:
switch(nEvent)
{
case E_CHG_ChState:
switch(nEChState)
{
case S_CALL_STANDBY:
ChannelState[ch].WorkState = CH_IDLE;
ChannelState[ch].Dir = UNKNOWN;
break;
case S_CALL_RINGING:
break;
case S_DTRC_ACTIVE:
break;
case S_CALL_OFFLINE:
break;
default:
break;
}
break;
default:
break;
}
break;
default:
break;
}
}//End if
return CDialog::WindowProc(message, wParam, lParam);
}
void CSHR_StateEvent_VCDlg::UpdateChannelState()
{
CString StateTrk;
CString ControlState;
CString strtemp;
char getitemtextstr[50];
int num;
int i;
int reGetChType;
num=0;
for(i=0; i<MaxLine; i++)
{
reGetChType = SsmGetChType(i);
if(reGetChType == -1)
{
SsmGetLastErrMsg(ChannelState[i].pErrMsg);
WriteLog(ChannelState[i].pErrMsg);
}
if(reGetChType == 12)
{
switch(ChannelState[i].WorkState)
{
case CH_IDLE: strtemp = "Idle"; break;
case CH_RING: strtemp = "Ringing"; break;
case CH_ACTIVE: strtemp = "Active"; break;
case CH_OUTLINE: strtemp = "Offline"; break;
}
m_ListCh.GetItemText(num, 1, getitemtextstr, 29);
if(getitemtextstr != strtemp)
{
m_ListCh.SetItemText(num, 1, strtemp);
}
//Listen status
switch(ChannelState[i].IsListen)
{
case LISTEN: strtemp = "Listen"; break;
case UNLISTEN: strtemp = "NoListen"; break;
}
m_ListCh.GetItemText(num, 2, getitemtextstr, 29);
if(getitemtextstr != strtemp)
{
m_ListCh.SetItemText(num, 2, strtemp);
}
//Record status
switch(ChannelState[i].IsRecord)
{
case UNRECORD: strtemp = "NoRec"; break;
case RECORD: strtemp = "Rec"; break;
}
m_ListCh.GetItemText(num, 3, getitemtextstr, 29);
if(getitemtextstr != strtemp)
{
m_ListCh.SetItemText(num, 3, strtemp);
}
//Number
strtemp = "";
m_ListCh.GetItemText(num, 4, getitemtextstr, 29);
strtemp.Format("%s", ChannelState[i].pCallerId);
if(getitemtextstr != strtemp)
{
m_ListCh.SetItemText(num, 4, strtemp);
}
//LCD information
strtemp = "";
m_ListCh.GetItemText(num, 5, getitemtextstr, 29);
strtemp.Format("%s", ChannelState[i].Lcd);
if(getitemtextstr != strtemp)
{
m_ListCh.SetItemText(num, 5, strtemp);
}
//Call direction
switch(ChannelState[i].Dir)
{
case UNKNOWN: strtemp = "Unknown"; break;
case UP: strtemp = "Outbound"; break;
case DOWN: strtemp = "Inbound"; break;
}
m_ListCh.GetItemText(num, 6, getitemtextstr, 29);
if(getitemtextstr != strtemp)
{
m_ListCh.SetItemText(num, 6, strtemp);
}
//Volume
m_ListCh.GetItemText(num, 7, getitemtextstr, 29);
strtemp.Format("%d", ChannelState[i].Volume);
if(getitemtextstr != strtemp)
{
m_ListCh.SetItemText(num, 7, strtemp);
}
//Time
m_ListCh.GetItemText(num, 8, getitemtextstr, 29);
strtemp.Format("%d", ChannelState[i].dwTimeOutCounter);
if(getitemtextstr != strtemp)
{
m_ListCh.SetItemText(num, 8, strtemp);
}
num++;
}
}
}//UpdateChannelState End
void CSHR_StateEvent_VCDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
UpdateData(TRUE);
UpdateChannelState();
UpdateData(FALSE);
CDialog::OnTimer(nIDEvent);
}
void CSHR_StateEvent_VCDlg::OnOK()
{
// TODO: Add extra validation here
if(SsmCloseCti() == -1)
{
WriteLog("Close Board Failed!");
}
CDialog::OnOK();
}
void CSHR_StateEvent_VCDlg::OnBUTTONSetListen()
{
// TODO: Add your control notification handler code here
int Cur_Line ;
Cur_Line = m_CurLine.GetCurSel();
if (ListenChannel != Cur_Line)
{
ChannelState[Cur_Line].IsListen = LISTEN;
PlayListen(0, Cur_Line);
if(ListenChannel < MaxLine)
{
ChannelState[ListenChannel].IsListen = UNLISTEN;
StopListen(0);
}
ListenChannel = Cur_Line;
}
UpdateData(FALSE);
}
void CSHR_StateEvent_VCDlg::OnBUTTONUnSetListen()
{
// TODO: Add your control notification handler code here
ChannelState[ListenChannel].IsListen = UNLISTEN;
ListenChannel = MaxLine;
StopListen(0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -