コード例 #1
0
// ---------------------------------------------------------------------------
// CNATFWTraversalAdapter::SaveL
//
// ---------------------------------------------------------------------------
//
void CNATFWTraversalAdapter::SaveL( TInt aIndex )
    {
    DBG_PRINT( "CNATFWTraversalAdapter::SaveL - begin" );
    CWPNATFWItem* cNATFWItem = iDatas[aIndex];
    const TInt iapItemCount( iDatas[aIndex]->IAPItems().Count() );
    for ( TInt counter = 0; counter < iapItemCount; counter++ )
        {
        // Set access point ID to current IAP item (access point is always
        // stored before NAT/FW settings).
        CNATFWIAPSpecificItem* cIapItem = iDatas[aIndex]->IAPItems()[counter];
        if ( cIapItem->NapDef() )
            {
            // Get WAP ID.
            TPckgBuf<TUint32> uid;
            uid.Copy( cIapItem->NapDef()->Data( 0 ) );
            
            TUint32 wapId( uid() );
            // Get corresponding IAP ID.
            TUint32 iapId = IapIdFromWapIdL( wapId );
            cIapItem->SetIAPId( iapId );
            }// if 
        cIapItem = NULL;    
        }
    cNATFWItem->StoreL();
    cNATFWItem = NULL;
    DBG_PRINT( "CNATFWTraversalAdapter::SaveL - end" );
    }
コード例 #2
0
// -----------------------------------------------------------------------------
// CMceComAvSink::SetParameterL
// -----------------------------------------------------------------------------
//    
TBool CMceComAvSink::SetParameterL( 
    const CMceComEndpoint& aClient, 
    TUint32 aParam,
    const TDesC8& aValue )
    {
    // At the moment, only supported parameter is volume for speaker
    //
    if ( aClient.iType != KMceSpeakerSink || aParam != KMccSpeakerVolume )
        {
        return KMceSrvStreamDefaultSequence;
        }
    
    __ASSERT_ALWAYS( ServesProxyClient( aClient ), User::Leave( KErrNotFound ) );
    
    __ASSERT_ALWAYS( aClient.MediaStream() && aClient.MediaStream()->Session(),
                     User::Leave( KErrNotFound ) );
   
    CMceMediaManager& manager = 
        aClient.MediaStream()->Session()->SdpSession().Manager();
    
    TPckgBuf<TInt> volBuf;
    volBuf.Copy( aValue );
    
    iVolume = volBuf();
    
    if ( aClient.IsEnabled() )
        {
        manager.SetMccParameterL( 
            static_cast<const CMceComMediaSink&>( aClient ), aParam, aValue );
        }
        
    return KMceSrvStreamAlternativeSequence;
    }
コード例 #3
0
LOCAL_C void TestDeleteStoreOperationL()
	{
	CMsgsTestUtils::SetDriveL(EDriveC);

	CSessionObserver* ob = new(ELeave)CSessionObserver;
	CleanupStack::PushL(ob);

	// Set session in observer
	CMsvSession* session = CMsvSession::OpenAsyncL(*ob);
	ob->iSession = session; 
	CleanupStack::PushL(session);
	
	CActiveScheduler::Start();
	test(ob->iType==MMsvSessionObserver::EMsvServerReady);

	CTestActive* active = new(ELeave)CTestActive;
	CleanupStack::PushL(active);
	
	// Test Delete MailStore 
	active->StartL();
	CMsvOperation* operation = NULL;
	TDriveUnit unit =(EDriveD);
	operation = session->DeleteStoreL(unit, active->iStatus);
	test(operation->Mtm() == KUidMsvServerMtm);
	CleanupStack::PushL(operation);
	
    CActiveScheduler::Start();
    
    //Retrieve progress 
	TPckgBuf<TMsvCopyProgress> package;
	package.Copy(operation->ProgressL());
	test((package().iError == KErrNone) || (package().iError == KErrPathNotFound)) ;
	
	CleanupStack::PopAndDestroy(4);	
	}
コード例 #4
0
// -----------------------------------------------------------------------------
// CPosLmEventHandler::HandleRequestForEventL
//
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CPosLmEventHandler::HandleRequestForEventL(
    const RMessagePtr2& aMessage)
    {
    TPckgBuf<TPosLmEvent> event;
    TInt desMaxLength = aMessage.GetDesMaxLength(KPosLmServerEventArg);
    if (desMaxLength != event.Length())
        {
        PanicClient(aMessage, EPosUnableToReadOrWriteDataToClient);
        return;
        }

    if (iEventQueue.Count() > 0)
        {
        // Send the first event in the queue to the client.
        WriteEventAndComplete(aMessage, iEventQueue[0]);
        iEventQueue.Remove(0);
        }
    else
        {
        // No events in queue. Put the message on hold.
        if (!iHoldingMessage.IsNull())
            {
            PanicClient(aMessage,
                EPosEventNotifierAlreadyHasOutstandingRequest);
            }
        else
            {
            iHoldingMessage = aMessage;
            }
        }
    }
