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

📄 shr_poll_vcdlg.cpp

📁 三汇CTI示例程序源码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	for(i=0; i<MaxLine; i++)
	{
		reGetChType = SsmGetChType(i); 
		if(reGetChType == -1)
		{
			SsmGetLastErrMsg(ChannelState[i].pErrMsg);
			WriteLog(ChannelState[i].pErrMsg);	
		}

		if(reGetChType == 12)
		{   
			//Channel state
            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 = "Lineoff"; 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);
			}

			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_Poll_VCDlg::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	UpdateData(TRUE);
	ScanChannelState();
	UpdateChannelState();
	UpdateData(FALSE);
	CDialog::OnTimer(nIDEvent);
}


void CSHR_Poll_VCDlg::ScanChannelState()
{
	int i;
	int ChState = -1;      
	int reGetChType;       
	int reChkRecToFile;		
	char recFile[256];      

	for(i=0; i<MaxLine; i++)
	{
		reGetChType = SsmGetChType(i); 
		if(reGetChType == -1)
		{
			SsmGetLastErrMsg(ChannelState[i].pErrMsg);
			WriteLog(ChannelState[i].pErrMsg);
		}

		if(reGetChType == 12) //Digit record channel
		{
			ChState = SsmGetChState(i);  
			if(ChState == -1)
			{
				SsmGetLastErrMsg(ChannelState[i].pErrMsg);
				WriteLog(ChannelState[i].pErrMsg);
			}

			switch(ChannelState[i].WorkState)
			{
			case CH_IDLE:
				switch(ChState)
				{
				case S_CALL_RINGING: 
					ChannelState[i].Dir = DOWN;
					ChannelState[i].WorkState = CH_RING;
					break;

				case S_DTRC_ACTIVE:
					ChannelState[i].Dir = UP;
					ChannelState[i].WorkState = CH_ACTIVE;
					_snprintf(recFile, 256, "Test%d", i);
					if(SsmRecToFile(i, recFile, -1, 0, 0xffffffff, 0, 0) == -1) 
					{
						SsmGetLastErrMsg(ChannelState[i].pErrMsg);
						WriteLog(ChannelState[i].pErrMsg);	
					}
					ChannelState[i].IsRecord = RECORD;
					break;

				case S_CALL_OFFLINE:
					ChannelState[i].Dir = UNKNOWN;
					ChannelState[i].WorkState = CH_OUTLINE;
					break;

				default: 
					break;
				}
				break;

			case CH_RING: 
				switch(ChState)
				{
				case S_CALL_STANDBY:
					ChannelState[i].Dir = UNKNOWN; 
					ChannelState[i].WorkState = CH_IDLE;
					break;

				case S_DTRC_ACTIVE:
					ChannelState[i].WorkState = CH_ACTIVE;
					_snprintf(recFile, 256, "Test%d", i);
					if(SsmRecToFile(i, recFile, -1, 0, 0xffffffff, 0, 0) == -1)
					{
						SsmGetLastErrMsg(ChannelState[i].pErrMsg);
						WriteLog(ChannelState[i].pErrMsg);	
					}
					ChannelState[i].IsRecord = RECORD;
					break;

				case S_CALL_OFFLINE:
					ChannelState[i].Dir = UNKNOWN; 
					ChannelState[i].WorkState = CH_OUTLINE;
					break;

				default: 
					break;
				}
				break;

			case CH_ACTIVE: 
				ChannelState[i].pCallerId[0] = '\0';
				int reGetLCDStr; //the length of the LCD
				reGetLCDStr = DTRGetLCDStr(i, ChannelState[i].Lcd); //Get current Lcd information
				if(reGetLCDStr == -1)
				{
					SsmGetLastErrMsg(ChannelState[i].pErrMsg);
					WriteLog(ChannelState[i].pErrMsg);
				}
				
				switch(ChState)
				{
				case S_CALL_STANDBY:
					ChannelState[i].dwTimeOutCounter = 0;
		     		ChannelState[i].WorkState  = CH_IDLE;
					ChannelState[i].IsRecord = UNRECORD;

					reChkRecToFile = SsmChkRecToFile(i); 
					if(reChkRecToFile == -1)
					{
						SsmGetLastErrMsg(ChannelState[i].pErrMsg);
						WriteLog(ChannelState[i].pErrMsg);
					}

					if(reChkRecToFile == 1) 
					{
						if(SsmStopRecToFile(i) == -1) 
						{
							SsmGetLastErrMsg(ChannelState[i].pErrMsg);
							WriteLog(ChannelState[i].pErrMsg);
						}
					}

					if(ChannelState[i].Dir == DOWN)
					{
						if(SsmGetCallerId(i, ChannelState[i].pCallerId) == -1) 
						{
							SsmGetLastErrMsg(ChannelState[i].pErrMsg);
							WriteLog(ChannelState[i].pErrMsg);
						}
					}
					else if(ChannelState[i].Dir == UP)
					{
						if(SsmGetPhoNumStr(i, ChannelState[i].pCallerId) == -1) 
						{
							SsmGetLastErrMsg(ChannelState[i].pErrMsg);
							WriteLog(ChannelState[i].pErrMsg);
						}
					}
					break;

				case S_CALL_OFFLINE:
					ChannelState[i].dwTimeOutCounter = 0;
					ChannelState[i].Dir = UNKNOWN;
					ChannelState[i].WorkState  = CH_OUTLINE;
					reChkRecToFile = SsmChkRecToFile(i); 
					if(reChkRecToFile == -1)
					{
						SsmGetLastErrMsg(ChannelState[i].pErrMsg);
						WriteLog(ChannelState[i].pErrMsg);
					}
					if(reChkRecToFile == 1) 
					{
						if(SsmStopRecToFile(i) == -1)
						{
							SsmGetLastErrMsg(ChannelState[i].pErrMsg);
							WriteLog(ChannelState[i].pErrMsg);
						}
					}
					break;

				default:
					break;
				}
    			break;

			case CH_OUTLINE: 
				if(ChState == S_CALL_STANDBY)
				{
					ChannelState[i].WorkState  = CH_IDLE;
				}
				break;

			default:
				break;
			}

		} 
	}
}//ScanChannelState End

void CSHR_Poll_VCDlg::OnOK() 
{
	// TODO: Add extra validation here
	if(SsmCloseCti() == -1) 
	{
		WriteLog("Close Board Failed!");
	}
	CDialog::OnOK();
}

void CSHR_Poll_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_Poll_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 + -