예제 #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);
        }
    }
예제 #2
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;
	}
예제 #3
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;
	}
예제 #4
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;
	}