当前位置: 首页>>代码示例>>C++>>正文


C++ PString::Tokenise方法代码示例

本文整理汇总了C++中PString::Tokenise方法的典型用法代码示例。如果您正苦于以下问题:C++ PString::Tokenise方法的具体用法?C++ PString::Tokenise怎么用?C++ PString::Tokenise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PString的用法示例。


在下文中一共展示了PString::Tokenise方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MakeCall

bool Manager::MakeCall(const PString &remoteParty)
{
    cout << "Setting up a call to: " << remoteParty << endl;
    PString token;
    if (TPState::Instance().GetProtocol() != TPState::RTP) {
        if (!SetUpCall("local:*", remoteParty, token)) {
            cerr << "Call setup to " << remoteParty << " failed" << endl;
            return false;
        }
    } else {
        // setting up rtp, split desination into ip and port parts
        PStringArray arr = remoteParty.Tokenise(":");
        if (arr.GetSize() != 2) {
            std::cerr << "invalid address: " << remoteParty << std::endl;
            return false;
        }

        // create rtp session
        RTP_Session::Params p;
        p.id = OpalMediaType::Audio().GetDefinition()->GetDefaultSessionId();
        p.encoding = OpalMediaType::Audio().GetDefinition()->GetRTPEncoding();
        p.userData = new RTPUserData;

        //m_rtpsession->SetUserData(new RTPUserData);
        m_rtpsession = new RTPSession(p);
        m_rtpsession->SelectAudioFormat(RTPSession::PCM16);

        // local and remote addresses
        PIPSocket::Address remote(arr[0]);
        PIPSocket::Address local(TPState::Instance().GetLocalAddress());

        if (!m_rtpsession->SetRemoteSocketInfo(remote, arr[1].AsInteger(), true)) {
            cerr << "could not set remote socket info" << endl;
            return false;
        }

        if (!m_rtpsession->Open(local,
                                TPState::Instance().GetListenPort(),
                                TPState::Instance().GetListenPort(), 2)) {
            cerr << "could not open rtp session" << endl;
            return false;
        }

        m_rtpsession->SetJitterBufferSize(100, 1000);
        std::cout
                << "RTP local address:     " << local << std::endl
                << "RTP local data port:   " << m_rtpsession->GetLocalDataPort() << std::endl
                << "RTP remote address:    " << remote << std::endl
                << "RTP remote data port:  " << m_rtpsession->GetRemoteDataPort() << std::endl;

        std::cout << "RTP stream set up!" << std::endl;
        TPState::Instance().SetState(TPState::ESTABLISHED);
        return true;
    }

    cout << "connection set up to " << remoteParty << endl;
    std::string val = token;
    currentCallToken = val;
    return true;
}
开发者ID:edholland,项目名称:sipcmd,代码行数:60,代码来源:main.cpp

示例2: Initialise

