os/kernelhwsrv/kerneltest/f32test/server/t_notifier_caps.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // f32test\server\t_notifier_caps.cpp
    15 // 
    16 //
    17 
    18 #include <f32file.h>
    19 #include <e32test.h>
    20 #include <e32hal.h>
    21 #include <e32math.h>
    22 #include <f32dbg.h>
    23 
    24 const TInt KNotificationHeaderSize = (sizeof(TUint16)*2)+(sizeof(TUint));
    25 const TInt KMinNotificationBufferSize = 2*KNotificationHeaderSize + 2*KMaxFileName;
    26 
    27 TInt E32Main()
    28 	{
    29 	TInt r = KErrNone;
    30 	
    31 	CTrapCleanup* cleanup;
    32 	cleanup = CTrapCleanup::New();
    33 		
    34 	RFs fs;
    35 	fs.Connect();
    36 	
    37 	CFsNotify* notify = NULL;
    38 	TRAP(r, notify = CFsNotify::NewL(fs,KMinNotificationBufferSize));
    39 	User::LeaveIfError(r);
    40 	
    41 	TChar systemChar = fs.GetSystemDriveChar();
    42 	TBuf<40> path;
    43 	path.Append(systemChar);
    44 	path.Append(_L(":\\PRIVATE\\01234567\\"));
    45 	
    46 	TBuf<8> filename;
    47 	filename.Append(_L("file.txt"));
    48 	
    49 	r = notify->AddNotification((TUint)TFsNotification::ECreate,path,filename);
    50 
    51 	delete notify;
    52 	delete cleanup;
    53 	fs.Close();
    54 	return r;
    55 	}