コード例 #5
0
// -----------------------------------------------------------------------------
// CPosLmDbManEventHandler::HandleRequestForEventL
//
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CPosLmDbManEventHandler::HandleRequestForEventL(
    const RMessagePtr2& aMessage)
    {
    // check that descriptor parameters are OK so that server
    // won't panic when trying to write.
    TPckgBuf<TPosLmDatabaseEvent> event;
    TPckgBuf<TInt> length;
    TInt eventMaxLength = aMessage.GetDesMaxLength(KPosLmServerDbManEventArg);
    TInt lengthMaxLength = aMessage.GetDesMaxLength(KPosLmServerUriLengthArg);
    if (eventMaxLength  != event.Length() ||
        lengthMaxLength != length.Length())
        {
        PanicClient(aMessage, EPosUnableToReadOrWriteDataToClient);
        return;
        }

    if (iEventQueue.Count() > 0)
        {
        // Send the first event in the queue to the client.
        WriteEventAndComplete(aMessage);
        }
    else
         {
        // No events in queue. Put the message on hold.
        if (!iHoldingMessage.IsNull())
            {
            PanicClient(aMessage,
                EPosEventNotifierAlreadyHasOutstandingRequest);
            }
        else
            {
            iHoldingMessage = aMessage;
            }
        }
    }
コード例 #6
0
static void DeleteSingleton( const TUid& aSingletonKey )
/**
 * Deletes a singleton object that was created on WServ's main heap.
 * 
 * @pre     The ws plugins have not been unloaded.
 * @param   aSingletonKey   The UID of the singleton which correponds to an
 *                          RProperty within WServ's category.                       
 */
    {   
    if ( gReleaseSingletonsOnExit )
        {
        RThread t;
        TPckgBuf<TCallBack> cb;
        RProperty prop; 
        TInt err = prop.Get(TUid::Uid(t.SecureId().iId), aSingletonKey.iUid, cb);
        if (err == KErrNone && cb.Length() == sizeof(TCallBack) && 
                cb().iFunction && cb().iPtr == &User::Heap())
            {
            // Callback is only invoked if the heap for the singleton was the 
            // WServ heap because the WServ memory leak tests only check this
            // heap.
            cb().CallBack();
            }
        // Errors are ignored because the purpose of this function is to free
        // singletons in order top make memory leak checks pass.
        prop.Close();
        t.Close();
        }
    }
コード例 #7
0
/**
Extracts the artist from the 'get artist' response data and calls 
the relevant mixin function on the observer.	
	
@param The data passed with the response.
*/	
void CRemConTrackInfoController::HandleGetArtistResponse(TInt aError, const TDesC8& aData)
	{
	LOG_FUNC

	TPckgBuf<TName> buf;
	buf.Copy((aData.Mid(KRemConExtApi1ResultDataLength)));
	iObserver.MrcticoGetArtistResponse(aError, buf());
	}
コード例 #8
0
// -----------------------------------------------------------------------------
// CNSmlDsProvisioningAdapter::DeleteL
// -----------------------------------------------------------------------------
void CNSmlDsProvisioningAdapter::DeleteL( const TDesC8& aSaveData)
	{
	_DBG_FILE("CNSmlDsProvisioningAdapter::DeleteL(): begin");
	TPckgBuf<TInt> uid;
	uid.Copy( aSaveData );
	iSession.DeleteProfileL( uid() );
	_DBG_FILE("CNSmlDsProvisioningAdapter::DeleteL(): end");
	}
コード例 #9
0
ファイル: TXCLIENT.CPP プロジェクト: huellif/symbian-example
CMsvOperation* CTextMtmClient::ForwardL(TMsvId aForwardEntryId, TMsvPartList aPartList, 
										TRequestStatus& aCompletionStatus)