BOOL CMyPhoneEndPoint::Initialise(CMyPhoneDlg *dlg, CVideoDlg *vdlg)
{
	m_dialog = dlg;
        m_vdlg = vdlg;
	isIncomingCall = FALSE;

	SetAudioJitterDelay(50, config.GetInteger(JitterConfigKey, GetMaxAudioJitterDelay()));
	SetSoundChannelBufferDepth(config.GetInteger(BufferCountConfigKey, GetSoundChannelBufferDepth()));
	
	// UserInput mode
    // Backward compatibility configuration entry
    unsigned mode = H323Connection::SendUserInputAsString;
	m_fDtmfAsString=true;
    if (config.HasKey(DtmfAsStringConfigKey)) {
		if (!config.GetBoolean(DtmfAsStringConfigKey))
		{
			mode = H323Connection::SendUserInputAsTone;
			m_fDtmfAsString=false;
		}
		config.DeleteKey(DtmfAsStringConfigKey);
	}
	mode = config.GetInteger(UserInputModeConfigKey, mode);
	SetSendUserInputMode((H323Connection::SendUserInputModes)mode);

//        SetSoundChannelPlayDriver("WindowsMutimedia");
//        SetSoundChannelRecordDriver("WindowsMultimedia");
//        SetSoundChannelPlayDriver("DirectSound");
//        SetSoundChannelRecordDriver("DirectSound");
	
        PString soundPlayStr = config.GetString(SoundPlayConfigKey, GetSoundChannelPlayDevice());
        PStringArray soundPlayer = soundPlayStr.Tokenise('\t');
        BOOL fPlayerAvailable;
        if(soundPlayer.GetSize()==1)
        {  
         SetSoundChannelPlayDriver("WindowsMutimedia");
	 fPlayerAvailable = SetSoundChannelPlayDevice(soundPlayer[0]);
         PTRACE(1, "MyPhone\tSetSoundPlayer Driver:WindowsMultimedia, Device:" << soundPlayer[0]);
        }
        else
        {
         SetSoundChannelPlayDriver(soundPlayer[0]);
	 fPlayerAvailable = SetSoundChannelPlayDevice(soundPlayer[1]);
         PTRACE(1, "MyPhone\tSetSoundPlayer Driver:" << soundPlayer[0] << ", Device:" << soundPlayer[1]);
	}

        PString soundRecordStr = config.GetString(SoundRecordConfigKey, GetSoundChannelRecordDevice());
        PStringArray soundRecorder = soundRecordStr.Tokenise('\t');
        BOOL fRecorderAvailable;
        if(soundRecorder.GetSize()==1)
        {  
         SetSoundChannelRecordDriver("WindowsMutimedia");
	 fRecorderAvailable = SetSoundChannelRecordDevice(soundRecorder[0]);
         PTRACE(1, "MyPhone\tSetSoundRecorder Driver:WindowsMultimedia, Device:" << soundRecorder[0]);
        }
        else
        {
         SetSoundChannelRecordDriver(soundRecorder[0]);
	 fRecorderAvailable = SetSoundChannelRecordDevice(soundRecorder[1]);
         PTRACE(1, "MyPhone\tSetSoundRecorder Driver:" << soundRecorder[0] << ", Device:" << soundRecorder[1]);
	}

	m_fAECOn = config.GetBoolean(AECEnableConfigKey, FALSE);
	m_fAGCOn = config.GetInteger(AGCEnableConfigKey, FALSE);
	SetAECAlgo(m_fAECOn);
	agc = m_fAGCOn;
	             
	// set some oter settings from Config
	m_fNoFastStart =  config.GetBoolean(NoFastStartConfigKey, FALSE);
    DisableFastStart(m_fNoFastStart);
	m_fStrictSingleLine =  config.GetBoolean(StrictSingleLineConfigKey, FALSE);
    StrictSingleLine(m_fStrictSingleLine);

	m_fDoH245Tunnelling = !(config.GetBoolean(NoTunnelingConfigKey, FALSE));
    DisableH245Tunneling(!m_fDoH245Tunnelling);
	m_fSilenceOn = config.GetBoolean(SilenceDetectConfigKey, TRUE);
    SetSilenceDetectionMode(m_fSilenceOn
		? H323AudioCodec::AdaptiveSilenceDetection
		: H323AudioCodec::NoSilenceDetection);
    SetLocalUserName(config.GetString(UsernameConfigKey, GetLocalUserName()));
    SetInitialBandwidth((unsigned)(config.GetReal(BandwidthConfigKey, 10000)*20));
    SetRtpIpTypeofService(config.GetInteger(IpTosConfigKey, GetRtpIpTypeofService()));
	
	SetRtpIpPorts(config.GetInteger(RTPPortBaseConfigKey, GetRtpIpPortBase()),
		config.GetInteger(RTPPortMaxConfigKey,  GetRtpIpPortBase()));
	if(config.HasKey(RouterConfigKey))
		m_router = config.GetString(RouterConfigKey, m_router.AsString());
	
	m_fAutoAnswer = config.GetBoolean(AutoAnswerConfigKey, false);
	m_fAutoMute = config.GetBoolean(AutoMuteConfigKey, false);
	
    CString alias, aliases;
	aliases = CString((const char *)config.GetString(AliasConfigKey, _T("")));
	aliases.TrimLeft();
	int iPos=0;
    while ((iPos = aliases.Find(_T("|")))>0)  // loading user aliases
	{
		alias = aliases.Left(iPos);
		aliases.Delete(0,iPos+1);
		AddAliasName((LPCTSTR)alias);
	}
//.........这里部分代码省略.........
开发者ID:cubemoon,项目名称:myphone3,代码行数:101,代码来源:MyPhoneEndPoint.cpp


注:本文中的PString::Tokenise方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。