void CReferenceHandler::CreateReferenceObject2L(CObexBufObject& aObject, CBufFlat& aObjectBuf, TTransport aTransport) { //Reset the object (also resets the buffer) aObject.Reset(); const TUint KNumOfObjects = 2; aObjectBuf.ResizeL(KNumOfObjects * 20); //populate the buffer... _LIT8(KRefDesc2, "*Reference Object 2*"); TUint i; for (i=0; i<KNumOfObjects; i++) { aObjectBuf.Write(20*i, KRefDesc2); } //populate the object aObject.SetNameL(KRef2Name); aObject.SetTypeL(KRefType); aObject.SetLengthL(aObjectBuf.Size()); const TTime KRef2Time = TDateTime(2002, EJanuary, 0, 0, 0, 0, 0); aObject.SetTimeL(KRef2Time); // Set up the MF description header const TUint KDescLength = ( (aTransport==EBluetooth?KObexPacketDefaultSize:2044) - KObexPacketHeaderSize - 5 - 5)/sizeof(TText); // Size in characters HBufC* descBuf = HBufC::NewLC(KDescLength); ASSERT(descBuf); TPtr ptr(descBuf->Des()); ptr.Zero(); for (i=0; i<KDescLength; i++) { ptr.AppendNumFixedWidth(i%10, EDecimal, 1); } aObject.SetDescriptionL(ptr); CleanupStack::PopAndDestroy(descBuf); aObject.SetTargetL(KRefIrMCTarget); aObject.SetHeaderMask(KObexHdrName | KObexHdrType | KObexHdrLength | KObexHdrTime | KObexHdrDescription | KObexHdrTarget); }
// --------------------------------------------------------- // RNSmlPrivateAPI::GetDMAuthInfoL( CNSmlDMAuthInfo& aAuthInfo ) // Retrieves DM auhentication info from settings // --------------------------------------------------------- // EXPORT_C void RNSmlPrivateAPI::GetDMAuthInfoL( CNSmlDMAuthInfo& aAuthInfo ) { TPckgBuf<TInt> buf; TIpcArgs args(aAuthInfo.iProfileId, &buf); User::LeaveIfError( SendReceive( ECmdInitDMAuthInfo, args) ); CBufFlat* buffer = CBufFlat::NewL( KDefaultNSmlBufferGranularity ); CleanupStack::PushL( buffer ); buffer->ResizeL( buf() ); TPtr8 pBuffer(0, NULL, 0); pBuffer.Set( buffer->Ptr(0) ); TIpcArgs argsGet( &pBuffer ); User::LeaveIfError( SendReceive( ECmdGetDMAuthInfo, argsGet) ); RDesReadStream stream; stream.Open( pBuffer ); CleanupClosePushL( stream ); aAuthInfo.InternalizeL( stream ); CleanupStack::PopAndDestroy(2); // stream, buffer }
void CReferenceHandler::CreateReferenceObject7L(CObexBufObject& aObject, CBufFlat& aObjectBuf, TTransport aTransport) { //Reset the object (also resets the buffer) aObject.Reset(); const TUint KNumOfAlphabets = 200; aObjectBuf.ResizeL(KNumOfAlphabets * 30); //populate the buffer... TBuf8<4> buf; TUint i; for (i=0; i<KNumOfAlphabets; i++) { buf.Zero(); buf.AppendNumFixedWidth(i, EDecimal, 4); aObjectBuf.Write(30*i, buf); aObjectBuf.Write(30*i + 4, KAlphabet); } //populate the object aObject.SetNameL(KRef7Name); aObject.SetTypeL(KRefImageJpegType); aObject.SetLengthL(aObjectBuf.Size()); const TTime KRef5Time = TDateTime(2001, EFebruary, 14, 15, 38, 24, 0);//set time to 15:38:24.0 on 14th Feb 2001 - obex doesn't transfer microseconds!! aObject.SetTimeL(KRef5Time); _LIT8(KRef1HTTP, "Accept: text/*"); _LIT8(KRef2HTTP, "Location: http://www.w3.org"); _LIT8(KRef3HTTP, "Date: Tue, 10 Nov 2002 09:17:21 GMT"); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef3HTTP); // Set up the MF description header const TUint KDescLength = ( (aTransport==EBluetooth?KObexPacketDefaultSize:2044) - KObexPacketHeaderSize - 5 - 5)/sizeof(TText); // Size in characters HBufC* descBuf = HBufC::NewLC(KDescLength); /* ASSERT(descBuf); TPtr ptr(descBuf->Des()); ptr.Zero(); for (i=0; i<KDescLength; i++) { ptr.AppendNumFixedWidth(i%10, EDecimal, 1); } aObject.SetDescriptionL(ptr); */ CleanupStack::PopAndDestroy(descBuf); aObject.SetTargetL(KRefSyncMLTarget); aObject.SetHeaderMask(KObexHdrName | KObexHdrType | KObexHdrTime | KObexHdrLength | KObexHdrHttp | KObexHdrTarget); }
void CMsvSendErrorActionsStep::TestRestoreFromResourceL() { CBufFlat *buf = CBufFlat::NewL(32); CleanupStack::PushL(buf); buf->ResizeL(0x10000); RBufWriteStream writer(*buf); writer.PushL(); //default error action writer.WriteInt8L(0); //flag, action + retry + retry spacing writer.WriteInt16L(3); //max retries writer.WriteInt16L(1); //error code count writer.WriteInt32L(-1); //error code //error action count writer.WriteInt16L(1); //error action writer.WriteInt8L(1); writer.WriteInt16L(2); writer.WriteInt16L(2); //error code count writer.WriteInt32L(-2); //error code -2 writer.WriteInt32L(-3); //error code -3 writer.CommitL(); CleanupStack::PopAndDestroy(&writer); CMsvSendErrorActions* errorActions = CMsvSendErrorActions::NewL(); CleanupStack::PushL(errorActions); TResourceReader reader; TPtr8 bufPtr = buf->Ptr(0); reader.SetBuffer(&bufPtr); errorActions->RestoreFromResourceL(reader); TMsvSendErrorAction errorAction; if(errorActions->GetSendErrorAction(-2, errorAction) != KErrNone || errorActions->GetSendErrorAction(-3, errorAction) != KErrNone || errorActions->Errors().Count() != 2) { INFO_PRINTF1(_L("CMsvSendErrorActions::RestoreFromResourceL failed")); SetTestStepResult(EFail); } CleanupStack::PopAndDestroy(errorActions); CleanupStack::PopAndDestroy(buf); }
void CReferenceHandler::CreateReferenceObject4L(CObexBufObject& aObject, CBufFlat& aObjectBuf, TTransport aTransport) { //Reset the object (also resets the buffer) aObject.Reset(); const TUint KNumOfAlphabets = 200; aObjectBuf.ResizeL(KNumOfAlphabets * 30); //populate the buffer... TBuf8<4> buf; TUint i; for (i=0; i<KNumOfAlphabets; i++) { buf.Zero(); buf.AppendNumFixedWidth(i, EDecimal, 4); aObjectBuf.Write(30*i, buf); aObjectBuf.Write(30*i + 4, KAlphabet); } //populate the object aObject.SetNameL(KRef4Name); aObject.SetLengthL(aObjectBuf.Size()); // Set up the MF description header const TUint KDescLength = ( (aTransport==EBluetooth?KObexPacketDefaultSize:2044) - KObexPacketHeaderSize - 5 - 5)/sizeof(TText); // Size in characters HBufC* descBuf = HBufC::NewLC(KDescLength); ASSERT(descBuf); TPtr ptr(descBuf->Des()); ptr.Zero(); for (i=0; i<KDescLength; i++) { ptr.AppendNumFixedWidth(i%10, EDecimal, 1); } aObject.SetDescriptionL(ptr); CleanupStack::PopAndDestroy(descBuf); aObject.SetTargetL(KRefTarget); TBuf8<40> param; param.Copy(_L("\x04")); param.Append(_L("\x03")); param.Append(_L("App params 456")); aObject.SetAppParamL(param); aObject.SetHeaderMask(KObexHdrName | KObexHdrLength | KObexHdrDescription | KObexHdrTarget | KObexHdrAppParam); }
void CASYStubCmdHandlerBase::ProcessObjectL( const TProcessCmdId aCommand, const TASYCmdParams& aCmdParams ) { COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL() - CAccPolObjectBase" ) ) ); RBufReadStream rStrm; TUint32 name; aCmdParams().iNameRecord.GetName( name ); if( name == KAccAudioStreamsFormat ) { switch( aCommand ) { case ECmdGetObjectValue: { CAccPolAudioStreamFormatCon* container1 = CAccPolAudioStreamFormatCon::NewLC(); CAccPolAudioStreamFormatCon* container2 = CAccPolAudioStreamFormatCon::NewLC(); RProperty prop; CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity ); CleanupStack::PushL( buf ); buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize ); TPtr8 ptr( buf->Ptr( 0 ) ); TInt retval = prop.Get( KTFAccessoryTestProperty, KTFAccessoryObjectMethod, ptr ); ( void )rStrm.Open( *buf ); rStrm.PushL(); container1->InternalizeL( rStrm ); rStrm.Close(); rStrm.Pop(); for( TInt i = 0; i < container1->Count(); i++ ) { container2->AddL( *container1->AtL( i ) ); } ProcessResponseL( *container2 ); CleanupStack::PopAndDestroy( buf ); CleanupStack::PopAndDestroy( container2 ); CleanupStack::PopAndDestroy( container1 ); } break; case ECmdSetObjectValue: { CAccPolAudioStreamFormatCon* container1 = CAccPolAudioStreamFormatCon::NewLC(); CAccPolAudioStreamFormatCon* container2 = CAccPolAudioStreamFormatCon::NewLC(); RProperty prop; CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity ); CleanupStack::PushL( buf ); buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize ); TPtr8 ptr( buf->Ptr( 0 ) ); TInt retval = prop.Get( KTFAccessoryTestProperty, KTFAccessoryObjectMethod, ptr ); ( void )rStrm.Open( *buf ); rStrm.PushL(); container1->InternalizeL( rStrm ); rStrm.Close(); rStrm.Pop(); // Read objects from proxy ObjectConDataFromProxyL( *container2 ); //externalize container to bufFromServer CBufFlat* bufFromServer = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity ); CleanupStack::PushL( bufFromServer ); bufFromServer->ResizeL( KAccSrvObjectBaseStreamBufMaxSize ); RBufWriteStream wStrm; ( void )wStrm.Open( *bufFromServer ); wStrm.PushL(); container2->ExternalizeL( wStrm ); wStrm.CommitL(); wStrm.Close(); wStrm.Pop(); TPtr8 ptrbufFromServer( bufFromServer->Ptr( 0 ) ); //bufFromServer content must equal to buf content TInt err = ( 0 == memcompare( reinterpret_cast<TUint8*> ( &ptrbufFromServer ), sizeof( bufFromServer ), reinterpret_cast<TUint8*> ( &ptr ), sizeof( bufFromServer ) ) ) ? KErrNone : KErrGeneral; ProcessResponseL( *container2, err ); // same container which was received from server CleanupStack::PopAndDestroy( bufFromServer ); CleanupStack::PopAndDestroy( buf ); CleanupStack::PopAndDestroy( container2 ); CleanupStack::PopAndDestroy( container1 ); } break; default: { COMPONENT_TRACE( ( _L( "BTASYStub - CBTBTASYStubCmdHandlerBase::ProcessCommandL() - CAccPolObjectBase - ERROR: unhandled command" ) ) ); TRACE_ASSERT_ALWAYS; User::Panic( _L("ASY Stub"), KErrGeneral ); } break; } } else if( name == KAccAudioUnits ) { CAccPolAudioTopologyObjectCon* container1 = CAccPolAudioTopologyObjectCon::NewLC(); CAccPolAudioTopologyObjectCon* container2 = CAccPolAudioTopologyObjectCon::NewLC(); RProperty prop; CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity ); CleanupStack::PushL( buf ); buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize ); TPtr8 ptr( buf->Ptr( 0 ) ); TInt retval = prop.Get( KTFAccessoryTestProperty, KTFAccessoryObjectMethod, ptr ); ( void )rStrm.Open( *buf ); rStrm.PushL(); container1->InternalizeL( rStrm ); rStrm.Close(); rStrm.Pop(); for( TInt i = 0; i < container1->Count(); i++ ) { container2->AddL( *container1->AtL( i ) ); } ProcessResponseL( *container2 ); CleanupStack::PopAndDestroy( buf ); CleanupStack::PopAndDestroy( container2 ); CleanupStack::PopAndDestroy( container1 ); } else if( name == KAccAudioControl ) { if( aCommand == ECmdSetObjectValue ) { CAccPolAudioTopologyObjectCon* container1 = CAccPolAudioTopologyObjectCon::NewLC(); // Get object from proxy ObjectConDataFromProxyL( *container1 ); for( TInt i = 0; i < container1->Count(); i++ ) { if( container1->AtL( i )->ObjectType() == EAccPolAudioVolumeControlObject ) { CAccPolVolumeControl* mVolume = ( CAccPolVolumeControl* )container1->AtL( i ); if( mVolume->UnitId() == 2 && mVolume->Channel() == KAccRightFrontChannel ) { COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL - SET - right channel volume level=%f" ), mVolume->VolumeDb() ) ); COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL - SET - right channel volume min level=%f" ), mVolume->MinVolumeDb() ) ); COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL - SET - right channel volume max level=%f" ), mVolume->MaxVolumeDb() ) ); COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL - SET - right channel volume res level=%f" ), mVolume->VolumeResDb() ) ); } if( mVolume->UnitId() == 2 && mVolume->Channel() == KAccLeftFrontChannel ) { COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL - SET - left channel volume level=%f" ), mVolume->VolumeDb() ) ); COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL - SET - left channel volume min level=%f" ), mVolume->MinVolumeDb() ) ); COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL - SET - left channel volume max level=%f" ), mVolume->MaxVolumeDb() ) ); COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL - SET - left channel volume res level=%f" ), mVolume->VolumeResDb() ) ); } } else { CAccPolMuteControl* mMute = ( CAccPolMuteControl* )container1->AtL( i ); if( mMute->Channel() == KAccMasterChannel ) { COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL - KAccSetAudioControl - mute=%d" ), mMute->Mute() ) ); } } } ProcessResponseL( *container1 ); CleanupStack::PopAndDestroy( container1 ); } else if( aCommand == ECmdGetObjectValue ) { CAccPolAudioTopologyObjectCon* container1 = CAccPolAudioTopologyObjectCon::NewLC(); CAccPolAudioTopologyObjectCon* container2 = CAccPolAudioTopologyObjectCon::NewLC(); RProperty prop; CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity ); CleanupStack::PushL( buf ); buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize ); TPtr8 ptr( buf->Ptr( 0 ) ); TInt retval = prop.Get( KTFAccessoryTestProperty, KTFAccessoryObjectMethod, ptr ); ( void )rStrm.Open( *buf ); rStrm.PushL(); container2->InternalizeL( rStrm ); rStrm.Close(); rStrm.Pop(); // Read object --> after that assign new value ObjectConDataFromProxyL( *container1 ); if( container1->AtL( 0 )->ObjectType() == EAccPolAudioVolumeControlObject ) { CAccPolVolumeControl* rightVolume = ( CAccPolVolumeControl* )container2->AtL( 0 ); CAccPolVolumeControl* leftVolume = ( CAccPolVolumeControl* )container2->AtL( 1 ); if( reinterpret_cast<CAccPolVolumeControl*> ( container1->AtL( 0 ) )->Channel() == KAccRightFrontChannel ) { reinterpret_cast<CAccPolVolumeControl*> ( container1->AtL( 0 ) )->SetVolumeDb( rightVolume->VolumeDb() ); reinterpret_cast<CAccPolVolumeControl*> ( container1->AtL( 0 ) )->SetMinVolumeDb( rightVolume->MinVolumeDb() ); reinterpret_cast<CAccPolVolumeControl*> ( container1->AtL( 0 ) )->SetMaxVolumeDb( rightVolume->MaxVolumeDb() ); reinterpret_cast<CAccPolVolumeControl*> ( container1->AtL( 0 ) )->SetVolumeResDb( rightVolume->VolumeResDb() ); } if( reinterpret_cast<CAccPolVolumeControl*> ( container1->AtL( 1 ) )->Channel() == KAccLeftFrontChannel ) { reinterpret_cast<CAccPolVolumeControl*> ( container1->AtL( 1 ) )->SetVolumeDb( rightVolume->VolumeDb() ); reinterpret_cast<CAccPolVolumeControl*> ( container1->AtL( 1 ) )->SetMinVolumeDb( rightVolume->MinVolumeDb() ); reinterpret_cast<CAccPolVolumeControl*> ( container1->AtL( 1 ) )->SetMaxVolumeDb( rightVolume->MaxVolumeDb() ); reinterpret_cast<CAccPolVolumeControl*> ( container1->AtL( 1 ) )->SetVolumeResDb( rightVolume->VolumeResDb() ); } } else { CAccPolMuteControl* psMute = ( CAccPolMuteControl* )container2->AtL( 0 ); if( reinterpret_cast<CAccPolMuteControl*> ( container1->AtL( 0 ) )->Channel() == KAccMasterChannel ) { reinterpret_cast<CAccPolMuteControl*> ( container1->AtL( 0 ) )->SetMute( psMute->Mute() ); } } ProcessResponseL( *container1 ); CleanupStack::PopAndDestroy( buf ); CleanupStack::PopAndDestroy( container2 ); CleanupStack::PopAndDestroy( container1 ); } else { COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL - No control object to found!" ) ) ); } } else if( name == KAccVideoHdmiAttributes ) { switch( aCommand ) { case ECmdGetObjectValue: { // Create buffer CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity ); CleanupStack::PushL( buf ); buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize ); // Read container from P&S TPtr8 bufPtr( buf->Ptr( 0 ) ); TInt err = RProperty::Get( KTFAccessoryTestProperty, KTFAccessoryObjectMethod, bufPtr ); if( err == KErrNone ) { // Stream HDMI container from data read from P&S CAccPolHdmiObjectCon* con = CAccPolHdmiObjectCon::NewLC(); RBufReadStream readStream( *buf ); readStream.PushL(); con->InternalizeL( readStream ); // Change all aatributes in speaker allocation to false RAccPolHdmiSpeakerAllocationArray array; CleanupClosePushL( array ); con->GetHdmiSpeakerAllocationObjectsL( array ); if( array.Count() ) { CAccPolHdmiSpeakerAllocation* speakerAllocation = array[0]; CAccPolHdmiSpeakerAllocation::THdmiSpeakerAllocation bits = CAccPolHdmiSpeakerAllocation::EHdmiSpeakerUnknown; speakerAllocation->SetSpeakerAllocation( bits ); } CleanupStack::PopAndDestroy( &array ); // Process response ProcessResponseL( *con, err ); // Cleanup CleanupStack::PopAndDestroy( &readStream ); CleanupStack::PopAndDestroy( con ); } // Cleanup CleanupStack::PopAndDestroy( buf ); break; } case ECmdSetObjectValue: default: { COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL - Nothing to do!" ) ) ); break; } } } else if( name == KAccVideoFormat ) { switch( aCommand ) { case ECmdGetObjectValue: { // Create buffer CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity ); CleanupStack::PushL( buf ); buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize ); // Read container from P&S TPtr8 bufPtr( buf->Ptr( 0 ) ); TInt err = RProperty::Get( KTFAccessoryTestProperty, KTFAccessoryObjectMethod, bufPtr ); if( err == KErrNone ) { // Stream HDMI object container format from data read from P&S CAccPolHdmiObjectCon* con = CAccPolHdmiObjectCon::NewLC(); RBufReadStream readStream( *buf ); readStream.PushL(); con->InternalizeL( readStream ); CleanupStack::PopAndDestroy( &readStream ); // Set video format to interlaced mode RAccPolHdmiVideoFormatArray array; CleanupClosePushL( array ); con->GetHdmiVideoFormatObjectsL( array ); if( array.Count() ) { CAccPolHdmiVideoFormat* videoFormat = array[0]; videoFormat->SetInterlaced( ETrue ); } CleanupStack::PopAndDestroy( &array ); // Process response ProcessResponseL( *con, err ); // Cleanup CleanupStack::PopAndDestroy( con ); } // Cleanup CleanupStack::PopAndDestroy( buf ); break; } case ECmdSetObjectValue: default: { COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL - Nothing to do!" ) ) ); break; } } } else { COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL - Nothing to do!" ) ) ); } /*CleanupStack::PopAndDestroy( buf ); CleanupStack::PopAndDestroy( container ); CleanupStack::PopAndDestroy( aObject ); */ COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL - return void - CAccPolObjectBase" ) ) ); }
TAny* CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL( TAny* aCellAddress, CMemSpyEngineActiveObjectArray& aArray ) { //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - START"); //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.cellAddress: 0x%08x", aCellAddress); TAny* nextCellAddress = NULL; TMemSpyDriverCellType cellType; TInt cellLength; TInt cellNestingLevel; TInt cellAllocationNumber; TInt cellHeaderSize; TAny* cellPayloadAddress; // Make a separate copy of the cell address - calling GetCellInfo may well result in the address being // changed in order to match the real starting address of a *heap cell*. TAny* requestedCellAddress = aCellAddress; TInt err = iEngine.Driver().WalkHeapGetCellInfo( requestedCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress ); //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - err: %d, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, cellLength, cellAllocationNumber, cellType); User::LeaveIfError( err ); if (cellType & EMemSpyDriverAllocatedCellMask) { const TInt payloadLength = cellLength; //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - payloadLength: %d", payloadLength); // const TInt payloadLength = Max( 512, cellLength - iHeapInfo.iHeapCellHeaderLengthAllocated ); // Prevent negative payload lengths? CBufFlat* data = CBufFlat::NewL( payloadLength ); CleanupStack::PushL( data ); data->ResizeL( payloadLength ); TPtr8 pData( data->Ptr( 0 ) ); // err = iEngine.Driver().WalkHeapReadCellData( requestedCellAddress, pData, payloadLength ); //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.heapCellAddress: 0x%08x (err: %d)", requestedCellAddress, err); User::LeaveIfError( err ); // If an object is embedded directly within a class, for example // // class CSomething : public CBase // { // CIdle iEmbeddedIdler; // } // // then aCellAddress actually points to somewhere *within* a heap cell, not to the actual starting address of // the heap cell itself. We must take this into account when parsing the heap cell data (i.e. the bit of the cell we // are interested in starts part way through the cell data). TInt cellOffset = TUint32( aCellAddress ) - TUint32( requestedCellAddress ); //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.cellOffset: %d (ignoring cell header)", cellOffset); cellOffset -= cellHeaderSize; //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.cellOffset: %d (adjusted for cell header)", cellOffset); // Got the cell data for the active object. Let's parse it. RBufReadStream stream( *data, cellOffset ); CleanupClosePushL( stream ); // First item should be vTable TAny* vTable = (TAny*) stream.ReadUint32L(); //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.vTable: 0x%08x", vTable ); // Next item should be the request status. First the iStatus, then the iFlags const TInt requestStatusValue = stream.ReadInt32L(); //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.rsVal: %10d", requestStatusValue ); const TUint requestStatusFlags = stream.ReadUint32L(); //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.rsFlags: 0x%02x", requestStatusFlags ); // Next comes the baseclass for the link - TDblQueLinkBase TAny* nextEntryAddress = (TAny*) stream.ReadUint32L(); //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.iLink.Next: 0x%08x", nextEntryAddress ); TAny* prevEntryAddress = (TAny*) stream.ReadUint32L(); //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.iLink.Prev: 0x%08x", prevEntryAddress ); // Next comes the TPriQueueLink itself const TInt priority = stream.ReadInt32L(); //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.iLink.Pri: %d", priority ); // Done - save object & tidy up CMemSpyEngineActiveObject* object = CMemSpyEngineActiveObject::NewLC( aCellAddress, vTable, priority, requestStatusValue, requestStatusFlags, nextEntryAddress, prevEntryAddress, iEngine ); aArray.AddItemL( object ); CleanupStack::Pop( object ); CleanupStack::PopAndDestroy( 2, data ); // stream & data nextCellAddress = (TAny*) nextEntryAddress; //RDebug::Printf(" "); } return nextCellAddress; }
/**--------------------------------------------------------- * * ServiceL(const RMessage& aMessage) * *----------------------------------------------------------*/ void CPKISession::ServiceL(const RMessage2& aMessage) { TInt Status = KErrNone; TInt count = 0; LOG_1("CPKISession::ServiceL: function = %d", aMessage.Function()); switch(aMessage.Function()) { case PkiService::ECancelPendingOperation: iWrapper->CancelPendingOperation(); aMessage.Complete(KErrNone); break; case PkiService::EGetRequiredBufferSize: if (iRequiredBufferSize == KBufferSizeNotDefined) { Status = iWrapper->GetRequiredBufferSizeL(aMessage); } else { TPckg<TInt> pckgSize(iRequiredBufferSize); aMessage.WriteL(0, pckgSize); aMessage.Complete(KErrNone); } break; case PkiService::ECertCount: count = iMapper.CertCount(iWrapper->Informational()); aMessage.Complete(count); break; case PkiService::EApplicableCertCount: { TInt aC = 0; TPckg<TInt> pckgApplCount(aC); aMessage.ReadL(0, pckgApplCount); // Read applications // Allocate list for applications CBufFlat* list = CBufFlat::NewL(sizeof(TUid)); CleanupStack::PushL(list); list->ResizeL(aC * sizeof(TUid)); TPtr8 ptrList = list->Ptr(0); aMessage.ReadL(1, ptrList); iUidArray.Close(); if(aC > 0) { TUid tempUid; for (TInt i = 0; i < aC; i++) { list->Read(i * sizeof(TUid), (TAny*)&tempUid, sizeof(TUid)); iUidArray.Append(tempUid); } } CleanupStack::PopAndDestroy(1); // list TInt matchCount = iMapper.ApplicableCertCount(iUidArray); aMessage.Complete(matchCount); } break; case PkiService::EGetCertDetails: { TPckgBuf<TSecurityObjectDescriptor> secDescPtr; aMessage.ReadL(1, secDescPtr); TCertificateListEntry* resultCertInfo = new (ELeave) TCertificateListEntry; CleanupStack::PushL(resultCertInfo); Status = iMapper.GetCertDetailsL(secDescPtr(), iWrapper->CertStoreType(), iWrapper->Informational(), *resultCertInfo); if (Status == KErrNone) { TPckg<TCertificateListEntry> certDetailsPtr(*resultCertInfo); aMessage.WriteL(0, certDetailsPtr); } aMessage.Complete(Status); CleanupStack::PopAndDestroy(resultCertInfo); } break; case PkiService::EGetCertList: iMapper.GetCertListL(aMessage, iWrapper->Informational()); aMessage.Complete(KErrNone); break; case PkiService::EGetApplicableCertList: iMapper.GetApplicableCertListL(aMessage, iUidArray); aMessage.Complete(KErrNone); break; case PkiService::EGetKeyList: { PKISERVICE_ASSERT(iKeyList != NULL); CBufFlat* list = CBufFlat::NewL(sizeof(TKeyListEntry)); CleanupStack::PushL(list); list->ResizeL(iKeyList->Count() * sizeof(TKeyListEntry)); for(TInt i = 0; i < iKeyList->Count(); i++) { const TKeyListEntry& keyInfo = (*iKeyList)[i]; list->Write(i * sizeof(TKeyListEntry), (TAny*)&keyInfo, sizeof(TKeyListEntry)); } TPtr8 ptrList = list->Ptr(0); aMessage.WriteL(0, ptrList); CleanupStack::PopAndDestroy(list); // list delete iKeyList; iKeyList = NULL; aMessage.Complete(KErrNone); } break; case PkiService::ECertReqCount: count = iServer.CertificateRequestStore().CertReqCountL(); aMessage.Complete(count); break; case PkiService::EGetCertReqList: { CArrayFixFlat<TCertificateRequestListEntry>* certReqList = iServer.CertificateRequestStore().GetCertReqListLC(); TUint bufferGranularity = sizeof(TCertificateRequestListEntry); if (certReqList->Count() > 0) { bufferGranularity = bufferGranularity * certReqList->Count(); } CBufFlat* list = CBufFlat::NewL(bufferGranularity); CleanupStack::PushL(list); if (certReqList->Count() > 0) { list->ResizeL(sizeof(TCertificateRequestListEntry) * certReqList->Count()); } for (TInt i = 0; i < certReqList->Count(); ++i) { const TCertificateRequestListEntry &certReqInfo = (*certReqList)[i]; list->Write(i * sizeof(TCertificateRequestListEntry), &certReqInfo, sizeof(TCertificateRequestListEntry)); } TPtr8 ptrList = list->Ptr(0); aMessage.WriteL(0, ptrList); CleanupStack::PopAndDestroy(list); CleanupStack::PopAndDestroy(certReqList); aMessage.Complete(KErrNone); } break; case PkiService::ESaveCertificateRequest: { TInt requestSize = aMessage.GetDesLength(0); HBufC8* request = HBufC8::NewLC(requestSize); TPtr8 requestPtr = request->Des(); TKeyIdentifier keyId; aMessage.ReadL(0, requestPtr); aMessage.ReadL(2, keyId); //keyId is ignored. HBufC* certRequestRef = iServer.CertificateRequestStore().SaveCertRequestLC(*request); aMessage.WriteL(1, *certRequestRef); CleanupStack::PopAndDestroy(certRequestRef); CleanupStack::PopAndDestroy(request); aMessage.Complete(KErrNone); } break; case PkiService::EReadCertificateRequest: { TInt certRequestRefSize = aMessage.GetDesLength(0); HBufC *certRequestRef = HBufC::NewLC(certRequestRefSize); TPtr certRequestRefPtr = certRequestRef->Des(); aMessage.ReadL(0, certRequestRefPtr); if (certRequestRef->Length() == 0) { User::Leave(KErrNotFound); } HBufC8* certificateRequest = iServer.CertificateRequestStore().ReadCertRequestLC(*certRequestRef); if (aMessage.GetDesMaxLength(1) >= certificateRequest->Length()) { aMessage.WriteL(1, *certificateRequest); aMessage.Complete(KErrNone); } else { iRequiredBufferSize = certificateRequest->Length(); aMessage.Complete(KPKIErrBufferTooShort); } CleanupStack::PopAndDestroy(certificateRequest); CleanupStack::PopAndDestroy(certRequestRef); } break; case PkiService::EDeleteCertificateRequest: { TInt certRequestRefSize = aMessage.GetDesLength(0); HBufC *certRequestRef = HBufC::NewLC(certRequestRefSize); TPtr certRequestRefPtr = certRequestRef->Des(); aMessage.ReadL(0, certRequestRefPtr); iServer.CertificateRequestStore().DeleteCertRequestL(*certRequestRef); CleanupStack::PopAndDestroy(certRequestRef); aMessage.Complete(KErrNone); } break; case PkiService::ESetCertStoreType: iWrapper->SetCertStoreType(static_cast<TPkiServiceStoreType>(aMessage.Int0())); aMessage.Complete(KErrNone); break; case PkiService::ESetKeyStoreType: SetKeyStoreL(static_cast<TPkiServiceStoreType>(aMessage.Int0())); aMessage.Complete(KErrNone); break; case PkiService::ESetStoreType: iWrapper->SetCertStoreType(static_cast<TPkiServiceStoreType>(aMessage.Int0())); SetKeyStoreL(static_cast<TPkiServiceStoreType>(aMessage.Int1())); aMessage.Complete(KErrNone); break; case PkiService::EGetCertStoreType: { Status = iWrapper->CertStoreType(); aMessage.Complete(Status); break; } case PkiService::EGetKeyStoreType: { Status = KeyStore(); aMessage.Complete(Status); break; } case PkiService::ESetInformational: { iWrapper->SetInformational(aMessage.Int0()); aMessage.Complete(KErrNone); } break; case PkiService::EInitialize://falls through case PkiService::EKeyCount: //falls through case PkiService::EGetKeyDetails: //falls through case PkiService::EDecrypt: //falls through case PkiService::ESignWithKeyId: //falls through case PkiService::ESignWithCert: //falls through case PkiService::EReadPublicKey: //falls through case PkiService::ELogon: //falls through case PkiService::ELogoff: //falls through case PkiService::EChangePassword: //falls through case PkiService::ERemoveKeypair: //falls through case PkiService::EGenerateKeypair: //falls through case PkiService::EStoreKeypair: //falls through iKeyOperationQueue.AddOperationL(*this, aMessage, iUsedKeyStore, iWrapper->CertStoreType()); break; default: iRequiredBufferSize = KBufferSizeNotDefined; iWrapper->InitOperation(aMessage); break; } }
void CReferenceHandler::CreateReferenceObject1L(CObexBufObject& aObject, CBufFlat& aObjectBuf, TTransport aTransport) { //Reset the object (also resets the buffer) aObject.Reset(); const TUint KNumOfAlphabets = 2; aObjectBuf.ResizeL(KNumOfAlphabets * 30); //populate the buffer... TBuf8<4> buf; TUint i; for (i=0; i<KNumOfAlphabets; i++) { buf.Zero(); buf.AppendNumFixedWidth(i, EDecimal, 4); aObjectBuf.Write(30*i, buf); aObjectBuf.Write(30*i + 4, KAlphabet); } //populate the object aObject.SetNameL(KRef2Name); // check the deletecurrentheader method aObject.SetNameL(KRef1Name); _LIT8(KRef1HTTP, "Accept: text/*"); _LIT8(KRef2HTTP, "Location: http://www.w3.org"); _LIT8(KRef3HTTP, "Date: Tue, 10 Nov 2002 09:17:21 GMT"); // add Http header using old API // /* aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef3HTTP); // USE THE HEADER MASK TO REMOVE HTTP HEADERS FROM HEADERSET // THIS DOES NOT REMOVE THE ITEMS FROM iHttp LIST - this tests // the Http() function which should remove items from iHttp list // TObexMatchHeader* headerMask = new(ELeave) TObexMatchHeader; headerMask->SetHeader(TObexInternalHeader::EName); aObject.HeaderSet().SetMask(headerMask); aObject.HeaderSet().DeleteMasked(); aObject.HeaderSet().SetMask(NULL); delete headerMask; */ aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef3HTTP); /* if (aObject.Http()) { NULL; } */ // add a Count header using new API // CObexHeader* tempheader = CObexHeader::NewL(); CleanupStack::PushL(tempheader); tempheader->SetFourByte(TObexInternalHeader::ECount, 0xFE22FF54); aObject.AddHeaderL(*tempheader); CleanupStack::Pop(tempheader); // add an Http header using new API // tempheader = CObexHeader::NewL(); CleanupStack::PushL(tempheader); tempheader->SetByteSeqL(TObexInternalHeader::EHttp, KRef1HTTP); aObject.AddHeaderL(*tempheader); CleanupStack::Pop(tempheader); aObject.SetTypeL(KRefType); // set again to check header update functionality aObject.SetTypeL(KRefType); aObject.SetLengthL(aObjectBuf.Size()); // set again to check header update functionality aObject.SetLengthL(aObjectBuf.Size()); TBuf8<40> param; param.Copy(_L("\x04")); param.Append(_L("\x03")); param.Append(_L("App params 123")); aObject.SetAppParamL(param); // set again to check header update functionality aObject.SetAppParamL(param); const TTime KRef1Time = TDateTime(2003, EApril, 29, 10, 10, 10, 0); aObject.SetTimeL(KRef1Time); // set again to check header update functionality aObject.SetTimeL(KRef1Time); // Set up the MF description header const TUint KDescLength = ( (aTransport==EBluetooth?KObexPacketDefaultSize:2044) - KObexPacketHeaderSize - 5 - 5)/sizeof(TText); // Size in characters HBufC* descBuf = HBufC::NewLC(KDescLength); ASSERT(descBuf); TPtr ptr(descBuf->Des()); ptr.Zero(); for (i=0; i<KDescLength; i++) { ptr.AppendNumFixedWidth(i%10, EDecimal, 1); } aObject.SetDescriptionL(ptr); // set again to check header update functionality aObject.SetDescriptionL(ptr); CleanupStack::PopAndDestroy(descBuf); aObject.SetTargetL(KRefTarget); // set again to check header update functionality aObject.SetTargetL(KRefTarget); CObexHeader* header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetUnicodeL(0x30, KRef1Name); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(TObexInternalHeader::ECreatorID, 0x5F3A2343); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetUnicodeL(0x36, KRef5Name); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByteSeqL(TObexInternalHeader::EWanUUID, KRefTarget); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetUnicodeL(0x3F, KRef5Name); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByte(0xB0, 0x03); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByte(0xBF, 0x12); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByte(0xBE, 0x12); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(0xF0, 0x54545454); aObject.AddHeaderL(*header); CleanupStack::Pop(header); // THIS NEXT HEADER IS A NEGATIVE TEST. It should cause a panic // 0x2F header doesnt have a FourByte HI Type. /* header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(0x2F, 0x54); aObject.AddHeaderL(*header); CleanupStack::Pop(header); */ header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(0xFF, 0x00111243); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByteSeqL(0x73, KRefTarget); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByteSeqL(TObexInternalHeader::EObjectClass, KRefTarget); aObject.AddHeaderL(*header); CleanupStack::Pop(header); aObject.SetHeaderMask(KObexHdrName |KObexHdrType | KObexHdrLength | KObexHdrTime | KObexHdrDescription | KObexHdrTarget | KObexHdrHttp | KObexHdrCount | KObexHdrAppParam | KObexHdrUserDefined | KObexHdrObjectClass | KObexHdrWanUUID | KObexHdrCreatorID); }
void CReferenceHandler::CreateReferenceObject8L(CObexBufObject& aObject, CBufFlat& aObjectBuf, TTransport aTransport) { //Reset the object (also resets the buffer) aObject.Reset(); const TUint KNumOfAlphabets = 200; aObjectBuf.ResizeL(KNumOfAlphabets * 30); //populate the buffer... TBuf8<4> buf; TUint i; for (i=0; i<KNumOfAlphabets; i++) { buf.Zero(); buf.AppendNumFixedWidth(i, EDecimal, 4); aObjectBuf.Write(30*i, buf); aObjectBuf.Write(30*i + 4, KAlphabet); } //populate the object aObject.SetNameL(KRef8Name); aObject.SetTypeL(KRefType); const TTime KRef10Time = TDateTime(2005, EJanuary, 17, 14, 35, 30, 0); aObject.SetTimeL(KRef10Time); aObject.SetTargetL(KRefIrMCTarget); TBuf8<40> param; param.Copy(_L("\x04")); param.Append(_L("\x03")); param.Append(_L("PARAM 435")); aObject.SetAppParamL(param); _LIT8(KRef1HTTP, "Accept: text/*"); aObject.AddHttpL(KRef1HTTP); CObexHeader* header = CObexHeader::NewL(); CleanupStack::PushL(header); _LIT(KUserDefUnicode2, "UserDef2"); header->SetUnicodeL(0x34, KUserDefUnicode2); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByte(0xBC, 0x23); aObject.AddHeaderL(*header); CleanupStack::Pop(header); // Set up the MF description header const TUint KDescLength = ( (aTransport==EBluetooth?KObexPacketDefaultSize:2044) - KObexPacketHeaderSize - 5 - 5)/sizeof(TText); // Size in characters HBufC* descBuf = HBufC::NewLC(KDescLength); /* ASSERT(descBuf); Ptr ptr(descBuf->Des()); ptr.Zero(); for (i=0; i<KDescLength; i++) { ptr.AppendNumFixedWidth(i%10, EDecimal, 1); } aObject.SetDescriptionL(ptr); */ CleanupStack::PopAndDestroy(descBuf); aObject.SetHeaderMask(KObexHdrName | KObexHdrType | KObexHdrTime | KObexHdrTarget | KObexHdrAppParam | KObexHdrHttp |KObexHdrUserDefined); }
void CReferenceHandler::CreateReferenceObject6L(CObexBufObject& aObject, CBufFlat& aObjectBuf, TTransport aTransport) { //Reset the object (also resets the buffer) aObject.Reset(); const TUint KNumOfAlphabets = 200; aObjectBuf.ResizeL(KNumOfAlphabets * 30); //populate the buffer... TBuf8<4> buf; TUint i; for (i=0; i<KNumOfAlphabets; i++) { buf.Zero(); buf.AppendNumFixedWidth(i, EDecimal, 4); aObjectBuf.Write(30*i, buf); aObjectBuf.Write(30*i + 4, KAlphabet); } //populate the object aObject.SetNameL(KRef6Name); aObject.SetTypeL(KRefImageJpegType); aObject.SetLengthL(aObjectBuf.Size()); const TTime KRef5Time = TDateTime(2001, EFebruary, 14, 15, 38, 24, 0);//set time to 15:38:24.0 on 14th Feb 2001 - obex doesn't transfer microseconds!! aObject.SetTimeL(KRef5Time); _LIT8(KRef1HTTP, "Accept: text/*"); _LIT8(KRef2HTTP, "Location: http://www.w3.org"); _LIT8(KRef3HTTP, "Date: Tue, 10 Nov 2002 09:17:21 GMT"); /* TObexMatchHeader* headerMask = new(ELeave) TObexMatchHeader; headerMask->SetHeader(TObexInternalHeader::EName); aObject.HeaderSet().SetMask(headerMask); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef3HTTP); if (aObject.Http()) { NULL; } aObject.HeaderSet().SetMask(headerMask); aObject.HeaderSet().DeleteMasked(); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef3HTTP); if (aObject.Http()) { NULL; } aObject.HeaderSet().SetMask(headerMask); aObject.HeaderSet().DeleteMasked(); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef3HTTP); if (aObject.Http()) { NULL; } aObject.HeaderSet().SetMask(headerMask); aObject.HeaderSet().DeleteMasked(); delete headerMask; */ aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef2HTTP); /* if (aObject.Http()) { NULL; } aObject.HeaderSet().SetMask(NULL); */ // Set up the MF description header const TUint KDescLength = ( (aTransport==EBluetooth?KObexPacketDefaultSize:2044) - KObexPacketHeaderSize - 5 - 5)/sizeof(TText); // Size in characters HBufC* descBuf = HBufC::NewLC(KDescLength); /* ASSERT(descBuf); TPtr ptr(descBuf->Des()); ptr.Zero(); for (i=0; i<KDescLength; i++) { ptr.AppendNumFixedWidth(i%10, EDecimal, 1); } aObject.SetDescriptionL(ptr); */ CleanupStack::PopAndDestroy(descBuf); aObject.SetTargetL(KRefTarget); CObexHeader* header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetUnicodeL(0x30, KRef1Name); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetUnicodeL(0x36, KRef5Name); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetUnicodeL(0x3F, KRef5Name); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByte(0xB0, 0x03); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByte(0xBF, 0x12); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(0xF0, 0x54); aObject.AddHeaderL(*header); CleanupStack::Pop(header); // THIS NEXT HEADER IS A NEGATIVE TEST. It should cause a panic // 0x2F header doesnt have a FourByte HI Type. /* header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(0x2F, 0x54); aObject.AddHeaderL(*header); CleanupStack::Pop(header); */ header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(0xFF, 0x43); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByteSeqL(0x73, KRefTarget); aObject.AddHeaderL(*header); CleanupStack::Pop(header); aObject.SetHeaderMask(KObexHdrName | KObexHdrType | KObexHdrTime | KObexHdrLength | KObexHdrHttp | KObexHdrTarget | KObexHdrUserDefined ); }
void CReferenceHandler::CreateReferenceObject3L(CObexBufObject& aObject, CBufFlat& aObjectBuf, TTransport aTransport) { //Reset the object (also resets the buffer) aObject.Reset(); const TUint KNumOfAlphabets = 1000; aObjectBuf.ResizeL(KNumOfAlphabets * 30); //populate the buffer... TBuf8<4> buf; TUint i; for (i=0; i<KNumOfAlphabets; i++) { buf.Zero(); buf.AppendNumFixedWidth(i, EDecimal, 4); aObjectBuf.Write(30*i, buf); aObjectBuf.Write(30*i + 4, KAlphabet); } //populate the object aObject.SetNameL(KRef3Name); aObject.SetTypeL(KRefRichTextType); aObject.SetLengthL(aObjectBuf.Size()); const TTime KRef3Time = TDateTime(2002, EJanuary, 0, 0, 0, 0, 0); aObject.SetTimeL(KRef3Time); // Set up the MF description header const TUint KDescLength = ( (aTransport==EBluetooth?KObexPacketDefaultSize:2044) - KObexPacketHeaderSize - 5 - 5)/sizeof(TText); // Size in characters HBufC* descBuf = HBufC::NewLC(KDescLength); ASSERT(descBuf); TPtr ptr(descBuf->Des()); ptr.Zero(); for (i=0; i<KDescLength; i++) { ptr.AppendNumFixedWidth(i%10, EDecimal, 1); } aObject.SetDescriptionL(ptr); CleanupStack::PopAndDestroy(descBuf); aObject.SetTargetL(KRefTarget); CObexHeader* header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetUnicodeL(0x30, KRef1Name); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetUnicodeL(0x36, KRef5Name); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetUnicodeL(0x3F, KRef5Name); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByte(0xB0, 0x03); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByte(0xBF, 0x12); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(0xF0, 0x54); aObject.AddHeaderL(*header); CleanupStack::Pop(header); // THIS NEXT HEADER IS A NEGATIVE TEST. It should cause a panic // 0x2F header doesnt have a FourByte HI Type. /* header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(0x2F, 0x54); aObject.AddHeaderL(*header); CleanupStack::Pop(header); */ header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(0xFF, 0x43); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByteSeqL(0x73, KRefTarget); aObject.AddHeaderL(*header); CleanupStack::Pop(header); aObject.SetHeaderMask(KObexHdrName | KObexHdrType | KObexHdrLength | KObexHdrTime | KObexHdrDescription | KObexHdrTarget | KObexHdrUserDefined); }