// Create forwarded message 
// Destination folder is aForwardEntryL
//
	{
	__ASSERT_DEBUG(iMsvEntry!=NULL,gPanic(ETxtcNoCMsvEntrySet));
	__ASSERT_DEBUG(iMsvEntry->Entry().iType.iUid == KUidMsvMessageEntryValue, gPanic(ETxtcEntryTypeNotSupported));
	__ASSERT_DEBUG(iMsvEntry->Entry().iServiceId == KMsvLocalServiceIndexEntryId, gPanic(ETxtcInvalidServiceId));
	
	// Create the forwarded index entry
	TMsvEntry forwardEntry;
	forwardEntry.iMtm = KUidMsgTypeText;
	forwardEntry.iServiceId = Entry().Entry().iServiceId;
	forwardEntry.iType = KUidMsvMessageEntry;
	forwardEntry.iDetails.Set(iMsvEntry->Entry().iDetails);				
	forwardEntry.iSize = iMsvEntry->Entry().iSize;	
	if(aPartList&KMsvMessagePartDate)
		forwardEntry.iDate.HomeTime();
	if(aPartList&KMsvMessagePartDescription)
		forwardEntry.iDescription.Set(iMsvEntry->Entry().iDescription);		

	// Get CMsvEntry for destination (parent)
	CMsvEntry* cEntry = CMsvEntry::NewL(Session(), aForwardEntryId, TMsvSelectionOrdering());
	CleanupStack::PushL(cEntry);
	// Synchronously create new child
	CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC();
	CMsvOperation* opert = cEntry->CreateL(forwardEntry, wait->iStatus);
	CleanupStack::PushL(opert);
	wait->Start();
	User::LeaveIfError(opert->iStatus.Int());
	// Check result
	TPckgBuf<TMsvLocalOperationProgress> progressPack;
    progressPack.Copy(opert->ProgressL());
	TMsvLocalOperationProgress progress = progressPack();
	User::LeaveIfError(progress.iError);
	CleanupStack::PopAndDestroy(2);	// opert, wait

	// Get CMsvEntry for new entry
	TMsvId forwardId=progress.iId;
	cEntry->SetEntryL(forwardId);
	
	// Populate new forwarded message with Body text
	if(aPartList&KMsvMessagePartBody)
		{
		CMsvStore* store=cEntry->EditStoreL();
		CleanupStack::PushL(store);
		StoreBodyL(*store);				// Current context is original message
		store->CommitL();
		CleanupStack::PopAndDestroy();	// store
		}

	CleanupStack::PopAndDestroy(); // cEntry
		
	// Request was performed synchronously, so return a completed operation object
	return CMsvCompletedOperation::NewL(Session(), KUidMsgTypeText, progressPack, 
		KMsvNullIndexEntryId, aCompletionStatus);
	}
コード例 #10
0
/**
Extracts the track duration from the 'get track duration' response data and calls 
the relevant mixin function on the observer.	
	
@param The data passed with the response.
*/	
void CRemConTrackInfoController::HandleGetTrackDurationResponse(TInt aError, const TDesC8& aData)
	{
	LOG_FUNC	
	
	TPckgBuf<TInt64> buf;
	buf.Copy((aData.Mid(KRemConExtApi1ResultDataLength)));
	TTime duration(buf());
	iObserver.MrcticoGetTrackDurationResponse(aError, duration);
	}
コード例 #11
0
// -----------------------------------------------------------------------------
// CMccFileSource::ConstructSourceL
// -----------------------------------------------------------------------------
//
void CMccFileSource::ConstructSourceL( const TDesC8& aInitData )
    {    	
	iSourceImpl = CMccFileSourceImpl::NewL( 
        MCC_ENDPOINT_ID( static_cast<MDataSource*>( this ) ) );
  
    TPckgBuf<TFileName> initData;
    initData.Copy( aInitData );
    
    OpenFileL( initData() );
    }
コード例 #12
0
ファイル: exadump.cpp プロジェクト: cdaffara/symbiandump-os2
void CProtocolExadump::DoOpen(TInt aSnaplen)
	/**
	* Try opening the dump file.
	*
	* Opens the dump file and writes the file header to it.
	*
	* @param aSnaplen The snap length
	*/
	{
/** @code */
	// Just close the previous, if called with open file.
	if (iOpen > 0)
		{
		iDumpFile.Close();
		iFS.Close();
		}

	// Allocate a working buffer for the packet frames
	// (include packet header and snaplen).
	delete iBuffer;
	iBuffer = HBufC8::NewMax(aSnaplen + sizeof(struct pcap_file_header));
	if (iBuffer == NULL)
		{
		iOpen = KErrNoMemory;
		return;
		}

	_LIT(KDumpFile, "exedump.dat");	// the name of the dump file.

	iOpen = iFS.Connect();
	if (iOpen != KErrNone)
		return;
	iOpen = iDumpFile.Replace(iFS, KDumpFile, EFileWrite);
	if (iOpen != KErrNone)
		{
		iFS.Close();
		return;
		}

	// Write the header
	TPckgBuf<struct pcap_file_header> hdr;

	hdr().magic = TCPDUMP_MAGIC;
	hdr().version_major = PCAP_VERSION_MAJOR;
	hdr().version_minor = PCAP_VERSION_MINOR;

	hdr().thiszone = 0;
	hdr().snaplen = aSnaplen;
	hdr().sigfigs = 0;
	hdr().linktype = DLT_RAW;
	iDumpFile.Write(hdr, hdr.Length());
	iOpen = 1;
	return;
/** @endcode */
	}
