コード例 #1
0
ファイル: XMS_Demo_Sub.cpp プロジェクト: liguyu/cppexample
void DrawMain_LineState( TRUNK_STRUCT *pOneTrunk )
{
	char StateStr[100];
	int	 iDispRow;

	iDispRow = CalDispRow(pOneTrunk->iSeqID); 
	if ( iDispRow < 0 )	return;

	// 
	GetString_LineState ( StateStr, pOneTrunk->iLineState );
	pdlg->m_ListMain.SetItemText ( iDispRow, 3, StateStr ); 
}
コード例 #2
0
void DrawMain_LineState( VOIP_STRUCT *pOneVOIP )
{
	char StateStr[100];
	int	 iDispRow;

	if (pOneVOIP == NULL || pdlg == NULL)
		return;

	iDispRow = pOneVOIP->iSeqID; 

	// 
	GetString_LineState ( StateStr, pOneVOIP->iLineState );
	pdlg->m_ListMain.SetItemText ( iDispRow, 3, StateStr ); 
}
コード例 #3
0
ファイル: DTrunk.cpp プロジェクト: liguyu/cppexample
void DrawDTrunk_LineState(INTERFACE_STRUCT *pOneTrunk)
{
	char StateStr[100];
	int	 iDispRow;
	
	_ASSERT(pOneTrunk != NULL);
	_ASSERT(pdlg != NULL);		
	
	iDispRow = CalDispRow(pOneTrunk->iSeqID); 
	if ( iDispRow < 0 )	
		return;	 
	
	GetString_LineState ( StateStr, pOneTrunk->iLineState );
	pdlg->m_ListDTrunk.SetItemText ( iDispRow, 3, StateStr ); 	
	
	return;
}
コード例 #4
0
ファイル: HelloKeygoe_Sub.cpp プロジェクト: liguyu/cppexample
void	OpenDeviceOK ( DeviceID_t *pDevice )
{
	TRUNK_STRUCT *	pOneTrunk;
	VOICE_STRUCT *	pOneVoice;	
	if ( pDevice->m_s16DeviceMain == XMS_DEVMAIN_INTERFACE_CH )
	{
		pOneTrunk = &AllDeviceRes[(*pDevice).m_s8ModuleID].pTrunk[(*pDevice).m_s16ChannelID];
		
		pOneTrunk->deviceID.m_CallID = pDevice->m_CallID;		// this line is very important, must before all operation
		
		// init this Device: Trunk
		pOneTrunk->State = TRK_FREE;
		pOneTrunk->CallerCode[0]=0;
		pOneTrunk->CalledCode[0]=0;	
		memset ( &pOneTrunk->VocDevID, 0, sizeof(DeviceID_t) );		// 0: didn't alloc Voc Device
			
		XMS_ctsResetDevice ( g_acsHandle, pDevice, NULL );
		XMS_ctsGetDevState ( g_acsHandle, pDevice, NULL );
		
		pdlg->m_ListTrunk.SetItemText ( pOneTrunk->iSeqID, 3, GetString_LineState(pOneTrunk->iLineState) ); 
		
		if (pOneTrunk->deviceID.m_s16DeviceSub == XMS_DEVSUB_ANALOG_USER)
		{
			pdlg->m_ListTrunk.SetItemText ( pOneTrunk->iSeqID, 4, GetString_TrunkState(pOneTrunk) ); 
		}

		AllDeviceRes[pDevice->m_s8ModuleID].lTrunkOpened ++;		
	}
	
	if ( pDevice->m_s16DeviceMain == XMS_DEVMAIN_VOICE )
	{
		pOneVoice = &AllDeviceRes[(*pDevice).m_s8ModuleID].pVoice[(*pDevice).m_s16ChannelID];
		pOneVoice->deviceID.m_CallID = pDevice->m_CallID;		// this line is very important, must before all operation

		// init this Device: Voice
		pOneVoice->State = VOC_FREE;
		
		XMS_ctsResetDevice ( g_acsHandle, pDevice, NULL );
		XMS_ctsGetDevState ( g_acsHandle, pDevice, NULL );	
	
		AllDeviceRes[pDevice->m_s8ModuleID].lVocOpened ++;
		AllDeviceRes[pDevice->m_s8ModuleID].lVocFreeNum ++;	
	}

}
コード例 #5
0
ファイル: HelloKeygoe_Sub.cpp プロジェクト: liguyu/cppexample
void ResetUser ( TRUNK_STRUCT *pOneUser, Acs_Evt_t *pAcsEvt )
{
	VOICE_STRUCT * pOneVoice;
	if ( pOneUser->VocDevID.m_s16DeviceMain != 0 )//有语音设备与此中继连接
	{
		XMS_ctsUnlinkDevice ( g_acsHandle, &pOneUser->VocDevID, &pOneUser->deviceID, NULL ); 
		XMS_ctsUnlinkDevice ( g_acsHandle, &pOneUser->deviceID, &pOneUser->VocDevID, NULL ); 
		pOneVoice = &AllDeviceRes[pOneUser->VocDevID.m_s8ModuleID].pVoice[pOneUser->VocDevID.m_s16ChannelID];
		pOneVoice->State = VOC_FREE;
		AllDeviceRes[pOneVoice->deviceID.m_s8ModuleID].lVocFreeNum++;
	}
	
	pOneUser->State = TRK_FREE;
	memset( &pOneUser->VocDevID, 0, sizeof(DeviceID_t) );		// 0: didn't alloc Voc Device
	pdlg->m_ListTrunk.SetItemText ( pOneUser->iSeqID, 3, GetString_LineState(pOneUser->iLineState) ); 					
	pdlg->m_ListTrunk.SetItemText ( pOneUser->iSeqID, 4, GetString_TrunkState(pOneUser)); 					

}
コード例 #6
0
ファイル: HelloKeygoe_Sub.cpp プロジェクト: liguyu/cppexample
DJ_Void EvtHandler(DJ_U32 esrParam){
	Acs_Evt_t *			    pAcsEvt = NULL;
	Acs_Dev_List_Head_t *	pAcsDevList = NULL;
	DJ_S8					s8DspModID;
	DJ_S32					s32Num;
	pAcsEvt = (Acs_Evt_t *) esrParam;
	VOICE_STRUCT *			pOneVoice;
	TRUNK_STRUCT *			pOneTrunk;
	char					TmpStr[256];
	Acs_GeneralProc_Data *pGeneralData = NULL;	

	switch ( pAcsEvt->m_s32EventType )
	{
	case XMS_EVT_QUERY_DEVICE:		
		{
			pAcsDevList = ( Acs_Dev_List_Head_t *) FetchEventData(pAcsEvt);	
			s8DspModID = (DJ_S8) pAcsDevList->m_s32ModuleID;
			s32Num =  pAcsDevList->m_s32DeviceNum;
			if (s8DspModID == cfg_iPartWorkModuleID)
			{
				switch (pAcsDevList->m_s32DeviceMain)
				{
				case XMS_DEVMAIN_VOICE:	
					if ( (AllDeviceRes[s8DspModID].lVocNum == 0) && (s32Num > 0) )		//  the resources new added
					{
						AllDeviceRes[s8DspModID].pVoice = new VOICE_STRUCT[s32Num];
						if( AllDeviceRes[s8DspModID].pVoice )
						{
							AllDeviceRes[s8DspModID].lVocNum = s32Num;
							AllDeviceRes[s8DspModID].lVocOpened = 0;
							AllDeviceRes[s8DspModID].lVocFreeNum = 0;
							memset ( AllDeviceRes[s8DspModID].pVoice, 0, sizeof(VOICE_STRUCT)*s32Num );
							
							DeviceID_t	 *pDev;
							pDev = (DeviceID_t *)((BYTE *)pAcsDevList + sizeof(Acs_Dev_List_Head_t));
							
							for ( int i = 0; i < s32Num; i ++ )
							{
								AllDeviceRes[s8DspModID].pVoice[i].deviceID = pDev[i];
								AllDeviceRes[s8DspModID].pVoice[i].State = VOC_WAITOPEN;
							}
						}
					}
					break;
				case XMS_DEVMAIN_INTERFACE_CH:
					if ( (AllDeviceRes[s8DspModID].lTrunkNum == 0) && (s32Num > 0) )		//  the resources new added
					{
						AllDeviceRes[s8DspModID].pTrunk = new TRUNK_STRUCT[s32Num];
						if( AllDeviceRes[s8DspModID].pTrunk )
						{
							AllDeviceRes[s8DspModID].lTrunkNum = s32Num;
							AllDeviceRes[s8DspModID].lTrunkOpened = 0;
							memset ( AllDeviceRes[s8DspModID].pTrunk, 0, sizeof(TRUNK_STRUCT)*s32Num );
							
							DeviceID_t	 *pDev;
							
							pDev = (DeviceID_t *)((BYTE *)pAcsDevList + sizeof(Acs_Dev_List_Head_t));
							
							for (int i = 0; i < s32Num; i ++ )
							{
								AllDeviceRes[s8DspModID].pTrunk[i].deviceID = pDev[i];
								AllDeviceRes[s8DspModID].pTrunk[i].State = TRK_WAITOPEN;
							}
						}
					}					
					break;
				}

			}
			
		}
		break; 
	case XMS_EVT_QUERY_ONE_DSP_END:	//一个DSP上的资源搜索完毕,打开应用需要的设备
		if (pAcsEvt->m_DeviceID.m_s8ModuleID == cfg_iPartWorkModuleID)
		{
			AllDeviceRes[pAcsEvt->m_DeviceID.m_s8ModuleID].lFlag = 1;		// this DSP can use
			s8DspModID = (DJ_S8) pAcsEvt->m_DeviceID.m_s8ModuleID;
			// pVoice
			for ( int i = 0; i < AllDeviceRes[s8DspModID].lVocNum; i++ )
			{
				pOneVoice = &AllDeviceRes[s8DspModID].pVoice[i];			
				if ( pOneVoice->State == VOC_WAITOPEN )		// not Open yet
				{
					if ( XMS_ctsOpenDevice ( g_acsHandle, &pOneVoice->deviceID, NULL ) < 0 )
					{
						MessageBox(NULL, "Voice open fail!", "XMS_ctsOpenDevice", MB_OK ) ;
					}
				}
			}
						
			// pTrunk
			pdlg->m_ListTrunk.DeleteAllItems ();
			for ( int j = 0; j < AllDeviceRes[s8DspModID].lTrunkNum; j++ )
			{
				pOneTrunk = &AllDeviceRes[s8DspModID].pTrunk[j];
				pOneTrunk->iSeqID = j;
				if ( pOneTrunk->State == TRK_WAITOPEN )		// not Open yet
				{
					if ( XMS_ctsOpenDevice ( g_acsHandle, &pOneTrunk->deviceID, NULL ) < 0 )
					{
						MessageBox(NULL, "Trunk open fail!", "XMS_ctsOpenDevice", MB_OK ) ;
					}
				}
			
				//界面显示中继信息
				sprintf ( TmpStr, "%3d", j );
				pdlg->m_ListTrunk.InsertItem ( j, TmpStr );
				
				sprintf ( TmpStr, "%d,%d", pOneTrunk->deviceID.m_s8ModuleID, pOneTrunk->deviceID.m_s16ChannelID );
				pdlg->m_ListTrunk.SetItemText ( j, 1, TmpStr );	
				
				pdlg->m_ListTrunk.SetItemText ( j, 2, GetString_DeviceSub( pOneTrunk->deviceID.m_s16DeviceSub) );
				
				pdlg->m_ListTrunk.SetItemText ( j, 3, GetString_LineState(pOneTrunk->iLineState) ); 
			}
			
		}
		break;
	case XMS_EVT_QUERY_REMOVE_ONE_DSP_END:		
		break;		
	case XMS_EVT_QUERY_DEVICE_END:	// Query Device List End
		break;		
	case XMS_EVT_OPEN_DEVICE:
		OpenDeviceOK(&pAcsEvt->m_DeviceID );
		break;		
	case XMS_EVT_CLOSE_DEVICE:		// before Delete DSP, DSP send event CloseDevice to the APP; call XMS_ctsCloseDevicey() can generate this Event
		break;		
	case XMS_EVT_DEVICESTATE:
			
		pGeneralData = (Acs_GeneralProc_Data *)FetchEventData(pAcsEvt);
		
		if ( pAcsEvt->m_DeviceID.m_s16DeviceMain == XMS_DEVMAIN_INTERFACE_CH )
		{
			pOneTrunk = &AllDeviceRes[pAcsEvt->m_DeviceID.m_s8ModuleID].pTrunk[pAcsEvt->m_DeviceID.m_s16ChannelID];
			pOneTrunk->iLineState = pGeneralData->m_s32DeviceState;
			pdlg->m_ListTrunk.SetItemText ( pOneTrunk->iSeqID, 3, GetString_LineState(pOneTrunk->iLineState) ); 
		}
		break;		
	case XMS_EVT_UNIFAILURE:
		break;		
	default:
		if ( pAcsEvt->m_DeviceID.m_s16DeviceMain == XMS_DEVMAIN_INTERFACE_CH &&
			pAcsEvt->m_DeviceID.m_s16DeviceSub == XMS_DEVSUB_ANALOG_USER)
		{
			pOneTrunk = &AllDeviceRes[pAcsEvt->m_DeviceID.m_s8ModuleID].pTrunk[pAcsEvt->m_DeviceID.m_s16ChannelID];
			UserWork( pOneTrunk, pAcsEvt );
		}else if (pAcsEvt->m_DeviceID.m_s16DeviceMain == XMS_DEVMAIN_VOICE)
		{	
			DeviceID_t	*pDevID;
			pOneVoice = &AllDeviceRes[pAcsEvt->m_DeviceID.m_s8ModuleID].pVoice[pAcsEvt->m_DeviceID.m_s16ChannelID];
			pDevID = &pOneVoice->UsedDevID;
			
			if ( pDevID->m_s16DeviceMain == XMS_DEVMAIN_INTERFACE_CH && pDevID->m_s16DeviceSub == XMS_DEVSUB_ANALOG_USER)
			{
				pOneTrunk = &AllDeviceRes[pDevID->m_s8ModuleID].pTrunk[pDevID->m_s16ChannelID];
				UserWork ( pOneTrunk, pAcsEvt );
			}

		}
		break;
	}
}
コード例 #7
0
void	DispEventInfo ( Acs_Evt_t *pAcsEvt )
{
	char	TmpStr[256]={0};
	char	TmpS[256]={0};
	DeviceID_t	*pLinkTrkDevID;
	Acs_Dev_List_Head_t * pAcsDevList = NULL;
	Acs_UniFailure_Data * pAcsUniFailure = NULL;
	Acs_GeneralProc_Data * pAcsProcData=NULL;

	sprintf ( TmpStr, "EVT(%4d) : ", pAcsEvt->m_s32EvtSize );
	strcat ( TmpStr, GetString_EventType ( pAcsEvt->m_s32EventType ) );

	switch ( pAcsEvt->m_s32EventType )
	{
	case XMS_EVT_OPEN_STREAM:
		break;
	case XMS_EVT_CALLOUT:
	case XMS_EVT_CALLIN:
	case XMS_EVT_ANALOG_INTERFACE:
	case XMS_EVT_LINKDEVICE:
	case XMS_EVT_UNLINKDEVICE:
	case XMS_EVT_SETPARAM:
	case XMS_EVT_PLAY:
	case XMS_EVT_RECORD:		
	case XMS_EVT_OPEN_DEVICE:
	case XMS_EVT_CONTROLPLAY:
	case XMS_EVT_CONTROLRECORD:
	case XMS_EVT_CLEARCALL:
	case XMS_EVT_ANSWERCALL:
	case XMS_EVT_CAS_MFC_START:
	case XMS_EVT_CAS_MFC_END:
	case XMS_EVT_SENDIODATA:
	case XMS_EVT_DEV_TIMER:
		sprintf ( TmpS, "(%s, %s, %d, %d)", 
			GetString_DeviceMain(pAcsEvt->m_DeviceID.m_s16DeviceMain),
			GetString_DeviceSub(pAcsEvt->m_DeviceID.m_s16DeviceSub),
			pAcsEvt->m_DeviceID.m_s8ModuleID,
			pAcsEvt->m_DeviceID.m_s16ChannelID);
		strcat ( TmpStr, TmpS );
		break;
	case XMS_EVT_DEVICESTATE:
		{	
			char StateStr[100]={0};
			pAcsProcData = (Acs_GeneralProc_Data *)FetchEventData(pAcsEvt);
			GetString_LineState ( StateStr, pAcsProcData->m_s32DeviceState );
			sprintf ( TmpS, "(%s, %s, %d, %d), %s", 
				GetString_DeviceMain(pAcsEvt->m_DeviceID.m_s16DeviceMain),
				GetString_DeviceSub(pAcsEvt->m_DeviceID.m_s16DeviceSub),
				pAcsEvt->m_DeviceID.m_s8ModuleID,
				pAcsEvt->m_DeviceID.m_s16ChannelID,
				StateStr);
			strcat ( TmpStr, TmpS );
		}

		break;
	case XMS_EVT_RECVIODATA:
		{
			char		*p;
			Acs_IO_Data				*pIOData = NULL;
			pIOData = (Acs_IO_Data *)FetchEventData(pAcsEvt);	
			pLinkTrkDevID = &M_OneVoice(pAcsEvt->m_DeviceID).UsedDevID;

			if ( ( pIOData->m_u16IoType == XMS_IO_TYPE_DTMF ) && ( pIOData->m_u16IoDataLen > 0 ) )
			{
				p = (char *)FetchIOData(pAcsEvt);
				sprintf(TmpS,"[%c], (%s, %s, %d, %d), LinkTrk(%s, %s, %d, %d)",*p, 
					GetString_DeviceMain(pAcsEvt->m_DeviceID.m_s16DeviceMain),
					GetString_DeviceSub(pAcsEvt->m_DeviceID.m_s16DeviceSub),
					pAcsEvt->m_DeviceID.m_s8ModuleID,
					pAcsEvt->m_DeviceID.m_s16ChannelID,
					GetString_DeviceMain(pLinkTrkDevID->m_s16DeviceMain),
					GetString_DeviceSub(pLinkTrkDevID->m_s16DeviceSub),
					pLinkTrkDevID->m_s8ModuleID,
					pLinkTrkDevID->m_s16ChannelID);				
				strcat ( TmpStr, TmpS );
			}else if ( (pIOData->m_u16IoType == XMS_IO_TYPE_FSK) && (pIOData->m_u16IoDataLen > 0 ))
			{
				p = (char *)FetchIOData(pAcsEvt);
				sprintf(TmpS,"[%s], (%s, %s, %d, %d), LinkTrk(%s, %s, %d, %d)",p, 
					GetString_DeviceMain(pAcsEvt->m_DeviceID.m_s16DeviceMain),
					GetString_DeviceSub(pAcsEvt->m_DeviceID.m_s16DeviceSub),
					pAcsEvt->m_DeviceID.m_s8ModuleID,
					pAcsEvt->m_DeviceID.m_s16ChannelID,
					GetString_DeviceMain(pLinkTrkDevID->m_s16DeviceMain),
					GetString_DeviceSub(pLinkTrkDevID->m_s16DeviceSub),
					pLinkTrkDevID->m_s8ModuleID,
					pLinkTrkDevID->m_s16ChannelID);				
				strcat ( TmpStr, TmpS );
				
			}else
			{
				sprintf(TmpS,", m_u16IoType:%d, (%s, %s, %d, %d)",
					pIOData->m_u16IoType,
					GetString_DeviceMain(pAcsEvt->m_DeviceID.m_s16DeviceMain),
					GetString_DeviceSub(pAcsEvt->m_DeviceID.m_s16DeviceSub),
					pAcsEvt->m_DeviceID.m_s8ModuleID,
					pAcsEvt->m_DeviceID.m_s16ChannelID);				
				strcat ( TmpStr, TmpS );
			}
		}
		break;

	case XMS_EVT_QUERY_DEVICE:
		pAcsDevList = (Acs_Dev_List_Head_t *) FetchEventData(pAcsEvt);
		sprintf ( TmpS, " (%s,%2d,%3d)", GetString_DeviceMain(pAcsDevList->m_s32DeviceMain),
			pAcsDevList->m_s32ModuleID,	pAcsDevList->m_s32DeviceNum );
		strcat ( TmpStr, TmpS );
		break;

	case XMS_EVT_UNIFAILURE:
		pAcsUniFailure = (Acs_UniFailure_Data *) FetchEventData(pAcsEvt);
		sprintf ( TmpS, ": %s(0x%X) dev=(%s, %d, %d),  %d ?=? %d+%d", 
			GetString_ErrorCode(pAcsUniFailure->m_s32AcsEvtErrCode), pAcsUniFailure->m_s32AcsEvtErrCode,
			GetString_DeviceMain(pAcsEvt->m_DeviceID.m_s16DeviceMain),  pAcsEvt->m_DeviceID.m_s8ModuleID, pAcsEvt->m_DeviceID.m_s16ChannelID,
			pAcsEvt->m_s32EvtSize, sizeof(Acs_Evt_t), sizeof(Acs_UniFailure_Data) );
		strcat ( TmpStr, TmpS );
		break;

	default:
		break;

	}
	WriteLog(LEVEL_DEBUG, TmpStr);
}