本文整理汇总了C++中CChannel类的典型用法代码示例。如果您正苦于以下问题:C++ CChannel类的具体用法?C++ CChannel怎么用?C++ CChannel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CChannel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeUsrFaxFile
struct state* CMailChannel::RcvFxByte_cmplt(EVTBLK *evtblk)
{
int nChan = evtblk->nReference;
if ( evtblk->wEventCode == E_PROC_PlayEnd )
{
UsrLvFax = MakeUsrFaxFile( "tif" );
CChannel* pChannel = Network.FindChannel( m_nTaskId );
if ( ! pChannel ) throw "Invalid channel";
if ( pChannel->RecordFax( UsrLvFax, NULL ) )
{
CHAR sError[1024];
SsmGetLastErrMsg( sError );
theApp.Message( MSG_ERROR, sError );
}
}
///////////////////////////
if ( evtblk->wEventCode == E_PROC_FaxEnd )//&& m_bPending == TRUE )
{
if ( ! RepackFile( (LPCTSTR)UsrLvFax ) )
{
CHAR sError[1024];
fBmp_GetErrMsg( sError );
theApp.Message( MSG_ERROR, sError );
}
PutUsrRecord( UsrLvFax ); SetEvent( Traffic.m_pWakeup );
}
return ChkDTSignal( evtblk, &RcvFxByte );
}
示例2: RunNeighbours
BOOL CNetwork::RunNeighbours()
{
for ( POSITION posNext = m_pList.GetStartPosition(); posNext; )
{
CString xJobId;
CChannel* pChannel;
m_pList.GetNextAssoc( posNext, xJobId, (void*&)pChannel );
ASSERT( pChannel != NULL );
try
{
if ( pChannel ) pChannel->OnRun();
}
catch( CHAR* sError )
{
theApp.Message( MSG_ERROR, "error on channel %s: %s", xJobId, sError );
return FALSE;
}
#ifndef _DEBUG
catch(_com_error e)
{
theApp.Message( MSG_ERROR, "error on channel '%s': %s", xJobId, e.ErrorMessage() );
return FALSE;
}
catch(...)
{
theApp.Message( MSG_ERROR, "error on channel '%s': %s", xJobId, "a fatal error" );
return FALSE;
}
#endif
}
return TRUE;
}
示例3: ReadOperUser
CChannel* CCallerChannel::ReadOperUser(LPCTSTR xLocalId, LPCTSTR xOper)
{
int nCount = 0; m_pUserWnd->IsWellAlived( &nCount );
for ( CChannel* pChannel = m_pUserWnd->ReadItem( xLocalId ); pChannel && nCount > 0; nCount -- )
{
if ( _tcsicmp( xOper, pChannel->m_xFeeCode ) ) continue;
if ( SsmGetChState( pChannel->m_nChan ) == S_CALL_STANDBY &&
pChannel->m_nTaskId == -1 )
{
SsmPutUserEvent( E_CHG_ChState, pChannel->m_nChan,
MAKEVENT(m_nChan & 0xFFFF, S_CALL_RINGING) );
}
else
{
pChannel->SendPacket( new CRingPacket( RemoteId, LocalId, m_nChan ) );
// pChannel->SendPacket( new CByePacket );
SetTimer( 5 * 1000 );
}
return pChannel;
}
return NULL;
}
示例4: GetClientRect
void CShowVideo::Play(LPCTSTR strIp, LONG nPort, SHORT nNum)
{
CRect rect;
GetClientRect(&rect);
CString url(strIp);
int nBasePort = nPort;
int nLoop = (int)sqrt((float)nNum);
//
m_strLog.Format(_T("控件Play,正在运行,rect=%d,%d,%d,%d"), rect.left, rect.right, rect.Width(),
rect.Height());
CWinLog::GetInstance()->WriteLog(m_strLog, emRunLog);
int xGap = 0, yGap = 0;
int width = rect.Width()-0;
int height = rect.Height()-0;
int x = rect.left + xGap;
int y = rect.top + yGap;
int video_width, audio_width = 40, video_height, audio_height;
video_width = (width - (audio_width*nLoop + xGap*(nLoop + 1))) / nLoop;
video_height = audio_height = (height - yGap*(nLoop + 1)) / nLoop;
for (int i = 0; i < nLoop; ++i)
for (int j = 0; j < nLoop; ++j)
{
CChannel* pchannel = NULL;
pchannel = new CChannel(GetSafeHwnd()/*, i*/);
int video_x = x + i%nLoop*(video_width + audio_width + xGap);
int video_y = y + (i + j) % nLoop*(video_height + yGap);
int audio_x = x + video_width + i%nLoop*(video_width + audio_width + xGap);
int audio_y = video_y;
pchannel->putVideoOrAudioRect(video_x, video_y, video_width, video_height, TRUE);//设置视频位置
pchannel->putVideoOrAudioRect(audio_x, audio_y, audio_width, audio_height, FALSE);//设置音频位置
#if _DEBUG
m_strLog.Format(_T("视频频位置,video_x:%d, video_y:%d, video_width:%d, video_height:%d"),
video_x, video_y, video_width, video_height);
CWinLog::GetInstance()->WriteLog(m_strLog, emRunLog);
m_strLog.Format(_T("音频位置,audio_x:%d, audio_y:%d, audio_width:%d, audio_height:%d"),
audio_x, audio_y, audio_width, audio_height);
CWinLog::GetInstance()->WriteLog(m_strLog, emRunLog);
#endif
BOOL bRet = pchannel->InitAV(url, nBasePort);
if (!bRet)
{
delete pchannel;
m_strLog.Format(_T("%s:%d 初始化InitAV失败"), url, nBasePort);
CWinLog::GetInstance()->WriteLog(m_strLog, emErrorLog);
continue;
}
//初始化成功,加入CChannel数组中
m_vtrChannel.push_back(pchannel);
++nBasePort;
}
m_strLog.Format(_T("控件Play,运行完毕,Channel size=%d"), m_vtrChannel.size());
CWinLog::GetInstance()->WriteLog(m_strLog, emRunLog);
}
示例5: GetChannelManager
void CXEPxibb::SendStreamData(const CJid& rJid, u16 localCid, u16 localSid, CBuffer* pBuffer)
{
u16 remoteCid;
u16 remoteSid;
MutexOnChannelManager.Lock();
try
{
// we are looking for the channelmanager associate to the Jid
CChannelManager* pChannelManager = GetChannelManager(rJid);
if(pChannelManager == NULL)
throw CXEPxibbException(CXEPxibbException::XEPXEC_SENDSTREAMDATAERROR);
// we are looking for the channel associate to the localCid
CChannel* pChannel = pChannelManager->GetChannelByLocalCid(localCid);
if(pChannel == NULL)
throw CXEPxibbException(CXEPxibbException::XEPXEC_SENDSTREAMDATAERROR);
remoteCid = pChannel->GetRemoteCid();
// we are looking for the stream associate to the localSid
CStream* pStream = pChannel->GetStreamByLocalSid(localSid);
if(pStream == NULL)
throw CXEPxibbException(CXEPxibbException::XEPXEC_SENDSTREAMDATAERROR);
remoteSid = pStream->GetRemoteSid();
}
catch(exception& e)
{
MutexOnChannelManager.UnLock();
#ifdef __DEBUG__
cerr << e.what() << endl;
#endif //__DEBUG__
throw CXEPxibbException(CXEPxibbException::XEPXEC_SENDSTREAMDATAERROR);
}
MutexOnChannelManager.UnLock();
CStreamDataStanza StreamDataStanza(rJid, remoteCid, remoteSid);
CXMLNode* pData = StreamDataStanza.GetChild("stream-data");
string data;
CBase64 Base64;
Base64.To64(pBuffer, data);
pData->SetData(data.c_str(), data.size());
if(!pXMPPCore->Send(&StreamDataStanza))
throw CXEPxibbException(CXEPxibbException::XEPXEC_SENDSTREAMDATAERROR);
}
示例6: CChannel
int CPagerChannel::bkIdle_init(EVTBLK *evtblk)
{
int nChan = evtblk->nReference;
CChannel* pChannel = new CChannel( nChan );
pChannel->Clone( this ); Network.SetChannel( pChannel );
return (pChannel->*(pChannel->fcnp)->initiate)(evtblk);
}
示例7: Clear
void CNetwork::Clear()
{
for ( POSITION posNext = m_pList.GetStartPosition(); posNext; )
{
CString xJobId;
CChannel* pChannel;
m_pList.GetNextAssoc( posNext, xJobId, (void*&)pChannel );
if ( pChannel ) pChannel->Release();
}
}
示例8: throw
void* CXEPxibb::OnStreamCloseJob(void* pvThis) throw()
{
CXEPxibb* pXEPxibb = (CXEPxibb*) pvThis;
CStreamCloseHandler* pStreamCloseHandler = &(pXEPxibb->StreamCloseHandler);
CXMPPCore* pXMPPCore = pXEPxibb->pXMPPCore;
CStreamCloseStanza StreamCloseStanza;
while(pXMPPCore->Receive(pStreamCloseHandler, &StreamCloseStanza))
{
pXEPxibb->MutexOnChannelManager.Lock();
try
{
CChannelManager* pChannelManager = pXEPxibb->GetChannelManager(StreamCloseStanza.GetRemoteJid());
if(pChannelManager != NULL)
{
CChannel* pChannel = pChannelManager->GetChannelByRemoteCid(StreamCloseStanza.GetChannelId());
if(pChannel != NULL)
{
CStream* pStream = pChannel->GetStreamByRemoteSid(StreamCloseStanza.GetStreamId());
if(pStream != NULL)
{
pXMPPCore->CommitHandler(pStream->GetStreamDataHandler());
pChannel->RemoveStreamByRemoteSid(StreamCloseStanza.GetStreamId());
}
}
}
}
catch(exception& e)
{
#ifdef __DEBUG__
cerr << e.what() << endl;
#endif //__DEBUG__
}
pXEPxibb->MutexOnChannelManager.UnLock();
CIQResultStanza IQResultStanza;
IQResultStanza.SetTo(StreamCloseStanza.GetRemoteJid());
IQResultStanza.SetId(StreamCloseStanza.GetId());
if(!pXMPPCore->Send(&IQResultStanza))
return NULL;
}
return NULL;
}
示例9: KillLinker
int CCallerChannel::bkIdle_init(EVTBLK *evtblk)
{
int nChan = evtblk->nReference;
KillLinker();
SsmSetPlayDest( nChan, 0 ); // 取消上总线
CChannel* pChannel = new CChannel( nChan );
pChannel->Clone( this ); Network.SetChannel( pChannel );
return (pChannel->*(pChannel->fcnp)->initiate)(evtblk);
}
示例10: OnRequestInitializeInt
int OnRequestInitializeInt( LPSOCKETCONTEXT lpSockContext, char *cpPacket )
{
CCoder coder;
CChannel *pChannel = &Server.ch[lpSockContext->iChannel];
CRoom *pRoom;
char cPacket[32];
int iSize,
iNext;
#ifdef _LOGLEVEL3_
DConsole.Output( "OnRequestInitializeInt(%d) : %d\n", lpSockContext->index,
lpSockContext->iChannel );
#endif
// ---- 초기화 응답 ----
coder.SetBuf( cPacket );
coder.PutChar( lpSockContext->iChannel ); // 채널 번호
coder.PutChar( Server.iMaxChannel ); // 최대 채널수
coder.PutShort( pChannel->iUserNum + 1 ); // 채널에 있는 유저수
iSize = coder.SetHeader( ANSWER_INITIALIZE );
PostTcpSend( 1, (int *)&lpSockContext, cPacket, iSize );
// ---- 룸 리스트 전달 ----
OnNotifyRoomList( lpSockContext, NULL );
// ---- 유저 리스트 전달 ----
OnNotifyUserList( lpSockContext, NULL );
// ---- 유저를 링크에 연결 ----
pChannel->SetUserLink( lpSockContext->index );
// ---- 유저 입장을 통지 ----
coder.SetBuf( cPacket );
coder.PutChar( 1 ); // userNum
coder.PutChar( lpSockContext->idLen );
coder.PutText( lpSockContext->cID, lpSockContext->idLen );
coder.PutChar( WH_LOBBY ); // Where
iSize = coder.SetHeader( NOTIFY_USERLIST );
PostTcpSend( pChannel->iUserBegin, cPacket, iSize );
iNext = pChannel->iUsedRoomBegin;
while( iNext != NOTLINKED )
{
pRoom = &Server.rm[iNext];
PostTcpSend( pRoom->iUserBegin, cPacket, iSize );
iNext = Server.rn[iNext].next;
}
return 1;
}
示例11: CChannel
CFormListItemDlg *CMixereView::OnNewItem()
{
// create channel as a modeless dialog
CChannel *Chan = new CChannel(*this);
if (!Chan->Create(IDD_CHANNEL)) {
delete Chan;
return(NULL);
}
Chan->SetTitleFont(m_TitleFont); // set channel's title font
if (m_HasToolTips) // optionally enable its tooltips
Chan->EnableToolTips(TRUE);
return(Chan);
}
示例12: pLock
BOOL CNetworkMonitorBox::ProcessXML(POSITION posNext)
{
CXMLElement* pXML = Profiles.FindProcess( NULL, posNext );
if ( pXML == NULL ) return FALSE;
CSingleLock pLock( &Network.m_pSection, TRUE );
CString strValue = pXML->GetAttributeValue( "Host" );
if ( CChannel* pChannel = Network.FindChannel( strValue ) )
{
if ( pChannel->m_hSocket == INVALID_SOCKET && pChannel->TimeOut( 60 * 1000 ) )
{
CXMLAttribute* pAttri = pXML->GetAttribute( "Retry" );
if ( ! pAttri ) pAttri = pXML->AddAttribute( "Retry" );
if ( _ttoi( pAttri->GetValue() ) >= 2 )
{
AlarmToShortMessage( (LPCTSTR)strValue );
strValue = pXML->GetAttributeValue( _T("Path") );
RestartMachine( (LPCTSTR)strValue );
pXML->DeleteAttribute( "Retry" );
}
else
{
strValue.Format( "%i", _ttoi( pAttri->GetValue() ) + 1 );
pAttri->SetValue( (LPCTSTR)strValue );
pChannel->LinkRestart();
pChannel->m_tConnected = GetTickCount();
}
}
else
if ( pChannel->IsConnected() )
{
pXML->DeleteAttribute( "Retry" );
}
}
else
{
CChannel* pChannel = new CSentryChannel( pXML );
Network.SetChannel( pChannel );
pChannel->LinkRestart();
}
if ( posNext ) return ProcessXML( posNext );
return TRUE;
}
示例13: GetNext
void CNeighbour::OnEchnPacket(IEchnPacket* pPacket)
{
for ( POSITION posNext = GetIterator(); posNext; )
{
CChannel* pChannel = GetNext( posNext );
if ( pPacket->ChNum < pChannel->m_nChan ) continue;
for ( ; pChannel; pChannel = pChannel->m_pChNext )
{
if ( pPacket->ChNum != pChannel->m_nChan ) continue;
pChannel->SetChState( pPacket->ChState );
}
}
}
示例14: _T
struct state* CCallerChannel::CallRemoteUser(LPCTSTR xRemoteId, LPCTSTR xCallerId, struct state* lpszDefaultState)
{
CSettings::Item* pItem = Settings.GetSetting( _T("Trunk.TrunkFind") );
CChannel* pChannel = Network.LookOutPcm( *pItem->m_pString );
if ( pChannel == NULL ) return lpszDefaultState;
CDialPacket* pPacket = new CDialPacket;
pPacket->SetLocalId( "057496031" ); pPacket->SetRemoteId( xRemoteId );
pPacket->SetCallerId( xCallerId );
pChannel->OnDialPacket(pPacket); pPacket->Release();
SetLinker( pChannel->m_nChan );
return lpszDefaultState;
}
示例15: _variant_t
struct state* CMailChannel::GetFxByte_cmplt(EVTBLK *evtblk)
{
int nChan = evtblk->nReference;
if ( evtblk->wEventCode == E_PROC_PlayEnd )
{
CChannel* pChannel = Network.FindChannel( m_nTaskId );
if ( ! pChannel ) throw "Invalid channel";
_variant_t TheValue = m_pRecordset->GetCollect( "xfaxpath" );
pChannel->SendFax( (LPCTSTR)(_bstr_t)TheValue, NULL );
}
if ( evtblk->wEventCode == E_CHG_FaxPages && m_pRecordset != NULL )
{
m_pRecordset->PutCollect( "xstate", _variant_t("1") );
COleDateTime tt = COleDateTime::GetCurrentTime();
m_pRecordset->PutCollect( "xsenddate", _variant_t(tt) );
m_pRecordset->Update();
for ( m_pRecordset->MoveNext(); !m_pRecordset->adoEOF; m_pRecordset->MoveNext() )
{
CChannel* pChannel = Network.FindChannel( m_nTaskId );
if ( ! pChannel ) throw "Invalid channel";
_variant_t TheValue = m_pRecordset->GetCollect( "xfaxpath" );
pChannel->SendFax( (LPCTSTR)(_bstr_t)TheValue, NULL, TRUE );
m_pRecordset->PutCollect( "xstate", _variant_t("1") );
COleDateTime tt = COleDateTime::GetCurrentTime();
m_pRecordset->PutCollect( "xsenddate", _variant_t(tt) );
m_pRecordset->Update();
}
}
return ChkDTSignal( evtblk, &GetFxByte );
}