コード例 #13
0
// ---------------------------------------------------------------------------
// CSensorDataCompensatorAxisDataHandler::Update
// ---------------------------------------------------------------------------
//
TInt CSensorDataCompensatorAxisDataHandler::Update()
    {
	
	FUNC_LOG;
    TInt err( KErrNone );
    TInt count = iPlugin.GetCompensationItemCount();
    INFO_1( "Axis compensation item count %d", count );
    iMatrix.SetIdentity(); // Reset compensation
    if ( count >= 0 )
        {
        // Calculate final compensation angles and create compensation matrix
        TPckgBuf<TCompensationTypeAxisData> pckg;
        TInt x( 0 );
        TInt y( 0 );
        TInt z( 0 );
        TSensorDataCompensatorMatrix m;
        TSensorDataCompensatorMatrix m2;
        for ( TInt i( 0 ) ; i < count; i++ )
            {
            TPtrC8 data( iPlugin.GetCompensationItem( i ) );
            if ( data.Size() == pckg.MaxSize() )
                {
                pckg.Copy( data );
                x = pckg().iAxisX;
                y = pckg().iAxisY;
                z = pckg().iAxisZ;
                }
            else
                {
                err = KErrCorrupt;
                break;
                }
            m.SetRotateX( x );
            m2.SetRotateY( y );
            m *= m2; // xy
            m2.SetRotateZ( z );
            m *= m2; // xy * z
            iMatrix *= m;
            }
        if ( err != KErrNone )
            {
            iMatrix.SetIdentity();
            }
        }
    else
        {
        // Error occured in plugin
        err = count;
        }
    iCompensate = ( count > 0 ) && ( err == KErrNone ); // Ready to compensate
    ERROR( err, "Axis update error" );
    return err;
    }
コード例 #14
0
void CWin32Socket::Accept(TWin32Message& aMessage)
	{
	__ASSERT_DEBUG(iAcceptMessage == NULL, Panic(EWinSockPrtCWin32SocketMultipleAcceptRequests));
	__ASSERT_DEBUG(iBlankAcceptSocket == NULL, Panic(EWinSockPrtCWin32SocketAcceptBlankSocketNotNull));
	iAcceptMessage = &aMessage;
	WSP_LOG(WspLog::Printf(_L("CWin32Socket::Accept: this: 0x%x"), this));
	if (WSAEventSelect(iSocket, iEvent, FD_ACCEPT) == SOCKET_ERROR)
		{
		Complete(iAcceptMessage, MapWinSockError(WSAGetLastError()));
		}
	TPckgBuf<TInt> newSocketHandleBuf;
	newSocketHandleBuf.Copy(iAcceptMessage->ReadBuffer());
	iBlankAcceptSocket = (CWin32Socket*)newSocketHandleBuf();
	}
コード例 #15
0
void CWin32Socket::Listen(TWin32Message& aMessage)
	{
	TPckgBuf<TUint> queueSizeBuf;
	queueSizeBuf.Copy(aMessage.ReadBuffer());
	TUint& queueSize = queueSizeBuf();
	if (listen(iSocket, queueSize))
		{
		aMessage.Complete(MapWinSockError(WSAGetLastError()));
		}
	else
		{
		aMessage.Complete(KErrNone);
		}
	}
コード例 #16
0
// -----------------------------------------------------------------------------
// CResultCollector::VisitL
// -----------------------------------------------------------------------------
// 
void CResultCollector::VisitL( CNSPTest& aTest )
	{
	CBufFlat* buffer = CBufFlat::NewL( 300 );
	CleanupStack::PushL( buffer );
	RBufWriteStream stream;
	stream.Open( *buffer );
	CleanupClosePushL( stream );
	aTest.ExternalizeL( stream );
	
	TPckgBuf<TResult> pkgIn;
	pkgIn.Copy( buffer->Ptr(0) );
	PrintResult( pkgIn() );
	
	CleanupStack::PopAndDestroy();
	CleanupStack::PopAndDestroy( buffer );
	}
コード例 #17
0
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------    
// 
TInt CIpsPlgPop3ConnectOp::GetOperationErrorCodeL( )
    {
    FUNC_LOG;
    if ( !iSubOperation )
        {
        return KErrNotFound;
        }
    if ( !iSubOperation->IsActive() && iSubOperation->iStatus.Int() != KErrNone )
        {
        return iSubOperation->iStatus.Int();
        }
    
    TPckgBuf<TPop3Progress> paramPack;
    paramPack.Copy( iSubOperation->ProgressL() );
    const TPop3Progress& progress = paramPack();
    
    return progress.iErrorCode;
    }
