📄 cnfconference.cpp
字号:
// This is RFU
// cnf_dump(&CloseInfo);
LOG( RC(rc), GetName(),
"%d = cnf_CloseConference(0x%x)",
rc, m_srl_handle);
brc = (rc == 0);
if (!brc){
process_cnf_error();
} else {
m_srl_handle = INV_SRL_HANDLE;
}
} // Is opened
close_dx();
SetCurrentState(S_FINAL);
SetSrlState(SRLSTATE_ALL, RESET_SRL_STATE);
return brc;
} // End of Close()
//*****************************************************************************
// Purpose :
// Close this board if there are no more conferences
// Parameters:
// none
// Returns:
// true = success
//*****************************************************************************
bool CnfConference::TryClose(){
if ( cnf_size() > 0 ){
LOG(LOG_DBG, GetName(), "TryClose: cnf_size = %d", cnf_size());
SetCurrentState(S_WAIT_SUBDEV);
return false;
}
SetCurrentState(S_FINAL);
Close();
return false;
} // End of TryClose()
//*****************************************************************************
// Purpose :
// Set conference attributes according to configuration parameters
// Parameters:
// none
// Returns:
// true = success
//*****************************************************************************
#define MAX_ATTR 4
#define CHECK_INX if (inx >= MAX_ATTR) { \
LOG(LOG_ERR2, GetName(), msg_txt, \
__LINE__, __FILE__); \
return false; \
}
bool CnfConference::SetAttributes(){
static const char *msg_txt = "Too many conference attributes. Increase MAX_ATTR. Line %d File %s";
CNF_ATTR CnfAttr[MAX_ATTR];
CNF_ATTR_INFO CnfAttrInfo;
int inx = 0;
CnfAttrInfo.unVersion = CNF_ATTR_INFO_VERSION_0; ///< Structure version
CnfAttrInfo.pAttrList = CnfAttr; ///< Pointer to attribute structure list
CnfAttr[inx].unVersion = CNF_ATTR_VERSION_0 ; ///< Structure version
CnfAttr[inx].unAttribute = ECNF_CONF_ATTR_TONE_CLAMPING; ///< Attribute type
CnfAttr[inx].unValue = conf_DTMFClamping; ///< Attribute value
++inx;
#ifdef _FR2619
if (conf_BeepNotify){
CHECK_INX;
CnfAttr[inx].unVersion = CNF_ATTR_VERSION_0 ; ///< Structure version
CnfAttr[inx].unAttribute = ECNF_CONF_ATTR_NOTIFY; ///< Attribute type
CnfAttr[inx].unValue = ECNF_ATTR_STATE_ENABLED; ///< or ECNF_ATTR_STATE_DISABLED
++inx;
}
#endif
if (conf_DetectDigits) {
CHECK_INX;
CnfAttr[inx].unVersion = CNF_ATTR_VERSION_0 ; ///< Structure version
CnfAttr[inx].unAttribute = ECNF_CONF_ATTR_DTMF_MASK; ///< Attribute type
CnfAttr[inx].unValue = ECNF_DTMF_MASK_OP_SET
| ECNF_DTMF_DIGIT_1 | ECNF_DTMF_DIGIT_2
| ECNF_DTMF_DIGIT_3 | ECNF_DTMF_DIGIT_4
| ECNF_DTMF_DIGIT_5 | ECNF_DTMF_DIGIT_6
| ECNF_DTMF_DIGIT_7 | ECNF_DTMF_DIGIT_8
| ECNF_DTMF_DIGIT_9 | ECNF_DTMF_DIGIT_0
| ECNF_DTMF_DIGIT_STAR | ECNF_DTMF_DIGIT_POUND
| ECNF_DTMF_DIGIT_A | ECNF_DTMF_DIGIT_B
| ECNF_DTMF_DIGIT_C | ECNF_DTMF_DIGIT_D ;
++inx;
}
CnfAttrInfo.unAttrCount = inx; ///< Number of attribute structures in list
bool brc = false;
int rc;
rc = cnf_SetAttributes(m_srl_handle, &CnfAttrInfo, this);
cnf_dump(&CnfAttrInfo);
LOG( RC(rc), GetName(),
"%d = cnf_SetAttributes(0x%x,attr,0x%x(this))",
rc, m_srl_handle, this);
if (rc == CNF_ERROR) {
process_cnf_error();
}else {
brc = true;
}
return brc;
} // End of SetAttributes()
//*****************************************************************************
// Purpose :
// Enable events
// Parameters:
// none
// Returns:
// true = success
//*****************************************************************************
bool CnfConference::EnableEvents(){
CNF_EVENT_INFO CnfEventInfo;
unsigned int EventList[] = {
ECNF_CONF_EVT_DTMF_DETECTION,
//ECNF_CONF_EVT_PARTY_ADDED,
//ECNF_CONF_EVT_PARTY_REMOVED,
};
CnfEventInfo.unVersion = CNF_EVENT_INFO_VERSION_0; ///< Structure version
CnfEventInfo.unEventCount = sizeof(EventList)/sizeof(unsigned int); ///< Number of events in list
CnfEventInfo.punEventList = EventList; ///< Pointer to event list
bool brc = false;
int rc;
rc = cnf_EnableEvents(m_srl_handle, &CnfEventInfo, this);
cnf_dump(&CnfEventInfo);
LOG(RC(rc), GetName(), "%d = cnf_EnableEvents(0x%x, CNF_EVENT_INFO, 0x%x(this))",
rc,m_srl_handle,this);
if ( rc == CNF_ERROR) {
process_cnf_error();
}else {
brc = true;
}
return brc;
} // End of EnableEvents()
//*****************************************************************************
// Purpose :
// Dump members
// Parameters:
// none
// Returns:
// none
//*****************************************************************************
void CnfConference::Dump(){
LOG(LOG_APP, GetName(), "--Cnf Conference parameters");
LOG(LOG_APP, GetName(), " conf_Id = %d", conf_Id);
LOG(LOG_APP, GetName(), " conf_DTMFClamping = '%s'", YESNO(conf_DTMFClamping));
LOG(LOG_APP, GetName(), " conf_DetectDigits = '%s'", YESNO(conf_DetectDigits));
LOG(LOG_APP, GetName(), " conf_VoiceParty = '%s'", YESNO(conf_VoiceParty));
#ifdef _FR2619
LOG(LOG_APP, GetName(), " conf_BeepNotify = '%s'", YESNO(conf_BeepNotify));
#endif
LOG(LOG_APP, GetName(), " conf_PassCode = '%s'", conf_PassCode);
LOG(LOG_APP, GetName(), " conf_Tmo = '%s'", conf_Tmo);
LOG(LOG_APP, GetName(), " conf_PrivateLog = %d '%s'", conf_PrivateLog,log_get_msgtype_name(conf_PrivateLog));
return;
} // End of Dump()
//*****************************************************************************
// Purpose :
// Add a party to the conference
// Parameters:
// [in] party srl handle
// [in] pointer to srl device that requests this action
// Returns:
// true = success
//*****************************************************************************
bool CnfConference::AddParty(SRL_DEVICE_HANDLE PartyHandle, PSrlDevice pDev){
bool brc = true;
int rc;
CNF_PARTY_INFO PartyInfo;
PartyInfo.unVersion = CNF_PARTY_INFO_VERSION_0;
PartyInfo.unPartyCount = 1;
PartyInfo.pPartyList = &PartyHandle;
pDev->cnf_dump(&PartyInfo);
rc = cnf_AddParty(m_srl_handle, &PartyInfo, pDev);
pDev->GetLog()->Log(RC(rc), pDev->GetName(),
"%d = cnf_AddParty(0x%x, party_handle = 0x%x ,0x%x(pDev))",
rc, m_srl_handle, PartyHandle, pDev);
if (rc == CNF_ERROR) {
pDev->process_cnf_error();
}else {
brc = true;
if (pDev != this){
if ( conf_Tmo && (0 == cnf_size() ) ){
m_cnf_timer.StartTimer(conf_Tmo*1000);
LOG(LOG_DBG,GetName(),"***Start cnf timer for %d ms", conf_Tmo*1000);
}
push_back(pDev);
DumpMembers();
}
}
return brc;
} // End of AddParty()
//*****************************************************************************
// Purpose :
// Remove a party to the conference
// Parameters:
// [in] party srl handle
// [in] pointer to srl device that requests this action
// Returns:
// true = success
//*****************************************************************************
bool CnfConference::RemoveParty(SRL_DEVICE_HANDLE PartyHandle, PSrlDevice pDev){
bool brc = true;
int rc;
CNF_PARTY_INFO PartyInfo;
PartyInfo.unVersion = CNF_PARTY_INFO_VERSION_0;
PartyInfo.unPartyCount = 1;
PartyInfo.pPartyList = &PartyHandle;
pDev->cnf_dump(&PartyInfo);
rc = cnf_RemoveParty(m_srl_handle, &PartyInfo, pDev);
pDev->GetLog()->Log( RC(rc), pDev->GetName(),
"%d = cnf_RemoveParty(0x%x, party_handle = 0x%x ,0x%x(pDev))",
rc, m_srl_handle, PartyHandle, pDev);
if (rc == CNF_ERROR) {
pDev->process_cnf_error();
}else {
brc = true;
}
return brc;
} // End of RemoveParty()
//----------------------------------------------------------------------
// LOCAL VOICE C O N F E R E N C E
//-----------------------------------------------------------------------
//*****************************************************************************
// Purpose :
// join conference ( local dx device )
// Parameters:
// none
// Returns:
// true = success
//*****************************************************************************
bool CnfConference::AddPartyLocal(){
return AddParty(m_cnf_party_srl_handle,this);
}// End of AddPartyLocal()
//*****************************************************************************
// Purpose :
// Remove party from conference (local dx device)
// Parameters:
// none
// Returns:
// true = success
//*****************************************************************************
bool CnfConference::RemovePartyLocal(){
return RemoveParty(m_cnf_party_srl_handle, this);
}// End of RemovePartyLocal()
//*****************************************************************************
// Purpose :
// If conf_VoiceParty, OpenParty, else post USREV_SKIP_VOICE_PARTY
// Parameters:
// none
// Returns:
// true = success
//*****************************************************************************
bool CnfConference::TryOpenParty(){
if (conf_VoiceParty){
return OpenParty();
}
PutEvent(USREV_SKIP_VOICE, GetName());
return true;
}// End of TryOpenParty()
//*****************************************************************************
// Purpose :
// If conf_VoiceParty, DevDisconnect(DX), else post USREV_SKIP_VOICE
// Parameters:
// none
// Returns:
// true = success
//*****************************************************************************
bool CnfConference::TryDevDisconnectDx(){
if (conf_VoiceParty){
return DevDisconnect(DEV_DX_PARTY);
}
PutEvent(USREV_SKIP_VOICE, GetName());
return true;
}// End of TryCloseParty()
//*****************************************************************************
// Purpose :
// Dump all members
// Parameters:
// none
// Returns:
// none
//*****************************************************************************
void CnfConference::DumpMembers(){
LOG(LOG_APP, GetName(), "Conference Members: %d ", cnf_size());
list<PSrlDevice>::iterator pos;
PSrlDevice pDev;
for ( pos = m_CnfList.begin(); pos != m_CnfList.end(); ++pos) {
pDev = *pos;
LOG(LOG_APP, GetName(), " %s", pDev->GetName());
}
return;
}
//*****************************************************************************
// Purpose :
// Signal to all members all members
// Parameters:
// none
// Returns:
// none
//*****************************************************************************
bool CnfConference::SignalToMembers(int event){
list<PSrlDevice>::iterator pos;
PSrlDevice pDev;
for ( pos = m_CnfList.begin(); pos != m_CnfList.end(); ++pos) {
pDev = *pos;
pDev->PutEvent(event,GetName());
}
return true;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -