connectivitymodules/SeCon/servers/syncserver/src/sconsyncrelationship.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:20:56 +0100
branchRCL_3
changeset 43 4a793f564d72
parent 40 453dfc402455
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201032 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:  CSconSyncRelationship implementation
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include "sconsyncrelationship.h"
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <s32file.h>
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <nsmlchangefinder.h>
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include "debug.h"
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
_LIT(KContextStore, "contextstore_0x%08x.dat");
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
_LIT(KTimeStore, "timestore_0x%08x.dat");
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
CSconSyncRelationship::~CSconSyncRelationship()
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
    {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
    TRACE_FUNC_ENTRY;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
    if ( iDictionaryStore )
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
        {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
        iDictionaryStore->Commit();
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
        delete iDictionaryStore;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
        }
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
    TRACE_FUNC_EXIT;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
    }
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
CSconSyncRelationship::CSconSyncRelationship( RFs& aFs, TUid aRelationUid, TSmlDataProviderId aProviderId )
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
    : iFs(aFs), iID(aRelationUid), iProviderId(aProviderId)
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
    {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
    TRACE_FUNC;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
    
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
    }
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
CSconSyncRelationship* CSconSyncRelationship::NewL( RFs& aFs, TUid aRelationUid, TSmlDataProviderId aProviderId )
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
    {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
    TRACE_FUNC_ENTRY;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
    CSconSyncRelationship* self = new (ELeave) CSconSyncRelationship( aFs, aRelationUid, aProviderId );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
    CleanupStack::PushL( self );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
    self->ConstructL();
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
    CleanupStack::Pop( self );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
    TRACE_FUNC_EXIT;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
    return self;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
    }
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
void CSconSyncRelationship::SetTimeStampL( RFs& aFs, TUid aRelationUid, TSmlDataProviderId aId )
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
    {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
    TRACE_FUNC_ENTRY;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
    LOGGER_WRITE_1("aRelationUid: 0x%08x", aRelationUid.iUid );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
    LOGGER_WRITE_1("aId: 0x%08x", aId );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
    aFs.SetSessionToPrivate( EDriveC );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
    TFileName file;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
    file.Format(KTimeStore, aRelationUid.iUid);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
    CDictionaryFileStore* dictionaryStore = CDictionaryFileStore::OpenLC(aFs, file, TUid::Uid(0x0001));
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
    
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
    RDictionaryWriteStream stream;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
    stream.AssignLC( *dictionaryStore, TUid::Uid(aId) );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
    
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
    TTime time;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
    time.UniversalTime();
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
    
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
    TDateTime dateTime = time.DateTime();
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
    TPckgBuf<TDateTime> timeBuf(dateTime);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
    
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
    stream.WriteL( timeBuf );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
    stream.CommitL();
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
    
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
    CleanupStack::PopAndDestroy( &stream ); //AssingLC
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
    dictionaryStore->Commit();
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
    CleanupStack::PopAndDestroy( dictionaryStore );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
    TRACE_FUNC_EXIT;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
    }
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
void CSconSyncRelationship::GetTimeStampL( RFs& aFs, TUid aRelationUid, TSmlDataProviderId aId, TDateTime& aTimeStamp )
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
    {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
    TRACE_FUNC_ENTRY;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
    LOGGER_WRITE_1("aRelationUid: 0x%08x", aRelationUid.iUid );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
    LOGGER_WRITE_1("aId: 0x%08x", aId );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
    User::LeaveIfError( aFs.SetSessionToPrivate( EDriveC ) );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
    TFileName file;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
    file.Format(KTimeStore, aRelationUid.iUid);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
    CDictionaryFileStore* dictionaryStore = CDictionaryFileStore::OpenLC(aFs, file, TUid::Uid(0x0001));
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
    TBool present = dictionaryStore->IsPresentL( TUid::Uid(aId) );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
    if ( !present )
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
        {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
        LOGGER_WRITE("Stream was not present");
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
        User::Leave(KErrNotFound);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
        }
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
    RDictionaryReadStream stream;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
    stream.OpenLC( *dictionaryStore, TUid::Uid(aId) );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
    TPckgBuf<TDateTime> timeBuf;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
    stream.ReadL( timeBuf );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
    aTimeStamp = timeBuf();
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
    CleanupStack::PopAndDestroy(); //OpenLC
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
    CleanupStack::PopAndDestroy( dictionaryStore );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
    
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
    TRACE_FUNC_EXIT;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
    }
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
void CSconSyncRelationship::ConstructL()
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
    {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
    TRACE_FUNC_ENTRY;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
    iFs.SetSessionToPrivate( EDriveC );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
    TFileName file;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
    file.Format(KContextStore, iID.iUid);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
    iDictionaryStore = CDictionaryFileStore::OpenL(
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
            iFs, file, TUid::Uid(0x0001));
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
    
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
    TRACE_FUNC_EXIT;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
    }
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
TSmlSyncTaskKey CSconSyncRelationship::SyncTaskKey() const
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
    {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
    TRACE_FUNC;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
    return static_cast<TSmlSyncTaskKey>(iID.iUid);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
    }
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
void CSconSyncRelationship::OpenReadStreamLC(RReadStream& aReadStream, TUid aStreamUid)
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
    {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
    TRACE_FUNC_ENTRY;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
    LOGGER_WRITE_1("aStreamUid: 0x%08x", aStreamUid);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
    TUid streamUid(aStreamUid);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
    if ( aStreamUid.iUid == KNSmlDefaultSnapshotStreamUID )
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
        {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
        LOGGER_WRITE_1(" Default stream uid was used, use provider uid (0x%08x) as stream uid", iProviderId);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
        streamUid.iUid = iProviderId;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
        }
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
    if ( !IsStreamPresentL( streamUid ) )
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
        {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
        LOGGER_WRITE("Stream was not present");
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
        User::Leave(KErrNotFound);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
        }
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
    
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
        
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
    static_cast<RDictionaryReadStream&>(aReadStream).OpenLC(
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
        *iDictionaryStore, streamUid );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
    TRACE_FUNC_EXIT;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
    }
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
void CSconSyncRelationship::OpenWriteStreamLC(RWriteStream& aWriteStream, TUid aStreamUid)
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
    {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
    TRACE_FUNC_ENTRY;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
    
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
    LOGGER_WRITE_1("aStreamUid: 0x%08x", aStreamUid);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
    TUid streamUid(aStreamUid);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
    if ( aStreamUid.iUid == KNSmlDefaultSnapshotStreamUID )
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
        {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
        LOGGER_WRITE_1(" Default stream uid was used, use provider uid (0x%08x) as stream uid", iProviderId);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
        streamUid.iUid = iProviderId;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
        }
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
    static_cast<RDictionaryWriteStream&>(aWriteStream).AssignLC(
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
                 *iDictionaryStore, streamUid );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
    TRACE_FUNC_EXIT;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
    }
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
TBool CSconSyncRelationship::IsStreamPresentL(TUid aStreamUid) const
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
    {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
    TRACE_FUNC_ENTRY;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
    LOGGER_WRITE_1("aStreamUid: 0x%08x", aStreamUid.iUid );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
    TUid streamUid(aStreamUid);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
    if ( aStreamUid.iUid == KNSmlDefaultSnapshotStreamUID )
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
        {
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
        LOGGER_WRITE_1(" Default stream uid was used, use provider uid (0x%08x) as stream uid", iProviderId);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   176
        streamUid.iUid = iProviderId;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
        }
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   178
    TBool present = iDictionaryStore->IsPresentL( streamUid );
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
    LOGGER_WRITE_1("CSconSyncRelationship::IsStreamPresentL() return: %d",(TInt)present);
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
    return present;
453dfc402455 Revision: 201030
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
    }