Esempio n. 1
0
void CCSPPlayDlg::OnButton1() 
{
	char MsgStr[100]={0};
	int r = 0;
	CSPPlayProperty_t cspProperty={0};

	cspProperty.m_u8TaskID = (DJ_U8)GetTickCount();
	cspProperty.m_u8SrcMode = XMS_SRC_8K;
	cspProperty.m_u8DecodeType = XMS_Alaw_type;
	cspProperty.m_u32MaxSize = 0;
	cspProperty.m_u32MaxTime = 0;
	cspProperty.m_u32StopMode = XMS_Normal_Stop;
	cspProperty.m_u32StopCode = 0;

	
	//XMS_ctsPlayCSP(g_acsHandle,&DevOpened[iOpenedIndex1].DevID, &cspProperty,NULL);
	XMS_ctsPlayCSP(g_acsHandle,&DevPlayCsp, &cspProperty,NULL);
	if ( r < 0 )
	{
		sprintf ( MsgStr, "X(%d) XMS_ctsPlayCSP() FAIL! (%s)", 
			r, GetString_DeviceAll (&DevPlayCsp)  );
		AddMsg ( MSG_TYPE_FUNCTION, MsgStr);
	}
	else
	{
		sprintf ( MsgStr, "XMS_ctsPlayCSP() OK! (%s)", 
			GetString_DeviceAll (&DevPlayCsp));
		AddMsg ( MSG_TYPE_FUNCTION, MsgStr );
	}

	CDialog::OnOK();	
}
Esempio n. 2
0
void	CloseDeviceOK ( DeviceID_t	*pDev )
{
	char		TmpStr[256];
	int			i, j, iRemoveIndex;
	bool		bFindFlag = false;

	for ( i = 0; i < TotalDevOpened; i ++ )
	{
		if ( ( DevOpened[i].DevID.m_s16DeviceMain == pDev->m_s16DeviceMain )
			&& ( DevOpened[i].DevID.m_s16DeviceSub == pDev->m_s16DeviceSub )
			&& ( DevOpened[i].DevID.m_s8ModuleID == pDev->m_s8ModuleID )
			&& ( DevOpened[i].DevID.m_s16ChannelID == pDev->m_s16ChannelID ) )
		{
			bFindFlag = true;
			iRemoveIndex = i;

			if ( i < TotalDevOpened -1 )
			{
				for ( j = i; j < TotalDevOpened-1 ; j ++ )
				{
					DevOpened[j] = DevOpened[j+1];
				}
				break;
			}
		}
	}

	if ( !bFindFlag )
	{
		sprintf ( TmpStr, "Fail to Remove from list in CloseDevice()! (%s)", GetString_DeviceAll(pDev) );
		AddMsg ( MSG_TYPE_OTHER, TmpStr );
	}
	else
	{
		TotalDevOpened --;

		if ( iOpenedIndex1 == iRemoveIndex)
		{
			iOpenedIndex1 = -1;
			pdlg->GetDlgItem ( IDC_EDIT_DEVICE1 )->SetWindowText ( "" );
		}
		
		/*if ( iOpenedIndex3 == iRemoveIndex)
		{
			iOpenedIndex3 = -1;
			pdlg->GetDlgItem ( IDC_EDIT_DEVICE3 )->SetWindowText ( "" );
		}*/
	}

	// redraw list
	pdlg->m_ListDevOpened.ResetContent ();
	for ( i = 0; i < TotalDevOpened; i ++ )
	{
		sprintf ( TmpStr, "%d-(%s) (%d,%d)", i, GetString_DeviceAll(&DevOpened[i].DevID),
			DevOpened[i].DevID.m_CallID.m_s32FlowType, DevOpened[i].DevID.m_CallID.m_s32FlowChannel );
		pdlg->m_ListDevOpened.AddString ( TmpStr );
	}

}
Esempio n. 3
0
void	OpenDeviceOK ( DeviceID_t	*pDev )
{
	char		TmpStr[256];

	if ( TotalDevOpened >= MAX_DEVICE_ALLOW_OPEN )
	{
		AddMsg ( MSG_TYPE_OTHER, "Add OpenDevice Fail. overflow." );
	}
	else
	{
		DevOpened[TotalDevOpened].DevID = *pDev;
		DevOpened[TotalDevOpened].bOpenFlag = true;

		sprintf ( TmpStr, "%d-(%s) (%d,%d)", TotalDevOpened, GetString_DeviceAll(pDev),
			pDev->m_CallID.m_s32FlowType, pDev->m_CallID.m_s32FlowChannel );
		pdlg->m_ListDevOpened.AddString ( TmpStr );

		if ( TotalDevOpened == 0 )
		{
			//it is fill into IDC_EDIT_DEVICE1 block automatic if opened the first deviceID
			//if ( pDev->m_s16DeviceMain != XMS_DEVMAIN_VOIP)
				 iOpenedIndex1 = 0;
			//else
			//	 iOpenedIndex3 = 0;

			//pdlg->GetDlgItem ( IDC_EDIT_DEVICE1 )->SetWindowText ( GetString_DeviceAll(&DevOpened[iOpenedIndex1].DevID) );
		}
/*		if ( iOpenedIndex1 == -1)
		{
			pdlg->m_ListDevOpened.SetCurSel (TotalDevOpened);
		}
*/
		TotalDevOpened ++;
	}
}
Esempio n. 4
0
void	SelectOpenedDevice(void)
{
	int		iRow;
	
	iRow = pdlg->m_ListDevOpened.GetCurSel ();
		
	if ( (iRow < 0) || (iRow >= TotalDevOpened) )
	{
		pdlg->GetDlgItem ( IDC_EDIT_DEVICE1 )->SetWindowText ( "" );
		pdlg->GetDlgItem ( IDC_EDIT_DEVICE3 )->SetWindowText ( "" );
	}
	else
	{
		/*if(DevOpened[iRow].DevID.m_s16DeviceMain == XMS_DEVMAIN_CTBUS_TS
			|| DevOpened[iRow].DevID.m_s16DeviceMain == XMS_DEVMAIN_VOIP)
		{
			//added by jerry Sep,25,2007
			//iOpenedIndex1 = iRow;

			iOpenedIndex3 = iRow;
			pdlg->GetDlgItem ( IDC_EDIT_DEVICE3 )->SetWindowText ( GetString_DeviceAll(&DevOpened[iOpenedIndex3].DevID) );
		}
		else*/
		{
			iOpenedIndex1 = iRow;
			pdlg->GetDlgItem ( IDC_EDIT_DEVICE1 )->SetWindowText ( GetString_DeviceAll(&DevOpened[iOpenedIndex1].DevID) );		
		}
	}
}
Esempio n. 5
0
void	ExchangeDeviceIndex(void)
{
	int		i;

	// exchange iOpenedIndex1 & iOpenedIndex2
	i = iOpenedIndex1;
	iOpenedIndex1 = iOpenedIndex2;
	iOpenedIndex2 = i;

	if ( (iOpenedIndex1 < 0) || (iOpenedIndex1 >= TotalDevOpened) )
		pdlg->GetDlgItem ( IDC_EDIT_DEVICE1 )->SetWindowText ( "" );
	else
		pdlg->GetDlgItem ( IDC_EDIT_DEVICE1 )->SetWindowText ( GetString_DeviceAll(&DevOpened[iOpenedIndex1].DevID) );

	if ( (iOpenedIndex2 < 0) || (iOpenedIndex2 >= TotalDevOpened) )
		pdlg->GetDlgItem ( IDC_EDIT_DEVICE2 )->SetWindowText ( "" );
	else
		pdlg->GetDlgItem ( IDC_EDIT_DEVICE2 )->SetWindowText ( GetString_DeviceAll(&DevOpened[iOpenedIndex2].DevID) );
}
Esempio n. 6
0
void	SelectOpenDevice(void)
{
	int		iRow = 0;
	char	TmpStr[256];
	
	iRow = pdlg->m_ListDevInfo.GetCurSel ();

	pdlg->m_ListDevInfo.GetText ( iRow, TmpStr );
	
	sscanf ( TmpStr, "%d", &iRow);

	iNowOpIndex = iRow;
	pdlg->GetDlgItem ( IDC_EDIT_NOW_OPEN_DEVICE )->SetWindowText ( GetString_DeviceAll(&pDevRes[iRow].DevID) );

}
Esempio n. 7
0
BOOL CXMSApi_BuildIndex::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	
	GetDlgItem ( IDC_EDIT_BuildIndex_DeviceID )->SetWindowText ( GetString_DeviceAll (&DevOpened[iOpenedIndex1].DevID) );
	
	if ( g_BuildIndexProperty.m_u16PlayType == XMS_BUILD_INDEX_FILE )
		((CButton *)GetDlgItem ( IDC_RADIO_INDEX_FILE ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_INDEX_RAM ))->SetCheck(1);

	GetDlgItem ( IDC_EDIT_BuildPlayIndex )->SetWindowText ( g_BuildIndexProperty.m_s8PlayContent );
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 8
0
void		InitDeviceInfo (void)
{
	char	TmpStr[256];
	int		i, iRow;

	pdlg->m_ListDevInfo.ResetContent ();

	iRow = pdlg->m_ComboDevice.GetCurSel ( ); 
	iComboDeviceSelect = iRow;

	for ( i = 0; i < TotalDevRes; i ++ )
	{
		if ( ( iRow == 0 ) || (iRow == pDevRes[i].DevID.m_s16DeviceMain) )
		{
			sprintf ( TmpStr, "%3d - (%s)", i, GetString_DeviceAll(&pDevRes[i].DevID) );
			pdlg->m_ListDevInfo.AddString ( TmpStr ); 
		}
	}
}
Esempio n. 9
0
// -------------------------------------------------------
DJ_Void EvtHandler(DJ_U32 esrParam)
{
	Acs_Evt_t *			    pAcsEvt = NULL;

	Acs_Dev_List_Head_t * pAcsDevList = NULL;
	Acs_GeneralProc_Data* pGeneral=NULL;

	char		TmpStr[256];
	char *      pStr = NULL;

	pAcsEvt = (Acs_Evt_t *) esrParam;

	DispEventInfo ( pAcsEvt );

	switch ( pAcsEvt->m_s32EventType )
	{
		case XMS_EVT_OPEN_STREAM:
			printf("");
			break;

		case XMS_EVT_QUERY_DEVICE:
			if ( !bStartWorkFlag )
			{
				pAcsDevList = ( Acs_Dev_List_Head_t *) ( (DJ_S8 *)pAcsEvt + sizeof(Acs_Evt_t) );

				//Add or modify device resource to pool when receive the device's event of the state changing
				AddDeviceRes ( pAcsDevList );
			}
			break; 

		case XMS_EVT_QUERY_DEVICE_END:	//get device list completely
			if ( !bStartWorkFlag )
			{
				pGeneral = (Acs_GeneralProc_Data*)FetchEventData(pAcsEvt);
				sprintf ( TmpStr, "Start work. DeviceNum = %d\n", TotalDevRes );
				AddMsg ( MSG_TYPE_OTHER, TmpStr );

				InitDeviceInfo();

				bStartWorkFlag = true;
			}
			break;

		case XMS_EVT_OPEN_DEVICE:
			OpenDeviceOK ( &pAcsEvt->m_DeviceID );						
			break;

		case XMS_EVT_CLOSE_DEVICE:
			CloseDeviceOK ( &pAcsEvt->m_DeviceID );

			pStr = GetString_DeviceAll(&pAcsEvt->m_DeviceID);
			sprintf(TmpStr,"Close devcie evt: %s",pStr);
			AfxMessageBox(TmpStr,NULL,MB_OK);
			break;

		case XMS_EVT_PLAYCSPREQ:
			{
				DJ_S32  r = 0;
				char MsgStr[100]={0};
				CSPPlayDataInfo_t     playCSP={0};
				Acs_CSPDataReq_Data * pCspReq = NULL;
				
				if(g_cspPlay == 0)
				{
					break;
				}

				pCspReq = (Acs_CSPDataReq_Data *)FetchEventData(pAcsEvt);
								
				if(g_cspFp == NULL)
				{
					g_cspFp = fopen(g_szCSPFile,"rb");
				}

				if(feof(g_cspFp))
				{
					fseek(g_cspFp,SEEK_SET,0);
					TRACE("Seek to Set\n");
				}
				
				playCSP.m_u16DataLen = pCspReq->m_u16ReqCspDataLen;
				playCSP.m_u8DataType = XMS_CSPPLAY_DATA_VOC;
				playCSP.m_u8TaskID = (DJ_U8)(GetTickCount() % 128);	
				
				long rr = fread(g_szDataBuf,sizeof(char),playCSP.m_u16DataLen,g_cspFp);
				TRACE("ReqDataLen = %d,sentData=%d\n",pCspReq->m_u16ReqCspDataLen,rr);
				
				r = XMS_ctsSendCSPData(g_acsHandle, &DevOpened[iOpenedIndex1].DevID, &playCSP,g_szDataBuf,NULL);
				if ( r < 0 )
				{
					sprintf ( MsgStr, "X(%d) XMS_ctsPlayCSP() FAIL! (%s)", 
						r, GetString_DeviceAll (&DevOpened[iOpenedIndex1].DevID)  );
					AddMsg ( MSG_TYPE_FUNCTION, MsgStr);
				}
				else
				{
					sprintf ( MsgStr, "XMS_ctsPlayCSP() OK! (%s)", 
						GetString_DeviceAll (&DevOpened[iOpenedIndex1].DevID));
					AddMsg ( MSG_TYPE_FUNCTION, MsgStr );
				}									
			}
			break;
		case XMS_EVT_CONTROLPLAY:
			g_cspPlay = 0;
			break;
		case XMS_EVT_RECORDCSP:
			{
				Acs_MediaCSPProc_Data * pCSPData = NULL;
								
				pCSPData = (Acs_MediaCSPProc_Data *)FetchEventData(pAcsEvt);				
				fwrite(pCSPData->m_u8StreamData,sizeof(char),pCSPData->m_u16DataLen,g_cspFp);				
			}
			break;
		default:
			break;
	}

}
Esempio n. 10
0
// -------------------------------------------------------
void	DispEventInfo ( Acs_Evt_t *pAcsEvt )
{
	char	TmpStr[512] = {0};
	char	TmpS[256] = {0};

	char		  SendTiffFileName[ACS_MAX_FILE_NAME_LEN];
	char		  RecvTiffFileName[ACS_MAX_FILE_NAME_LEN];
	
	char dtmf='?';

	Acs_Dev_List_Head_t * pAcsDevList = NULL;
	Acs_UniFailure_Data * pAcsUniFailure = NULL;
	Acs_GeneralProc_Data *pGeneralData = NULL;
	Acs_CallControl_Data *pCallControl = NULL;
	Acs_IO_Data			 *pIOData = NULL;
	Acs_CAS_ExtraInfo_t  *pCAS_ExtraInfo = NULL;
	Acs_AnalogInterface_Data* pAnalogInterface=NULL;
	Acs_CSPDataReq_Data* pCspReqData=NULL;
	Acs_ParamProc_Data*  pSetParam=NULL;
	Acs_ParamProc_Data*  pGetParam=NULL;
	Acs_MediaProc_Data* pMedia=NULL;
	Acs_ParamData_UserReadXmsBoardInfo* pBoardInfor=NULL;

	sprintf ( TmpStr, "" );
	strcat ( TmpStr, GetString_EventType ( pAcsEvt->m_s32EventType ) );

	Acs_MediaProc_Data * pMediaData = (Acs_MediaProc_Data *)FetchEventData(pAcsEvt);

	switch ( pAcsEvt->m_s32EventType )
	{
	case XMS_EVT_GETPARAM:
		{
			pGetParam = (Acs_ParamProc_Data*)FetchEventData(pAcsEvt);
			pBoardInfor = (Acs_ParamData_UserReadXmsBoardInfo*)((char*)pGetParam+sizeof(Acs_ParamProc_Data));
		}
		break;
	case XMS_EVT_DEV_TIMER:
		{

			char ioFskBuf[512];
			int iFskLen;
			char MsgStr[512];

			memset(ioFskBuf,0,sizeof(ioFskBuf));
			pdlg->GetDlgItemText(IDC_EDIT_CALLINGNUM,MsgStr,sizeof(MsgStr));
			EncodeFskCaller(MsgStr,ioFskBuf,&iFskLen);

		    int r = XMS_ctsSendIOData ( g_acsHandle, &pAcsEvt->m_DeviceID, 
			XMS_IO_TYPE_FSK, (DJ_U16)iFskLen, (DJ_Void *) ioFskBuf );
			if ( r < 0 )
			{
				sprintf ( MsgStr, "X(%d) XMS_ctsSendIOData( %s, %d, [%s] ) FAIL! (%s)", 
					r, "GTG ", g_iLen, TmpStr, 
					GetString_DeviceAll (&pAcsEvt->m_DeviceID)  );
				AddMsg ( MSG_TYPE_FUNCTION, MsgStr );
			}
			else
			{
				sprintf ( MsgStr, "XMS_ctsSendIOData( %s, %d, [%s] ) OK! (%s)", 
					"GTG ", g_iLen, TmpStr,  
					GetString_DeviceAll (&pAcsEvt->m_DeviceID)  );
				AddMsg ( MSG_TYPE_FUNCTION, MsgStr );
			}
		}
		break;
	case XMS_EVT_BUILDINDEX:
		pMedia=(Acs_MediaProc_Data*)FetchEventData(pAcsEvt);
		sprintf(TmpS," EvtState=%d taskID=%d fileIndex=%u,%x",pMedia->m_s32AcsEvtState,pMedia->m_u8TaskID,pMedia->m_u32CurFileIndex,pMedia->m_u32CurFileIndex);
		strcat(TmpStr,TmpS);
		break;
	case XMS_EVT_PLAY:
		pMedia=(Acs_MediaProc_Data*)FetchEventData(pAcsEvt);
		sprintf(TmpS," EvtState=%d Errcode=%d taskID=%d fileIndex=%d",pMedia->m_s32AcsEvtState,pMedia->m_s32AcsEvtErrCode,pMedia->m_u8TaskID,pMedia->m_u32CurFileIndex);
		strcat(TmpStr,TmpS);
		break;
	case XMS_EVT_SETPARAM:
		pSetParam = (Acs_ParamProc_Data*)FetchEventData(pAcsEvt);
		sprintf(TmpS," CmdType=[%d]",pSetParam->m_u16ParamCmdType);
		strcat(TmpStr,TmpS);
		break;
	case XMS_EVT_UNLINKDEVICE:
		pGeneralData = (Acs_GeneralProc_Data*) FetchEventData(pAcsEvt);
		break;
	case XMS_EVT_PLAYCSPREQ:
		//
		pCspReqData = (Acs_CSPDataReq_Data*)FetchEventData(pAcsEvt);
		sprintf(TmpS,"CSPPLAYREQ datalen =%d",pCspReqData->m_u16ReqCspDataLen);
		strcat(TmpStr,TmpS);
		break;

	case XMS_EVT_ANALOG_INTERFACE:
		pAnalogInterface = (Acs_AnalogInterface_Data*)FetchEventData(pAcsEvt);
		sprintf(TmpS,"(%d,%s)",pAnalogInterface->m_u8AnalogInterfaceState,GetString_AnalogInterfaceState(pAcsEvt->m_DeviceID.m_s16DeviceSub,pAnalogInterface->m_u8AnalogInterfaceState));
		strcat(TmpStr,TmpS);
		break;
	case XMS_EVT_SENDIODATA:
		sprintf ( TmpS, " (%s,%s,MachineID:%2d,ModuleID:%3d,Ch:%d)", 
			GetString_DeviceMain(pAcsEvt->m_DeviceID.m_s16DeviceMain),
			GetString_DeviceSub(pAcsEvt->m_DeviceID.m_s16DeviceMain,pAcsEvt->m_DeviceID.m_s16DeviceSub),
			pAcsEvt->m_DeviceID.m_s8MachineID,
			pAcsEvt->m_DeviceID.m_s8ModuleID,
			pAcsEvt->m_DeviceID.m_s16ChannelID );
		/*strcat ( TmpStr, TmpS );
		{
			CmdParamData_AnalogTrunk_t cmdAnalogTrunk;
			void*p =(void*)&cmdAnalogTrunk; ;
			XMS_ctsSetParam(g_acsHandle,&pAcsEvt->m_DeviceID,ANALOGTRUNK_PARAM_UNBINDVOC,sizeof(CmdParamData_AnalogTrunk_t),p);
			////
		}*/
		strcat(TmpStr,TmpS);
		break;
	case XMS_EVT_LINKDEVICE:
	case XMS_EVT_CLEARCALL:
		sprintf ( TmpS, " (%s,%s,MachineID:%2d,ModuleID:%3d,Ch:%d)", 
			GetString_DeviceMain(pAcsEvt->m_DeviceID.m_s16DeviceMain),
			GetString_DeviceSub(pAcsEvt->m_DeviceID.m_s16DeviceMain,pAcsEvt->m_DeviceID.m_s16DeviceSub),
			pAcsEvt->m_DeviceID.m_s8MachineID,
			pAcsEvt->m_DeviceID.m_s8ModuleID,
			pAcsEvt->m_DeviceID.m_s16ChannelID );
		strcat ( TmpStr, TmpS );
		break;
	case XMS_EVT_OPEN_STREAM:
		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_QUERY_ONE_DSP_START:
	case XMS_EVT_QUERY_ONE_DSP_END:
		sprintf ( TmpS, " (%d)", pAcsEvt->m_DeviceID.m_s8ModuleID );
		strcat ( TmpStr, TmpS );
		break;

	case XMS_EVT_OPEN_DEVICE:
		{
			pGeneralData = (Acs_GeneralProc_Data*)FetchEventData(pAcsEvt);
			int isize = sizeof(Acs_GeneralProc_Evt);
			 isize = sizeof(Acs_GeneralProc_Data);
			
			sprintf ( TmpS, "(%s) CallID(%d,%d)",  GetString_DeviceAll(&pAcsEvt->m_DeviceID), 
				pAcsEvt->m_DeviceID.m_CallID.m_s32FlowType, pAcsEvt->m_DeviceID.m_CallID.m_s32FlowChannel );
			strcat ( TmpStr, TmpS );
		}
		break;

	case XMS_EVT_DEVICESTATE:
		pGeneralData = (Acs_GeneralProc_Data *)FetchEventData(pAcsEvt);

		sprintf ( TmpS, "(%s) S=0x%X(%s)", GetString_DeviceAll(&pAcsEvt->m_DeviceID), 
			pGeneralData->m_s32DeviceState, GetString_DeviceState(pGeneralData->m_s32DeviceState) );
		strcat ( TmpStr, TmpS );
		break;

	case XMS_EVT_CALLIN:
		pCallControl = (Acs_CallControl_Data *)FetchEventData(pAcsEvt);

		sprintf ( TmpS, "(%s) (%s,%s)", GetString_DeviceAll(&pAcsEvt->m_DeviceID), 
			 pCallControl->m_s8CallingNum, pCallControl->m_s8CalledNum); 
		strcat ( TmpStr, TmpS );
		break;

	case XMS_EVT_CALLOUT:
		pCallControl = (Acs_CallControl_Data *)FetchEventData(pAcsEvt);

		sprintf ( TmpS, "(%s) EvtState=%d, ErrCode=%d,ClearCause=%d) calling=%s called=%s", GetString_DeviceAll(&pAcsEvt->m_DeviceID), 
			pCallControl->m_s32AcsEvtState, pCallControl->m_s32AcsEvtErrCode, pCallControl->m_s32CallClearCause,pCallControl->m_s8CallingNum,pCallControl->m_s8CalledNum );  
		strcat ( TmpStr, TmpS );
		break;

	case XMS_EVT_RECVIODATA:
		{
		pIOData = (Acs_IO_Data *)FetchEventData(pAcsEvt);


		//strcat ( TmpStr, TmpS );
		//AddMsg ( MSG_TYPE_EVENT, TmpStr );
		

		pdlg->GetDlgItem ( IDC_EDIT_SENDFAX )->GetWindowText ( SendTiffFileName, ACS_MAX_FILE_NAME_LEN-1 );
		pdlg->GetDlgItem ( IDC_EDIT_RECEIVEFAX )->GetWindowText ( RecvTiffFileName, ACS_MAX_FILE_NAME_LEN-1 );
		//sprintf ( s8LocalID, "DJ:83636988" );

		if( pAcsEvt->m_DeviceID.m_s16DeviceMain == XMS_DEVMAIN_VOIP)
		{
			//Fax Process....begin
			switch (pIOData->m_u16IoType)
			{
				case XMS_IO_TYPE_VOIP_H245UII:
					if (pIOData->m_u16IoDataLen == sizeof(Acs_VoIP_H245UII))
					{
						Acs_VoIP_H245UII *h245Uii = (Acs_VoIP_H245UII *)FetchIOData(pAcsEvt);
						dtmf = h245Uii->m_s8Signal;
					}
					sprintf ( TmpS, "(%s) (%s,%d) [%c]", GetString_DeviceAll(&pAcsEvt->m_DeviceID), 
					GetString_IOType(pIOData->m_u16IoType),  pIOData->m_u16IoDataLen, dtmf ); 
					break;
				case XMS_IO_TYPE_VOIP_SIPINFO:
					if (pIOData->m_u16IoDataLen == sizeof(Acs_VoIP_SIPINFO))
					{
						Acs_VoIP_SIPINFO *sipInfo = (Acs_VoIP_SIPINFO *)FetchIOData(pAcsEvt);
						if (strcmp(sipInfo->m_s8ContentType, "application/dtmf") == 0)
							sscanf(sipInfo->m_s8Body, "dtmf=%c", &dtmf);
					}
					sprintf ( TmpS, "(%s) (%s,%d) [%c]", GetString_DeviceAll(&pAcsEvt->m_DeviceID), 
					GetString_IOType(pIOData->m_u16IoType),  pIOData->m_u16IoDataLen, dtmf ); 
					break;
				case XMS_IO_TYPE_VOIP_RTPDTMF:
					if (pIOData->m_u16IoDataLen == sizeof(Acs_VoIP_RTPDTMF))
					{
						Acs_VoIP_RTPDTMF *rtpDtmf = (Acs_VoIP_RTPDTMF *)FetchIOData(pAcsEvt);
						dtmf = rtpDtmf->m_s8EventChar;
					}
					sprintf ( TmpS, "(%s) (%s,%d) [%c]", GetString_DeviceAll(&pAcsEvt->m_DeviceID), 
					GetString_IOType(pIOData->m_u16IoType),  pIOData->m_u16IoDataLen, dtmf ); 
					break;
				case XMS_IO_TYPE_VOIP_T38START:
					if (pIOData->m_u16IoDataLen == sizeof(DJ_S32))
					{
						DJ_S32 *ret = (DJ_S32 *)FetchIOData(pAcsEvt);
						if (*ret == 0)
						{
							

							pdlg->UpdateData();

							if (g_iSendRecv == 0)//SendFax
							{
								//pdlg->m_lstIP.SetItemText(iDevice, 3, _T("Send Fax"));

								XMS_ctsSendFax(g_acsHandle,
									&DevOpened[iOpenedIndex1].DevID,
									&DevOpened[iOpenedIndex2].DevID,
									//&g_deviceVoIP[iDevice].device,
									(DJ_S8 *)(LPCTSTR)SendTiffFileName, "1234", NULL);

								sprintf ( TmpS, "(%s) (%s,%d) T38START SENDFAX", GetString_DeviceAll(&pAcsEvt->m_DeviceID), 
								GetString_IOType(pIOData->m_u16IoType),  pIOData->m_u16IoDataLen  ); 
							}
							else
							{
								//pdlg->m_lstIP.SetItemText(iDevice, 3, _T("Recv Fax"));
								XMS_ctsReceiveFax(g_acsHandle,
									&DevOpened[iOpenedIndex1].DevID,
									&DevOpened[iOpenedIndex2].DevID,
									//&g_deviceVoIP[iDevice].device,
									(DJ_S8 *)(LPCTSTR)RecvTiffFileName, "1234", NULL);

								sprintf ( TmpS, "(%s) (%s,%d) T38START RECVFAX", GetString_DeviceAll(&pAcsEvt->m_DeviceID), 
								GetString_IOType(pIOData->m_u16IoType),  pIOData->m_u16IoDataLen  ); 
							}
						}
					}
			
					
					break;
				//default:
				//	sprintf ( TmpS, "(%s) (%s,%d) INVALID IOTYPE FOR VOIP", GetString_DeviceAll(&pAcsEvt->m_DeviceID), 
				//				GetString_IOType(pIOData->m_u16IoType),  pIOData->m_u16IoDataLen  ); 
				//	break;

				
			}
		//Fax Process....end

		}
		else //NO IP Device
		{
			char *p;
			p = (char *)(pIOData) + sizeof(Acs_IO_Data);
			switch( pIOData->m_u16IoType)
			{
			case XMS_IO_TYPE_DTMF:
				sprintf ( TmpS, "(%s) (%s,%d) [%s]", 
				GetString_DeviceAll(&pAcsEvt->m_DeviceID), 
				GetString_IOType(pIOData->m_u16IoType),  
				pIOData->m_u16IoDataLen, 
				p ); 
				break;
			case XMS_IO_TYPE_GTG:
				sprintf ( TmpS, "(%s) (%s,%d) [%c]", 
				GetString_DeviceAll(&pAcsEvt->m_DeviceID), 
				GetString_IOType(pIOData->m_u16IoType),  
				pIOData->m_u16IoDataLen, 
				*p ); 
				break;
			case XMS_IO_TYPE_FSK:
				sprintf ( TmpS, "(%s) (%s,Len:%d) [%d][%d][%d][%s]", 
				GetString_DeviceAll(&pAcsEvt->m_DeviceID), 
				GetString_IOType(pIOData->m_u16IoType),  
				pIOData->m_u16IoDataLen, 
				p[0],p[1],p[2],p ); 
				break;
			
			case XMS_IO_TYPE_PVD:
				sprintf ( TmpS, "(%s) (%s,%d) [%c]", 
				GetString_DeviceAll(&pAcsEvt->m_DeviceID), 
				GetString_IOType(pIOData->m_u16IoType),  
				pIOData->m_u16IoDataLen, 
				*p ); 
				break;
			default:
				break;
			}
			
		}

		}
		strcat ( TmpStr, TmpS );
		//AddMsg ( MSG_TYPE_EVENT, TmpStr );
		break;

	case XMS_EVT_CAS_MFC_START:
	case XMS_EVT_CAS_MFC_END:
		pCAS_ExtraInfo = (Acs_CAS_ExtraInfo_t *)FetchEventData(pAcsEvt);

		sprintf ( TmpS, "(%s) KA=%d, KD=%d)", GetString_DeviceAll(&pAcsEvt->m_DeviceID), 
			pCAS_ExtraInfo->m_u8KA, pCAS_ExtraInfo->m_u8KD );
		strcat ( TmpStr, TmpS );
		break;


	case XMS_EVT_UNIFAILURE:
		pAcsUniFailure = (Acs_UniFailure_Data *)FetchEventData(pAcsEvt);

		sprintf ( TmpS, ": %s(0x%X)", GetString_ErrorCode(pAcsUniFailure->m_s32AcsEvtErrCode), pAcsUniFailure->m_s32AcsEvtErrCode );
		strcat ( TmpStr, TmpS );

		if ( pAcsEvt->m_DeviceID.m_s16DeviceMain != 0 )
		{
			//Unifailure event that some device link each other
			sprintf ( TmpS, " (%s)", GetString_DeviceAll(&pAcsEvt->m_DeviceID) );
			strcat ( TmpStr, TmpS );
		}
		break;
	default:
		break;

	}

	AddMsg ( MSG_TYPE_EVENT, TmpStr );
}
Esempio n. 11
0
BOOL CXMSApi_3GPPPlaySet::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	char	TmpStr[256];

	GetDlgItem ( IDC_EDIT_Play_DevcieID )->SetWindowText ( GetString_DeviceAll (&DevOpened[iOpenedIndex1].DevID) );

	//playpropetry . m_u32TaskID
	sprintf ( TmpStr, "%d", g_Play3gppProperty.m_u8TaskID );
	GetDlgItem ( IDC_EDIT_Play_u32TaskID )->SetWindowText ( TmpStr );
	
	//playpropetry . m_u32MaxSize