コード例 #18
0
EXPORT_C CMemSpyApiHeap* RMemSpySession::GetHeapL()
	{
	CMemSpyApiHeap* aHeap;
	
	HBufC8* buffer = HBufC8::NewLC( sizeof(TMemSpyHeapData) );
	TPtr8 bufferPtr(buffer->Des());
	TIpcArgs args( &bufferPtr );
	
	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetHeap, args ));
	
	TPckgBuf<TMemSpyHeapData> data;
	data.Copy(bufferPtr.Ptr(), sizeof(TMemSpyHeapData));		
	aHeap = CMemSpyApiHeap::NewL( data() );
	
	CleanupStack::PopAndDestroy(buffer);
		
	return aHeap;
	}
コード例 #19
0
LOCAL_C void TestStoreExistsL()
	{
	CMsgsTestUtils::SetDriveL(EDriveC);
	
	//Check that message store exists on the drive at this stage
	CSessionObserver* ob = new(ELeave)CSessionObserver;
	CleanupStack::PushL(ob);
       
	// Set session in observer
	CMsvSession* session = CMsvSession::OpenAsyncL(*ob);
	ob->iSession = session; 
	CleanupStack::PushL(session);
    
	CActiveScheduler::Start();
	test(ob->iType==MMsvSessionObserver::EMsvServerReady);
	
	CTestActive* active = new(ELeave)CTestActive;
	CleanupStack::PushL(active);
     
	// Test Copy MailStore 
	active->StartL();
	CMsvOperation* operation = NULL;
	TDriveUnit unit = EDriveD;
	operation = session->CopyStoreL(unit, active->iStatus);
	test(operation->Mtm() == KUidMsvServerMtm);
	CleanupStack::PushL(operation);
	
	CActiveScheduler::Start();
	
	//Retrieve progress 
	//Should retrun KErrAlreadyExists
	TPckgBuf<TMsvCopyProgress> package;
	package.Copy(operation->ProgressL());
	test(package().iError == KErrAlreadyExists);
		
	//delete session;
	CleanupStack::PopAndDestroy(4, ob);
	
	CMsgsTestUtils::WaitForServerClose();
		
  	}
コード例 #20
0
EXPORT_C void RMemSpySession::GetThreadInfoItemsL( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType )
	{
	TPckgBuf<TThreadId> id( aId );	
	TPckgBuf<TMemSpyThreadInfoItemType> type( aType );
	TPckgBuf<TInt> count;	
	
	TInt error = SendReceive( EMemSpyClientServerOpGetThreadInfoItemsCount, TIpcArgs( &id, &type, &count ) );
	TInt itemCount = count();
	
	if( error == KErrNone )
		{		
		if( itemCount == 0 )
			{
			aInfoItems.Reset();
			}
		else
			{
			HBufC8* buffer = HBufC8::NewLC( itemCount * sizeof(TMemSpyThreadInfoItemData) );
			TPtr8 bufferPtr(buffer->Des());
			
			TPckgBuf<TInt> requestedCount( itemCount );
			
			TIpcArgs args( &requestedCount, &id, &type, &bufferPtr );
			TInt error = SendReceive( EMemSpyClientServerOpGetThreadInfoItems, args ); // TODO check error
			
			aInfoItems.Reset();
		
			for(TInt i=0, offset = 0; i < itemCount; i++, offset+=sizeof(TMemSpyThreadInfoItemData))
				{
				TPckgBuf<TMemSpyThreadInfoItemData> data;
				data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyThreadInfoItemData));
				aInfoItems.AppendL(CMemSpyApiThreadInfoItem::NewLC(data()));
				}
			
			CleanupStack::Pop(aInfoItems.Count());
			CleanupStack::PopAndDestroy(buffer);
			}
		}
	
	User::LeaveIfError(error);
	}
コード例 #21
0
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
//
TInt CIpsSosAOImapPopLogic::QueryMailboxStatus( TDesC8& aParameter )
    {
    FUNC_LOG;
    TPckgBuf<RMessage2> param;
    param.Copy( aParameter );
    // get ipc message from param
    RMessage2 msg = param();
    TPckgBuf<TMsvId> mboxBuf;
    msg.Read(0, mboxBuf);
    
    TMsvId mbox = mboxBuf();
    
    TInt error = KErrNone;
    
    TInt index = GetMailboxLogicIndex( mbox );


    if ( index != KErrNotFound )
        {
        TInt state = iMailboxLogics[index]->GetCurrentState(); // faulty CS warning

        if ( state == CIpsSosAOMBoxLogic::EStateSyncOngoing
          || state == CIpsSosAOMBoxLogic::EStateFetchOngoing )
            {
            TPckgBuf<TInt> event( EIpsAOPluginStatusSyncStarted );
            msg.Write(1, event );
            }
        else
            {
            TPckgBuf<TInt> event( EIpsAOPluginStatusSyncCompleted );
            msg.Write(1, event );
            }
        }
    else
        {
        error = KErrNotFound;
        }
    
    return error;
    }
