Ejemplo n.º 1
0
// --------------------------------------------------------------------------
// void CNSmlSOSHandler::CompleteEventMsgL( MSyncMLEventObserver::TEvent aEvent, TInt aId, TInt aError, TInt aAdditional )
// Writes data to all event messages and completes them.
// --------------------------------------------------------------------------
//
void CNSmlSOSHandler::CompleteEventMsgL( MSyncMLEventObserver::TEvent aEvent, TInt aId, TInt aError, TInt aAdditional )
    {
    if ( iEventMsgs.Count() )
        {
        HBufC8* buf = HBufC8::NewLC(( (2*KSizeofTInt8) + (3*KSizeofTInt32) ));
        TPtr8 bufPtr = buf->Des();

        RDesWriteStream stream;
        stream.Open(bufPtr);
        CleanupClosePushL(stream);

        stream.WriteInt8L( (TInt8) ENSmlTypeEvent );
        stream.WriteInt8L( (TInt8) aEvent );
        stream.WriteInt32L( aId );
        stream.WriteInt32L( aError );
        stream.WriteInt32L( aAdditional );
        stream.CommitL();

        while ( iEventMsgs.Count() > 0 )
            {
            if(!iEventMsgs[0].IsNull()&& iEventMsgs[0].Handle())
                {
                iEventMsgs[0].Write( 0, bufPtr, 0 );
                iEventMsgs[0].Complete( KErrNone );
                }
            iEventMsgs.Remove(0);
            }
        CleanupStack::PopAndDestroy(&stream); 
        CleanupStack::PopAndDestroy(buf);
        }
    }
Ejemplo n.º 2
0
// --------------------------------------------------------------------------
// HBufC8* CNSmlSOSHandler::WriteSyncErrorL( TErrorLevel aErrorLevel, TInt aError, TInt aTaskId, TInt aInfo1, TInt aInfo2 )
// --------------------------------------------------------------------------
//
HBufC8* CNSmlSOSHandler::WriteSyncErrorL( TErrorLevel aErrorLevel, TInt aError, TInt aTaskId, TInt aInfo1, TInt aInfo2 )
	{
    HBufC8* buf = HBufC8::NewLC( ( 3*KSizeofTInt8 + ( 4*KSizeofTInt32 ) ) );
    TPtr8 bufPtr = buf->Des();

    RDesWriteStream stream;
    stream.Open( bufPtr );
    CleanupClosePushL( stream );

    stream.WriteInt8L( (TInt8) ENSmlTypeProgressEvent );
    stream.WriteInt8L( (TInt8) ENSmlSyncError );
    stream.WriteInt8L( (TInt8) aErrorLevel );

    stream.WriteInt32L( aError );
    stream.WriteInt32L( aTaskId );
    stream.WriteInt32L( aInfo1 );
    stream.WriteInt32L( aInfo2 );
    stream.CommitL();
    
    CleanupStack::PopAndDestroy( &stream ); 
    CleanupStack::Pop( buf );
   	
   	return buf;
	}
// ----------------------------------------------------------------------------
// Sends the command to Widget launcher
// ----------------------------------------------------------------------------
//
static void HandleWidgetCommandL( 
    RApaLsSession& aSession, 
    const TDesC& aWidget,
    const TUid& aUid,
    TUint32 aOperation )
    {
    const TInt size( 2* aWidget.Length() + 3*sizeof( TUint32 ) );
    
    // Message format is <filenameLength><unicode_filename><someintegervalue>
    CApaCommandLine* cmd( CApaCommandLine::NewLC() );
    HBufC8* opaque( HBufC8::NewLC( size ) );
    
    RDesWriteStream stream;
    TPtr8 des( opaque->Des() );
    
    stream.Open( des );
    CleanupClosePushL( stream );
    
    // Generate the command.
    stream.WriteUint32L( aUid.iUid );
    stream.WriteUint32L( aWidget.Length() );
    stream.WriteL( reinterpret_cast< const TUint8* >( aWidget.Ptr() ),
                   aWidget.Size() );
    
    stream.WriteInt32L( aOperation );
    
    CleanupStack::PopAndDestroy( &stream );
    
    // Generate command.
    cmd->SetCommandL( EApaCommandBackgroundAndWithoutViews );
    cmd->SetOpaqueDataL( *opaque );    

    CleanupStack::PopAndDestroy( opaque );
    
    cmd->SetExecutableNameL( KLauncherApp );
    
    User::LeaveIfError( aSession.StartApp( *cmd ) );
    CleanupStack::PopAndDestroy( cmd );
    }
