| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- #include "StdAfx.h"
- #include "MeetingPool.h"
- #include "Meeting.h"
- #include "DevDsp.h"
- CMeetingPool::CMeetingPool(CDevDsp* pParent) : m_pParent(pParent), m_Handle(DEV_HANDLE_INVALID)
- {
- }
- CMeetingPool::~CMeetingPool(void)
- {
- __release();
- }
- /*****************************************************************
- **【函数名称】 __release
- **【函数功能】 释放资源
- **【参数】
- **【返回值】
- ****************************************************************/
- void CMeetingPool::__release( void )
- {
- int Key;
- CMeeting* pMeeting;
- POSITION Pos = m_MeetingMap.GetStartPosition();
- while(Pos != NULL)
- {
- m_MeetingMap.GetNextAssoc(Pos, Key, pMeeting);
- ASSERT(pMeeting != NULL);
- delete pMeeting;
- }
- m_MeetingMap.RemoveAll();
- }
- /*****************************************************************
- **【函数名称】 __getMeeting
- **【函数功能】 返回指定会议
- **【参数】
- **【返回值】
- ****************************************************************/
- CMeeting* CMeetingPool::__getMeeting( int MeetingId )
- {
- CMeeting* pMeeting = NULL;
- m_MeetingMap.Lookup(MeetingId, pMeeting);
- return pMeeting;
- }
- /*****************************************************************
- **【函数名称】 __deleteMeeting
- **【函数功能】 删除指定会议
- **【参数】
- **【返回值】
- ****************************************************************/
- void CMeetingPool::deleteMeeting( int MeetingId )
- {
- CMeeting* pMeeting = __getMeeting(MeetingId);
- if(pMeeting == NULL)
- return;
- ASSERT(pMeeting->attendeeCount() == 0);
- m_MeetingMap.RemoveKey(MeetingId);
- delete pMeeting;
- ISX_dcb_delconf(m_Handle, MeetingId);
- }
- /*****************************************************************
- **【函数名称】 open
- **【函数功能】 打开会议设备
- **【参数】
- **【返回值】
- ****************************************************************/
- bool CMeetingPool::open( void )
- {
- ASSERT(m_Handle == DEV_HANDLE_INVALID);
- m_Handle = ISX_dcb_open(m_pParent->nodeNo(), m_pParent->boardNo());
- bool t_bRes = false;
- if (m_Handle != DEV_HANDLE_INVALID) {
- LOGGER(LOG_CLASS_BUSI, LOG_LEVEL_WARNING, _T("{CMeetingPool}:DSP[%d-%d]成功打开会议设备[%d]"), m_pParent->nodeNo(), m_pParent->boardNo(), m_Handle);
- t_bRes = true;
- }
- else {
- LOGGER(LOG_CLASS_BUSI, LOG_LEVEL_WARNING, _T("{CMeetingPool}:DSP[%d-%d]打开会议设备失败"), m_pParent->nodeNo(), m_pParent->boardNo());
- }
- return t_bRes;
- }
- /*****************************************************************
- **【函数名称】 close
- **【函数功能】 关闭会议设备
- **【参数】
- **【返回值】
- ****************************************************************/
- void CMeetingPool::close( void )
- {
- if(m_Handle != DEV_HANDLE_INVALID)
- {
- ISX_dcb_close(m_Handle);
- m_Handle = DEV_HANDLE_INVALID;
- }
- __release();
- }
- /*****************************************************************
- **【函数名称】 createMeeting
- **【函数功能】 创建会议
- **【参数】
- **【返回值】
- ****************************************************************/
- bool CMeetingPool::createMeeting( MeetingInfo& MeetInfo )
- {
- ASSERT(m_Handle != DEV_HANDLE_INVALID);
- if(m_Handle == DEV_HANDLE_INVALID)
- return false;
- int MeetingId;
- if(ISX_dcb_estconf(m_Handle, NULL, 0, 0, &MeetingId) == 0)
- {
- CMeeting* pMeeting = new CMeeting(this, MeetingId);
- m_MeetingMap.SetAt(MeetingId, pMeeting);
- MeetInfo.NodeNo = m_pParent->nodeNo();
- MeetInfo.BoardNo = m_pParent->boardNo();
- MeetInfo.MeetingId = MeetingId;
- return true;
- }
- return false;
- }
- /*****************************************************************
- **【函数名称】 accept
- **【函数功能】 接受与会方
- **【参数】
- **【返回值】
- ****************************************************************/
- bool CMeetingPool::accept( int MeetingId, COneLeg* pAttendee, bool IsOneWay )
- {
- ASSERT(m_Handle != DEV_HANDLE_INVALID);
- if(m_Handle == DEV_HANDLE_INVALID)
- return false;
- CMeeting* pMeeting = __getMeeting(MeetingId);
- if(pMeeting == NULL)
- return false;
- return pMeeting->accept(pAttendee, IsOneWay);
- }
- /*****************************************************************
- **【函数名称】 remove
- **【函数功能】 删除一个与会方
- **【参数】
- **【返回值】
- ****************************************************************/
- bool CMeetingPool::remove( int MeetingId, COneLeg* pAttendee )
- {
- CMeeting* pMeeting = __getMeeting(MeetingId);
- if(pMeeting == NULL)
- return false;
- bool Res = pMeeting->remove(pAttendee);
- if(pMeeting->attendeeCount() == 0)
- deleteMeeting(MeetingId);
- return Res;
- }
- /*****************************************************************
- **【函数名称】 record
- **【函数功能】 为与会方录音
- **【参数】
- **【返回值】
- ****************************************************************/
- bool CMeetingPool::record( int MeetingId, COneLeg* pAttendee, RecordContent* pContent, bool IsStop )
- {
- CMeeting* pMeeting = __getMeeting(MeetingId);
- if(pMeeting == NULL)
- return false;
- return pMeeting->record(pAttendee, pContent, IsStop);
- }
- /*****************************************************************
- **【函数名称】 mute
- **【函数功能】 静音与会方
- **【参数】
- **【返回值】
- ****************************************************************/
- bool CMeetingPool::mute( int MeetingId, COneLeg* pAttendee, bool IsOff )
- {
- CMeeting* pMeeting = __getMeeting(MeetingId);
- if(pMeeting == NULL)
- return false;
- return pMeeting->mute(pAttendee, IsOff);
- }
- /*****************************************************************
- **【函数名称】 allocDspChan
- **【函数功能】 分配DSP通道
- **【参数】
- **【返回值】
- ****************************************************************/
- CDspChannel* CMeetingPool::allocDspChan( void )
- {
- return m_pParent->getFreeDspCh();
- }
|