コード例 #22
0
/**
Log command data
*/
void CMockPowerEngine::DoLogCommandData(TInt aCmdId, const TMockHwrmPluginData& aCmdData, const TDesC& aComment)
	{
	TBuf<KMaxLogLineSize> buffer;

    if (aCmdId == HWRMPowerCommand::EStartAverageBatteryPowerReportingCmdId)
        {
        TPckgBuf<TUint> intervalMultipleData;
		intervalMultipleData.Copy(aCmdData.CommandData());
		buffer.Format(_L("%S: Power intervalMultipleData=%d"), & aComment,
				intervalMultipleData());
        }
#ifdef SYMBIAN_HWRM_EXTPOWERINFO
    else if (aCmdId == HWRMPowerCommand::EStartAverageBatteryChargingCurrentReportingCmdId)
		{
		HWRMPowerCommand::TChrgCurrentIntervalMultiplePackage intervalMultipleData;
		intervalMultipleData.Copy(aCmdData.CommandData());
		buffer.Format(_L("%S: intervalMultipleData=%d"), & aComment,
				intervalMultipleData());			
		}		
#endif //SYMBIAN_HWRM_EXTPOWERINFO
	Log(buffer);
	}
コード例 #23
0
// Servers
EXPORT_C void RMemSpySession::GetServersL(RArray<CMemSpyApiServer*> &aServers)
    {
    TPckgBuf<TInt> count;
    User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetServerCount, TIpcArgs(&count)));
    
    TInt requestedCount = count();
    HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyServerData));
    TPtr8 bufferPtr(buffer->Des());
    
    User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetServers, TIpcArgs(&count, &bufferPtr)));
    aServers.Reset();
    
    TInt receivedCount = Min(count(), requestedCount);
    for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyServerData))
        {
        TPckgBuf<TMemSpyServerData> data;
        data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyServerData));
        aServers.AppendL(CMemSpyApiServer::NewLC(data()));
        }
    CleanupStack::Pop(aServers.Count());
    CleanupStack::PopAndDestroy(buffer);
    }
コード例 #24
0
// ---------------------------------------------------------------------------
// CSensorDataCompensatorAxisDataHandler::Compensate
// ---------------------------------------------------------------------------
//
TInt CSensorDataCompensatorAxisDataHandler::Compensate( TDes8& aData )
    {
	FUNC_LOG;
	TInt err( KErrNone );
    TInt x( 0 );
    TInt y( 0 );
    TInt z( 0 );

    TRACE_MATRIX( "Axis data compensation matrix", iMatrix );

    if ( KSensrvChannelTypeIdMagnetometerXYZAxisData == iDataType )
        {
        INFO( "Compensating magnetometer data" );
        TPckgBuf<TSensrvMagnetometerAxisData> pckg;
        if ( aData.MaxSize() == pckg.MaxSize() )
            {
            pckg.Copy( aData );
            iMatrix.Transform( x, y, z, pckg().iAxisXRaw, pckg().iAxisYRaw,  pckg().iAxisZRaw );
            INFO_3( "Compensated data Magnetometer raw [X: %d], [Y: %d], [Z: %d]", x, y, z );

            pckg().iAxisXRaw = x;
            pckg().iAxisYRaw = y;
            pckg().iAxisZRaw = z;                
            iMatrix.Transform( x, y, z, pckg().iAxisXCalibrated, pckg().iAxisYCalibrated, pckg().iAxisZCalibrated );
            INFO_3( "Compensated data Magnetometer calib [X: %d], [Y: %d], [Z: %d]", x, y, z );

            pckg().iAxisXCalibrated = x;
            pckg().iAxisYCalibrated = y;
            pckg().iAxisZCalibrated = z;
            aData.Copy( pckg );    
            }
        else
            {
            err = KErrArgument;
            }
        }
    else
        {        
        INFO( "Compensating accelerometer data" );
        TPckgBuf<TSensrvAccelerometerAxisData> pckg;
        if ( aData.MaxSize() == pckg.MaxSize() )
            {
            pckg.Copy( aData );
            iMatrix.Transform( x, y, z, pckg().iAxisX, pckg().iAxisY, pckg().iAxisZ );
            INFO_3( "Compensated data accelerometer[X: %d], [Y: %d], [Z: %d]", x, y, z  );
            pckg().iAxisX = x;
            pckg().iAxisY = y;
            pckg().iAxisZ = z;
            aData.Copy( pckg );
            }
        else
            {
            err = KErrArgument;
            }
        }

    ERROR( err, "Axis data compensation error" );
    return err;
    }