Ejemplo n.º 4
0
// --------------------------------------------------------------------------
// HBufC8* CNSmlSOSHandler::WriteSyncProgressL( TStatus aStatus, TInt aInfo1, TInt aInfo2 )
// --------------------------------------------------------------------------
//
HBufC8* CNSmlSOSHandler::WriteSyncProgressL( TStatus aStatus, TInt aInfo1, TInt aInfo2 )
	{
	HBufC8* buf = HBufC8::NewLC( (3*KSizeofTInt8 + (2*KSizeofTInt32) ));
    TPtr8 bufPtr = buf->Des();

    RDesWriteStream stream;
    stream.Open( bufPtr );
    CleanupClosePushL( stream );

    stream.WriteInt8L( (TInt8) ENSmlTypeProgressEvent );
    stream.WriteInt8L( (TInt8) ENSmlSyncProgress );
    stream.WriteInt8L( (TInt8) aStatus );

    stream.WriteInt32L( aInfo1 );
    stream.WriteInt32L( aInfo2 );
    stream.CommitL(); 
    
    CleanupStack::PopAndDestroy( &stream );
    CleanupStack::Pop( buf );
    
    return buf;
	}
Ejemplo n.º 5
0
 void UpdateDescriptorL()
     {
     delete iBuf;
     iBuf = 0;
     iBuf = HBufC8::NewL((iLines.Count()+1)*8 + 2*4);
     RDesWriteStream stream;
     TPtr8 ptr = iBuf->Des();
     stream.Open(ptr);
     CleanupClosePushL(stream);
     stream.WriteInt32L(iLines.Count());
     for (TInt i = iLines.Count()-1; i >= 0; i--)
         {
         if (iLines[i].iTexture)
             stream.WriteInt32L(iLines[i].iTexture->ServerHandle());
         else
             stream.WriteInt32L(0);                
         stream.WriteInt32L(iLines[i].iGap);
         }
     stream.WriteInt32L(iExtents.iWidth);
     stream.WriteInt32L(iExtents.iHeight);
     stream.CommitL();
     CleanupStack::PopAndDestroy(); // close stream
     }
Ejemplo n.º 6
0
// --------------------------------------------------------------------------
// HBufC8* CNSmlSOSHandler::WriteSyncModificationsL( TInt aTaskId, const TSyncMLDataSyncModifications& aClientMods, const TSyncMLDataSyncModifications& aServerMods )
// --------------------------------------------------------------------------
//
HBufC8* CNSmlSOSHandler::WriteSyncModificationsL( TInt aTaskId, const TSyncMLDataSyncModifications& aClientMods,
                                                                const TSyncMLDataSyncModifications& aServerMods )
	{
	HBufC8* buf = HBufC8::NewLC( (2*KSizeofTInt8 + (11*KSizeofTInt32) ));
    TPtr8 bufPtr = buf->Des();

    RDesWriteStream stream;
    stream.Open(bufPtr);
    CleanupClosePushL(stream);

    stream.WriteInt8L( (TInt8) ENSmlTypeProgressEvent );
    stream.WriteInt8L( (TInt8) ENSmlModifications );

    stream.WriteInt32L( aTaskId );

    stream.WriteInt32L( aClientMods.iNumAdded );
    stream.WriteInt32L( aClientMods.iNumReplaced );
    stream.WriteInt32L( aClientMods.iNumMoved );
    stream.WriteInt32L( aClientMods.iNumDeleted );
    stream.WriteInt32L( aClientMods.iNumFailed );

    stream.WriteInt32L( aServerMods.iNumAdded );
    stream.WriteInt32L( aServerMods.iNumReplaced );
    stream.WriteInt32L( aServerMods.iNumMoved );
    stream.WriteInt32L( aServerMods.iNumDeleted );
    stream.WriteInt32L( aServerMods.iNumFailed );
    stream.CommitL();
    
    CleanupStack::PopAndDestroy( &stream ); 
    CleanupStack::Pop( buf );
    
    return buf;
	}