// --------------------------------------------------------------------------- // CNATFWIceSettings::SetUtilityPluginsL // --------------------------------------------------------------------------- // void CNATFWIceSettings::SetUtilityPluginsL( const CDesC8Array& aUtilityPlugins ) { __ASSERT_ALWAYS( &aUtilityPlugins, User::Leave( KErrArgument ) ); iUtilityPlugins->Reset(); TInt pluginIdCount = aUtilityPlugins.Count(); for ( TInt i( 0 ); i < pluginIdCount; ++i ) { iUtilityPlugins->AppendL( aUtilityPlugins[ i ] ); } }
// --------------------------------------------------------------------------- // CStunTurnTests::ConstructL // Symbian 2nd phase constructor can leave. // --------------------------------------------------------------------------- // void CStunTurnTests::ConstructL( const TDesC8& aDomain, const CDesC8Array& aPlugins ) { iTestDomain = aDomain.AllocL(); iPlugins = new ( ELeave ) CDesC8ArrayFlat( KDefaultGranularity ); TInt count = aPlugins.Count(); for ( TInt i( 0 ); i < count; i++ ) { iPlugins->AppendL( aPlugins[i] ); } }
// ----------------------------------------------------------------------------- // CUpnpSsdpServer::ResponseL // // ----------------------------------------------------------------------------- // void CUpnpSsdpServer::ResponseL(CUpnpSsdpMessage* aMsg) { if ( !aMsg ) { return; } // a search message is received // seek for devices and services matching to the search // get device list from message handler RPointerArray<CUpnpDeviceLibraryElement>& devs = iSsdpServerObserver->DeviceList(); TInt devCount=0; // get number of devices devCount=devs.Count(); TInt j=0; for(j=0;j<devCount;j++) { CUpnpDeviceLibraryElement* dev = (CUpnpDeviceLibraryElement*) devs[j]; if (dev->Local()) { // for every device // make this device respond if needed SingleDeviceResponseL(dev, aMsg); // get the service list of this device CDesC8Array* services = &dev->ServiceList(); // get the first service for(TInt i=0; i<services->Count(); i++) { TPtrC8 serviceType = (*services)[i]; SingleServiceResponseL(dev, serviceType, aMsg); } } } }
void CRuleManager::ReadFromFile(const TDesC8& aFile,TInt aPos,CRule* aRule) { CDesC8Array *array = CCommonUtils::SplitText(aFile.Left(aPos),KCharRuleSymbolSplit); if (array->Count() == 6) { CRule* rule = aRule; HBufC* name = CCommonUtils::ConvertToUnicodeFromUTF8((*array)[0]); rule->SetName(name->Des()); delete name; TInt uid = CCommonUtils::StrToInt((*array)[1]); rule->SetUid(TUid::Uid(uid)); TInt type = CCommonUtils::StrToInt((*array)[2]); rule->SetType(type); if (type == 0) { TInt countdown = CCommonUtils::StrToInt((*array)[3]); rule->SetCountDown(countdown); } else { TTime time; TBuf<8> timetxt; timetxt.Copy((*array)[3]); TimeSet(timetxt,time); rule->SetClock(time); } HBufC* rulename = CCommonUtils::ConvertToUnicodeFromUTF8((*array)[4]); rule->SetRuleName(rulename->Des()); delete rulename; TInt lunch = CCommonUtils::StrToInt((*array)[5]); rule->SetLunchRun(lunch); } delete array; }
// ----------------------------------------------------------------------------- // CUpnpSsdpServer::SingleDeviceAdvertiseByebyeL // // ----------------------------------------------------------------------------- // void CUpnpSsdpServer::SingleDeviceAdvertiseByebyeL(CUpnpDeviceLibraryElement& aDev) { HBufC8* nt=NULL; HBufC8* usn=NULL; CDesC8Array* services = &aDev.ServiceList(); if (aDev.IsRootDevice()) { nt=HBufC8::NewLC(KUPnPRootDevice().Length()); nt->Des().Copy(KUPnPRootDevice()); usn=HBufC8::NewLC(KUPnPUuid().Length() +aDev.UUID().Length() +UpnpString::KDblColon().Length() +KUPnPRootDevice().Length()); usn->Des().Zero(); usn->Des().Append(KUPnPUuid()); usn->Des().Append(aDev.UUID()); usn->Des().Append(UpnpString::KDblColon()); usn->Des().Append(KUPnPRootDevice()); SendAdvertiseByebyeL(*nt, *usn); CleanupStack::PopAndDestroy(usn); usn=NULL; CleanupStack::PopAndDestroy(nt); nt=NULL; } nt=HBufC8::NewLC(KUPnPUuid().Length()+aDev.UUID().Length()); nt->Des().Zero(); nt->Des().Append(KUPnPUuid()); nt->Des().Append(aDev.UUID()); usn=HBufC8::NewLC(KUPnPUuid().Length()+aDev.UUID().Length()); usn->Des().Zero(); usn->Des().Append(KUPnPUuid()); usn->Des().Append(aDev.UUID()); SendAdvertiseByebyeL(*nt, *usn); CleanupStack::PopAndDestroy(usn); usn=NULL; CleanupStack::PopAndDestroy(nt); nt=NULL; nt=HBufC8::NewLC(aDev.DeviceType().Length()); nt->Des().Zero(); nt->Des().Append(aDev.DeviceType()); usn=HBufC8::NewLC(KUPnPUuid().Length() +aDev.UUID().Length() +UpnpString::KDblColon().Length() +aDev.DeviceType().Length()); usn->Des().Zero(); usn->Des().Append(KUPnPUuid()); usn->Des().Append(aDev.UUID()); usn->Des().Append(UpnpString::KDblColon()); usn->Des().Append(aDev.DeviceType()); SendAdvertiseByebyeL(*nt, *usn); CleanupStack::PopAndDestroy(usn); usn=NULL; CleanupStack::PopAndDestroy(nt); nt=NULL; TInt i=0; if(!services) { return; } TInt NumOfServices=services->Count(); for(i=0; i<NumOfServices; i++) { nt=HBufC8::NewLC(KUPnPServiceSchema().Length() +(*services)[i].Length()); nt->Des().Zero(); nt->Des().Append(KUPnPServiceSchema()); nt->Des().Append((*services)[i]); usn=HBufC8::NewLC(KUPnPUuid().Length() +aDev.UUID().Length() +UpnpString::KDblColon().Length() +KUPnPServiceSchema().Length() +(*services)[i].Length()); usn->Des().Zero(); usn->Des().Append(KUPnPUuid()); usn->Des().Append(aDev.UUID()); usn->Des().Append(UpnpString::KDblColon()); usn->Des().Append(KUPnPServiceSchema()); usn->Des().Append((*services)[i]); SendAdvertiseByebyeL(*nt, *usn); CleanupStack::PopAndDestroy(usn); usn=NULL; CleanupStack::PopAndDestroy(nt); nt=NULL; } }
void TCmdAddAudioStream::ExecuteL() { // ---------- Setup -------------------------------------------------------- // Get session CMceSession* session = reinterpret_cast<CMceSession*> (GetObjectForIdL(KSessionId, ETrue)); // Get existing stream CMceMediaStream* mainStream = reinterpret_cast<CMceMediaStream*> (GetObjectForIdL(KStreamId, EFalse)); TBool suppressRtcp = ExtractBooleanL( KParamSuppressRtcp, EFalse ); //source path for audiofile TPtrC8 pathAudioFile = ExtractTextL( KParamAudioFileSource, EFalse ); //get path for media file sink TPtrC8 mediaFileSink = ExtractTextL( KParamMediaFileSink, EFalse ); // ---------- Execution ---------------------------------------------------- CMceAudioStream* audioStream = CMceAudioStream::NewLC(); // Add source TPtrC8 source = ExtractTextL( KParamSource, EFalse ); if (source == KValueSourceRTP ) { CMceRtpSource* rtpSource = CMceRtpSource::NewLC(); audioStream->SetSourceL(rtpSource); CleanupStack::Pop(rtpSource); } else if (source == KValueSourceMic ) { CMceMicSource* mic = CMceMicSource::NewLC(); audioStream->SetSourceL(mic); CleanupStack::Pop(mic); } else if (pathAudioFile.Compare( KNullDesC8 ) != 0) { // If source path was defined use the file audio specified in path iSessionHelper.SetMediaFileSourceL( iContext.MCEManager(), *audioStream, pathAudioFile ); } else { if( mediaFileSink.Compare( KNullDesC8 ) == 0 ) User::Leave( KErrNotSupported ); } // Add sinks CDesC8Array* sinks = ExtractArrayL( KParamSinks, EFalse ); if ( sinks ) { CleanupStack::PushL( sinks ); for ( TInt i = 0; i < sinks->Count(); i++ ) { if ( (*sinks)[i] == KValueSinkRTP ) { //CMceRtpSink* rtpSink = CMceRtpSink::NewLC(); //enable all RtpSink with RTCP CMceRtpSink* rtpSink = CMceRtpSink::NewL(suppressRtcp); CleanupStack::PushL(rtpSink); audioStream->AddSinkL(rtpSink); CleanupStack::Pop(rtpSink); } else if ( (*sinks)[i] == KValueSinkSpeaker ) { CMceSpeakerSink* speaker = CMceSpeakerSink::NewLC(); audioStream->AddSinkL(speaker); CleanupStack::Pop(speaker); } else if ( (*sinks)[i] == KValueSinkFile ) { const RPointerArray<CMceMediaStream>& streams = session->Streams(); for ( TInt i = 0; i < streams.Count(); ++i ) { CMceMediaStream* tmpStream; tmpStream = streams[i]; if ( tmpStream->Type() == KMceAudio ) { //use the same source which was used for outgoing audio stream if( tmpStream->Source()->Type() != KMceRTPSource ) { audioStream->SetSourceL( tmpStream->Source() ); } else { if(tmpStream->BoundStream()) if( tmpStream->BoundStreamL().Source()->Type() != KMceRTPSource ) audioStream->SetSourceL(tmpStream->BoundStreamL().Source()); } break; } } if( mediaFileSink.Compare( KNullDesC8 ) != 0 ) { iSessionHelper.SetMediaFileSinkL(*audioStream, mediaFileSink); } else { iSessionHelper.SetMediaFileSinkL(*audioStream, TPtrC8( KTestAudioFileName )); } session->AddStreamL(audioStream); } else { User::Leave( KErrNotSupported ); } } CleanupStack::PopAndDestroy( sinks ); } // Modify codecs CDesC8Array* codecs = ExtractArrayL( KParamCodecs, EFalse ); if ( codecs ) { CleanupStack::PushL( codecs ); if ( codecs->Count() > 0) { const RPointerArray<CMceAudioCodec>& streamCodecs = audioStream->Codecs(); if ( (*codecs)[0] == KValueCodecNone ) { // Remove all codecs from stream for (TInt i = 0; i < streamCodecs.Count(); i++ ) { // No implementation yet in MMCE audioStream->RemoveCodecL( *(streamCodecs[i]) ); } } if ( (*codecs)[0] != KValueCodecNone && (*codecs)[0] != KValueCodecAll ) { for (TInt i = 0; i < codecs->Count(); i++ ) { audioStream->AddCodecL( GetAudioCodecCloneL( (*codecs)[i] ) ); } } } CleanupStack::PopAndDestroy( codecs ); } // Add streams if (mainStream) { mainStream->BindL( audioStream ); //if there are no codecs in the stream already, all the codecs will be //added to stream by mce. //Note: streams needs to be bound before adding stream to session session->AddStreamL( mainStream ); } else { //NOOP } CleanupStack::Pop( audioStream ); // ---------- Response creation -------------------------------------------- AddIdResponseL(KSessionId, session); // uses CleanupStack internally AddIdResponseL(KStreamId, *audioStream); }