コード例 #25
0
// ---------------------------------------------------------
// CDownloadMgrSession::DownloadMgrAttachL
// ---------------------------------------------------------
//
void CDownloadMgrSession::DownloadMgrAttachL()
    {
    CLOG_ENTERFN( "CDownloadMgrSession::DownloadMgrAttachL" )
    // The client would like to attach the dowmloads were created previously.
    // Here, we create a buffer with the unique handles of download subsessions
    // and copy it to the client's address space.
    CLOG_WRITE_FORMAT( "CDownloadMgrSession::DownloadMgrAttachL iClientAppInstance %d", iClientAppInstance );
    CArrayPtrFlat<CHttpDownload>* currentDownloads = iClientAppInstance->DownloadsL();
    CleanupStack::PushL( currentDownloads );
    TPckgBuf<TInt> arrayPckg;
    HBufC8* buf = HBufC8::NewLC( currentDownloads->Count() * arrayPckg.Size() );
    // Cerate subsessions one by one and write the unique handles to the client.
    // Later the handles is used by the client subsession to attach to the server.
    for( TInt i = 0; i < currentDownloads->Count(); i++ )
        {
        CHttpDownload* httpDownload = (*currentDownloads)[i];
	    // make a new download object
	    CDownloadSubSession* download = CDownloadSubSession::NewL( this, httpDownload );
        CleanupStack::PushL( download );
	    // add object to object container to gererate unique id
	    iObjectContainer->AddL( download );
	    // add object to object index; this returns a unique handle so we can get it again
        CLOG_WRITE_FORMAT( "CDownloadMgrSession::DownloadMgrAttachL, download %d", download );
	    arrayPckg() = iObjectIx->AddL( download );
        CLOG_WRITE_FORMAT( "CDownloadMgrSession::DownloadMgrAttachL, iObjectIx->ActiveCount() %d", iObjectIx->ActiveCount() );
        // Store handle to the subsession. It is used when the URL is checked.
        download->SetHandle( arrayPckg() );
        CleanupStack::Pop( download ); //download
        buf->Des().Append( arrayPckg );
        }
    TPtr8 ptr = buf->Des();

    Write( 0, CurrentMessage(), ptr );

    CleanupStack::PopAndDestroy( buf ); // buf
    currentDownloads->Reset();
    CleanupStack::PopAndDestroy( currentDownloads ); // currentDownloads
    }
コード例 #26
0
EXPORT_C void RMemSpySession::GetEComImplementationsL(TUid aInterface, RArray<CMemSpyApiEComImplementation*> &aImplementations)
    {
    TPckgBuf<TInt> count;
    TPckgBuf<TUid> interface(aInterface);
    User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComImplementationCount, TIpcArgs(&count, &interface)));
    
    TInt requestedCount = count();
    HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyEComImplementationData));
    TPtr8 bufferPtr(buffer->Des());
    
    User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComImplementations, TIpcArgs(&count, &interface, &bufferPtr)));
    aImplementations.Reset();
    
    TInt receivedCount = Min(count(), requestedCount);
    for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyEComImplementationData))
        {
        TPckgBuf<TMemSpyEComImplementationData> data;
        data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyEComImplementationData));
        aImplementations.AppendL(CMemSpyApiEComImplementation::NewLC(data()));
        }
    CleanupStack::Pop(aImplementations.Count());
    CleanupStack::PopAndDestroy(buffer);
    }
コード例 #27
0
// Threads related methods
EXPORT_C void RMemSpySession::GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiThread*> &aThreads, TSortType aSortType)
	{
	TPckgBuf<TInt> count;
	TPckgBuf<TProcessId> pid(aProcessId);
	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetThreadCount, TIpcArgs(&count, &pid)));
	
	TInt requestedCount = count();
	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyThreadData));
	TPtr8 bufferPtr(buffer->Des());
	
	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetThreads, TIpcArgs(&count, &bufferPtr, &pid)));
	aThreads.Reset();
	
	TInt receivedCount = Min(count(), requestedCount);
	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyThreadData))
		{
		TPckgBuf<TMemSpyThreadData> data;
		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyThreadData));
		aThreads.AppendL(CMemSpyApiThread::NewLC(data()));
		}
	CleanupStack::Pop(aThreads.Count());
	CleanupStack::PopAndDestroy(buffer);
	}
コード例 #28
0
EXPORT_C void RMemSpySession::GetKernelObjectItemsL( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer )
	{
	TPckgBuf<TInt> count;
	TPckgBuf<TMemSpyDriverContainerType> type(aForContainer);
	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectItemCount, TIpcArgs(&count, &type) ));

	TInt requestedCount = count();
	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyDriverHandleInfoGeneric));
	TPtr8 bufferPtr(buffer->Des());
	
	TIpcArgs args( &count, &type, &bufferPtr );
	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectItems, args ));
	
	aKernelObjectItems.Reset();
	
	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyDriverHandleInfoGeneric))
		{
		TPckgBuf<TMemSpyDriverHandleInfoGeneric> data;
		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyDriverHandleInfoGeneric));
		aKernelObjectItems.AppendL( CMemSpyApiKernelObjectItem::NewLC( data() ) );
		}
	CleanupStack::Pop(aKernelObjectItems.Count());
	CleanupStack::PopAndDestroy(buffer);
	}