//	sprintf ( TmpStr, "%d", g_Play3gppProperty.m_u32MaxSize );
	//GetDlgItem ( IDC_EDIT_Play_u32MaxSize )->SetWindowText ( TmpStr );

	// playpropetry . m_u32MaxTime
	sprintf ( TmpStr, "%d", g_Play3gppProperty.m_u32MaxTime );
	GetDlgItem ( IDC_EDIT_Play_u32MaxTime )->SetWindowText ( TmpStr );

	sprintf ( TmpStr, "%d", g_Play3gppProperty.m_u32VideoMaxTime );
	GetDlgItem ( IDC_EDIT_Play_u32VideoMaxTime )->SetWindowText ( TmpStr );


	//sprintf ( TmpStr, "%d", g_Play3gppProperty.m_u8MediaType );
	//GetDlgItem ( IDC_EDIT_Play_u8MediaType )->SetWindowText ( TmpStr );
	
	//m_u8MediaType
	g_Play3gppProperty.m_u8MediaType = MEDIA_TYPE_ANV;
	if ( g_Play3gppProperty.m_u8MediaType == MEDIA_TYPE_ANV )
		((CButton *)GetDlgItem ( IDC_RADIO_ANV ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_ANV ))->SetCheck(0);

	if ( g_Play3gppProperty.m_u8MediaType == MEDIA_TYPE_AUDIO )
		((CButton *)GetDlgItem ( IDC_RADIO_AUDIO ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_AUDIO ))->SetCheck(0);

	if ( g_Play3gppProperty.m_u8MediaType == MEDIA_TYPE_VIDEO )
		((CButton *)GetDlgItem ( IDC_RADIO_VIDEO ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_VIDEO ))->SetCheck(0);

	
	//playpropetry . m_u8SrcMode
	if ( g_Play3gppProperty.m_u8SrcMode == XMS_SRC_8K )
		((CButton *)GetDlgItem ( IDC_RADIO_SRC_8K ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_SRC_8K ))->SetCheck(0);
	if ( g_Play3gppProperty.m_u8SrcMode == XMS_SRC_6K )
		((CButton *)GetDlgItem ( IDC_RADIO_SRC_6K ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_SRC_6K ))->SetCheck(0);
	if ( g_Play3gppProperty.m_u8SrcMode == XMS_SRC_GTG )
		((CButton *)GetDlgItem ( IDC_RADIO_SRC_GTG ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_SRC_GTG ))->SetCheck(0);
	if ( g_Play3gppProperty.m_u8SrcMode == XMS_SRC_FSK )
		((CButton *)GetDlgItem ( IDC_RADIO_SRC_FSK ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_SRC_FSK ))->SetCheck(0);
	if ( g_Play3gppProperty.m_u8SrcMode == XMS_SRC_FAX )
		((CButton *)GetDlgItem ( IDC_RADIO_SRC_FAX ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_SRC_FAX ))->SetCheck(0);

	//playpropetry . m_u8DecodeType
	if ( g_Play3gppProperty.m_u8DecodeType == XMS_Alaw_type )
		((CButton *)GetDlgItem ( IDC_RADIO_Alaw_type ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_Alaw_type ))->SetCheck(0);
	if ( g_Play3gppProperty.m_u8DecodeType == XMS_Ulaw_type )
		((CButton *)GetDlgItem ( IDC_RADIO_Ulaw_type ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_Ulaw_type ))->SetCheck(0);
	if ( g_Play3gppProperty.m_u8DecodeType == XMS_Vox_type )
		((CButton *)GetDlgItem ( IDC_RADIO_Vox_type ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_Vox_type ))->SetCheck(0);
	if ( g_Play3gppProperty.m_u8DecodeType == XMS_Linear_8bit )
		((CButton *)GetDlgItem ( IDC_RADIO_Linear_8bit ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_Linear_8bit ))->SetCheck(0);
	if ( g_Play3gppProperty.m_u8DecodeType == XMS_Linear_16bit )
		((CButton *)GetDlgItem ( IDC_RADIO_PLY_Linear_16bit ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_PLY_Linear_16bit ))->SetCheck(0);

	//playpropetry . m_u32StopMode
	if ( g_PlayProperty.m_u32StopMode == XMS_Normal_Stop )
		((CButton *)GetDlgItem ( IDC_RADIO_Normal_Stop ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_Normal_Stop ))->SetCheck(0);
	if ( g_Play3gppProperty.m_u32StopMode == XMS_Single_Code )
		((CButton *)GetDlgItem ( IDC_RADIO_Single_Code ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_Single_Code ))->SetCheck(0);
	if ( g_Play3gppProperty.m_u32StopMode == XMS_Any_Code )
		((CButton *)GetDlgItem ( IDC_RADIO_Any_Code ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_Any_Code ))->SetCheck(0);

	//playpropetry . m_u32StopCode
	sprintf ( TmpStr, "%c", g_Play3gppProperty.m_u32StopCode );
	GetDlgItem ( IDC_EDIT_Play_u32StopCode )->SetWindowText ( TmpStr );

	//playpropetry . m_u16FileOffset
	sprintf ( TmpStr, "%d", g_Play3gppProperty.m_u16TimeOffset );
	GetDlgItem ( IDC_EDIT_Play_u16TimeOffset )->SetWindowText ( TmpStr );

	sprintf ( TmpStr, "%d", g_Play3gppProperty.m_u16VideoTimeOffset );
	GetDlgItem ( IDC_EDIT_Play_u16VideoTimeOffset )->SetWindowText ( TmpStr );

	//playpropetry . m_u16PlayType
	if ( g_Play3gppProperty.m_u16PlayType == XMS_PLAY_TYPE_FILE )
		((CButton *)GetDlgItem ( IDC_RADIO_PLAY_TYPE_FILE ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_PLAY_TYPE_FILE ))->SetCheck(0);
	if ( g_Play3gppProperty.m_u16PlayType == XMS_PLAY_TYPE_INDEX )
		((CButton *)GetDlgItem ( IDC_RADIO_PLAY_TYPE_INDEX ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_PLAY_TYPE_INDEX ))->SetCheck(0);
	if ( g_Play3gppProperty.m_u16PlayType == XMS_PLAY_TYPE_FILE_QUEUE )
		((CButton *)GetDlgItem ( IDC_RADIO_PLAY_TYPE_FILE_QUEUE ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_PLAY_TYPE_FILE_QUEUE ))->SetCheck(0);
	if ( g_Play3gppProperty.m_u16PlayType == XMS_PLAY_TYPE_INDEX_QUEUE )
		((CButton *)GetDlgItem ( IDC_RADIO_PLAY_TYPE_INDEX_QUEUE ))->SetCheck(1);
	else
		((CButton *)GetDlgItem ( IDC_RADIO_PLAY_TYPE_INDEX_QUEUE ))->SetCheck(0);

	//playpropetry . m_u16PlayIndex
	sprintf ( TmpStr, "%d", g_Play3gppProperty.m_u16PlayIndex );
	GetDlgItem ( IDC_EDIT_Play_u16PlayIndex )->SetWindowText ( TmpStr );

	//playpropetry . m_u16PlayIndex
	sprintf ( TmpStr, "%d", g_Play3gppProperty.m_u16VideoPlayIndex );
	GetDlgItem ( IDC_EDIT_Play_u16PlayIndex_Video )->SetWindowText ( TmpStr );

	//playpropetry . m_s8PlayContext
	GetDlgItem ( IDC_EDIT_Play_s8PlayContent )->SetWindowText (g_Play3gppProperty.m_s8PlayContent);
	GetDlgItem ( IDC_EDIT_Play_s8PlayContent_3GPP )->SetWindowText (g_Play3gppProperty.m_s8VideoPlayContent);

	// -------------------------------------------------------------------------------
	// Handle Enable Disable
	HandleEnableDisable ();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}