// ----------------------------------------------------------------------------- // CCommonTestClass::ExternalizeMPXCollectionTypeL() // Returns: Symbian OS errors. // ----------------------------------------------------------------------------- TInt CCommonTestClass::ExternalizeMPXCollectionTypeL() { FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL begin"))); iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL begin")); TInt err = KErrNone; if ( iType != NULL ) { FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL started Externalize"))); iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL started Externalize")); CBufBase* buffer = CBufFlat::NewL( 50 ); CleanupStack::PushL( buffer ); RBufWriteStream writeStream( *buffer ); CleanupClosePushL( writeStream ); iType->ExternalizeL( writeStream ); writeStream.CommitL(); buffer->Compress(); CleanupStack::PopAndDestroy( &writeStream ); CleanupStack::PopAndDestroy( buffer ); } else { err = KErrBadTestParameter; FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL Stif test script is wrong."))); iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL Stif test script is wrong.")); } FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL end err=%d"), err)); iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL end err=%d"), err); return err; }
// ----------------------------------------------------------------------------- // CCommonTestClass::MpxAttStreamingL() // Returns: Symbian OS errors. // ----------------------------------------------------------------------------- TInt CCommonTestClass::MpxAttStreamingL(CStifItemParser& aItem) { FTRACE(FPrint(_L("CCommonTestClass::MpxAttStreamingL testing TMPXAttribute ExternalizeL and InternalizeL begin"))); iLog->Log(_L("CCommonTestClass::MpxAttStreamingL testing TMPXAttribute ExternalizeL and InternalizeL begin")); TInt err=KErrNone; TUint index; // read in parameters if ( aItem.GetNextInt(index) ) { iLog->Log(_L("Missing Parameter: index.")); return KErrBadTestParameter; } if ( index >= iMPXAttArray.Count() ) { iLog->Log(_L("Bad Parameter: index out of range.")); return KErrBadTestParameter; } FTRACE(FPrint(_L("CCommonTestClass::MpxAttStreamingL started ExternalizeL"))); iLog->Log(_L("CCommonTestClass::MpxAttStreamingL started ExternalizeL")); CBufBase* buffer = CBufFlat::NewL( 50 ); CleanupStack::PushL( buffer ); RBufWriteStream writeStream( *buffer ); CleanupClosePushL( writeStream ); iMPXAttArray[index].ExternalizeL( writeStream ); writeStream.CommitL(); buffer->Compress(); CleanupStack::PopAndDestroy( &writeStream ); FTRACE(FPrint(_L("CCommonTestClass::MpxAttStreamingL started InternalizeL"))); iLog->Log(_L("CCommonTestClass::MpxAttStreamingL started InternalizeL")); RBufReadStream readStream( *buffer ); CleanupClosePushL( readStream ); TMPXAttribute att; att.InternalizeL( readStream ); CleanupStack::PopAndDestroy( &readStream ); CleanupStack::PopAndDestroy( buffer ); // verify streaming was correct if ( !TMPXAttribute::Match(att, iMPXAttArray[index]) ) { iLog->Log(_L("Streaming Failed Verification.")); err = KErrUnexpectedValue; } return err; }
// ----------------------------------------------------------------------------- // CNATFWUNSAFMessage::EncodeL // ----------------------------------------------------------------------------- // EXPORT_C CBufBase* CNATFWUNSAFMessage::EncodeL() const { CBufBase* msg = EncodeMessageHeaderLC(); for (TInt i = 0; i < iAttributes.Count(); ++i) { if (iAttributes[i]->Type() != CNATFWUNSAFAttribute::EMessageIntegrity && iAttributes[i]->Type() != CNATFWUNSAFAttribute::EFingerprint) { HBufC8* attribute = iAttributes[i]->EncodeL(); CleanupStack::PushL(attribute); msg->InsertL(msg->Size(), *attribute); CleanupStack::PopAndDestroy(attribute); } } CleanupStack::Pop(msg); msg->Compress(); SetMessageLength(*msg); return msg; }
// ----------------------------------------------------------------------------- // CNATFWUNSAFMessage::EncodeL // 1. Encode the UNSAF message normally. // 2. Create a MESSAGE-INTEGRITY attribute. This updates also the header's // length field to include the MESSAGE-INTEGRITY before computing the hash. // 3. Encode it to the last attribute of the UNSAF message. // 4. Create a FINGERPRINT attribute. This updates also the header's // length field to include the FINGERPRINT before computing the hash. // 5. Encode it to the last attribute of the UNSAF message. // ----------------------------------------------------------------------------- // EXPORT_C CBufBase* CNATFWUNSAFMessage::EncodeL( const TDesC8& aSharedSecret, TBool aUseFingerprint) const { CBufBase* msg = EncodeL(); CleanupStack::PushL(msg); if ( aSharedSecret.Length() ) { //Long term credentials need be used if there's a REALM attribute CNATFWUNSAFMessageIntegrityAttribute* msgIntegrity = CNATFWUNSAFMessageIntegrityAttribute::NewLC(aSharedSecret, *msg, HasAttribute( CNATFWUNSAFAttribute::ERealm )); HBufC8* encodedMsgIntegrity = msgIntegrity->EncodeL(); CleanupStack::PushL(encodedMsgIntegrity); msg->InsertL(msg->Size(), *encodedMsgIntegrity); CleanupStack::PopAndDestroy(encodedMsgIntegrity); CleanupStack::PopAndDestroy(msgIntegrity); } if ( aUseFingerprint ) { CNATFWUNSAFFingerprintAttribute* fingerprint = CNATFWUNSAFFingerprintAttribute::NewLC(*msg); HBufC8* encodedFingerprint = fingerprint->EncodeL(); CleanupStack::PushL(encodedFingerprint); msg->InsertL(msg->Size(), *encodedFingerprint); CleanupStack::PopAndDestroy(encodedFingerprint); CleanupStack::PopAndDestroy(fingerprint); } CleanupStack::Pop(msg); msg->Compress(); return msg; }
void PlayerController::GoToNowPlaying() { if (playerLaunched) { //Launch player RWsSession wsSession; User::LeaveIfError( wsSession.Connect() ); TApaTaskList list(wsSession); TApaTask task = list.FindApp(KMusicPlayerAppUid); CMPXParameter* param = new ( ELeave ) CMPXParameter(); CleanupStack::PushL( param ); param->iType.iUid = KMPXPluginTypePlaybackUid; param->iCmdForward = EMPXCmdFwdNone; CBufBase* buffer = CBufFlat::NewL(3 ); CleanupStack::PushL( buffer ); RBufWriteStream writeStream( *buffer ); CleanupClosePushL( writeStream ); param->ExternalizeL( writeStream ); writeStream.CommitL(); buffer->Compress(); CleanupStack::PopAndDestroy( &writeStream ); if ( task.Exists() ) { wsSession.SendMessageToWindowGroup( task.WgId(), KAppUidMusicPlayerX, buffer->Ptr( 0 ) ); } else { RApaLsSession ls; CleanupClosePushL( ls ); User::LeaveIfError( ls.Connect() ); TApaAppInfo appInfo; User::LeaveIfError( ls.GetAppInfo( appInfo, KAppUidMusicPlayerX ) ); CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC(); apaCommandLine->SetExecutableNameL( appInfo.iFullName ); apaCommandLine->SetTailEndL( buffer->Ptr( 0 ) ); User::LeaveIfError( ls.StartApp( *apaCommandLine ) ); CleanupStack::PopAndDestroy(); // apaCommandLine CleanupStack::PopAndDestroy(); // ls } CleanupStack::PopAndDestroy( buffer ); CleanupStack::PopAndDestroy( param ); wsSession.Close(); } else if (radioLaunched) { RApaLsSession ls; CleanupClosePushL( ls ); User::LeaveIfError( ls.Connect() ); TApaAppInfo appInfo; User::LeaveIfError( ls.GetAppInfo( appInfo, KRadioUid ) ); CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC(); apaCommandLine->SetExecutableNameL( appInfo.iFullName ); User::LeaveIfError( ls.StartApp( *apaCommandLine ) ); CleanupStack::PopAndDestroy(); // apaCommandLine CleanupStack::PopAndDestroy(); // ls } }