コード例 #29
0
ファイル: t_romg.cpp プロジェクト: kuailexs/symbiandump-os1
LOCAL_C void writeRomImage()
//
// Write the ROM image.
//
	{

	test.Start(_L("Write rom file header"));
//
	TPckgBuf<TRomFileHeader> fileHeadB;
	fileHeadB.FillZ(fileHeadB.MaxLength());
	TRomFileHeader& fileHead=fileHeadB();
	Mem::Copy(&fileHead.iName[0],"EPOC468 ROM     ",KRomFileHeaderNameSize);
	Mem::Copy(&fileHead.iVersionStr[0],"0.01",4);
	Mem::Copy(&fileHead.iBuildNumStr[0],"   1",4);
	fileHead.iRomSize=TheRomHeader.iRomSize;
	fileHead.iHeaderSize=KRomFileHeaderSize;
	test(TheFile.Write(fileHeadB)==KErrNone);
//
	test.Next(_L("Write rom header"));
	TheFiller.FillZ(TheFiller.MaxLength());
	TPckgC<TRomHeader> head(TheRomHeader);
	test(TheFile.Write(head)==KErrNone);
	TheCurrentBase=UserSvr::RomHeaderAddress()+sizeof(TheRomHeader);
//
	test.Next(_L("Write directories"));
	TheLevel=(-1);
	TheRootDir->WriteDirs();
	test(TheLevel==(-1));
//
	test.Next(_L("Write files"));
	TheLevel=(-1);
	TheRootDir->WriteFiles();
	test(TheLevel==(-1));
//
	test.End();
	}
コード例 #30
0
void CMockPowerEngine::FurtherProcessEventL(const TInt aCommandId, TDesC8& aData)
	{
	switch (aCommandId)
		{

        case HWRMPowerCommand::EStartAverageBatteryPowerReportingCmdId:
			{
			// starting the measurements. Set flag ETrue and the counter to 0.
			iPowerReporting = ETrue;
			iPowerVoltageNotificationCounter = 0;
            iPowerCurrentNotificationCounter = 0;
			
			// Setting the interval multiple to the requested valuue
			TPckgBuf<TUint> requestedIntervalMultiplePckg;
			requestedIntervalMultiplePckg.Copy(aData);			    
			iPowerNotificationPeriod = requestedIntervalMultiplePckg();
			}
		break;

        case HWRMPowerCommand::ESetPowerReportingIntervalMultipleCmdId:
			{
			// Setting the interval multiple to the requested valuue
			TPckgBuf<TUint> requestedIntervalMultiplePckg;
			requestedIntervalMultiplePckg.Copy(aData);
			iPowerNotificationPeriod = requestedIntervalMultiplePckg();
			}
		break;
    	case HWRMPowerCommand::EStopAverageBatteryPowerReportingCmdId:
    		{
    		iPowerReporting = EFalse;
    		}
		break;
#ifdef SYMBIAN_HWRM_EXTPOWERINFO
        case HWRMPowerCommand::EStartAverageBatteryChargingCurrentReportingCmdId:
			{
			// starting the measurements. Set flag ETrue and the counter to 0.
			iChargingCurrentReporting = ETrue;
			iChargingCurrentCounter = 0;
			
			// Setting the interval multiple to the requested valuue
			HWRMPowerCommand::TChrgCurrentIntervalMultiplePackage requestedIntervalMultiplePckg;
			requestedIntervalMultiplePckg.Copy(aData);			    
			iChargingCurrentNotificationPeriod = requestedIntervalMultiplePckg();
			}
		break;

        case HWRMPowerCommand::EStartBatteryFullChargingTimeReportingCmdId:
			{
			// starting the measurements. Set flag ETrue and the counter to 0.
			iChargingTimeReporting = ETrue;
			iChargeTimeCounter = 0;
			
			//Notification time is decided by plugin
			iChargeTimeNotificationPeriod = 1;
			}
		break;
		
        case HWRMPowerCommand::ESetChargeCurrentIntervalMultipleCmdId:
			{
			// Setting the interval multiple to the requested valuue
			HWRMPowerCommand::TChrgCurrentIntervalMultiplePackage requestedIntervalMultiplePckg;
			requestedIntervalMultiplePckg.Copy(aData);
			iChargingCurrentNotificationPeriod = requestedIntervalMultiplePckg();
			}
		break;
		
		case HWRMPowerCommand::EStopAverageBatteryChargingCurrentReportingCmdId:
			{
			iChargingCurrentReporting = EFalse;
			}
		break;

        case HWRMPowerCommand::EStopBatteryFullChargingTimeReportingCmdId:
			{
			iChargingTimeReporting = EFalse;
			}
		break;
#endif //SYMBIAN_HWRM_EXTPOWERINFO
        
		default:
		break;		
		}
	}